Beginner C++ Game Programming DirectX Tutorial 5
Posted: August 18th, 2017, 10:32 am
Hi everyone,
I've been trying to solve the problem of the cursor hitting the edges of the screen
so i did exactly what chili did in the video https://www.youtube.com/watch?v=UREKHWv ... m1w03c010c 9:40
I set the values and everything to the same he did but my program still crashes when it hits the bottom of the screen , I wonder if someone could help me figure out the reason :
if (x + 5 > gfx.ScreenWidth) {
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}
if (y - 5 < 0) {
y = 5;
vy = 0;
}
if (x - 5 < 0) {
x = 5;
vx = 0;
}
I've been trying to solve the problem of the cursor hitting the edges of the screen
so i did exactly what chili did in the video https://www.youtube.com/watch?v=UREKHWv ... m1w03c010c 9:40
I set the values and everything to the same he did but my program still crashes when it hits the bottom of the screen , I wonder if someone could help me figure out the reason :
if (x + 5 > gfx.ScreenWidth) {
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}
if (y - 5 < 0) {
y = 5;
vy = 0;
}
if (x - 5 < 0) {
x = 5;
vx = 0;
}