GameResize (Client Size)

Started by umar4911, Oct 27, 2018, 01:30 PM

Previous topic - Next topic

umar4911

The GUILabel dont get to the expected position. However, the size does

this.Information <- ::GUILabel(VectorScreen(screen.X * 0.28, screen.Y * 0.10), Colour(28, 174, 190), "Registeration");

function GUI::GameResize(width, height)
{
screen <- GUI.GetScreenSize();
WelcomeScreen.Information.Position = VectorScreen(screen.X * 0.28, screen.Y * 0.10);
WelcomeScreen.Information.FontSize = screen.X * 0.06;
 }
I am gamer, programmer and hacker. Try to find me!
xD

umar4911

I am gamer, programmer and hacker. Try to find me!
xD

Mötley

#2
Okay I'll try even though I haven't touched vcmp's client scripting..

I'll attempt to set it dead center as I have no clue where your trying to place it.

function GUI::GameResize(width, height)
{
// Should go dead center
registration_text <- ::GUILabel(VectorScreen(0, 0), Colour(28, 174, 190), "Registration");

screen <- GUI.GetScreenSize();

// tbh, should be VectorScreen(screen.X, screen.Y);
WelcomeScreen.Information.Position = VectorScreen(screen.X * 0.28, screen.Y * 0.10);

// what does font size have to do with setting to the screen size?
WelcomeScreen.Information.FontSize = screen.X * 0.06;

// Should add the label to the window
WelcomeScreen.AddChild(registration_text)
 }

idk, I tried,client side resources are a little odd in this mp. but I tried, If I knew enough on it I could be of great help but I don't have the time for it

umar4911

I debugged it and came to know that Sprite works perfect with the position attribute. The Label is fishy. If the size is increased, it goes good and when you decrease it, it rekts.
I am gamer, programmer and hacker. Try to find me!
xD

Mötley

#4
Lol didn't know this was a sprite.. I thought we were talking about a gui label..

Sprites isn't something you should resize. I would just create 4 different sprites for four main ranges of resolutions. and depending on the resolution size, use what ever size you rendered for the resolution, you can still modify the size, But it's not wise to modify the size of a sprite that has a higher definition and the resolution calls for it to shrink, it's going to look like shit...

Tbh I use a custom 600 sized game window so my fps will always stay strong regardless of what crazy crap goes on around me in a server. I would try to make sure you have four different sprites for ranges of:
<1000>
<2000>
<3000>
<4000>

The wasted space will be worth it as the professionalism of the sprite will be perfected. I don't personally mess with gui and screen positions as I'm to anal about my work..

As for the label size, I would recommend looking into ceilThen begin checking out the font size after that

umar4911

Quote from: Motley on Oct 31, 2018, 02:20 PMLol didn't know this was a sprite.. I thought we were talking about a gui label..

Sprites isn't something you should resize. I would just create 4 different sprites for four main ranges of resolutions. and depending on the resolution size, use what ever size you rendered for the resolution, you can still modify the size, But it's not wise to modify the size of a sprite that has a higher definition and the resolution calls for it to shrink, it's going to look like shit...

Tbh I use a custom 600 sized game window so my fps will always stay strong regardless of what crazy crap goes on around me in a server. I would try to make sure you have four different sprites for ranges of:
<1000>
<2000>
<3000>
<4000>

The wasted space will be worth it as the professionalism of the sprite will be perfected. I don't personally mess with gui and screen positions as I'm to anal about my work..

As for the label size, I would recommend looking into ceilThen begin checking out the font size after that
It is a label. Lol. Actually, I am trying to find solutions to make my GUI perfect on screen change. The bugs I found:
- Position attribute of decreasing screen size
- increasing width only can result in disappearing of the label
- GUI.GetScreenSize() doesn't update on game resize.
I am gamer, programmer and hacker. Try to find me!
xD

Mötley

#6
The wiki version doesn't update?
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/GUI::GetScreenSize

If it doesn't try seeing if a few things will manually update it like
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/GUI::SetMouseEnabled

Might be a bug, but the code might update when the mouse is showing. dunno

umar4911

Quote from: Motley on Nov 01, 2018, 05:10 PMThe wiki version doesn't update?
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/GUI::GetScreenSize

