Legacy GM view_enabled[n] behaves inconsistently

Pinuzzo

Member
Hello,

I currently have a view that keeps the player in the middle of the screen. I am setting these values in the Room Editor. However, I am trying to convert it into code in the player object.

So, I disable *Visible when room starts* and then in the Create event of the player object I write:

view_enabled[0] = true;

However, this causes the view to become very distorted and causes the framerate to drop to about a quarter. Why is there a difference between enabling views via Room Editor and enabling views via a Create event?
 

Pinuzzo

Member
I believe so. Here is the view I'm trying to replicate:
upload_2016-10-23_17-32-48.png

and here is the code in my Player object:

In Create:
Code:
view_visible[0]=true;
width=2048;
height=1536;

view_wview[0]=width;
view_hview[0]=height;
view_wport[0]=width;
view_hport[0]=height;
In Step:
Code:
view_xview[0]=x-(view_wview[0]/2);
view_yview[0]=y-(view_hview[0]/2);
 
A

Ariak

Guest
Theres an easier way to do it ;)

Use the built in view_object. It handles all of that for you! Just define the view_object once in the player create event.
Code:
view_object[0] = object_index;
Alternatively you would need to round the view_xview values to avoid non-integer x,y positions, which cause massive picture distortion.
 

Pinuzzo

Member
Theres an easier way to do it ;)

Use the built in view_object. It handles all of that for you! Just define the view_object once in the player create event.
Code:
view_object[0] = object_index;
Alternatively you would need to round the view_xview values to avoid non-integer x,y positions, which cause massive picture distortion.

Hmm, where would I put this? In Create? And which other things would I run alongside with it?
 
A

Ariak

Guest
Put in the create event of the object your camera shoudl follow. So the player in this case.
It will then handle following the player automatically.
I would definetly create a controller object for resizing the game + view. This shouldn't really run in the player object.
 
Top