Hey guys. This is my first time on the forum and using DGDK really. I'm starting work on a 3D FPS using DGDK and for some reason when I execute my program it just draws the FPS but not the cube I told it to.
Code:
#include "DarkGDK.h"
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
using namespace std;
void init();
void render();
void update();
void exit();
void loadAssets();
void unLoadAssets();
void renderSplashScreens();
void renderMenu();
void renderFPS();
void renderMap();
void renderPlayer();
void renderAI();
void renderEndOfGame();
void updateSplashScreens();
void updateMenu();
void updateFPS();
void updateMap();
void updatePlayer();
void updateAI();
void updateEndOfGame();
int state; //0=SplashScreens, 1=Menu, 2=Game, 3=End of Game
int FPS;
string FPS_txt;
void DarkGDK(){
init();
while(LoopGDK()){
dbPositionMouse(dbScreenWidth()/2,dbScreenHeight()/2);
render();
update();
}
exit();
return;
}
void init(){
dbSyncOn();
dbSyncRate(60);
dbRandomize(dbTimer());
//dbSetDir("Assets");
/*dbSetWindowOff();
dbMaximizeWindow();*/
dbSetWindowTitle("EPA");
dbHideMouse();
state=0;
dbPositionCamera(0,0,0);
dbMakeObjectCube(0,10);
dbPositionObject(0,0,0,25);
//loadAssets();
}
void render(){
dbClear(0,0,0);
switch(state){
case 0:
//Render SplashScreens
renderSplashScreens();
state++;
break;
case 1:
//Render Menu
renderMenu();
state++; //Dbg feature
break;
case 2:
//Render Game
renderFPS();
renderMap();
renderPlayer();
renderAI();
break;
case 3:
//Render End of Game
renderEndOfGame();
break;
}
dbSync();
}
void update(){
switch(state){
case 0:
//Check if the user wishes to skip the cutscenes
break;
case 1:
//Check if they wish to select something
break;
case 2:
updateFPS();
updateMap();
updatePlayer();
updateAI();
break;
case 3:
//Check if they wish to skip the credits
break;
}
}
void exit(){
//Destroy DGDK objects and Deallocate any pointers
//unLoadAssets();
}
void loadAssets(){
//Load SplashScreen images
dbLoadImage("EPA-Dev.png",0);
//Load Menu images
dbLoadImage("menu.png",1);
dbLoadImage("controls.png",2);
dbLoadImage("about.png",3);
dbLoadImage("credits.png",4);
dbLoadImage("exit.png",5);
//Load In-Game images
dbLoadImage("crosshair.png",6);
dbLoadImage("plasma_indicator.png",7);
dbLoadImage("health_indicator.png",8);
//Load In-Game Object-Assets(Models and Textures)
dbLoadObject("player.x",9);
}
void unLoadAssets(){
}
void renderSplashScreens(){
}
void renderMenu(){
}
void renderFPS(){
dbText(0,dbScreenHeight()-20,const_cast<char*>(FPS_txt.c_str()));
}
void renderMap(){
}
void renderPlayer(){
}
void renderAI(){
}
void renderEndOfGame(){
}
void updateSplashScreens(){
}
void updateMenu(){
}
void updateFPS(){
FPS=dbScreenFPS();
stringstream FPS_ss;
FPS_ss<<FPS;
FPS_txt=FPS_ss.str();
FPS_txt+=" FPS";
}
void updateMap(){
}
void updatePlayer(){
}
void updateAI(){
}
void updateEndOfGame(){
}
Thanks in advance.
C++ Game Engine Developer.