If it doesn't try seeing if a few things will manually update it like
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/GUI::SetMouseEnabled

Might be a bug, but the code might update when the mouse is showing. dunno
The GetScreenSize does updates if game is resized. It shows sprites with old size made after resize.
Most exciting thing, the mouse it enabled already in that function.
I am gamer, programmer and hacker. Try to find me!
xD

DizzasTeR

Your formula for calculating the font size is wrong, it generates invalid/un-supported results. I wrote this and it works fine when I resized the game.
screen <- GUI.GetScreenSize();
test <- ::GUILabel(VectorScreen(screen.X * 0.28, screen.Y * 0.10), Colour(28, 174, 190), "Registeration");

function GUI::GameResize(width, height)
{
::screen = this.GetScreenSize();
::test.Position = VectorScreen(screen.X * 0.28, screen.Y * 0.10);
::test.FontSize = 10 + (height/480); // Doom's font-size formula
}

NicusorN5

10 + (height/480); // Doom's font-size formula
No shit. Stop crediting yourself.

umar4911

Quote from: Doom_Kill3R on Nov 02, 2018, 09:38 AMYour formula for calculating the font size is wrong, it generates invalid/un-supported results. I wrote this and it works fine when I resized the game.
screen <- GUI.GetScreenSize();
test <- ::GUILabel(VectorScreen(screen.X * 0.28, screen.Y * 0.10), Colour(28, 174, 190), "Registeration");

function GUI::GameResize(width, height)
{
::screen = this.GetScreenSize();
::test.Position = VectorScreen(screen.X * 0.28, screen.Y * 0.10);
::test.FontSize = 10 + (height/480); // Doom's font-size formula
}
Font Size is working good. The problem is with POSITION. Still, I'll use that.
I am gamer, programmer and hacker. Try to find me!
xD

DizzasTeR

Quote from: Athanatos on Nov 02, 2018, 01:57 PM 10 + (height/480); // Doom's font-size formula
No shit. Stop crediting yourself.

Mission accomplished, enemy was pissed off.

On-Topic: The position is already going to be same since you are using relative values .

umar4911

Quote from: Doom_Kill3R on Nov 03, 2018, 06:58 AM
Quote from: Athanatos on Nov 02, 2018, 01:57 PM 10 + (height/480); // Doom's font-size formula
No shit. Stop crediting yourself.

Mission accomplished, enemy was pissed off.

On-Topic: The position is already going to be same since you are using relative values .
Listen, when I start game (small screen size) the word "registration" is in the center of screen. When I resize to big, the size increases and position still stays in center. But after again resize to small, the word goes away from centre.
I am gamer, programmer and hacker. Try to find me!
xD

!

#13
Quote from: umar4911 on Oct 27, 2018, 01:30 PMThe GUILabel dont get to the expected position. However, the size does

this.Information <- ::GUILabel(VectorScreen(screen.X * 0.28, screen.Y * 0.10), Colour(28, 174, 190), "Registeration");

function GUI::GameResize(width, height)
{
screen <- GUI.GetScreenSize();
WelcomeScreen.Information.Position = VectorScreen(screen.X * 0.28, screen.Y * 0.10);
WelcomeScreen.Information.FontSize = screen.X * 0.06;
 }
Why creating new slot of screen under GameResize(width, height)
I am pretty sure you might have created a new slot of this variable at somewhere else but still not sure if creating a new slot again and again in client side is allowed any way try using a local variable with a different name instead maybe it is because of overriding new slot.
function GUI::GameResize(width, height)
{
   local rel = GUI.GetScreenSize();
   WelcomeScreen.Information.Position = VectorScreen(rel.X * 0.28, rel.Y * 0.10);
   WelcomeScreen.Information.FontSize = rel.X * 0.06;
 }

Discord: zeus#5155

DizzasTeR

Quote from: umar4911 on Nov 03, 2018, 02:38 PMListen, when I start game (small screen size) the word "registration" is in the center of screen. When I resize to big, the size increases and position still stays in center. But after again resize to small, the word goes away from centre.

I don't think that 0.2 and 0.1 is going to center it, to center it they both must be screen.X*0.5 and screen.Y*0.5