paragui-users
[Top][All Lists]
Advanced

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

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


From: Michael Lüftenegger
Subject: [paragui-users] draw an object on screen - HOW?
Date: Fri, 27 Jun 2003 23:12:39 +0200

Hi,
 
i need you help. i wrote a small app, that doesn't work correctly. There is a butten which executes the mydrawmethode of the golobject. The golobject has a pointer to a widgetobject in which it schould draw. But nothing is shown on screen. I don't know what's wrong, please help!!
 
 
misch
 
<---------------------------------- 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();
    }
};
 
// 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>

reply via email to

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