paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] draw an object on screen - HOW?


From: Ulf Lorenz
Subject: Re: [paragui-users] draw an object on screen - HOW?
Date: Sun, 29 Jun 2003 22:14:27 +0200
User-agent: Mutt/1.4i

On Fri, Jun 27, 2003 at 11:12:39PM +0200, Michael Lüftenegger wrote:
> <---------------------------------- code beginn>
> #include "SDL\SDL.h"
> #include "pgapplication.h"
> #include "pgbutton.h"
> 
> class gol{
> public:
>     PG_Widget *screen;
>     
>     gol(){
>         screen = NULL;
>     }
> 
>     void mydraw(){
>         Uint8 R =255;
>         // SHOULD DRAW A RECT_OBJECT, BUT IT DOESN'T WORK!!
>         // WHY??
>         screen->DrawRectWH (10,10,100,100,R,R,R);
>         screen->Update();
You aren't missing a "screen->Show()", are you?

>     }
> };
> 
> // Eventhandler
>     // Button_step
>         PARAGUI_CALLBACK(step_handler) {
>             gol *app = (gol*) clientdata;
>             app->mydraw();
>             return true;
>         }
>   
> int main(int argc, char* argv[]) {
>     PG_Application app;
>     app.LoadTheme("default");
>     app.InitScreen(800, 600, 16, SDL_SWSURFACE);
>     app.SetEmergencyQuit(true);
>     // WIDGET TO DRAW IN. 
>         PG_Widget mywid(NULL,PG_Rect(10,35,600,360));
>     // gol
>         gol mygol;
>         mygol.screen = &mywid;
>     // Button start/stop
>         PG_Button B_start_stop(NULL, 1,PG_Rect(650, 35, 100, 30),"step");
>         B_start_stop.SetEventCallback(MSG_BUTTONCLICK, step_handler, &mygol);
>         B_start_stop.Show();
>         app.Run();
>         return 0;
> }
> <---------------------------------- code end>

Ulf

-- 
Never age. Never die. Live for ever in that one last white-hot moment, when the
crowd screamed. When every note was a heartbeat. Burn across the sky.
You will never grow old. They will never say you died.
(Soul Music)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]