paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/include pgattrib.h,NONE,1.1.2.1 pgapplication


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/include pgattrib.h,NONE,1.1.2.1 pgapplication.h,1.11.2.3,1.11.2.4 pgdraw.h,1.4.2.5,1.4.2.6 pggldraw.h,1.1.2.4,1.1.2.5
Date: Wed, 30 Oct 2002 04:16:32 -0500

Update of /cvsroot/paragui/paragui/include
In directory subversions:/tmp/cvs-serv26981/include

Modified Files:
      Tag: devel-opengl
        pgapplication.h pgdraw.h pggldraw.h 
Added Files:
      Tag: devel-opengl
        pgattrib.h 
Log Message:
Updating function names to be more consistent with ParaGUI
There's a persistant memory bug - somewhere - which is attempting to delete 
information already deleted.  Not all demos exhibit this, but paratest is 
amongst those that do.
Significant rewrite of most of OpenGL driver.  There's still more to be done 
and the driver as yet does not work correctly.  Any help would be quite 
appreciated but as I haven't received anything more than a couple comments yet 
I'm not holding my breath - T.


***** Error reading new file: [Errno 2] No such file or directory: 'pgattrib.h'
Index: pgapplication.h
===================================================================
RCS file: /cvsroot/paragui/paragui/include/pgapplication.h,v
retrieving revision 1.11.2.3
retrieving revision 1.11.2.4
diff -C2 -r1.11.2.3 -r1.11.2.4
*** pgapplication.h     31 Aug 2002 04:01:22 -0000      1.11.2.3
--- pgapplication.h     30 Oct 2002 09:16:28 -0000      1.11.2.4
***************
*** 279,283 ****
        static void SetBulkMode(bool bulk = true);
  
!       static bool GetGLMode();
  
        void EnableBackground(bool enable = true);
--- 279,283 ----
        static void SetBulkMode(bool bulk = true);
  
!       /* static bool GetGLMode(); -- no longer any way to test this */
  
        void EnableBackground(bool enable = true);
***************
*** 616,620 ****
  
        static bool bulkMode;
!       static bool glMode;
        static bool emergencyQuit;
        static bool enableBackground;
--- 616,620 ----
  
        static bool bulkMode;
!       /* static bool glMode; -- no longer any way to test this */
        static bool emergencyQuit;
        static bool enableBackground;

Index: pgdraw.h
===================================================================
RCS file: /cvsroot/paragui/paragui/include/pgdraw.h,v
retrieving revision 1.4.2.5
retrieving revision 1.4.2.6
diff -C2 -r1.4.2.5 -r1.4.2.6
*** pgdraw.h    24 Oct 2002 16:08:12 -0000      1.4.2.5
--- pgdraw.h    30 Oct 2002 09:16:28 -0000      1.4.2.6
***************
*** 29,32 ****
--- 29,40 ----
  /** \file pgdraw.h
        Header file for the PG_Draw namespace.
+       PG_Draw and PG_DrawableSurface decribe virtual base classes that
+       describe how to communicate with the videoscreen(s).
+ 
+       How these objects are implemented is up to the graphics driver.  All
+       must provide valid data unless otherwise noted.
+ 
+       Also - there are some useful prototypes provided that aren't specific
+       to videodriver.
  */
  
***************
*** 37,40 ****
--- 45,49 ----
  #include <vector>
  #include "pgrect.h"
+ #include "pgattrib.h"
  
  #include <ft2build.h>
***************
*** 68,245 ****
     class PG_DrawableSurface;
  
!    class PG_DrawableSurface {
!       friend class PG_Draw;
!     protected:
!       PG_Draw* creator;
!       PG_DrawableSurface();
!       PG_DrawableSurface(SDL_Surface*);
!     public:
!       virtual ~PG_DrawableSurface();
! 
!       virtual SDL_Surface* getScreen();
!       virtual Uint32 getWidth();
!       virtual Uint32 getHeight();
! 
!       /**
!       Update the surface; default is SDL_UpdateRects(..)
!       */
!       virtual void UpdateRects(int numrects, PG_Rect *rects);
!             
!       /**
!       Lock the surface; default is [if SDL_MUSTLOCK(surface) 
SDL_LockSurface(..)]
!       */
!       virtual int Lock();
!       /**
!       Unlock the surface; default is [if SDL_MUSTLOCK(surface) 
SDL_UnlockSurface(..)]
!       */
!       virtual void Unlock();
! 
!       /**
!       Set clipping rectangle; default is SDL_SetClipRect(..)
!        */
!       virtual bool SetClipRect(const PG_Rect& rect);
!       virtual bool SetClipRect();
! 
!       /**
!       Get clipping rectangle; default is SDL_GetClipRect(..)
!       */
!       virtual void GetClipRect(PG_Rect& rect);
! 
!       /**
!       Blit a surface to this surface (specifically); default is 
SDL_BlitSurface
!       with the destination being the current surface.
!       */
!       virtual void BlitSurface(const PG_DrawableSurface* srf_src, const 
PG_Rect& rect_src, const PG_Rect& rect_dst);
!       virtual void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst);
!       //! Scale and blit surface
!       /*!
!       Scales a 32 bit or 8 bit SDL_Surface to the size of the destination
!       surface dst and blits the result to the destination surface.  If the
!       surface is not 8bit or 32bit RGBA/ABGR it will be converted into a
!       32bit RGBA format on the fly.
!       Destination is <this> surface.
!       
!       \param src Source surface
        \param smooth whether or not to use anti-aliasing */
