[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] draw an object on screen - HOW?
From: |
Alexander Pipelka |
Subject: |
Re: [paragui-users] draw an object on screen - HOW? |
Date: |
30 Jun 2003 09:21:43 +0200 |
All drawing operations for your widget should be done in "eventBlit".
Just override the virtual eventBlit function. Everything else should
happen automatically.
Alex
Am Mon, 2003-06-30 um 09.01 schrieb Michael Lüftenegger:
> Hi,
>
> thanks for your answer, but it doesn't work, i tried it. I have no idea why?
>
> misch
>
>
> ----- Original Message -----
> From: "Ulf Lorenz" <address@hidden>
> To: <address@hidden>
> Sent: Sunday, June 29, 2003 10:14 PM
> Subject: Re: [paragui-users] draw an object on screen - HOW?
>
>
> 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