/* This file is part of the Zenipex Library (zenilib). * Copyleft (C) 2011 Mitchell Keith Bloch (bazald). * * This source file is simply under the public domain. */ #include #if defined(_DEBUG) && defined(_WINDOWS) #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW #endif using namespace std; using namespace Zeni; class Simple_Rendering_State : public Gamestate_Base { void render() { Video &vr = get_Video(); Colors &cr = get_Colors(); vr.set_2d(); Vertex2f_Color p0(Point2f(0.0f, 0.0f), cr["red"]); Vertex2f_Color p1(Point2f(0.0f, 300.0f), cr["green"]); Vertex2f_Color p2(Point2f(400.0f, 0.0f), cr["blue"]); Triangle triangle(p0, p1, p2); vr.render(triangle); } }; class Instructions_State : public Gamestate_Base { void render() { get_Video().set_2d(); Font &font = get_Fonts()["system_36_600"]; font.render_text("See how simple rendering can be?", Point2f(), Color()); } }; class Bootstrap { class Gamestate_One_Initializer : public Gamestate_Zero_Initializer { virtual Gamestate_Base * operator()() { Window::set_title("zenilib Example 1"); get_Joysticks(); get_Video(); get_Textures(); get_Fonts(); get_Sounds(); return new Title_State("zenilib:\nExample 1"); } } m_goi; public: Bootstrap() { g_gzi = &m_goi; } } g_bootstrap; int main(int argc, char **argv) { return zenilib_main(argc, argv); }