!       virtual void BlitScale(PG_DrawableSurface* src, bool smooth = true);
! 
!       /* from SDL_SetColors(..) (don't US know how to spell? It's 'colour'! */
!       virtual int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
!       virtual int SetPalette(int flags, SDL_Color *colors, int firstcolor, 
int ncolors);
!       virtual int SetColorKey(Uint32 flag, Uint32 key);
!       virtual int SetAlpha(Uint32 flag, Uint8 alpha);
!       virtual int FillRect(const PG_Rect& dstrect, Uint32 color);
!       /**
!       Draw a line.
!       @param x0 x startposition
!       @param y0 y startposition
!       @param x1 x endposition
!       @param y1 y endposition
!       @param color color of the line
!       @param width width of the line
! 
!       Draws a line with given color and width onto a surface.
!        */
!       virtual void DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const 
SDL_Color& color, Uint8 width = 1);
! 
!       /**
!       Set a pixel.
!       @param x      x position
!       @param y      y position
!       @param color  color of the pixel; using this for consistency
!       */
!       virtual void SetPixel(int x, int y, const SDL_Color& color);
! 
!       //! Rotate and scale an SDL_Surface
!       /*!
!       Rotates and scales a 32bit or 8bit SDL_Surface to newly created
!       destination surface. If smooth is 1 the destination 32bit surface is
!       anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will
!       be converted into a 32bit RGBA format on the fly.
!       Source surface is <this> object.
!       
!       \param angle the rotation in degrees
!       \param zoom the scaling factor
!       \param smooth whether or not to use anti-aliasing
!       
!       \return A new surface with the scaled, rotated original surface.
!       */
!       virtual PG_DrawableSurface* RotoScaleSurface(double angle, double zoom,
!                                                  bool smooth = true);
!       
!       //! Scale an SDL_Surface
!       /*!
!       Scales a 32bit or 8bit SDL_Surface to newly created destination
!       surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!       converted into a 32bit RGBA format on the fly.
!       Source surface is <this> object.
!       
!       \param zoomx, zoomy width and height scaling factors
!       \param smooth whether or not to enable anti-aliasing
!       
!       \return A newly created surface with the scaled surface
!       */
!       virtual PG_DrawableSurface* ScaleSurface(double zoomx, double zoomy,
!                                              bool smooth = true);
! 
!       //! Scale an SDL_Surface
!       /*!
!       Scales a 32bit or 8bit SDL_Surface to newly created destination
!       surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!       converted into a 32bit RGBA format on the fly.
!       Source surface is <this> object.
!       
!       \param rect PG_Rect specifying the width and height of the new surface
!       \param smooth whether or not to enable anti-aliasing
!       
!       \return A newly created surface with the scaled surface
!       */
!       PG_DrawableSurface* ScaleSurface(const PG_Rect &rect,
!                                      bool smooth = true);
!       
!       //! Scale an SDL_Surface
!       /*!
!       Scales a 32bit or 8bit SDL_Surface to newly created destination
!       surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!       converted into a 32bit RGBA format on the fly.
!       Source surface is <this> object.
        
!       \param newx, newy the width and height of the new surface
!       \param smooth whether or not to enable anti-aliasing
        
!       \return A newly created surface with the scaled surface
!       */
!       PG_DrawableSurface* ScaleSurface(Uint16 newx, Uint16 newy,
!                                      bool smooth = true);
! 
!       /**
!        */
!       virtual void DrawGradient(const PG_Rect& r, PG_Gradient& gradient);
!       
!       /**
!        */
!       virtual void DrawGradient(const PG_Rect& rect, const SDL_Color & ul, 
const SDL_Color & ur, const SDL_Color & dl, const SDL_Color & dr);
! 
!       /**
!        Draw a 'themed' surface onto this surface
!        
!        @param r               the rectangle of the surface to draw in
!        @param gradient        pointer to a gradient structure (may be NULL)
!        @param background      pointer to a background surface (may be NULL)
!        @param bkmode          the mode how to fill in the background surface 
(BKMODE_TILE | BKMODE_STRETCH)
!        @param blend           the blend-level between gradient an background
!       */
!       virtual void DrawThemedSurface(const PG_Rect& r, PG_Gradient* gradient, 
PG_DrawableSurface* background, int bkmode, Uint8 blend);
! 
!       virtual void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
! 
!       virtual bool BlitFTBitmap(FT_Bitmap *Bitmap, int PosX, int PosY, 
PG_Font* Param, PG_Rect *ClipRect);
!       virtual PG_Draw* getCreator() const { return creator; };
  
     protected:
