int main(int argc, char** argv) { QApplication* App = new QApplication(argc,argv); InGame* IG = new InGame(WIDTH,HEIGHT); IG->init(); IG->show(); return App->exec(); }
void Event(SDL_Event* Event) { if (Event->type == SDL_QUIT) { Running = false; } switch (Current) { case Structure::STORY: story->CheckEvent(Event); break; case Structure::INTRO: intro->CheckEvent(Event); break; case Structure::MENU: menu->CheckEvent(Event); break; case Structure::INGAME: ingame->CheckEvent(Event); break; case Structure::HELP: help->CheckEvent(Event); break; } }
bool Init() { Current = Structure::INTRO; //Inicializacion de SDL if (SDL_Init(SDL_INIT_EVERYTHING) < 0) return false; //Inicializacion de Display if ((Display = SDL_SetVideoMode(1024, 768, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL) return false; //Inicializacion de ventanas if (!intro->Init()) return false; if (!menu->Init()) return false; if (!help->Init()) return false; if (!ingame->Init()) return false; if (!story->Init()) return false; return true; }
void Render(SDL_Surface* display, float camera = 0) { switch (Current) { case Structure::STORY: story->Render(display); break; case Structure::INTRO: intro->Render(display); break; case Structure::MENU: menu->Render(display); break; case Structure::INGAME: ingame->Render(display); break; case Structure::HELP: help->Render(display); break; } SDL_Flip(display); }
int Loop() { switch (Current) { case Structure::STORY: Current = story->Loop(); break; case Structure::INTRO: Current = intro->Loop(); break; case Structure::MENU: Current = menu->Loop(); break; case Structure::INGAME: Current = ingame->Loop(); break; case Structure::HELP: Current = help->Loop(); break; } return Current; }
void Cleanup() const { story->Cleanup(); intro->Cleanup(); menu->Cleanup(); help->Cleanup(); ingame->Cleanup(); SDL_Quit(); }
void Start::on_btnLoad_clicked(){ World::getInstance()->setFile(true); InGame* gameScreen = new InGame(this); for (QObject *obj : server->children()){ QTcpSocket *anotherSock = dynamic_cast<QTcpSocket*>(obj); if (anotherSock != NULL){ QString str = "start"; anotherSock->write(str.toLocal8Bit()+"\n"); } } gameScreen->show(); timer->start(); this->hide(); }