SimpleApplication
From SWWorkshop
Basic game mechanism is same for all games.
- Game initialization function is called first. This function sets up game engine and engine defaults.
- Game loop function calls every screen refresh. This function executes all game logic. Rendering, Player Interaction, Music, AI, Collision Detection operation. So It's important to balance cpu usage and time comsuming. İf operations takes too long time then your frame rate will drop.
- Game exit function called before game exit. This function kill engine and release allocated resource.
SWEngine simplifies these operations. It abstracts these mechanism so you don't worry about these things. Below example shows you how can we create simple game mechanism.
Api Doc
SWApplication,SwEngine.
Source Code
#include "../../include/SWEngine.h" #pragma comment (lib,"../../lib/SWEngine.lib") swApplication simpleApplication; //------------------------------------------------------------------------------------------- void GameLoop(){ //TODO //Input Handling //Process Input //Process System & AI //Rendering } //------------------------------------------------------------------------------------------- int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd) { //Application Settings simpleApplication.hInstance=hInstance; simpleApplication.fullScreen=false; simpleApplication.cursor=true; simpleApplication.width=800; simpleApplication.height=600; simpleApplication.title="Simple Application"; simpleApplication.path="resource"; simpleApplication.appRun=GameLoop; //Application Execution swEngineInit(&simpleApplication); swEngineRun(); swEngineExit(); return 0; }

