In file libs/cs2d/glide2common/glide2common2d.h:

class csGraphics2DGlideCommon : public csGraphics2D

Basic OpenGL version of the 2D driver class You can look at the openGLX graphics class as an example of how to inherit and use this class

Inheritance:


Public Fields

ISystem* System
local copy of System interface for CsPrintf

Public Methods

csGraphics2DGlideCommon(ISystem* piSystem)
constructor initializes System member
virtual void DrawLine(int x1, int y1, int x2, int y2, int color)
Draw a line
static void DrawPixelGlide(int x, int y, int color)
Draw a pixel
static void DrawSpriteGlide(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
Draw a 2D sprite
static unsigned char* GetPixelAtGlide(int x, int y)
Get address of video RAM at given x,y coordinates
virtual void Initialize()
Figure out draw functions
virtual bool Open(char *Title)
initialize fonts, texture cache, prints renderer name and version
static void WriteCharGlide(int x, int y, int fg, int bg, char c)
Write a single character
virtual ~csGraphics2DGlideCommon()
Destructor deletes texture_cache and LocalFontServer

Public

Figure out GL RGB color from a packed color format
hold the CS fonts in an OpenGL-friendly format

Protected Fields

bool bPaletteChanged
palette has been changed
static bool locked
flag to prevent 2D drawing
bool m_DoGlideInWindow
flag to indicate whether to draw fullscreen or not.

Protected

my own private texture cache--for 2D sprites!

Inherited from csGraphics2D:

Public Fields

static int Font
static bool FullScreen
static RGBpaletteEntry Palette[256]
static bool PaletteAlloc[256]
static int Width

Public Methods

static void (*DrawPixel)(int x, int y, int color)
static void (*DrawSprite)(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
static unsigned char* (*GetPixelAt)(int x, int y)
static void (*WriteChar)(int x, int y, int fg, int bg, char c)
virtual bool BeginDraw()
virtual void Clear(int color)
void ClearAll(int color)
static bool ClipLine(float &x1, float &y1, float &x2, float &y2, int xmin, int ymin, int xmax, int ymax)
virtual void Close()
virtual bool DoubleBuffer()
virtual bool DoubleBuffer(bool Enable)
virtual void DrawBox(int x, int y, int w, int h, int color)
static void DrawPixel8(int x, int y, int color)
virtual void FinishDraw()
virtual void FreeArea(ImageArea *Area)
virtual void GetClipRect(int &xmin, int &ymin, int &xmax, int &ymax)
int GetNumPalEntries()
virtual int GetPage()
int GetPixelBytes()
csPixelFormat* GetPixelFormat()
virtual void GetStringError(HRESULT hRes, char* szValue)
virtual int GetTextHeight(int Font)
virtual int GetTextWidth(int Font, char *text)
virtual bool PerformExtension(char* args)
virtual void Print(csRect *area = NULL)
virtual void RestoreArea(ImageArea *Area, bool Free = true)
virtual bool SaveArea(ImageArea *&Area, int x, int y, int w, int h)
virtual void SetClipRect(int xmin, int ymin, int xmax, int ymax)
virtual bool SetMouseCursor(int iShape, ITextureHandle *hBitmap)
virtual bool SetMousePosition(int x, int y)
virtual void SetRGB(int i, int r, int g, int b)
void SysPrintf(int mode, char* text, ...)
virtual void Write(int x, int y, int fg, int bg, char *text)

Protected Fields

static int ClipX1
static int* LineAddress
static unsigned char* Memory
static csPixelFormat pfmt
static ISystem* system

Protected Methods

void complete_pixel_format()
static void DrawPixel16(int x, int y, int color)
static void DrawPixel32(int x, int y, int color)
static void DrawSprite16(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
static void DrawSprite32(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
static void DrawSprite8(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
static unsigned char* GetPixelAt16(int x, int y)
static unsigned char* GetPixelAt32(int x, int y)
static unsigned char* GetPixelAt8(int x, int y)
static void WriteChar16(int x, int y, int fg, int bg, char c)
static void WriteChar32(int x, int y, int fg, int bg, char c)
static void WriteChar8(int x, int y, int fg, int bg, char c)

Documentation

Basic OpenGL version of the 2D driver class You can look at the openGLX graphics class as an example of how to inherit and use this class. In short, inherit from this common class instead of from csGraphics2D, and override all the functions you normally would except for the 2D drawing functions, which are supplied for you here. That way all OpenGL drawing functions are unified over platforms, so that a fix or improvement will be inherited by all platforms instead of percolating via people copying code over. -GJH
bool m_DoGlideInWindow
flag to indicate whether to draw fullscreen or not.

bool bPaletteChanged
palette has been changed

static bool locked
flag to prevent 2D drawing

my own private texture cache--for 2D sprites!

hold the CS fonts in an OpenGL-friendly format

ISystem* System
local copy of System interface for CsPrintf

csGraphics2DGlideCommon(ISystem* piSystem)
constructor initializes System member.. LocalFontServer and texture_cache are initialized in Open()

virtual ~csGraphics2DGlideCommon()
Destructor deletes texture_cache and LocalFontServer

virtual void Initialize()
Figure out draw functions...little else done here, most of the work is done in Open()

virtual bool Open(char *Title)
initialize fonts, texture cache, prints renderer name and version. you should still print out the 2D driver type (X, Win, etc.) in your subclass code. Note that the Open() method makes some OpenGL calls, so your GL context should already be created and bound before you call csGraphics2DGlideCommon::Open()! This means you may or may not be calling this method at the beginning of your own class Open(), since the GL context may not have been bound yet... check the GLX class for an example

virtual void DrawLine(int x1, int y1, int x2, int y2, int color)
Draw a line

static void DrawPixelGlide(int x, int y, int color)
Draw a pixel

static void WriteCharGlide(int x, int y, int fg, int bg, char c)
Write a single character

static void DrawSpriteGlide(ITextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th)
Draw a 2D sprite

Figure out GL RGB color from a packed color format

static unsigned char* GetPixelAtGlide(int x, int y)
Get address of video RAM at given x,y coordinates. The Glide version of this function just returns NULL.


Direct child classes:
csGraphics2DBeGlide

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de