diff options
| author | Andreas Oberritter <obi@opendreambox.org> | 2010-10-29 14:54:36 +0200 |
|---|---|---|
| committer | Andreas Oberritter <obi@opendreambox.org> | 2010-11-16 17:15:38 +0100 |
| commit | 059c9a03c8cc02b0c595e3a5599be04dc157f725 (patch) | |
| tree | 8ce10b7cb512ab1e1b49f4e10562aa5d83c433c0 /lib/gdi/sdl.cpp | |
| parent | e8164a09377e89aeb0c208c12b979811d5bc33fe (diff) | |
| download | enigma2-059c9a03c8cc02b0c595e3a5599be04dc157f725.tar.gz enigma2-059c9a03c8cc02b0c595e3a5599be04dc157f725.zip | |
Add abstract class gMainDC as an interface for gFBDC and gSDLDC
Diffstat (limited to 'lib/gdi/sdl.cpp')
| -rw-r--r-- | lib/gdi/sdl.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/gdi/sdl.cpp b/lib/gdi/sdl.cpp index 6dbdb67c..e816a185 100644 --- a/lib/gdi/sdl.cpp +++ b/lib/gdi/sdl.cpp @@ -1,4 +1,3 @@ -#ifdef WITH_SDL #include <lib/gdi/sdl.h> #include <lib/base/init.h> @@ -6,8 +5,6 @@ #include <SDL.h> -gSDLDC *gSDLDC::m_instance; - gSDLDC::gSDLDC() { if (SDL_Init(SDL_INIT_VIDEO) < 0) @@ -15,23 +12,12 @@ gSDLDC::gSDLDC() eWarning("Could not initialize SDL: %s", SDL_GetError()); return; } - - m_screen = SDL_SetVideoMode(720, 576, 32, SDL_HWSURFACE); - if (!m_screen) - { - eWarning("Could not create SDL surface: %s", SDL_GetError()); - return; - } - m_instance=this; - + setResolution(720, 576); + + CONNECT(m_pump.recv_msg, gSDLDC::pumpEvent); + m_surface.type = 0; - m_surface.x = m_screen->w; - m_surface.y = m_screen->h; - m_surface.bpp = m_screen->format->BitsPerPixel; - m_surface.bypp = m_screen->format->BytesPerPixel; - m_surface.stride = m_screen->pitch; - m_surface.data = m_screen->pixels; m_surface.clut.colors=256; m_surface.clut.data=new gRGB[m_surface.clut.colors]; @@ -43,7 +29,6 @@ gSDLDC::gSDLDC() gSDLDC::~gSDLDC() { SDL_Quit(); - m_instance=0; } void gSDLDC::setPalette() @@ -63,7 +48,7 @@ void gSDLDC::setPalette() fb->PutCMAP(); */ } -void gSDLDC::exec(gOpcode *o) +void gSDLDC::exec(const gOpcode *o) { switch (o->opcode) { @@ -83,6 +68,21 @@ void gSDLDC::exec(gOpcode *o) } } -eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC"); +void gSDLDC::setResolution(int xres, int yres) +{ + m_screen = SDL_SetVideoMode(xres, yres, 32, SDL_HWSURFACE); + if (!m_screen) + { + eWarning("Could not create SDL surface: %s", SDL_GetError()); + return; + } + + m_surface.x = m_screen->w; + m_surface.y = m_screen->h; + m_surface.bpp = m_screen->format->BitsPerPixel; + m_surface.bypp = m_screen->format->BytesPerPixel; + m_surface.stride = m_screen->pitch; + m_surface.data = m_screen->pixels; +} -#endif +eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC"); |
