GameResize (Client Size)

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

Previous topic - Next topic

umar4911

Quote from: ! on Nov 03, 2018, 03:16 PM
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;
 }
No still doesn't work.

Quote from: Doom_Kill3R on Nov 04, 2018, 05:54 AM
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
See this man. My game is in windowed mode.

First (no resize and screen size is small)


Second (After resize to big)


Third (after again resize to small)





I did this thrice to explain. This bug occurs even at first time when you reduce the size to small.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

DizzasTeR

You are most likely doing something wrong because I tested it and it works fine for me, double check your calculations and how you are re-adjusting them.

https://youtu.be/v7t6oMtcUjM

Mötley

#17
Off Topic: 0 is supposed to be dead center and that looks slightly off center. Are you sure doing that is right?

Also that event should fix it as Dooms showing you as the event is called each time the screen is adjusted, You just gotta reset the label every time the screen is adjusted. Make sure you don't have two of the same events loaded I suppose and add a message to the event Message("I was called"); to ensure it's getting called.

Still don't know much about client scripting for vcmp, only LU and a lot of the cool sides of the gui scripting isn't added >.< but even this should create a window to the exact size of the screen resolution
Screen <- GUI.GetScreenSize();
//Should add a alpha and transparancy to the window, maybe 120 and call for this window when it's rainy for an interesting graphical effect
GUIWindow(VectorScreen(0, 0), VectorScreen(Screen.x, Screen.y), Colour( 0, 0, 223 ), "Overlay"); 

http://liberty-unleashed.co.uk/LUWiki/Squirrel/Client/Functions/GUIWindow/Transparent

http://liberty-unleashed.co.uk/LUWiki/Squirrel/Client/Functions/GUIWindow/Alpha

!

#18
For a correct possible solution make a test code which produce the same bug and post here because the problem is in the script not client side issue or anything.
Same as @Doom_Kill3R did without source one can put a suggestion nothing else.

Discord: zeus#5155

umar4911

Quote from: ! on Nov 04, 2018, 05:06 PMFor a correct possible solution make a test code which produce the same bug and post here because the problem is in the script not client side issue or anything.
Same as @Doom_Kill3R did without source one can put a suggestion nothing else.
so after debugging again and again, I came to know that the thing which creates problem is FontSize.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

!

Solution for others Change the size before changing the rel position of a GUI.

@umar4911  check if I am not wrong

function GUI::GameResize(width, height)
{
   local rel = GUI.GetScreenSize();
   WelcomeScreen.Information.FontSize = rel.X * 0.06;
   WelcomeScreen.Information.Position = VectorScreen(rel.X * 0.28, rel.Y * 0.10);
 }

Discord: zeus#5155

umar4911

Quote from: ! on Nov 08, 2018, 08:10 AMSolution for others Change the size before changing the rel position of a GUI.

@umar4911  check if I am not wrong

function GUI::GameResize(width, height)
{
   local rel = GUI.GetScreenSize();
   WelcomeScreen.Information.FontSize = rel.X * 0.06;
   WelcomeScreen.Information.Position = VectorScreen(rel.X * 0.28, rel.Y * 0.10);
 }
The problem still persists
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

!

#22
Quote from: umar4911 on Nov 15, 2018, 11:13 AMThe problem still persists

The only reason I told you to create a test script producing same bug and post here so others can point out the problem.
Tested and working perfect






 :edit:
Tested for 3 labels at the same time working perfect for all of em





Discord: zeus#5155