Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / dbCLS not working

Author
Message
JeremyS
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location:
Posted: 30th Nov 2009 02:57
Hello--I'm new to using the Dark GDK (and C++ in general). I've had some experience programming simple games in Java, so I'm currently trying to reproduce those games with the Dark GDK. At the moment, however, I cannot even get a rectangle to move across the screen. Here is my code:



The call to dbCLS() does nothing, with the result that my box just expands to the right. After swapping some of the code around, I discovered that dbCLS seems to clear the background while dbBox draws to the foreground.

I then tried to simulate dbCLS with a call to dbBox(0,0,PWIDTH,PHEIGHT), but the background box drew once and then never again, while the other box continued to ooze across the screen. After fiddling with the numbers, I found that the background box would only draw and refresh properly if its dimensions were at least one pixel less than the window size.

The problem persists even if I take out the code to change the window size and resolution.

Could someone please point out the very basic thing I must be missing?
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 3rd Dec 2009 02:04
Quote: "After fiddling with the numbers, I found that the background box would only draw and refresh properly if its dimensions were at least one pixel less than the window size."


Honestly you'd probably have more luck in the DarkGDK forums. I think that the reason might be though that in an 800x600 window, the pixels are numbered 0-799 horizontally and 0-599 vertically, so it wouldn't draw something larger than the screen itself. I'm not absolutely 100% on that, but it's just something I've kind of assumed myself because of problems like this in the past.

Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Dec 2009 02:30
We're having problems with CLS too. It only effects some systems.

http://forum.thegamecreators.com/?m=forum_view&t=161068&b=1

JeremyS
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location:
Posted: 7th Dec 2009 00:07
@demons breath:

It's a good thought, but my scrolling box has no problem with being drawn off the screen. So, it doesn't make sense to me why my background box would.

@Grog:

Thanks for the link--it's nice to know I'm not the only one having issues.

Login to post a reply

Server time is: 2024-04-26 12:33:26
Your offset time is: 2024-04-26 12:33:26