Page 1 of 1

Beginner C++ Game Programming DirectX Tutorial 5

Posted: August 18th, 2017, 10:32 am
by what on earth
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;
}

Re: Beginner C++ Game Programming DirectX Tutorial 5

Posted: August 18th, 2017, 10:34 am
by chili
if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}

Exactly what I did huh? ;)

Re: Beginner C++ Game Programming DirectX Tutorial 5

Posted: August 18th, 2017, 10:37 am
by what on earth
chili wrote:if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}

Exactly what I did huh? ;)

OMG I've been trying for like an hour or so :shock:
thank you so much :D

Re: Beginner C++ Game Programming DirectX Tutorial 5

Posted: August 18th, 2017, 10:54 am
by chili
Np bro. You just ask the same question in the comments btw?

Re: Beginner C++ Game Programming DirectX Tutorial 5

Posted: August 18th, 2017, 11:08 am
by what on earth
chili wrote:Np bro. You just ask the same question in the comments btw?
Yes ! I accidentally deleted my reply on my comment so I couldn't see if i got replies so I just asked here again.