#include "cPongStart.hpp" /*** TrooperEngine DLL Header Files ***/ #include "TrooperEngine.hpp" /*** Custom Header Files ***/ #include "../MainMenu/Input/cMenuUp.hpp" #include "../MainMenu/Input/cMenuDown.hpp" #include "../MainMenu/Input/cMenuSelect.hpp" #include "../MainMenu/Input/cEsc.hpp" #include "../MainMenu/cBuildMainMenu.hpp" #include "../Equipment/cCourt.hpp" #include "../Equipment/cPaddle.hpp" #include "../Equipment/Input/cPlayerUp.hpp" #include "../Equipment/Input/cPlayerDown.hpp" #include "../Equipment/Input/cQuitButton.hpp" using PongStart::cPongStart; cPongStart::cPongStart() : mp_menu(nullptr), m_option(MainMenu::Start) { TrooperEngineCore::cTrooperEngineCore& core = TrooperEngineCore::cTrooperEngineCore::Inst(); core.TimerInit(); core.VideoInit(); core.AudioInit(); core.TextTypeInit(); if (core.getVideo()) VideoEngine::cVideo::Inst().Setup(); if (core.getAudio()) AudioEngine::cAudio::Inst().Setup(); if (core.getTimer()) TimingEngine::cTiming::Inst().Setup(); if (core.getText()) TextTypeEngine::cTextType::Inst().Setup(); TrooperEngineCore::cTrooperEngineCore::Inst().PrintSDLVersion(); } cPongStart::~cPongStart() { TrooperEngineCore::cTrooperEngineCore::Inst().Delete(); } void cPongStart::Main() { //GUIHelpers::cTexture* temp = new GUIHelpers::cTexture(); //SDL_Rect rec = {0,0,25,25}; //temp->GenerateTexture(rec); //TextTypeEngine::cText* txt = new TextTypeEngine::cText("Hello akjfdklajfdlkjfkljdfalkajdlkfjakljflkjafdlkjflkajdlkfjalkdjflkajdlkfajlkfdjafkljdfkljasdfalk"); //VideoEngine::cSprite* sprt = new VideoEngine::cSprite((VideoEngine::cImage**)(&txt)); //sprt->Draw(); // GUIEngine::cButton* but = new GUIEngine::cButton(0, "button2"); // but->Draw(); //GUIEngine::cWindow* win = new GUIEngine::cWindow(); GUIEngine::cLayout* lay = new GUIEngine::cLayout(); GUIEngine::cLabel* lbl = new GUIEngine::cLabel(lay, 22, "Hello world"); lay->Resize(); lay->Display(); //GUIEngine::cGUI::Inst().AddObject(win); //GUIEngine::cGUI::Inst().Display(); //while (true) { EventEngine::cEvent::Inst().CheckEvents(); /*SDL_Colour col = { 255, 255, 255, 255}; SDL_Rect re= { 0, 0, 100, 100}; FXEngine::cGFX::Inst().RoundedRectangle(re, 4, col);*/ VideoEngine::cVideo::Inst().Display(); //break; //} system("pause"); /*MainMenu(); switch (m_option) { case MainMenu::Start: Start(); break; case MainMenu::Head: HeadtoHead(); break; case MainMenu::Quit: default: Quit(); break; }*/ } ///private void cPongStart::MainMenu() { MainMenu::cBuildMainMenu temp; mp_menu = temp.ReadXML(); Input::cMenuUp* menuup = new Input::cMenuUp(SDLK_a, &mp_menu); Input::cMenuDown* menudown = new Input::cMenuDown(SDLK_z, &mp_menu); Input::cMenuSelect* menuselect = new Input::cMenuSelect(SDLK_x, &mp_menu); Input::cEsc* esc = new Input::cEsc(SDLK_ESCAPE, &mp_menu); InputEngine::cKeyboard* menukeyboard = new InputEngine::cKeyboard("MenuKeyboard"); menukeyboard->AddKey(menuup); menukeyboard->AddKey(menudown); menukeyboard->AddKey(menuselect); menukeyboard->AddKey(esc); InputEngine::cInput::Inst().AddKeyboard(menukeyboard); m_option = mp_menu->ShowMenu(); } void cPongStart::Start() { VideoEngine::cImage* p_image = new VideoEngine::cImage("img/", "Equipment.png", true, 0, 0, 0); VideoEngine::cImage* p_court = new VideoEngine::cImage("img/", "Court.png"); Equipment::cBall* ball = new Equipment::cBall(400, 400, 17, 65, 12, 12, &p_image); Equipment::cPaddle* paddle = new Equipment::cPaddle(0, 0, 0, 0, 16, 77, &p_image); Equipment::cPaddle* paddle2 = new Equipment::cPaddle(0, 200, 29, 0, 16, 77, &p_image); Equipment::cCourt* court = new Equipment::cCourt(ball, paddle, paddle2, &p_court); InputEngine::cTextInput text;// = new InputEngine::cTextInput(); TimingEngine::cTiming::Inst().setFTP(30); while (court->isPause() == false) { ball->Move(); paddle->Move(); paddle2->Move(); court->CheckCollision(); court->Draw(); ball->Draw(); paddle->Draw(); paddle2->Draw(); TimingEngine::cTiming::Inst().Time(); VideoEngine::cVideo::Inst().Display(); } delete p_image; p_image = nullptr; delete p_court; p_court; delete court; court = nullptr; } void cPongStart::HeadtoHead() { } void cPongStart::Quit() { }