!       SDL_Surface* ref;
     };
     
     class PG_Draw {
      public:
        static PG_Draw* GetDefaultDrawable();
--- 77,286 ----
     class PG_DrawableSurface;
  
!    class PG_DrawableSurface : public PG_AttribList {
!      friend class PG_Draw;
!    protected:
!      PG_Draw* creator;
!      PG_DrawableSurface();
!      PG_DrawableSurface(SDL_Surface*);
!    public:
!      virtual ~PG_DrawableSurface();
!      
!      virtual Uint32 GetWidth();
!      virtual Uint32 GetHeight();
!      virtual Uint32 GetDepth(); /* BitsPerPixel */
!      virtual SDL_PixelFormat* GetFormat();
!      virtual void*  GetPixels(); /* may return NULL - as a warning! */
!      virtual Uint32 GetPitch();  /* may return 0 - as a warning! */
!      
!      /**
!       Update the surface
!      */
!      virtual void UpdateRects(int numrects, PG_Rect *rects);
!      
!      /**
!       Lock the surface
!      */
!      virtual int Lock();
!      /**
!       Unlock the surface;
!      */
!      virtual void Unlock();
!      
!      /**
!       Set clipping rectangle
!      */
!      virtual bool SetClipRect(const PG_Rect& rect);
!      virtual bool SetClipRect();
!      
!      /**
!       Get clipping rectangle
!      */
!      virtual void GetClipRect(PG_Rect& rect);
! 
!      /**
!       Blit a surface to this surface (specifically); default is 
SDL_BlitSurface
!       with the destination being the current surface.
!      */
!      virtual void BlitSurface(const PG_DrawableSurface* srf_src, const 
PG_Rect& rect_src, const PG_Rect& rect_dst);
!      //! Scale and blit surface
!      /*!
!        Scales a 32 bit or 8 bit SDL_Surface to the size of the destination
!        surface dst and blits the result to the destination surface.  If the
!        surface is not 8bit or 32bit RGBA/ABGR it will be converted into a
!        32bit RGBA format on the fly.
!        Destination is <this> surface.
!        
!        \param src Source surface
        \param smooth whether or not to use anti-aliasing */
!      virtual void BlitScale(PG_DrawableSurface* src, bool smooth = true);
!      
!      /* from SDL_SetColors(..) (don't US know how to spell? It's 'colour'! */
!      virtual int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
!      virtual int SetPalette(int flags, SDL_Color *colors, int firstcolor, int 
ncolors);
!      virtual int SetColorKey(Uint32 flag, Uint32 key);
!      virtual int SetAlpha(Uint32 flag, Uint8 alpha);
!      virtual Uint32 MapRGB(Uint8 r, Uint8 g, Uint8 b);
!      virtual Uint32 MapRGBA(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
! 
!      /* Rendering Functions
!       *       -------------------
!       */
!      virtual int FillRect(const PG_Rect& dstrect, Uint32 color);
! 
!      /**
!       Draw a line.
!       @param x0 x startposition
!       @param y0 y startposition
!       @param x1 x endposition
!       @param y1 y endposition
!       @param color color of the line
!       @param width width of the line
        
!       Draws a line with given color and width onto a surface.
!      */
!      virtual void DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const 
SDL_Color& color, Uint8 width = 1);
!      
!      /**
!       Set a pixel.
!       @param x      x position
!       @param y      y position
!       @param color  color of the pixel; using this for consistency
!      */
!      virtual void SetPixel(int x, int y, const SDL_Color& color);
!      
!      //! Rotate and scale a surface
!      /*!
!        Rotates and scales a 32bit or 8bit surface to newly created
!        destination surface. If smooth is 1 the destination 32bit surface is
!        anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will
!        be converted into a 32bit RGBA format on the fly.
!        Source surface is <this> object.
!        
!        \param angle the rotation in degrees
!        \param zoom the scaling factor
!        \param smooth whether or not to use anti-aliasing
!        
!        \return A new surface with the scaled, rotated original surface.
!      */
!      virtual PG_DrawableSurface* RotoScaleSurface(double angle, double zoom,
!                                                 bool smooth = true);
!      
!      //! Scale a surface
!      /*!
!        Scales a 32bit or 8bit surface to newly created destination
!        surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!        converted into a 32bit RGBA format on the fly.
!        Source surface is <this> object.
!        
!        \param zoomx, zoomy width and height scaling factors
!        \param smooth whether or not to enable anti-aliasing
!        
!        \return A newly created surface with the scaled surface
!      */
!      virtual PG_DrawableSurface* ScaleSurface(double zoomx, double zoomy,
!                                             bool smooth = true);
!      
!      //! Scale a surface
!      /*!
!        Scales a 32bit or 8bit surface to newly created destination
!        surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!        converted into a 32bit RGBA format on the fly.
!        Source surface is <this> object.
!        
!        \param rect PG_Rect specifying the width and height of the new surface
!        \param smooth whether or not to enable anti-aliasing
!        
!        \return A newly created surface with the scaled surface
!      */
!      PG_DrawableSurface* ScaleSurface(const PG_Rect &rect,
!                                     bool smooth = true);
!      
!      //! Scale an SDL_Surface
!      /*!
!        Scales a 32bit or 8bit SDL_Surface to newly created destination
!        surface.  If the surface is not 8bit or 32bit RGBA/ABGR it will be
!        converted into a 32bit RGBA format on the fly.
!        Source surface is <this> object.
!        
!        \param newx, newy the width and height of the new surface
!        \param smooth whether or not to enable anti-aliasing
!        
!        \return A newly created surface with the scaled surface
!      */
!      PG_DrawableSurface* ScaleSurface(Uint16 newx, Uint16 newy,
!                                     bool smooth = true);
!      
!      /**
!       */
!      virtual void DrawGradient(const PG_Rect& r, PG_Gradient& gradient);
!      
!      /**
!       */
!      virtual void DrawGradient(const PG_Rect& rect, const SDL_Color & ul, 
const SDL_Color & ur, const SDL_Color & dl, const SDL_Color & dr);
!      
!      /**
!       Draw a 'themed' surface onto this surface
        
!       @param r                the rectangle of the surface to draw in
!       @param gradient pointer to a gradient structure (may be NULL)
!       @param background       pointer to a background surface (may be NULL)
!       @param bkmode           the mode how to fill in the background surface 
(BKMODE_TILE | BKMODE_STRETCH)
!       @param blend            the blend-level between gradient an background
!      */
!      virtual void DrawThemedSurface(const PG_Rect& r, PG_Gradient* gradient, 
PG_DrawableSurface* background, int bkmode, Uint8 blend);
!      
!      virtual void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
!      
!      virtual bool BlitFTBitmap(FT_Bitmap *Bitmap, int PosX, int PosY, 
PG_Font* Param, PG_Rect *ClipRect);
!      virtual PG_Draw* GetCreator() const { return creator; };
!      
!      virtual int GetAttrOffset(std::string name);
!      virtual std::string GetAttribute(int offset);
!      virtual bool validAttribute(int offset);
!      virtual bool setAttribute(int offset, std::string data);
!      /* local attributes:
!       * name    format                meaning
!       * ------  --------------------  --------------
!       * pixels  void*                 pixel data    (this calls GetPixels())
!       * width   int                   screen width  (this calls GetWidth())
!       * height  int                   screen height (this calls GetHeight())
!       * depth   int                   screen depth  (this calls GetDepth())
!       * format  SDL_PixelFormat*      pixel format  (this calls GetFormat())
!       * SDL     SDL_Surface*          used to be "GetScreen()"
!       */
! 
!      /* SDL-specific calls
!       * ------------------
!       */
!      Uint32 GetSDLFlags();
!      virtual SDL_Surface* SDL();
!      void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
  
     protected:
!      SDL_Surface* ref;
     };
     
     class PG_Draw {
+       friend class PG_DrawableSurface;
      public:
        static PG_Draw* GetDefaultDrawable();
***************
*** 247,251 ****
        PG_Draw();
        virtual ~PG_Draw();
!       virtual std::string getName() const { return "SDL"; };
  
        /**
--- 288,292 ----
        PG_Draw();
        virtual ~PG_Draw();
!       virtual std::string GetName() const { return "SDL"; };
  
        /**
***************
*** 287,290 ****
--- 328,332 ----
        /**
         Convert a surface to be native to this drawing engine
+        FIXME currently broken
        */
        virtual PG_DrawableSurface* MakeNative(PG_DrawableSurface*);
***************
*** 292,295 ****
--- 334,338 ----
        /**
         Convert all attached surfaces to be native to this drawing engine
+        FIXME currently broken
        */
        virtual bool ConvertAllNative(PG_Draw*);
***************
*** 394,397 ****
--- 437,446 ----
  
        /**
+       Creates a PG_DrawableSurface matching current display settings from a
+       surface; calls AccelDrawableSurface(..) by default.
+       */
+       virtual PG_DrawableSurface* AccelerateSurface(PG_DrawableSurface* srf);
+ 
+       /**
        Creates a surface filled with a gradient
  
***************
*** 427,431 ****
        virtual Uint8 GetRelativeMouseState(int *x, int *y);
        virtual void  WarpMouse(Uint16 x, Uint16 y);
!       /* ParaGUI uses a different mouse cursor... */
        /* SDL_Cursor * CreateCursor(Uint8 *data, Uint8 *mask, int w, int h, 
int hot_x, int hot_y); */
        /* void SetCursor(SDL_Cursor *cursor); */
--- 476,481 ----
        virtual Uint8 GetRelativeMouseState(int *x, int *y);
        virtual void  WarpMouse(Uint16 x, Uint16 y);
!       void SetCursor(PG_DrawableSurface* cursor);
!       /* ParaGUI uses a different mouse cursor... or will... */
        /* SDL_Cursor * CreateCursor(Uint8 *data, Uint8 *mask, int w, int h, 
int hot_x, int hot_y); */
        /* void SetCursor(SDL_Cursor *cursor); */
***************
*** 434,438 ****
        int ShowCursor(int toggle);
  
!     protected:
        Uint32 flags;
        static PG_Draw* defaultdraw;
--- 484,491 ----
        int ShowCursor(int toggle);
  
!       virtual int SetIcon(PG_DrawableSurface* icon);
!       /* return 0 on success else <0 */
! 
!    protected:
        Uint32 flags;
        static PG_Draw* defaultdraw;
***************
*** 447,456 ****
     };
  
!    inline SDL_Surface* PG_DrawableSurface::getScreen() {
!      return ref;
!    };
! 
!    inline Uint32 PG_DrawableSurface::getWidth()  { return ref->w; };
!    inline Uint32 PG_DrawableSurface::getHeight() { return ref->h; };
  
     inline PG_DrawableSurface*
--- 500,511 ----
     };
  
