Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Resolutions, windows, antialias, etc... #231935
10/17/08 22:47
10/17/08 22:47
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I am having problems setting my games resolution, window mode, window size, and antialias.

Here is what I do:

-First i declare the variables that I use to store the settings that the user chooses (with the default settings in case he just clicks "start_button".

int my_resX = 1024;
int my_resY = 768;
int my_antialias = 0;
int my_gamma = 100;
int my_window = 1;
int start_my_game = 0;

-After that I declare my panel and all the buttons to adjust the settings, and the functions those buttons call to modify those variables.
(I have checked and the panel and all the functions to modify those variables work correctly.)

-In last place I have this in my main loop:

function main()
{
//initial settings that match my option panel's size
mouse_mode = 4;
video_window(vector(0,0,0),vector(375,500,0),2,"Game");
video_set (375,500,32,2);
d3d_antialias = 0;

//my main while loop
while(1)
{
//until player clicks the "start" button "start_my_game" is not set to 1
if (start_my_game == 1)
{
wait(1);
video_window(NULL, vector(sys_metrics(61), sys_metrics(62), 0), 1, "Game");
wait(1);
video_set (my_resX,my_resY,32,my_window);
d3d_antialias = my_antialias;
video_gamma = my_gamma;

level_load("Dungeon.wmb");
place_and_position_character_panels();
}

wait(1);
}
}

I have also tried with video_switch() (using a variable that chooses one of the engine's default resolutions) instead of video_set(), but it dosent work either...

Here are my problems:

-Im not sure if the d3d_antialias instruction is actually working (no visible change noticed).

-When fullscreen mode is chosen the resolution settings work fine and all loads well, but...

-When the game is in fullscreen mode correctly and the user presses alt+enter the game goes to window mode but in a very small screen with very low resolution and only part of the level's view is visible (this happens even if the resolution in fullscreen is lower than the desktop resolution!). And if he hits alt+enter again to go back to fullscreen to fix this, it will go back to fullscreen but in that horrible resolution of the little window, and still only a part of the level's view visible, only that now that little part of the view occupies the full screen.

-When window mode is chosen and a resolution lower than the desktop is chosen the chosen resolution loads well, and the window is set to the size of the desktop (streching the grafics but maintaining that resolution at a bigger window size). This is intended and is working correctly, but... If the user hits alt+enter to go to fullscreen mode, for some reason the resolution changes to a small resolution and only a part of my view is visible, and that small part now occupies the fullscreen. If he hits alt+enter again to back to window mode it goes back, but with that small reolution and still only part of the view is visible.

-When window mode is chosen and a resolution bigger than the desktop resolution is chosen I get a window with the level loaded correctly but the panels are not placed well, and I get the same resolution errors that I described above when trying to enter fullscreen mode with alt+enter.

The only thing that seems to be working correctly is the gamma setting, hahaha!
Question: Do you think the antialias is also working correctly in my code?
Question: What am I doing wrong to set the video settings to start the game with?


Any suggestions, corrections, tips, or point me in the right direction?

Any help would be much apreciated to understand why my code is not working and how to fix it. I am searching the manual as much as I can but I cant seem to get these things to work.
Thankyou in advance for your time and patience.

Last edited by Carlos3DGS; 10/17/08 22:52.

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Resolutions, windows, antialias, etc... [Re: Carlos3DGS] #231964
10/18/08 11:47
10/18/08 11:47
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quote:
Im not sure if the d3d_antialias instruction is actually working (no visible change noticed).


you have to change this in first frame(before any "wait" instructions). Once AA changed, game must be restared.(save value somewhere and set aa on first frame)

---
for video_window, it's best to use your game's resolution(i.e 1024x768). Because, video_window doesnt change the resolution, just changes the width/height of the window. Display is stretched to fit window.(personally i use this only for changing the title.). And you cant set video_window to desktop resolution(taskbar,window borders etc. no enough place.) or larger than desktop resolution.


3333333333
Re: Resolutions, windows, antialias, etc... [Re: Quad] #232258
10/20/08 17:12
10/20/08 17:12
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I understand how to solve some of my problems now, thanks alot for your help.
But I have some nore now, hehehe.


Originally Posted By: Quadraxas

you have to change this in first frame(before any "wait" instructions). Once AA changed, game must be restared.(save value somewhere and set aa on first frame)

How can I save only those variables (my setting variables) to somewhere, but not all the game variables/function states?


Originally Posted By: Quadraxas

Display is stretched to fit window.

when I use video_set with a resolution less than the video_window window size it streches the pixels like you said, to fit that resolution on the window (I actually want that to happen)... but when I use a video_set resolution larger than my video_window size, it dosent "shrink" the pixels to fit the window size. The extra pixels (part of my panels) are just out of the window view... Is there any way to make the resolution inside the window "shrink", just like it also "streches"?

-I am also having trouble re-placing the window (position). I want it in the top left of the desktop but for some reason video_window(vector(0,0,0),NULL,1,"Game"); dosent seem to change the window position to the top left corner of my screen. Do you know how this is done or what I'm doing wrong?

-And last, when I set the border of the window to show, the users can manually change the position of the window with the pointer (click & drag) on the title bar, but I would also like them to be able to resize the window when clicking on the border. But clicking & dragging the borders of the window does not work, how could I do this?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Resolutions, windows, antialias, etc... [Re: Carlos3DGS] #232273
10/20/08 18:57
10/20/08 18:57
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
you can try writing it to a text file.
see file_var_write and file_var_read on manual.

try video_window(vector(1,1,0),NULL,1,"Game");


for the last one, in default border mode, users can scale window manually afaik.


3333333333
Re: Resolutions, windows, antialias, etc... [Re: Quad] #232280
10/20/08 21:28
10/20/08 21:28
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Thanks alot for your help!

Only one thing left for me to learn to finish this part of my game...

Originally Posted By: Quadraxas
for the last one, in default border mode, users can scale window manually afaik.


What is the default window border?

All I found in the manual about window borders is this:
Originally Posted By: Manual Search
1 no border
2 thin border
4 thick border
16 title bar and border
48 title bar with system menu
112 title bar with system menu and minimize button
256 hide the window

But I have no idea what to set for the default border mode so players can use the border to resize the window.


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Resolutions, windows, antialias, etc... [Re: Carlos3DGS] #232284
10/20/08 21:47
10/20/08 21:47
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
4 thick border allwos you to resize

and if you dont change the border style( 0 ) it will remain default(resizable).


3333333333
Re: Resolutions, windows, antialias, etc... [Re: Quad] #232327
10/21/08 09:40
10/21/08 09:40
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Thankyou for all your help laugh


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Resolutions, windows, antialias, etc... [Re: Quad] #232354
10/21/08 13:05
10/21/08 13:05
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
One last question about my window issues (I hope I am not abusing your patience)

Almost everything works now, I just have one small problem now...

When in window mode the mouse dosent work properly when in one of two situations...
1- the user has moved the window origin (top left corner)to a position that is not window_pos.x=1 and window_pos.y=1 on the desktop.
2- when the user changes the window to a different size than the resolution the view now works correctly and the resulution is mantained but the pixels are expanded/shrinked to fit the new window size (this works correctly now). But... the mouse_pos does not represent the mouse_cursor coordinates (they are off by the ratio the resolution has been scaled to fit the window).

My initial Mouse move function that had these errors because it used the cursor position on the desktop withought translating it into a position on top of my window:
Quote:
function MyMouse_Move()
{
mouse_map = arrow_tga;
vec_set(mouse_pos,mouse_cursor);
}


To fix this, and offset the desktop cursor positions for my window's cursor position when the the window is moved to a different origin on the desktop, I transformed it into this:
Quote:
function MyMouse_Move()
{
mouse_map = arrow_tga;
mouse_pos.x = mouse_cursor.x - window_pos.x;
mouse_pos.y = mouse_cursor.y - window_pos.y;
}


With the above modification the mouse coordinates are calculated being aware of the new window position on the desktop. But now I have to get a solution to calculate the expanded/shrinked ratio that the resolution is being scaled by to fit the new window size, so besides having a correct origin now, it also has to calculate a correct distance from that origin...
The variable "screen_size" gives me the current resolution, but not the window size. I have searched everywhere in the manual for something like "window_size" to get the window size and calculate the ratio that the resolution is being scaled by (with something like: window_size/screen_size) to calculate the correct mouse position, but I am unable to find the engine variable that stores the window size (not "screen_size" because it only tells me the current resolution but not the actual window size). My new mouse function would look something like this:
Quote:
function MyMouse_Move()
{
mouse_map = arrow_tga;
mouse_pos.x = (mouse_cursor.x * (¿window_size.x? / screen_size.x)) - window_pos.x;
mouse_pos.y = (mouse_cursor.y * (¿window_size.y? / screen_size.y)) - window_pos.y;
}

But I do not know the engine variable that stores the window size and am unable to find it in the manual.


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Resolutions, windows, antialias, etc... [Re: Carlos3DGS] #232355
10/21/08 13:37
10/21/08 13:37
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
try mouse_mode and see if they work properly under this situations. (see mouse mode in manual)

about window sizes i am not sure but you can try some sys_metrics..


3333333333
Re: Resolutions, windows, antialias, etc... [Re: Quad] #232400
10/21/08 17:05
10/21/08 17:05
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I took a look at mouse_mode, and setting it to 4 actually helps a little (I no longer need the -window_pos instructions).
But it only corrects the mouse origin coordinates (x=0,y=0). I still have issues when I go past the origin due to the resolution scaling to fit the window size.

I already use some sys_metrics (sys_metrics(61) & sys_metrics(62)), for when the resolution selected is larger than the max window size available for the desktop resolution, I use those two sys_metrics to adjust the sindow size and the resolution is automatically scaled down to fit the new size.

I have been reading all the sys_metrics but I can't find any that give me the current window height and width, all I can find are default windowsXP values for minimizedwindows, maximizedwindows, 2d/3d border and titlebar sizes, etc...

I recorded a video showing my issues to better explain my problem and uploaded the video to youtube. The video is currently being processed by youtube and should be available once they have processed it.

Video showing problem with WindowsPointer, GameCursor and ResolutionScale:


Video Showing problem when clicking a hand or foot of my model: (even though the games cursor is on the hand/foot, since the windows pointer is out of the screen the window loses the focus when I click and the game cursor "jumps" to the window origin coordinates, to get the focus back I click on the window again and the game cursor jumps back to its position in game)


·A brief explanation of the environment settings chosen for the video:
-My current windows desktop resolution : 1152x864
-When starting the game the chosen resolution was 1024x768
-the window was made much smaller and the 1024x768 pixels have shrunken to fit the small window
-the window was moved to a position on the desktop far away from the top left corner.

·A brief explanation of the issues seen in the video:
-mouse_mode=4 has corrected the origin issues (now x=0 and y=0 are not when the pointer is in the top right of the desktop, they are as they are supposed to be: at the window origin and not the desktop origin.
-First I slowly move the mouse horizontally so you can see the X scaling issue.
-Then I slowly move the mouse vertically so you can see the Y scaling issue.
-At the end of the video I try to click on a hand and a foot of my model. The game cursor is on top of the hand/foot, but not properly (since the windows cursor is completely out of the window), so when i click the hand/foot the game window is not the focus window anymore and the cursor "jumps" to the window's (0,0) position. After that i move the windows pointer back into the game window and click so the game is focused again and the cursor in game jumps back to its position offseted by the resolution scaling...

Im sure being able to include something like mouse_pos = mouse_cursor * scale would fix this problem (scale being: window_size/resolution), but I cannot find anything that helps me set the scale.
The longer version of that formula would be:
mouse_pos.x = mouse_cursor.x * (window_size.x / screen_size.x);
mouse_pos.x = mouse_cursor.y * (window_size.y / screen_size.y);

I have found all I need except one las variable
mouse_pos is the cursor coordinates in the game
mouse_cursor is the pointer coordinates in windows
screen_size is the resolution settings in the window
¿? is the window height and width?

It is so frustrating to know the solution but not being able to find one last variable...
I am going crazy looking everywhere i can for this variable like: window_size

Last edited by Carlos3DGS; 10/21/08 18:03. Reason: Updated Videos

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1