07-08-2018, 10:49 PM
(07-08-2018, 01:10 PM)Melana Wrote: I finally managed to tell my graphics card to stop stretching RMXP games to 16:9 resolution in full screen. That always annoyed me.
Nvidia or Amd?
In Nvidia you just change the perform scaling option from Monitor to GPU which usually solves 99.99% of the problems, I believe AMD has a similar feature or may be named something else.
Been working on my Camera all day, currently working on a borderless full screen option.
Code:
//--------------------------------------------
// XenRPG Camera
// Ver 1.0
// XenRPG_camera(dw, dh, psf, target, cam_border_x, cam_border_y, aa, vsync, fullscreen);
//--------------------------------------------
//--------------------------------------------
// Init Variables
//--------------------------------------------
#region
globalvar display_width, display_height, internal_width, internal_height;
globalvar camera, camera_target, camera_border_x, camera_border_y, _curRoom;
globalvar aa, vsync, fullscreen, pixel_scaling_factor;
#endregion
//--------------------------------------------
// Game Settings
//--------------------------------------------
#region
display_width = argument0;
display_height = argument1;
pixel_scaling_factor = argument2;
internal_width = display_width / pixel_scaling_factor;
internal_height = display_height / pixel_scaling_factor;
aa = argument6;
vsync = argument7;
fullscreen = argument8;
#endregion
//--------------------------------------------
// Camera Settings
//--------------------------------------------
#region
_curRoom = room_add();
room_set_view_enabled(_curRoom,true);
camera = camera_create();
camera = camera_create_view(x, y, internal_width, internal_height, 0, self, -1, -1, internal_width / 2, internal_height / 2);
room_set_width(_curRoom, internal_width);
room_set_height(_curRoom, internal_height);
room_set_viewport(_curRoom, 0, true, 0, 0, internal_width, internal_height);
camera_matrix = matrix_build_lookat(x, y, -TILESIZE, x, y, 0, 0, 1, 0);
camera_projection = matrix_build_projection_ortho(internal_width, internal_height, 1, 9999);
camera_set_view_mat(camera, camera_matrix);
camera_set_proj_mat(camera, camera_projection);
view_camera[0] = camera;
cam_target = argument3;
cam_border_x = argument4;
cam_border_y = argument5;
window_set_size(internal_width * 1, internal_height * 1);
surface_resize(application_surface, internal_width, internal_height);
application_surface_draw_enable(true)
display_reset(aa, vsync);
if (os_type == os_windows || os_macosx || os_linux) {
window_set_fullscreen(true);
}
#endregion
Code:
XenRPG_camera(1280, 720, 2, object18, 64, 32, 16, true, false);
Code:
//Update/lerp the camera pos
var cam_x = camera_get_view_x(camera);
var cam_y = camera_get_view_y(camera);
camera_set_view_pos(camera, lerp(cam_x, cam_target.x, 1), lerp(cam_y, cam_target.y, 1))
x = clamp(x, cam_target.x-cam_border_x, cam_target.x+cam_border_x);
y = clamp(y, cam_target.y-cam_border_y, cam_target.y+cam_border_y);
// RPG Maker screen size changes
if (os_type == os_windows || os_macosx || os_linux) {
// If full screen go back to windowed mode
if (window_get_fullscreen()) {
if (keyboard_check_pressed(vk_f12)) {
window_set_fullscreen(false);
window_set_size(internal_width * 1, internal_height * 1);
surface_resize(application_surface, internal_width, internal_height);
application_surface_draw_enable(true)
display_reset(aa, vsync);
}
} else {
// if in windowed mode switch between base and double window sizes or go full screen
if (keyboard_check_pressed(vk_f4)) {
window_set_fullscreen(false);
window_set_size(internal_width * 1, internal_height * 1);
surface_resize(application_surface, internal_width, internal_height);
application_surface_draw_enable(true)
display_reset(aa, vsync);
}
if (keyboard_check_pressed(vk_f5)) {
window_set_fullscreen(false);
window_set_size(internal_width * 2 * 1, internal_height * 2 * 1);
surface_resize(application_surface, internal_width, internal_height);
application_surface_draw_enable(true)
display_reset(aa, vsync);
}
if (keyboard_check_pressed(vk_f12)) {
window_set_fullscreen(true);
}
}
}