!    inline Uint32 PG_DrawableSurface::GetWidth()  { return ref->w; };
!    inline Uint32 PG_DrawableSurface::GetHeight() { return ref->h; };
!    inline Uint32 PG_DrawableSurface::GetDepth() { return 
ref->format->BitsPerPixel; };
!    inline SDL_PixelFormat* PG_DrawableSurface::GetFormat() { return 
ref->format; };
!    inline void* PG_DrawableSurface::GetPixels() { return ref->pixels; };
!    inline Uint32 PG_DrawableSurface::GetPitch() { return ref->pitch; };
!    inline Uint32 PG_DrawableSurface::GetSDLFlags() { return ref->flags; };
!    inline SDL_Surface* PG_DrawableSurface::SDL() { return ref; };
  
     inline PG_DrawableSurface*

Index: pggldraw.h
===================================================================
RCS file: /cvsroot/paragui/paragui/include/Attic/pggldraw.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** pggldraw.h  24 Oct 2002 16:08:12 -0000      1.1.2.4
--- pggldraw.h  30 Oct 2002 09:16:28 -0000      1.1.2.5
***************
*** 89,93 ****
  typedef struct glSDL_TexInfo *pglSDL_TexInfo;
  
- 
  /*
   * Uuurgh! SDL doesn't clear the 'unused1' field.
--- 89,92 ----
***************
*** 96,104 ****
  
  class PG_GLDraw;
! /* preliminary test object */
  class PG_GLDrawableSurface : public PG_DrawableSurface {
     friend class PG_GLDraw;
- private:
-    bool glactive;
  protected:
     PG_GLDrawableSurface();
--- 95,106 ----
  
  class PG_GLDraw;
! /* OpenGL drawing context
!    ----------------------
!    This object describes a surface visible within an OpenGL screen - basically
!    a texture.  While it's intended use is as a window within the renderer,
!    this object can be used independantly as a texture in 3D rendering.
!  */
  class PG_GLDrawableSurface : public PG_DrawableSurface {
     friend class PG_GLDraw;
  protected:
     PG_GLDrawableSurface();
***************
*** 107,111 ****
  public:
     PG_GLDrawableSurface(PG_GLDraw*, SDL_Surface*);
!    virtual ~PG_GLDrawableSurface();
  
     int Lock();
--- 109,126 ----
  public:
     PG_GLDrawableSurface(PG_GLDraw*, SDL_Surface*);
!    ~PG_GLDrawableSurface();
! 
!    Uint32 GetWidth();
!    Uint32 GetHeight();
!    Uint32 GetDepth(); /* BitsPerPixel */
!    SDL_PixelFormat* GetFormat();
!    void*  GetPixels(); /* may return NULL - as a warning! */
!    Uint32 GetPitch();  /* may return 0 - as a warning! */
! 
!    /* SDL references */
!    Uint32 GetSDLFlags();
!    SDL_Surface* SDL();
!    /* since the surface-reference version calls this, .... */
!    void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
  
     int Lock();
***************
*** 114,118 ****
     int SetColorKey(Uint32 flag, Uint32 key);
     bool SetClipRect(const PG_Rect& rect);
-    void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
     int FillRect(const PG_Rect& dstrect, Uint32 color);
     void DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const SDL_Color& 
color, Uint8 width = 1);
--- 129,132 ----
***************
*** 121,128 ****
     void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
  
-    SDL_Surface* getScreen();
     void GetClipRect(PG_Rect& rect);
     void BlitScale(PG_DrawableSurface* src, bool smooth = true);
-    /* from SDL_SetColors(..) (don't US know how to spell? It's 'colour'! */
     int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
     int SetPalette(int flags, SDL_Color *colors, int firstcolor, int ncolors);
--- 135,141 ----
     void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
  
     void GetClipRect(PG_Rect& rect);
+    void BlitSurface(const PG_DrawableSurface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst);
     void BlitScale(PG_DrawableSurface* src, bool smooth = true);
     int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
     int SetPalette(int flags, SDL_Color *colors, int firstcolor, int ncolors);
***************
*** 142,254 ****
     glSDL_TexInfo *GetTexInfo();
  
!    bool is_GL() { return glactive; };
!    
! protected:
     PG_GLDraw* host;
     int scale;
  };
  
