00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #include "WinMainSelector.h"
00024
00025 #ifdef COMPILE_DEMOBATTLE
00026
00027 #include "..\AEngine\AEngine.h"
00028 #include "globals.h"
00029 #include "BattleEntry.h"
00030
00031 using namespace Globals;
00032
00033 BattleEntry *pBattle;
00034 FLOAT screenSize;
00035
00036
00037 void init()
00038 {
00039 sys_showConsole(false);
00040 Globals::artWork = new ArtWork();
00041 pBattle = NULL;
00042 screenSize = 1.0f;
00043 sys_setSkipRate(0);
00044 }
00045
00046 void update()
00047 {
00048 if( input_isKeyPressed(KeyCodes::key_SPACE) && pBattle==NULL )
00049 {
00050 pBattle = new BattleEntry( Colors::blue, Colors::black, Vec2D(0.0f,0.0f) );
00051
00052 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00053 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::HEAVY_TANK, 16 ) );
00054 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::LAUNCHER, 24 ) );
00055 pBattle->teamAGroups.push_back( Int2Tuple( UnitTypes::ARTILLERY, 18 ) );
00056
00057 pBattle->teamBGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00058 pBattle->teamBGroups.push_back( Int2Tuple( UnitTypes::LIGHT_TANK, 30 ) );
00059
00060 screenSize = 0.01f;
00061 }
00062
00063 if(pBattle)
00064 {
00065 pBattle->input();
00066 pBattle->update();
00067 if(pBattle->isBattleFinished()) pBattle = NULL;
00068 }
00069
00070 if(screenSize<1.0f) screenSize = (screenSize + 0.004f) * 1.025f;
00071 if(screenSize>1.0f) screenSize = 1.0f;
00072 camera_setScreenSize(screenSize);
00073 }
00074
00075 void render()
00076 {
00077 if(pBattle)
00078 {
00079 pBattle->render();
00080 }
00081 else
00082 {
00083 overlay_text() << "DemoBattleMode : Main" << endl;
00084 overlay_text() << "Press SpaceBar to Simulate a Battle" << endl;
00085 overlay_textOut( Vec2D(0.0f,0.0f) );
00086 }
00087 }
00088
00089 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR, INT )
00090 {
00091 sys_init(hInst,800,600,32,true);
00092 sys_setInitFunc(init);
00093 sys_setUpdateFunc(update);
00094 sys_setRenderFunc(render);
00095 sys_go();
00096 return 0;
00097 }
00098
00099 #endif