Results 1 to 9 of 9

Thread: GUI

  1. #1
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default GUI

    how can i draw circle on gui component ?!!! cl_window:aint and cl_window::request_paint doesnt work !!! how can i do this ?

    i want use gui such as .NET and get Graphics . please help me. tnx

  2. #2
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    cl_window:: paint **

  3. #3
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    please help me how can i use cl_draw with cl_window-GUI-.

  4. #4
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    void click(CL_Window *window)
    {
    CL_PushButton btn( window );

    btn.set_geometry( CL_Rect( 120, 120, 150, 150) );
    }

    int main(const std::vector<CL_String> &args)
    {
    CL_SetupCore s_core;
    CL_SetupDisplay s_display;
    CL_SetupGUI s_gui;
    CL_SetupSWRender s_swrender;

    try
    {
    CL_DisplayWindowDescription win_desc;
    win_desc.set_size(CL_Size( 500, 500 ), false);

    CL_GUIWindowManagerSystem wm;
    CL_GUIManager gui(wm, "x.css");

    CL_Window window(&gui, win_desc);

    CL_PushButton btn( &window );
    btn.set_geometry( CL_Rect(1, 1, 100, 100) );
    btn.func_clicked().set(click, &window);

    window.exec();
    }
    .
    .
    .

    why after click on btn , do not create new pushbutton ?!

  5. #5
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default

    That is simple...
    The variable "btn" went out of scope.

    The following code should work:
    Code:
    void click(CL_Window *window)
    {
        CL_PushButton *btn = new CL_PushButton( window );
    
        btn->set_geometry( CL_Rect( 120, 120, 150, 150) );
    }

  6. #6
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    tnx alot my friend. how can i use cl_draw :



    void btn_clicked(CL_Window *window)
    {
    CL_Draw::circle(window->get_gc(), 100, 100, 20, CL_Colorf::black);
    }


    int main(const std::vector<CL_String> &args)
    {
    CL_SetupCore s_core;
    CL_SetupDisplay s_display;
    CL_SetupGUI s_gui;
    CL_SetupSWRender s_swrender;

    try
    {
    CL_DisplayWindowDescription win_desc;
    win_desc.set_size(CL_Size( 500, 500 ), false);

    CL_GUIWindowManagerSystem wm;
    CL_GUIManager gui(wm, "");

    CL_Window window(&gui, win_desc);

    CL_PushButton btn( &window );
    btn.set_geometry( CL_Rect(1, 1, 100, 100) );
    btn.func_clicked().set(btn_clicked, &window);

    window.exec();
    }
    .
    .
    .
    .

    why doesnt draw circle ?!

  7. #7
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    i must use "CL_GUIWindowManagerTexture" but now my question is how can i clear background of this window to black ?!!! ( (

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    See Examples/GUI/GUI_Texture in ClanLib 2.2.9

  9. #9
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    30

    Default

    if i use openGL and just use cl_setupgl , screen clear to black !!!

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
  •