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 / Help with dbSetWindowOff()

Author
Message
NicGuitar
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location:
Posted: 23rd Jan 2011 06:59
Hello,everybody!I'm a new person,know some simple code.I 'm a Chinese and just a student,my English isn't very good,so I will make some mistake.Please forgive me!

Now,I have a question is about the dbSetWindowOff().
When I use this command,the window will change full screen.
But if I use some images in this , I just can see a black's background.
If I don't use the dbSetWindowOff(),will be normal!
You have try this question before?And how to work out?

Thank you have the patience to read my words and forgive my mistake!

I show my code.If somewhere make a mistake, grateful to you for pointing out!

#include "DarkGDK.h"

void setUp();
void setMusic();
void setMouse();
void setSync();
void setImage();
void mouseMove(int&,int&);

void DarkGDK()
{
int x,y;
setUp();
setMusic();
setMouse();
setSync();
setImage();
while(LoopGDK())
{
dbPasteImage(2,0,0,0);
//dbSprite(2,0,0,2);
x=dbMouseX();
y=dbMouseY();
mouseMove(x,y);
dbSprite(1,x,y,1);
if(dbEscapeKey())
{
dbRestoreWindow();
}
if(dbReturnKey())
{
dbMaximizeWindow();
}
if(dbSpaceKey())
{
dbSetWindowOff(); //question about this command!
}
if(dbControlKey())
{
dbSetWindowOn(); //I can't use the command to change my program to normal,when I use dbSetWindowOff() later .
}
dbSync();
}
dbWaitKey();
}

void setUp()
{
dbSetWindowTitle("武林");
dbMaximizeWindow();
dbDisableEscapekey();
}

void setMusic()
{
dbLoadMusic("music/战斗.mp3",1);
dbLoopMusic(1);
}

void setImage()
{
dbSetImageColorKey(0,0,0);
dbLoadImage("pic/mouse.bmp",1);
dbLoadImage("pic/fight.jpg",2);
dbOffsetSprite(1,3,0);
dbSetSpritePriority(1,1);
}

void setMouse()
{
dbHideMouse();
}

void setSync()
{
dbSyncOn();
dbSyncRate(100);
}

void mouseMove(int& x,int& y)
{
int spriteWidth=dbSpriteWidth(1);
int spriteHeight=dbSpriteHeight(1);
int screenWidth=dbScreenWidth()-1;
int screenHeight=dbScreenHeight()-1;
if(x<0)
{
x=0;
}
if(x+spriteWidth>screenWidth)
{
x=screenWidth-spriteWidth;
}
if(y<0)
{
y=0;
}
if(y+spriteHeight>screenWidth)
{
y=screenHeight-spriteHeight;
}
}

I love music and rock!

Attachments

Login to view attachments
RomuluS85
18
Years of Service
User Offline
Joined: 10th Apr 2006
Location:
Posted: 24th Jan 2011 01:03
don't know if this exists in dark gdk, but it used to happen with dark basic...

what happened is that if you had stuff loaded, and changed screen resolution, or something that has a similar impact on the game window, it would "forget" everything done "before" that...

i.e. you'll need to reinitialize the screen once you have resized it. (load up everything again etc.)
RomuluS85
18
Years of Service
User Offline
Joined: 10th Apr 2006
Location:
Posted: 24th Jan 2011 01:11
overall i'd just go with keeping it windowed as long as you're developing then test if it runs if you turn it on to fullscreen mode.

i find it to be rather annoying when it takes considerably longer to start up the game, when developing.
NicGuitar
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location:
Posted: 24th Jan 2011 07:24
Oh,you are right.

"what happened is that if you had stuff loaded, and changed screen resolution, or something that has a similar impact on the game window, it would "forget" everything done "before" that..."

Now,I know how to work out the problem!
Thank you,RomuluS85!

I love music and rock!

Login to post a reply

Server time is: 2024-09-28 14:02:14
Your offset time is: 2024-09-28 14:02:14