Example #1
0
    void run()
    {

        quit = false;

        CL_DisplayWindowDescription window_desc;
        window_desc.set_size(CL_Size(sizex, sizey), true);
        window_desc.set_title("Chess");
        window_desc.set_allow_resize(true);
        CL_DisplayWindow window(window_desc);

        CL_Slot slot_quit = window.sig_window_close().connect(this, &SpritesExample::on_window_close);
        window.func_window_resize().set(this, &SpritesExample::resize);

        CL_GraphicContext gc = window.get_gc();
        CL_InputDevice keyboard = window.get_ic().get_keyboard();

        CL_ResourceManager resources("resources.xml");

        CL_Image lol(gc,"Board",&resources);

        CEGUI::OpenGLRenderer & myRenderer = CEGUI::OpenGLRenderer::bootstrapSystem();

        CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

        CEGUI::DefaultWindow* root = (CEGUI::DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");

        CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
        CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

        CEGUI::FrameWindow* wnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");

        root->addChildWindow(wnd);

        wnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
        wnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));

        // now we set the maximum and minum sizes for the new window.  These are
        // specified using relative co-ordinates, but the important thing to note
        // is that these settings are aways relative to the display rather than the
        // parent window.
        //
        // here we set a maximum size for the FrameWindow which is equal to the size
        // of the display, and a minimum size of one tenth of the display.
        wnd->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
        wnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));

        // As a final step in the initialisation of our sample window, we set the window's
        // text to "Hello World!", so that this text will appear as the caption in the
        // FrameWindow's titlebar.
        wnd->setText("Hello World!");
        CEGUI::System::getSingleton().renderGUI();
        window.flip();

        while (!quit)
        {
            if(keyboard.get_keycode(CL_KEY_ESCAPE) == true)
                quit = true;


            CL_Colorf red(155/255.0f, 60/255.0f, 68/255.0f);
            //CL_Draw::fill(gc, CL_Rectf(0, sizey, sizex, 0), red);
            //lol.draw(gc,CL_Rectf(0,sizey,sizex,0));
            //CEGUI::System::getSingleton().renderGUI();

            //window.flip();
            CL_KeepAlive::process();
            CL_System::sleep(10);
        }
    }