! class PG_GLDraw : public PG_Draw {
!       friend class PG_GLDrawableSurface;
  public:
!       PG_GLDraw();
!       virtual ~PG_GLDraw();
!       void init(Uint32 flags);
!       void quit();
!       virtual std::string getName() const { return "OpenGL"; };
!       int attach(PG_DrawableSurface*);
!       int detach(PG_DrawableSurface*);
! 
!       PG_DrawableSurface* SetMode(int width, int height, int depth, Uint32 
flags);
!       void UpdateRects(int numrects, PG_Rect *rects);
!       int Flip();
!       PG_DrawableSurface* AccelDrawableSurface(SDL_Surface* src, bool 
hasalpha=false);
!       PG_DrawableSurface* CreateSDLSurface(SDL_Surface*);
!       PG_DrawableSurface*
!       CreateDrawableSurface(Uint32 flags,int width, int height, int depth=0,
!                             Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, 
Uint32 Amask=0);
  
!       PG_DrawableSurface* CreateDrawableSurface(int width, int height);
!       PG_DrawableSurface*
!       CreateDrawableSurfaceFrom(void* pixels,
!                                 int width, int height, int depth=0, int 
pitch=0,
!                                 Uint32 Rmask=0, Uint32 Gmask=0, Uint32 
Bmask=0, Uint32 Amask=0);
!       PG_DrawableSurface* CopyDrawableSurface(SDL_Surface* src);
! 
!       /* new functions */
!       glSDL_TexInfo *GetTexInfo(SDL_Surface *surface);
!       glSDL_TexInfo *AllocTexInfo(SDL_Surface *surface);
!       void FreeTexInfo(SDL_Surface *surface);
!       int AddTexInfo(SDL_Surface *surface);
!       int  DownloadSurface(SDL_Surface *surface);
!       void UnloadSurface(SDL_Surface *surface);
! 
!       bool is_GL();
! 
! private:
!       void _FreeTexInfo(Uint32 handle);
!       void _KillAllTextures(void);
!       int _CalcChop(glSDL_TexInfo *txi);
!       SDL_Surface *_CreateRGBSurface(int w, int h);
!       SDL_Surface *_CreateRGBASurface(int w, int h);
!       void PG_GLDraw::_FreeSurface(SDL_Surface *);
!       void _init_formats(void);
!       int _FormatIsOk(SDL_Surface *surface);
!       void gl_reset(void);
!       void gl_do_blend(int on);
!       void gl_do_texture(int on);
!       void gl_blendfunc(GLenum sfactor, GLenum dfactor);
!       void gl_texture(GLuint tx);
!       void _BlitGL_single(glSDL_TexInfo *txi,
!                         float x1, float y1, float x2, float y2,
!                         int dx1, int dy1, int dx2, int dy2,
!                         unsigned char alpha, float texscale);
!       void _BlitGL_htile(glSDL_TexInfo *txi,
!                        float x1, float y1, float x2, float y2,
!                        int dx1, int dy1, int dx2, int dy2,
!                        unsigned char alpha, float texscale);
!       void _BlitGL_vtile(glSDL_TexInfo *txi,
!                        float x1, float y1, float x2, float y2,
!                        int dx1, int dy1, int dx2, int dy2,
!                        unsigned char alpha, float texscale);
!       int _BlitGL(SDL_Surface *src, SDL_Rect *srcrect,
!                 SDL_Surface *dst, SDL_Rect *dstrect);
!       int  _DownloadTexture(SDL_Surface *datasurf, glSDL_TexInfo *txi, int 
tex);
!       void _UnloadTexture(glSDL_TexInfo *txi);
! 
!       GLint maxtexsize;
!       int update_screen;
!       SDL_PixelFormat _RGBfmt, _RGBAfmt;
!       pglSDL_TexInfo* texinfotab;
! 
!       SDL_Surface *fake_screen;
!       PG_GLDrawableSurface* realscreen;
!       PG_DrawableSurface* my_charSurface;
! 
!       struct
!       {
!       int     do_blend;
!       int     do_texture;
!       GLuint  texture;
!       GLenum  sfactor, dfactor;
!       } glstate;
  
  #if 0
!       virtual void preinit() {};
!       virtual void prerm() {};
!       virtual void postrm() {};
! 
!       const SDL_VideoInfo* GetVideoInfo() const;
!       int VerifyMode(int width, int height, int depth, Uint32 flags);
!       SDL_Rect ** ListModes(SDL_PixelFormat *format, Uint32 flags);
!       int Lock();
!       void Unlock();
!       bool SetClipRect(const PG_Rect& rect = PG_Rect());
!       void GetClipRect(PG_Rect& rect);
!       void BlitSurface(const PG_DrawableSurface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst);
!       void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
!       PG_DrawableSurface* CreateGradient(const PG_Rect& r, PG_Gradient& 
gradient);
!       PG_DrawableSurface*  CreateGradient(const PG_Rect& r, SDL_Color & ul, 
SDL_Color & ur, SDL_Color & dl, SDL_Color & dr);
!       PG_DrawableSurface* GetVideoSurface();
  #endif
  };
