Jump to content


Photo

Window size and views problem


  • Please log in to reply
5 replies to this topic

#1 Henez

Henez

    GMC Member

  • New Member
  • 3 posts

Posted 24 April 2012 - 12:03 PM

Hi

I am having trouble allowing my window sizes to be variable. What I want to do is to allow the player to change the size of the screen through an options menu but I do not want the screen to merely stretch, rather I want to increase the view in the room.

For example. This is a 640x480 default sized window:

Posted Image

Whereas this is a larger 1024x640 window:

Posted Image

Notice the window size has increased but has not stretched the display.

Ive tried many things similar to the code below:

//setWindow(width,height)

view_wview[0]=argument0
view_hview[0]=argument1
view_wport[0]=argument0
view_hport[0]=argument1
window_set_size(argument0,argument1)

But every time I get a wierd or undesired result. Could someone possibly give me a function that resizes the game window variably without stretching the view?

Thanks
  • 0

#2 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 24 April 2012 - 02:50 PM

There is a very, very, very, very, very, easy way to do it.

Go to Global Game Settings and check 'Keep aspect ratio' in the 'Start in full screen mode' section

That way, the player can adjust the window without any functions or script but can stretch it using the bottom right corner of the window.
This even works making the room smaller.
  • 0

#3 Henez

Henez

    GMC Member

  • New Member
  • 3 posts

Posted 24 April 2012 - 10:45 PM

There is a very, very, very, very, very, easy way to do it.

Go to Global Game Settings and check 'Keep aspect ratio' in the 'Start in full screen mode' section

That way, the player can adjust the window without any functions or script but can stretch it using the bottom right corner of the window.
This even works making the room smaller.


Thanks for posting

Doing that still stretches the room to scale with the screen. All I want to do is to have a larger view as the screen increases in size without changing the size of any sprites or anything within the room
  • 0

#4 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 25 April 2012 - 01:37 AM

you can't do it live without major hacking.

room_set_view(ind,vind,vis,xview,yview,wview,hview,xport,yport,wport,hport,hborder,vborder,hspeed,vspeed,obj) Sets the view with index vind (0-7) for the room with the indicated index. vis indicates whether the view is visible. xview, yview, wview, and hview indicate the position of the view in the room. xport, yport, wport, and hport indicate the position on the screen. When the view must follow an object hborder and vborder indicate the minimal visible border that must be kept around the object. hspeed and vspeed indicate the maximal speed with which the view can move. obj is the index of the object or the index of the instance.


Limitations:
Cannot be done on the current room
Does not affect persistent rooms that have been visited.

what I did, I have room1 and room2, they are blank rooms. room 0 is the game. to change the view to match the window, You start in room0. Your controller detects the resize. if I'm in room0 I call room_set_view for room1, else I call room_set_view for room0. Then I set all my instances to be persistent. with(all) persistent = true; then I room_goto room1 or room0 depending when I am. The controller is persistent and detects the room start event. on room start I call
with(all) persistent = false;
persistent = true;

So what happens is you do room switching on the fly, making the instances follow you.

another method is going to a room (changeRoom) and going back to the original. it's not as smooth but it supports persistence of the room

From memory, not tested
ControllerObj, persistent ON
create
doresize = false;
thisroom = room;
waspersitent = room_persistent;
needsresize = false; //set this to true to trigger
step
if(needsresize) //whatever your code is to do that
{
    doresize = true;
    thisroom = room;
    waspersitent = room_persistent;
    room_persistent = false;
    with(all)
    {
        __oldpersitent = persistent;
        persistent = true;
    }
    room_goto(changeRoom);
}
on room start
if(doresize)
{
    if (room == changeRoom)
    {
        room_set_view(thisroom,.......)
        room_goto(thisroom);
    }
    else
    {
        doresize = false;
        with(all)
        {
            persistent = __oldpersitent;
        }
        room_persistent = waspersitent;
        needsresize = false;
    }
}

  • 0

#5 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 25 April 2012 - 03:02 AM

I shall leave it at the hands of a experienced Global Moderator
  • 0

#6 Henez

Henez

    GMC Member

  • New Member
  • 3 posts

Posted 25 April 2012 - 09:10 AM

Thank you very much icuurd12b42!

Luckily it wasn't too much of a problem for me because I only intended to visit my games settings page once. From their I just set up the main game room and its all good!

Thank you :)!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users