Results 1 to 2 of 2

Thread: cl_displaywindow refuses to display a window

  1. #1

    Default cl_displaywindow refuses to display a window

    Hi, I read about ClanLib a while back and recently decided to try it. I love the way the API is laid out. Anyway my problem is that CL_DisplayWindow doesn't work.

    this is my code:

    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
    #include <ClanLib/display.h>
    #include <ClanLib/gl.h>
    #include <iostream>
    
    using namespace std;
    class MyApp : public CL_ClanApplication
    {
        public:
            virtual int main(int, char**);
    
    } app;
    
    
    int MyApp::main(int argc, char **argv)
    {
        CL_SetupCore sc;
        CL_SetupDisplay sd;
    
            CL_DisplayWindowDescription desc;
            CL_Size sz(640,480);
            desc.set_title("test");
            desc.set_size(sz);
    
        try
        {
            CL_DisplayWindow window(desc);
        }
        catch (CL_Error err)
        {
            cout << err.message.c_str() << endl;
        }
    
        /*while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
        {
            //CL_Display::flip();
            CL_System::keep_alive(20);
        }*/
    
        return 0;
    }
    I can compile and link this just fine, and if I remove the CL_DisplayWindow it runs through, ofc since it doesn't do anything hehe.

    I get this error though if I include displaywindow:
    Code:
    You need to create a display target first.
    Any idea what's up here? I've checked countless examples and the display overview among others. The code checks out afaik. Oh, and I've tried using the dipslaywindow constructor as well, to no avail.

    Thanks.

  2. #2

    Default

    Alright, I got an update on this problem now. I managed to solve it on my own.

    Oh and before I get to the solution, I should mention that I'm doing everything on a linux computer, I reckon that could be important

    It seems I cannot create a window without specifying the underlying renderer as either SDL or OpenGL. I assume the default is X11 or something which I apparantly couldn't do without some additional mods.

    By writing CL_SetupSDL sdl; OR CL_SetupGL gl; I can get the window to show.

    Maybe this'll help someone else, now I'm moving on to doing something useful with the window.

Similar Threads

  1. ClanLib crashes when creating CL_DisplayWindow with target SDL.
    By Otto (Strange) Halmén in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 01-19-2008, 08:38 AM
  2. Trying to set the window icon
    By JonR in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 08-09-2007, 08:14 AM
  3. Threading: window busy
    By Caesar in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 08-06-2007, 02:07 PM
  4. Display targets and input
    By void_kill in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 03-23-2007, 11:56 PM
  5. Clanlibs display errors
    By megumiaraki in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 12-07-2006, 07:20 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •