Catfish
Member
Alright, I'll cut to the chase, because my issue is a heckin weird one.
So, I have a camera code where I can zoom in and out, move the view around with arrow keys, etc. Works great.
I'm also trying to add a custom cursor (with multiple frames, so I can't just set the cursor to a sprite) that won't resize when you zoom the camera. So my last option is to draw it in Draw GUI.
However, getting the cursor to follow the mouse AND have it work well with the Draw GUI event is NOT happening. It just kinda... either slides around, or just doesn't appear on-screen at all. Here's my code for the step event of my camera object:
Does anyone what code might make this work properly for Draw GUI? Thank you!
So, I have a camera code where I can zoom in and out, move the view around with arrow keys, etc. Works great.
I'm also trying to add a custom cursor (with multiple frames, so I can't just set the cursor to a sprite) that won't resize when you zoom the camera. So my last option is to draw it in Draw GUI.
However, getting the cursor to follow the mouse AND have it work well with the Draw GUI event is NOT happening. It just kinda... either slides around, or just doesn't appear on-screen at all. Here's my code for the step event of my camera object:
///Move view
var view_midx, view_midy;
view_midx = view_xview[0] + (view_wview[0]/2);
view_midy = view_yview[0] + (view_hview[0]/2);
if (keyboard_check(ord("A")) + keyboard_check(vk_left)) - (keyboard_check(ord("D")) + keyboard_check(vk_right)) > 0{
view_xview[0] -= round(view_wview*0.005);
}
if (keyboard_check(ord("A")) + keyboard_check(vk_left)) - (keyboard_check(ord("D")) + keyboard_check(vk_right)) < 0{
view_xview[0] += round(view_wview*0.005);
}
if (keyboard_check(ord("W")) + keyboard_check(vk_up)) - (keyboard_check(ord("S")) + keyboard_check(vk_down)) > 0{
view_yview[0] -= round(view_wview*0.005);
}
if (keyboard_check(ord("W")) + keyboard_check(vk_up)) - (keyboard_check(ord("S")) + keyboard_check(vk_down)) < 0{
view_yview[0] += round(view_wview*0.005);
}
if mouse_wheel_up() && view_wview > 320{
view_wview[0] -= 128;
view_xview[0] += 64;
view_hview[0] -= 72;
view_yview[0] += 36;
}
if mouse_wheel_down() && view_wview < 1280{
view_wview[0] += 128;
view_xview[0] -= 64;
view_hview[0] += 72;
view_yview[0] -= 36;
}
view_xview[0] = clamp(view_xview[0],0,room_width-view_wview[0]);
view_yview[0] = clamp(view_yview[0],0,room_height-view_hview[0]);
var view_midx, view_midy;
view_midx = view_xview[0] + (view_wview[0]/2);
view_midy = view_yview[0] + (view_hview[0]/2);
if (keyboard_check(ord("A")) + keyboard_check(vk_left)) - (keyboard_check(ord("D")) + keyboard_check(vk_right)) > 0{
view_xview[0] -= round(view_wview*0.005);
}
if (keyboard_check(ord("A")) + keyboard_check(vk_left)) - (keyboard_check(ord("D")) + keyboard_check(vk_right)) < 0{
view_xview[0] += round(view_wview*0.005);
}
if (keyboard_check(ord("W")) + keyboard_check(vk_up)) - (keyboard_check(ord("S")) + keyboard_check(vk_down)) > 0{
view_yview[0] -= round(view_wview*0.005);
}
if (keyboard_check(ord("W")) + keyboard_check(vk_up)) - (keyboard_check(ord("S")) + keyboard_check(vk_down)) < 0{
view_yview[0] += round(view_wview*0.005);
}
if mouse_wheel_up() && view_wview > 320{
view_wview[0] -= 128;
view_xview[0] += 64;
view_hview[0] -= 72;
view_yview[0] += 36;
}
if mouse_wheel_down() && view_wview < 1280{
view_wview[0] += 128;
view_xview[0] -= 64;
view_hview[0] += 72;
view_yview[0] -= 36;
}
view_xview[0] = clamp(view_xview[0],0,room_width-view_wview[0]);
view_yview[0] = clamp(view_yview[0],0,room_height-view_hview[0]);
Does anyone what code might make this work properly for Draw GUI? Thank you!
Last edited: