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.

Dark GDK / HelloWorld's blue backgrownd

Author
Message
MxM111
14
Years of Service
User Offline
Joined: 3rd Oct 2009
Location:
Posted: 4th Oct 2009 18:54
Can somebody explain, why application Hello World shows the rotating globe on BLUE background. Where does the background come from?

I am trying to modify the example (drawing lines) but it looks that this background overwrite my lines.

Basically, if I do this:

void DarkGDK ( void )
{
dbLine (66, 5, 3, 300 );
dbCreateAnimatedSprite ( 1, "animatedsprite.png", 4, 4, 1 );
dbSprite ( 1, 111, 111, 1 );
char* str;
dbSetCursor ( 50, 50 );
str=dbInput();

Then I see the globe on blue background and I do not see my line. The text that I input is flashing on/off and looks gray. But if I do this:
void DarkGDK ( void )
{
dbLine (66, 5, 3, 300 );
char* str;
dbSetCursor ( 50, 50 );
str=dbInput();

Then I see black background, white line and the text that I enter is white.
What is going on?

One thing I am sure, the file animatedsprite.png does not contain blue background. I also used different bmp file and used dbLoadImage but the result was the same: if I have sprite created before I call dbInput, then background is blue!
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 5th Oct 2009 00:50
No, draw the line in your loop...

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Oct 2009 05:03
The blue background is the GDK Backdrop. It is turned On by default and will cover 2D drawing operations that arent sprites.

Calling sprite commands, 3D object commands or some other GDK commands aswell, causes it to create a backdrop to be able to render properly(it has to clear the DirectX device each frame).

If it ain't broke.... DONT FIX IT !!!
MxM111
14
Years of Service
User Offline
Joined: 3rd Oct 2009
Location:
Posted: 5th Oct 2009 06:02
Thanks for the replies, however even if I put dbLine AFTER dbSprite command, I still do not see the line. Like in here


I guess when dbSync is Off then the creation of this blue background happens later, when GDK decides to update the window...

But I tried the following:


And still NO success! I see very briefly white line drawn on black background, and then blue background takes everything erasing the line.

BTW, is there any way on these forums to preview the message?
Wilvis
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location:
Posted: 5th Oct 2009 20:19
you will need to redraw the line in youe main loop.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 6th Oct 2009 00:04
You can switch off the blue background by dbBackdropOff().
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 6th Oct 2009 04:55
The BASIC structure of your program is not correct for what you are doing. You have no main loop, so the program code will execute once and then exit, that could be why you are only seeing the line briefly.

If you do have a loop, but are drawing outside of it, then when the program does get to the loop and starts updating the screen in the loop, it will probaby overwrite the contents of the backbuffer as its refreshed..

here is the basic way your program should look, without actually putting your code in(you can do that) :



Thats just the basic layout, you can see from my comments where you would put in your own code, the loading of the sprite/creating the animated sprite would be outside the loop, the dbLine command should be called inside the main loop.

If it ain't broke.... DONT FIX IT !!!
MxM111
14
Years of Service
User Offline
Joined: 3rd Oct 2009
Location:
Posted: 6th Oct 2009 08:19
1) dbBackdropOff does not help

2) Of course I have the loop. It is just it is below in the program and was not included into the snippet I posted here. I wanted to get some dbInput before I run the main loop. But even if I put the dbInput into the loop, it does not change a thing. Here is my full program (not part of it as it was before)


I even dbSync it twice (removing any of the dbSyncs does not change a thing). Can somebody run it and see if the behavior is different and how to make it show those lines and text I enter? The file animatedsprite.png is in tutorial folder of GDK "C:\Program Files\The Game Creators\Dark GDK\Tutorials\Getting Started\Getting Started" for default installation. But I am more or less sure that any image will do.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 6th Oct 2009 20:12
I tried on my computer. It seems dbInput is the suspect. If I run the code without dbInput, I see the cyan lines over the blue background (which really cannot be switched off) and the animated sprite. With dbInput, the program freezes in various ways: black screen, blue screen, or just the sprite but it does not animate. Maybe dbInput waits for input and the screen does not update properly in the meantime. I tried calling dbInKey instead of dbInput and then it works again.
MxM111
14
Years of Service
User Offline
Joined: 3rd Oct 2009
Location:
Posted: 7th Oct 2009 05:47
Thanks for checking, Mireben.
So, what is the best way then to input something from keyboard (like player name) if I can not use dbInput?
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 7th Oct 2009 22:56 Edited at: 7th Oct 2009 22:57
Try either dbEntry, dbGetEntry (I think that's two names for the same function but I'm not sure) or dbInKey. In this thread you can find a conversation about dbGetEntry, containing a post by Michael P. which shows how to use it. Usage of dbInKey should be very similar.

http://forum.thegamecreators.com/?m=forum_view&t=151965&b=22

Login to post a reply

Server time is: 2024-10-01 14:35:19
Your offset time is: 2024-10-01 14:35:19