int main(int argc, char** argv) { try { sf::RenderWindow app(sf::VideoMode(800, 600, 32), "SFML Graphics"); StateEngine se; se.pushState(std::unique_ptr<State>(new MenuState(se, app))); std::cerr << "Loop\n"; sf::Clock timer; while (app.isOpen()) { //std::cerr<<"nasmnmasdn\n"; app.clear(sf::Color(128,128,255)); se.update(); app.display(); // std::cerr<<"Main: "<<timer.restart().asMilliseconds()<<"\n"; } return EXIT_SUCCESS; } catch(const std::exception& e) { std::cerr<<"CATCH\n"; std::cerr<<e.what()<<"\n"; } }
int main(int argc, char** argv) { using namespace Heroes; using namespace Heroes::Engine; //// Create a new lua state //lua_State *luaState = luaL_newstate(); //// Connect LuaBind to this lua state //luabind::open(luaState); //luabind::module(luaState)[ // luabind::def("SDL_GameControllerGetButton", &print_hello) //]; //luabind::object f = luabind::globals(luaState); //g_assert(f); //luabind::object t = f["SDL_GameControllerGetButton"]; //g_assert(t.is_valid()); //t(SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_BACK); ////luabind::call_function<Uint8>(luaState, "SDL_GameControllerGetButton", nullptr, SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_BACK) ////luabind::object f; //// Now call our function in a lua script ///*luaL_dostring( // myLuaState, // "print_hello(123)\n" // );*/ StateEngine stateEngine; if (!stateEngine.Init()) { return 1; } StateCreationPackage firstStateCreationPackage = StateCreationPackage(States::MainMenu::CreateMainMenuState, StateCreationData(NoStateCreationData, false)); stateEngine.Run(firstStateCreationPackage); // main menu stateEngine.Destroy(); return 0; }
int main() { // create game object engine.Init("Game"); engine.ChangeState(IntroState::Instance()); while(engine.Running()) { engine.HandleEvent(); engine.Update(); engine.Draw(); s3ePointerUpdate(); s3eKeyboardUpdate(); // S3E applications should yield frequently s3eDeviceYield(); } // clear up game object engine.Destroy(); return 0; }