This is my code:
#include "DarkGDK.h"
#include "g_def.h"
enum IDImportant{
SKYBOX=1,
PLAYER
};
enum IDMisc{
CUBE=3,
MATRIX
};
void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(0);
dbLoadObject("media/skyboxes/sky05/sky05.x", SKYBOX);
dbScaleObject(SKYBOX, 30000, 30000, 30000);
dbMakeObjectCube(CUBE, 4);
dbPositionObject(CUBE, 0, 0, 1);
dbMakeMatrix(MATRIX,200,200,100,100);
dbLoadObject ("media/models/playermodel/H-GI-Static.x", PLAYER);
dbAppendObject("media/models/playermodel/H-GI-Idle.x", PLAYER, 1);
float cameraAngleX = 0.0f;
float cameraAngleY = 0.0f;
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
while(LoopGDK())
{
dbPositionObject(SKYBOX,
dbObjectPositionX(PLAYER),
dbObjectPositionY(PLAYER),
dbObjectPositionZ(PLAYER));
if(dbKeyState(KEY_W))
dbMoveObject(PLAYER, 1);
if(dbKeyState(KEY_A))
dbMoveObjectLeft(PLAYER, 1);
if(dbKeyState(KEY_S))
dbMoveObject(PLAYER, -1);
if(dbKeyState(KEY_D))
dbMoveObjectRight(PLAYER, 1);
cameraAngleY = dbWrapValue(dbObjectAngleY(PLAYER) + dbMouseMoveX() * 0.9f);
dbYRotateObject(PLAYER, cameraAngleY);
fCameraAngleX = dbWrapValue(dbCameraAngleX() + dbMouseMoveY() * 0.9f)-180.0f;
fCameraAngleY = dbWrapValue(dbCameraAngleY() + dbMouseMoveX() * 0.9f);
dbXRotateCamera(fCameraAngleX);
dbYRotateCamera(fCameraAngleY);
dbPositionCamera(
dbObjectPositionX(PLAYER)-1.0f,
dbObjectPositionY(PLAYER),
dbObjectPositionZ(PLAYER)-2.0f);
dbSync();
}
return;
}
But whenever I run it, everything shows up alright, but i get this really weird flickering of the screen, I don't know what caused it, I've tried removing certain commands, but with no luck . Can someone please help me to find out the cause of this problem.