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 / Attempting Quickstart Tutorial 1 - What's wrong with this code?

Author
Message
JohnD99
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location:
Posted: 5th Sep 2006 01:22
Hey everyone... DarkSDK newbie here, I am attempting to transform quickstart tutorial 1 from DBPro to DarkSDK, but can't get the right results to display on screen. When I run this code the original picture displays, but then nothing happens afterwards. What am I missing?

#include "DarkGDK.h"

void DarkGDK ( void )
{
dbSyncRate(60);
dbSyncOn();
dbBackdropOff();

dbLoadBitmap("media/800x600.jpg");

int x1 = 352;
int y1 = 16;
int x2 = 784;
int y2 = 384;
float tv = 0;
int spr = 2;

dbGetImage(1,0,0,800,600,0);
dbGetImage(2,x1,y1,x2,y2,0);

dbSprite(1,0,0,1);
dbSprite(2,x1,y1,2);

while (LoopGDK())
{
if (dbSpaceKey())
return;

tv = tv + 0.01;

dbSetSpriteTextureCoord(spr,0, 0.0, 0.0 + tv);
dbSetSpriteTextureCoord(spr,1, 1.0, 0.0 + tv);
dbSetSpriteTextureCoord(spr,2, 0.0, 1.0 + tv);
dbSetSpriteTextureCoord(spr,3, 1.0, 1.0 + tv);

if (dbUpKey())
spr = 2;


if (dbDownKey())
spr = 1;

dbSync();
}

}
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 5th Sep 2006 12:46
Put a dbSetDisplayMode(800,600,32) at the start of the program - it seems the resolution is smaller than this, causing problems.

Come to the last Unofficial DBPro Convention - register interest by Saturday 2/9/06 (http://convention.logicstudios.net/)
Demoing at the last Chichester Convention : Humans On A Planet
JohnD99
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location:
Posted: 5th Sep 2006 23:41
Thanks Philbert. Works great now, I've translated several tutorials now. Seems like everything except shading works.

Login to post a reply

Server time is: 2024-11-19 08:41:40
Your offset time is: 2024-11-19 08:41:40