00001 /* 00002 $Id: displaycard.h,v 1.2 2001/03/15 12:14:46 mbn Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00016 00017 #ifndef header_displaycard 00018 #define header_displaycard 00019 00020 #include <list> 00021 #include <string> 00022 00023 class CL_VidMode; 00024 class CL_Palette; 00025 class CL_Target; 00026 class CL_Rect; 00027 00028 #include "cliprect.h" 00029 #include "../../signals.h" 00030 00031 class CL_InputSourceProvider; 00032 class CL_DisplayCard 00033 //: The display card class. 00034 // <p>This class represents a display card in ClanLib. It is mainly used to 00035 // set the videomode, flip the display and do simple graphics operations 00036 // such as filled rectangles or drawing lines.</p> 00037 // 00038 // <p>If you're always only using one display card at the time, you may want 00039 // to consider using the static functions in CL_Display instead. They do 00040 // exactly the same, but operates on a selected display card instead 00041 // (default the primary card). This saves you from passing around a pointer 00042 // to the displaycard.</p> 00043 { 00044 public: 00045 virtual const std::list<CL_VidMode*> &get_videomodes()=0; 00046 //: Get list of videomodes available on this card. 00048 00049 virtual std::string get_name()=0; 00050 //: Get name of the card. 00052 00053 virtual int get_total_memory()=0; 00054 //: Get videomemory available. 00056 00057 virtual int get_card_no()=0; 00058 //: Get card number. 00060 00061 virtual ~CL_DisplayCard() { ; } 00062 00063 virtual void flip_display(bool sync=false)=0; 00064 //: Flips the front and backbuffer. Everything is normally drawn to the 00065 //: backbuffer, and flip_display() needs to be called before it can be seen 00066 //: onto the screen. 00068 00069 virtual void put_display(const class CL_Rect &rect)=0; 00070 //: Copies the specified area of the backbuffer to the front buffer. This is 00071 //: in particular useful if you only want to update a limited region, and not 00072 //: do a full-blown flipping. 00073 00074 virtual void sync_buffers()=0; 00075 //: Copies the contents of the frontbuffer to all other buffers (usually just 00076 //: the backbuffer). This ensures that all buffers contain the same image. 00077 00078 virtual void clear_display(float red=0, float green=0, float blue=0, float alpha=1)=0; 00079 //: Clears backbuffer with the specified color. 00084 00085 virtual void set_palette(CL_Palette *palette)=0; 00086 //: Set system palette on this card. 00087 //: <br> 00088 //: If the display card is in a non-palettelized mode, this will be the palette 00089 //: used when surfaceproviders doesn't specify a palette themself. 00091 00092 virtual CL_Palette *get_palette()=0; 00093 //: Return the current system palette on this card. 00095 00096 virtual void set_videomode(CL_VidMode *mode); 00097 //: Change the display card's video mode. 00099 00100 virtual void set_videomode( 00101 int width, 00102 int height, 00103 int bpp, 00104 bool fullscreen = true, 00105 bool allow_resize = false, 00106 bool video_memory = true)=0; 00107 //: Change the display card's video mode. 00112 00113 virtual bool is_initialized()=0; 00114 //: Returns true if the display card is in a video mode. 00116 00117 virtual CL_Target* get_target()=0; 00118 //: Return either NULL or the Target that is blitted to (aka Framebuffer) 00119 //:!retval: NULL if Framebuffer access is not possible, CL_Target if it is 00120 00121 virtual int get_width()=0; 00122 //: Returns the width of the current video mode. 00124 00125 virtual int get_height()=0; 00126 //: Returns the height of the current video mode. 00128 00129 virtual int get_bpp()=0; 00130 //: Returns the depth of the current video mode. 00132 00133 virtual void push_clip_rect()=0; 00134 //: Pushes the current clipping rectangle onto the cliprect stack. 00135 00136 virtual void push_clip_rect(const CL_ClipRect &rect)=0; 00137 //: Pushes the current clipping rectangle onto the cliprect stack. It then clips 00138 //: the passed rectangle 'rect' with the current one, and uses the result as the 00139 //: new clipping rect. 00141 00142 virtual CL_ClipRect get_clip_rect()=0; 00143 //: Returns the current clipping rectangle. 00145 00146 virtual void set_clip_rect(const CL_ClipRect &rect)=0; 00147 //: Sets the current clipping rectangle. This is an absolute set, so it doesn't 00148 //: get clipped with the previous one. 00149 00150 virtual void pop_clip_rect()=0; 00151 //: Pop the clipping rectangle last pushed onto the stack. 00152 00153 virtual void push_translate_offset()=0; 00154 //: Pushes the current translation rectangle onto the cliprect stack. 00155 00156 virtual void push_translate_offset(int x, int y)=0; 00157 //: Push translation offset onto translation stack. This offset will 00158 //: affect any subsequent display operations on the displaycard, by 00159 //: translating the position of the display operation with the offset. 00160 //: The offset will be offset by any previous offsets pushed onto the stack, 00161 //: eg. it inherits the previous offset. 00162 00163 virtual int get_translate_offset_x() =0; 00164 //: Returns the current effective x-axis translation offset. 00165 00166 virtual int get_translate_offset_y() =0; 00167 //: Returns the current effective y-axis translation offset. 00168 00169 virtual void set_translate_offset(int x, int y)=0; 00170 //: Sets the translation offset as a new absolute translation offset. 00171 //: The new offset will disregard any previous offset's, but will not 00172 //: empty the translation stack. The new translation offset will affect 00173 //: any subsequent display operations on the displaycard, by 00174 //: translating the position of the display operation with the offset 00175 00176 virtual void pop_translate_offset()=0; 00177 //: Pops the last pushed translation offset from the translation offset 00178 //: stack. If the stack is empty, nothing will happen, and if the last 00179 //: translation offset is popped, the translation offset will be set to 0,0 00180 00181 virtual void fill_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a)=0; 00182 //: Draw a filled rectangle from ('x1', 'y1') to ('x2', 'y2') using the color 00183 //: ('r', 'g', 'b', 'a'). 00192 00193 virtual void draw_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a)=0; 00194 //: Draw a rectangle from ('x1', 'y1') to ('x2', 'y2') using the color 00195 //: ('r', 'g', 'b', 'a'). 00204 00205 virtual void draw_line(int x1, int y1, int x2, int y2, float r, float g, float b, float a)=0; 00206 //: Draw a line from ('x1', 'y1') to ('x2', 'y2') using the color 00207 //: ('r', 'g', 'b', 'a'). 00216 00217 virtual CL_Signal_v2<int, int> &get_sig_resize()=0; 00218 //: Returns the resize signal for the display card. 00219 // You can use this signal to listen for window resize events. 00220 // The parameters passed by the signal are the new width and height of the window. 00221 00222 virtual CL_Signal_v1<const CL_Rect &> &get_sig_paint()=0; 00223 //: Returns the paint signal for the display card. 00224 // Use this signal to listen for invalidated screen areas that need to be repainted. 00225 // The parameter passed by the signal is the area that need a repaint. 00226 }; 00227 00228 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001