--- 155,336 ----
     glSDL_TexInfo *GetTexInfo();
  
!    /* for glTex<...> replace -- glBindTexture + make sure textures active...
!       so that these draw surfaces can be used in 3D rendering */
!    void TextureRef();
! 
!  protected:
     PG_GLDraw* host;
     int scale;
  };
  
! /* as the OpenGL root object does NOT have access to pixel data in any
!    shape or form, a custom object exists to specifically speak with the
!    OpenGL rendering engine directly.  Public access is being provided as it
!    adds some additional drawing commands that aren't available in the
!    standard drawable surface.
! 
!    Just to make this clear - "getPixels()" WILL return NULL in this object.
! */
! class PG_GLRootDrawableSurface : public PG_DrawableSurface {
!    friend class PG_GLDraw;
! protected:
!    PG_GLRootDrawableSurface();
  public:
!    ~PG_GLRootDrawableSurface();
  
!    Uint32 GetWidth();
!    Uint32 GetHeight();
!    Uint32 GetDepth(); /* BitsPerPixel */
!    SDL_PixelFormat* GetFormat();
!    void*  GetPixels(); /* returns NULL.  This just isn't accessable. */
!    Uint32 GetPitch();  /* returns 0.  Again not accessable */
! 
!    /* SDL references */
!    Uint32 GetSDLFlags();
!    SDL_Surface* SDL();  /* also returns NULL... */
!    /* since the surface-reference version calls this, .... */
!    void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
! 
!    /* access routines */
!    int Lock();
!    void Unlock();
  
+    /* lowlevel update functions */
+    void UpdateRects(int numrects, PG_Rect *rects);
+    void Invalidate(const PG_Rect& area);
+    void SetLogicSize(int w, int h);
+ 
+    /* state functions */
+    int SetColorKey(Uint32 flag, Uint32 key);
+    bool SetClipRect(const PG_Rect& rect);
+    void GetClipRect(PG_Rect& rect);
+    int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
+    int SetPalette(int flags, SDL_Color *colors, int firstcolor, int ncolors);
+    int SetAlpha(Uint32 flag, Uint8 alpha);
+ 
+    /* drawing functions */
+    void SetPixel(int x, int y, const SDL_Color& color);
+    void DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const SDL_Color& 
color, Uint8 width = 1);
+    int FillRect(const PG_Rect& dstrect, Uint32 color);
+ 
+    /* surface rendering (texturing) */
+    void BlitSurface(const PG_DrawableSurface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst);
+    void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
+    void BlitScale(PG_DrawableSurface* src, bool smooth = true);
+ 
+    /* meta-drawing - special case drawing functions */
+    void DrawGradient(const PG_Rect& r, PG_Gradient& gradient);
+    void DrawGradient(const PG_Rect& rect, const SDL_Color & ul, const 
SDL_Color & ur, const SDL_Color & dl, const SDL_Color & dr);
+    bool BlitFTBitmap(FT_Bitmap *Bitmap, int PosX, int PosY, PG_Font* Param, 
PG_Rect *ClipRect);
+    void DrawThemedSurface(const PG_Rect& r, PG_Gradient* gradient, 
PG_DrawableSurface* background, int bkmode, Uint8 blend);
+ 
+    /* these don't apply to this object so return NULL */
+    PG_DrawableSurface* RotoScaleSurface(double angle, double zoom, bool 
smooth = true);
+    PG_DrawableSurface* ScaleSurface(double zoomx, double zoomy, bool smooth = 
true);
+  protected:
+    PG_GLDraw* host;
+    int scale;
+ };
+ 
+ class PG_GLDraw : public PG_Draw {
+   friend class PG_GLDrawableSurface;
+   friend class PG_GLRootDrawableSurface;
+  public:
+   PG_GLDraw();
+   ~PG_GLDraw();
+   void init(Uint32 flags);
+   void quit();
+   virtual std::string GetName() const { return "OpenGL"; };
+   int attach(PG_DrawableSurface*);
+   int detach(PG_DrawableSurface*);
+   
+   PG_DrawableSurface* SetMode(int width, int height, int depth, Uint32 flags);
+   void UpdateRects(int numrects, PG_Rect *rects);
+   int Flip();
+   PG_DrawableSurface* AccelDrawableSurface(SDL_Surface* src, bool 
hasalpha=false);
+   PG_DrawableSurface* CreateSDLSurface(SDL_Surface*);
+   PG_DrawableSurface*
+     CreateDrawableSurface(Uint32 flags,int width, int height, int depth=0,
+                         Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, 
Uint32 Amask=0);
+   
+   PG_DrawableSurface* CreateDrawableSurface(int width, int height);
+   PG_DrawableSurface*
+     CreateDrawableSurfaceFrom(void* pixels,
+                             int width, int height, int depth=0, int pitch=0,
+                             Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, 
Uint32 Amask=0);
+   PG_DrawableSurface* CopyDrawableSurface(SDL_Surface* src);
+   
+   /* new functions */
+   glSDL_TexInfo *GetTexInfo(SDL_Surface *surface);
+   glSDL_TexInfo *AllocTexInfo(SDL_Surface *surface);
+   void FreeTexInfo(SDL_Surface *surface);
+   int AddTexInfo(SDL_Surface *surface);
+   int  DownloadSurface(SDL_Surface *surface);
+   void UnloadSurface(SDL_Surface *surface);
+ 
+  private:
+   void _FreeTexInfo(Uint32 handle);
+   void _KillAllTextures(void);
+   int _CalcChop(glSDL_TexInfo *txi);
+   SDL_Surface *_CreateRGBSurface(int w, int h);
+   SDL_Surface *_CreateRGBASurface(int w, int h);
+   void PG_GLDraw::_FreeSurface(SDL_Surface *);
+   void _init_formats(void);
+   int _FormatIsOk(SDL_Surface *surface);
+   void gl_reset(void);
+   void gl_do_blend(int on);
+   void gl_do_texture(int on);
+   void gl_blendfunc(GLenum sfactor, GLenum dfactor);
+   void gl_texture(GLuint tx);
+   void _BlitGL_single(glSDL_TexInfo *txi,
+                     float x1, float y1, float x2, float y2,
+                     int dx1, int dy1, int dx2, int dy2,
+                     unsigned char alpha, float texscale);
+   void _BlitGL_htile(glSDL_TexInfo *txi,
+                    float x1, float y1, float x2, float y2,
+                    int dx1, int dy1, int dx2, int dy2,
+                    unsigned char alpha, float texscale);
+   void _BlitGL_vtile(glSDL_TexInfo *txi,
+                    float x1, float y1, float x2, float y2,
+                    int dx1, int dy1, int dx2, int dy2,
+                    unsigned char alpha, float texscale);
+   int _BlitGL(SDL_Surface *src, SDL_Rect *srcrect,
+             SDL_Surface *dst, SDL_Rect *dstrect);
+   int  _DownloadTexture(SDL_Surface *datasurf, glSDL_TexInfo *txi, int tex);
+   void _UnloadTexture(glSDL_TexInfo *txi);
+   
+   GLint maxtexsize;
+   int update_screen;
+   SDL_PixelFormat _RGBfmt, _RGBAfmt;
+   pglSDL_TexInfo* texinfotab;
+   
+   PG_GLRootDrawableSurface* realscreen;
+   PG_DrawableSurface* my_charSurface;
+   
+   struct
+   {
+     int       do_blend;
+     int       do_texture;
+     GLuint    texture;
+     GLenum    sfactor, dfactor;
+   } glstate;
+   
  #if 0
!   void preinit() {};
!   void prerm() {};
!   void postrm() {};
!   
!   const SDL_VideoInfo* GetVideoInfo() const;
!   int VerifyMode(int width, int height, int depth, Uint32 flags);
!   SDL_Rect ** ListModes(SDL_PixelFormat *format, Uint32 flags);
!   int Lock();
!   void Unlock();
!   bool SetClipRect(const PG_Rect& rect = PG_Rect());
!   void GetClipRect(PG_Rect& rect);
!   void BlitSurface(const PG_DrawableSurface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst);
!   void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, const 
PG_Rect& rect_dst);
!   PG_DrawableSurface* CreateGradient(const PG_Rect& r, PG_Gradient& gradient);
!   PG_DrawableSurface*  CreateGradient(const PG_Rect& r, SDL_Color & ul, 
SDL_Color & ur, SDL_Color & dl, SDL_Color & dr);
!   PG_DrawableSurface* GetVideoSurface();
  #endif
  };





reply via email to

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