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!