Bentley
Member
I'm used to GM1's views so I've been struggling with GM2's cameras. I understand that you can set the view size and the port through the room editor, like you could in GM1. But I'm trying to "go with the tide" for lack of a better phrase, so I want to create a camera, a port, and a view through code.
As far as I can tell, none of the "port" code works, and it screws up the rest of the code. If I understand what ports are, then I should have a tiny game window (100x100) that shows what the view shows.
If anyone can explain the basics of cameras / views / ports I would greatly appreciate it. If you can point me to a blog that would be great too. Anything would help. Thanks for reading.
Code:
view_enabled = true;
view_visible[0] = true;
// Create Camera
global.cam = camera_create();
// Port
view_set_visible(0, true); // Make the port visible
view_set_camera(0, global.cam); // Assign the camera to port 0
view_set_xport(0, 0); // Port dimensions
view_set_yport(0, 0);
view_set_wport(0, 100); // This is 100x100 to test whether it's working, which it' not : (
view_set_hport(0, 100);
// View
camera_set_view_pos(global.cam, 0, 0);
camera_set_view_size(global.cam, CAM_WIDTH, CAM_HEIGHT);
camera_set_view_border(global.cam, CAM_WIDTH / 2, CAM_HEIGHT / 2);
camera_set_view_target(global.cam, id);
If anyone can explain the basics of cameras / views / ports I would greatly appreciate it. If you can point me to a blog that would be great too. Anything would help. Thanks for reading.
Last edited: