GUI on the bottom of the screen in 640x480 resolution

Started by SupSuper, Mon 14/05/2007 00:04:25

Previous topic - Next topic

SupSuper

I nedd to put a GUI on the bottom of the screen, regardless of whatever resolution or GUI size is used. Currently I use:

somegui.Y = System.ViewportHeight-somegui.Height;

The problem is, this doesn't work with 640x480 (letterbox resolution). The Y returned is 160, while the Y I need is 200, and ScreenWidth is completely out of the question. Suggestions?
Programmer looking for work

Gilbert

Your GUI is 40 pixels tall, right?

Then it's normal that the returned Y was 160.

Since, in 640x480 letterbox mode, the viewport height is only 200 pixels (400 screen pixels).

SupSuper

This isn't a 640x400 game with "letterbox" on though. This is a native 640x480 game with no black space in it. So it ends up looking a bit ugly since part of the room is seen under the GUI.

Is there anyway I can check for "letterbox" mode in the script so I can add the extra bit respectively?
Programmer looking for work

Gilbert

Are you sure the background for that room wasn't 320x200 or 640x400? If you import a background of such dimensions in a 320x240/640x480 game it would be turned into letterbox mode when in that room, i.e., the graphics would be centred alongside with everythinf like GUIs restricted to the middle area, with black bars added on top and bottom, you cannot place anything beyond the room area (i.e. the game is in 320x200/640x400 room in such a room). Just manually add the black bars to your backgrounds and make them proper 640x480 size before importing.

Radiant

An easy solution would be to make your GUI taller by adding a transparent rectangle at the top so it doesn't show.

GarageGothic

Quote from: Radiant on Mon 14/05/2007 10:19:15An easy solution would be to make your GUI taller by adding a transparent rectangle at the top so it doesn't show.

But wouldn't the transparent part of the GUI still be clickable, thus catching any attempt at interacting with the background area behind it?

Radiant

Yes, but you can work around this. In the on_event function, catch the GUI_MDOWN event. If this event happens over that GUI over button -1 (i.e. not on any button) (or alternatively, within certain mouse.y values) call the regular mouse handler instead.

strazer

Do you use this code in the game_start function?
If so, it is a known bug that System.ViewportHeight returns a height of 200 instead of 240 pixels there.
If you're coding a module, you could put the code in the on_event function instead.

SupSuper

Quote from: strazer on Mon 14/05/2007 14:15:56
Do you use this code in the game_start function?
If so, it is a known bug that System.ViewportHeight returns a height of 200 instead of 240 pixels there.
If you're coding a module, you could put the code in the on_event function instead.
That fixed it, thanks. :D

Another side-effect of this "bug" is that you also can't set a GUI.Y >= 200 in on_game_start.

Wait. If I can set the X/Y coordinates to any value in the GUI Editor, why can't I do the same in the script?
Programmer looking for work

SMF spam blocked by CleanTalk