[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src/gfx gfx.cc, 1.2, 1.3 screen.cc, 1
From: |
Alexandre Courbot <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src/gfx gfx.cc, 1.2, 1.3 screen.cc, 1.2, 1.3 screen.h, 1.1.1.1, 1.2 |
Date: |
Sun, 27 Jul 2003 10:08:22 -0400 |
Update of /cvsroot/adonthell/adonthell/src/gfx
In directory subversions:/tmp/cvs-serv28382/src/gfx
Modified Files:
gfx.cc screen.cc screen.h
Log Message:
Added a surface abstraction for the screen surface
Added gfxtest (which might unveil a bug somewhere)
Index: gfx.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gfx/gfx.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gfx.cc 24 Jul 2003 12:57:58 -0000 1.2
--- gfx.cc 27 Jul 2003 14:08:20 -0000 1.3
***************
*** 64,154 ****
namespace gfx
{
! bool init(const string & backend_name)
! {
! if (lt_dlinit())
! {
! cerr << lt_dlerror() << endl;
! cerr << "Error initializing liblt!\n";
! return false;
! }
!
! // dlhandle = lt_dlopenext(libname.c_str());
! dlhandle = base::get_module(string("/gfx/") + backend_name);
!
! if (!dlhandle) goto bigerror;
!
! gfxinit = (bool(*)()) lt_dlsym(dlhandle, "gfx_init");
! if (!gfxinit)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! gfxcleanup = (void(*)()) lt_dlsym(dlhandle, "gfx_cleanup");
! if (!gfxcleanup)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::set_video_mode_p = (bool(*)(u_int16, u_int16, u_int8))
lt_dlsym(dlhandle, "gfx_screen_set_video_mode");
! if (!screen::set_video_mode_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::update_p = (void(*)()) lt_dlsym(dlhandle, "gfx_screen_update");
! if (!screen::update_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::trans_color_p = (u_int32(*)()) lt_dlsym(dlhandle,
"gfx_screen_trans_color");
! if (!screen::trans_color_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::clear_p = (void(*)()) lt_dlsym(dlhandle, "gfx_screen_clear");
! if (!screen::clear_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! create_surface_p = (surface *(*)()) lt_dlsym(dlhandle,
"gfx_create_surface");
! if (!create_surface_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! goto success;
!
! bigerror:
! if (dlhandle) lt_dlclose(dlhandle);
! lt_dlexit();
! return false;
!
! success:
! return gfxinit();
! }
!
! void cleanup()
! {
! if (gfxcleanup) gfxcleanup();
! gfxcleanup = NULL;
!
! if (dlhandle) lt_dlclose(dlhandle);
! lt_dlexit();
! }
! surface * create_surface()
! {
! return create_surface_p();
! }
!
}
--- 64,160 ----
namespace gfx
{
! bool init(const string & backend_name)
! {
! if (lt_dlinit())
! {
! cerr << lt_dlerror() << endl;
! cerr << "Error initializing liblt!\n";
! return false;
! }
!
! // dlhandle = lt_dlopenext(libname.c_str());
! dlhandle = base::get_module(string("/gfx/") + backend_name);
!
! if (!dlhandle) goto bigerror;
!
! gfxinit = (bool(*)()) lt_dlsym(dlhandle, "gfx_init");
! if (!gfxinit)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! gfxcleanup = (void(*)()) lt_dlsym(dlhandle, "gfx_cleanup");
! if (!gfxcleanup)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::set_video_mode_p = (bool(*)(u_int16, u_int16, u_int8))
lt_dlsym(dlhandle, "gfx_screen_set_video_mode");
! if (!screen::set_video_mode_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::update_p = (void(*)()) lt_dlsym(dlhandle,
"gfx_screen_update");
! if (!screen::update_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::trans_color_p = (u_int32(*)()) lt_dlsym(dlhandle,
"gfx_screen_trans_color");
! if (!screen::trans_color_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! screen::clear_p = (void(*)()) lt_dlsym(dlhandle, "gfx_screen_clear");
! if (!screen::clear_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
! screen::get_surface_p = (surface * (*)()) lt_dlsym(dlhandle,
"gfx_screen_get_surface");
! if (!screen::get_surface_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! create_surface_p = (surface *(*)()) lt_dlsym(dlhandle,
"gfx_create_surface");
! if (!create_surface_p)
! {
! cerr << lt_dlerror() << endl;
! goto bigerror;
! }
!
! goto success;
!
! bigerror:
! if (dlhandle) lt_dlclose(dlhandle);
! lt_dlexit();
! return false;
!
! success:
! return gfxinit();
! }
!
! void cleanup()
! {
! if (gfxcleanup) gfxcleanup();
! gfxcleanup = NULL;
!
! if (dlhandle) lt_dlclose(dlhandle);
! lt_dlexit();
! }
!
! surface * create_surface()
! {
! return create_surface_p();
! }
}
Index: screen.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gfx/screen.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** screen.cc 24 Jul 2003 12:57:58 -0000 1.2
--- screen.cc 27 Jul 2003 14:08:20 -0000 1.3
***************
*** 27,30 ****
--- 27,31 ----
namespace gfx
{
+ // All the static data for the screen.
u_int16 screen::length_, screen::height_;
u_int8 screen::bytes_per_pixel_;
***************
*** 35,38 ****
--- 36,40 ----
u_int32 (*screen::trans_color_p)() = NULL;
void (*screen::clear_p)() = NULL;
+ surface * (*screen::get_surface_p)() = NULL;
bool screen::set_video_mode(u_int16 nl, u_int16 nh, u_int8 depth)
Index: screen.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gfx/screen.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** screen.h 18 Jul 2003 15:16:09 -0000 1.1.1.1
--- screen.h 27 Jul 2003 14:08:20 -0000 1.2
***************
*** 29,33 ****
#include <string>
! // #include "gfx/surface.h"
namespace gfx
--- 29,33 ----
#include <string>
! #include "gfx/surface.h"
namespace gfx
***************
*** 92,95 ****
--- 92,97 ----
static u_int32 trans_color() { return trans_color_p(); }
+ static surface * get_surface() { return get_surface_p(); }
+
/** Returns whether the current mode is fullscreen or windowed.
* @return
***************
*** 108,112 ****
static void clear() { clear_p(); }
! /** Sets fullscreen/windowed mode.
* @param mode
* - true: fullscreen mode.
--- 110,114 ----
static void clear() { clear_p(); }
! /** Sets fullscreen/windowed mode.
* @param mode
* - true: fullscreen mode.
***************
*** 117,122 ****
* this mode.
*/
! // static bool set_fullscreen (bool m);
!
/**
* Returns information about the current screen settings,
--- 119,124 ----
* this mode.
*/
! // static bool set_fullscreen (bool m);
!
/**
* Returns information about the current screen settings,
***************
*** 126,131 ****
* @return printable information about the current screen settings.
*/
! // static std::string info ();
!
/**
* @name Transparent color settings
--- 128,133 ----
* @return printable information about the current screen settings.
*/
! // static std::string info ();
!
/**
* @name Transparent color settings
***************
*** 133,137 ****
*/
///@{
!
/// Red componant
static const u_int8 TRANS_RED = 0xff;
--- 135,139 ----
*/
///@{
!
/// Red componant
static const u_int8 TRANS_RED = 0xff;
***************
*** 140,147 ****
/// Blue componant
static const u_int8 TRANS_BLUE = 0xff;
!
///@}
!
! private:
static bool fullscreen_;
--- 142,149 ----
/// Blue componant
static const u_int8 TRANS_BLUE = 0xff;
!
///@}
!
! protected:
static bool fullscreen_;
***************
*** 149,157 ****
static u_int16 height_;
static u_int8 bytes_per_pixel_;
!
static bool (*set_video_mode_p) (u_int16 nl, u_int16 nh, u_int8 depth
= 0);
static void (*update_p)();
static u_int32 (*trans_color_p)();
static void (*clear_p)();
friend bool gfx::init(const std::string &);
--- 151,160 ----
static u_int16 height_;
static u_int8 bytes_per_pixel_;
!
static bool (*set_video_mode_p) (u_int16 nl, u_int16 nh, u_int8 depth
= 0);
static void (*update_p)();
static u_int32 (*trans_color_p)();
static void (*clear_p)();
+ static surface * (*get_surface_p)();
friend bool gfx::init(const std::string &);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src/gfx gfx.cc, 1.2, 1.3 screen.cc, 1.2, 1.3 screen.h, 1.1.1.1, 1.2,
Alexandre Courbot <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/src/gfx/sdl screen_sdl.cc, 1.1.1.1, 1.2 screen_sdl.h, 1.1.1.1, 1.2 surface_sdl.cc, 1.2, 1.3 surface_sdl.h, 1.2, 1.3
- Next by Date:
[Adonthell-commits] CVS: adonthell/src/gui - New directory
- Previous by thread:
[Adonthell-commits] CVS: adonthell/src/gfx/sdl screen_sdl.cc, 1.1.1.1, 1.2 screen_sdl.h, 1.1.1.1, 1.2 surface_sdl.cc, 1.2, 1.3 surface_sdl.h, 1.2, 1.3
- Next by thread:
[Adonthell-commits] CVS: adonthell/src/gui - New directory
- Index(es):