aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/sdl.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-03-30 07:28:17 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-03-30 07:28:17 +0000
commitab5aa90e1e05a89845c6e802ef1b2366d203aa45 (patch)
tree24b8f67a1cc123481b3f21fdc026795969a073cf /lib/gdi/sdl.cpp
parentcfe43ee16030fd37f6bce9ba99e367c15ecbf44f (diff)
downloadenigma2-ab5aa90e1e05a89845c6e802ef1b2366d203aa45.tar.gz
enigma2-ab5aa90e1e05a89845c6e802ef1b2366d203aa45.zip
- default fonts handled in windowstyle
- fixed 32bit ARGB support (drawLine) - add sdl (but currently disabled) - fixed /dev/vc/0 -> /dev/stdin for console input - added alignment to label - fixed skin parsing (getElementsByTagName didn't do what i expected)
Diffstat (limited to 'lib/gdi/sdl.cpp')
-rw-r--r--lib/gdi/sdl.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/lib/gdi/sdl.cpp b/lib/gdi/sdl.cpp
new file mode 100644
index 00000000..591487f4
--- /dev/null
+++ b/lib/gdi/sdl.cpp
@@ -0,0 +1,85 @@
+#include <lib/gdi/sdl.h>
+
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
+
+#include <SDL.h>
+
+gSDLDC *gSDLDC::m_instance;
+
+gSDLDC::gSDLDC()
+{
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ {
+ 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;
+
+ 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];
+
+ m_pixmap = new gPixmap(&m_surface);
+
+ memset(m_surface.clut.data, 0, sizeof(*m_surface.clut.data)*m_surface.clut.colors);
+}
+
+gSDLDC::~gSDLDC()
+{
+ SDL_Quit();
+ m_instance=0;
+}
+
+void gSDLDC::setPalette()
+{
+ if (!m_surface.clut.data)
+ return;
+
+/* for (int i=0; i<256; ++i)
+ {
+ fb->CMAP()->red[i]=ramp[m_surface.clut.data[i].r]<<8;
+ fb->CMAP()->green[i]=ramp[m_surface.clut.data[i].g]<<8;
+ fb->CMAP()->blue[i]=ramp[m_surface.clut.data[i].b]<<8;
+ fb->CMAP()->transp[i]=rampalpha[m_surface.clut.data[i].a]<<8;
+ if (!fb->CMAP()->red[i])
+ fb->CMAP()->red[i]=0x100;
+ }
+ fb->PutCMAP(); */
+}
+
+void gSDLDC::exec(gOpcode *o)
+{
+ switch (o->opcode)
+ {
+ case gOpcode::setPalette:
+ {
+ gDC::exec(o);
+ setPalette();
+ break;
+ }
+ case gOpcode::flush:
+ SDL_Flip(m_screen);
+ eDebug("FLUSH");
+ break;
+ default:
+ gDC::exec(o);
+ break;
+ }
+}
+
+eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC");