Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

display.cpp

Go to the documentation of this file.
00001 /*
00002         $Id: display.cpp,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 
00015 #include "Core/precomp.h"
00016 
00017 #ifdef BORLAND
00018 #pragma hdrstop
00019 #endif
00020 
00021 #include <API/Display/Display/display.h>
00022 #include <API/Display/Display/displaycard.h>
00023 #include <API/Display/Display/surface.h>
00024 
00025 std::vector<CL_DisplayCard*> CL_Display::cards;
00026 
00027 void CL_Display::flip_display(bool sync)
00028 {
00029         CL_Display::get_current_card()->flip_display(sync);
00030 }
00031 
00032 void CL_Display::put_display(const class CL_Rect &rect)
00033 {
00034         CL_Display::get_current_card()->put_display(rect);
00035 }
00036 
00037 void CL_Display::clear_display(float red, float green, float blue, float alpha)
00038 {
00039         CL_Display::get_current_card()->clear_display(red, green, blue, alpha);
00040 }
00041 
00042 void CL_Display::set_palette(CL_Palette *palette)
00043 {
00044         CL_Display::get_current_card()->set_palette(palette);
00045 }
00046 
00047 CL_Palette *CL_Display::get_palette()
00048 {
00049         return CL_Display::get_current_card()->get_palette();
00050 }
00051 
00052 void CL_Display::set_videomode(CL_VidMode *mode)
00053 {
00054         CL_Display::get_current_card()->set_videomode(mode);
00055 }
00056 
00057 void CL_Display::set_videomode(int width, int height, int bpp, bool fullscreen, bool allow_resize, bool video_memory)
00058 {
00059         CL_Display::get_current_card()->set_videomode(width, height, bpp, fullscreen, allow_resize, video_memory);
00060 }
00061 
00062 CL_Target *CL_Display::get_target()
00063 {
00064         return CL_Display::get_current_card()->get_target();
00065 }
00066 
00067 int CL_Display::get_width()
00068 {
00069         return CL_Display::get_current_card()->get_width();
00070 }
00071 
00072 int CL_Display::get_height()
00073 {
00074         return CL_Display::get_current_card()->get_height();
00075 }
00076 
00077 int CL_Display::get_bpp()
00078 {
00079         return CL_Display::get_current_card()->get_bpp();
00080 }
00081 
00082 void CL_Display::push_clip_rect()
00083 {
00084         CL_Display::get_current_card()->push_clip_rect();
00085 }
00086 
00087 void CL_Display::push_clip_rect(const CL_ClipRect &rect)
00088 {
00089         CL_Display::get_current_card()->push_clip_rect(rect);
00090 }
00091 
00092 CL_ClipRect CL_Display::get_clip_rect()
00093 {
00094         return CL_Display::get_current_card()->get_clip_rect();
00095 }
00096 
00097 void CL_Display::set_clip_rect(const CL_ClipRect &rect)
00098 {
00099         CL_Display::get_current_card()->set_clip_rect(rect);
00100 }
00101 
00102 void CL_Display::pop_clip_rect()
00103 {
00104         CL_Display::get_current_card()->pop_clip_rect();
00105 }
00106 
00107 void CL_Display::push_translate_offset()
00108 {
00109         CL_Display::get_current_card()->push_translate_offset();
00110 }
00111 
00112 void CL_Display::push_translate_offset(int x, int y)
00113 {
00114         CL_Display::get_current_card()->push_translate_offset(x, y);
00115 }
00116 
00117 int  CL_Display::get_translate_offset_x()
00118 {
00119         return CL_Display::get_current_card()->get_translate_offset_x();
00120 }
00121 
00122 int  CL_Display::get_translate_offset_y()
00123 {
00124         return CL_Display::get_current_card()->get_translate_offset_y();
00125 }
00126 
00127 void CL_Display::set_translate_offset(int x, int y)
00128 {
00129         CL_Display::get_current_card()->set_translate_offset(x, y);
00130 }
00131 
00132 void CL_Display::pop_translate_offset()
00133 {
00134         CL_Display::get_current_card()->pop_translate_offset();
00135 }
00136 
00137 void CL_Display::fill_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a)
00138 {
00139         CL_Display::get_current_card()->fill_rect(x1, y1, x2, y2, r, g, b, a);
00140 }
00141 
00142 void CL_Display::draw_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a)
00143 {
00144         CL_Display::get_current_card()->draw_rect(x1, y1, x2, y2, r, g, b, a);
00145 }
00146 
00147 void CL_Display::fill_rect(int x1, int y1, int x2, int y2, CL_Surface *fill_surface, int focus_x, int focus_y)
00148 {
00149         push_clip_rect(CL_ClipRect(
00150                 get_translate_offset_x()+x1,
00151                 get_translate_offset_y()+y1,
00152                 get_translate_offset_x()+x2,
00153                 get_translate_offset_y()+y2));
00154 
00155         int width = fill_surface->get_width();
00156         int height = fill_surface->get_height();
00157 
00158         int x, y;
00159         if (focus_x < x1)
00160         {
00161                 for (x=focus_x;x+width<x1;x+=width);
00162         }
00163         else
00164         {
00165                 for (x=focus_x;x>x1;x-=width);
00166         }
00167         if (focus_y < y1)
00168         {
00169                 for (y=focus_y;y+height<y1;y+=height);
00170         }
00171         else
00172         {
00173                 for (y=focus_y;y>y1;y-=height);
00174         }
00175 
00176         for (;y<y2;)
00177         {
00178                 for (int it_x=x;it_x<x2;it_x+=width)
00179                 {
00180                         fill_surface->put_screen(it_x, y);
00181                 }
00182                 y += height;
00183         }
00184 
00185         pop_clip_rect();
00186 }
00187 
00188 void CL_Display::draw_line(int x1, int y1, int x2, int y2, float r, float g, float b, float a)
00189 {
00190         CL_Display::get_current_card()->draw_line(x1, y1, x2, y2, r, g, b, a);
00191 }
00192 
00193 void CL_Display::sync_buffers()
00194 {
00195         CL_Display::get_current_card()->sync_buffers();
00196 }
00197 
00198 CL_Signal_v2<int, int> &CL_Display::get_sig_resize()
00199 {
00200         return CL_Display::get_current_card()->get_sig_resize();
00201 }
00202 
00203 CL_Signal_v1<const CL_Rect &> &CL_Display::get_sig_paint()
00204 {
00205         return CL_Display::get_current_card()->get_sig_paint();
00206 }

Generated at Wed Apr 4 19:54:00 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001