PMC goes fullscreen ...
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Tue, 01 Jun 2010 14:50:45 +0200
changeset 129 d82830a449a9
parent 128 efa226a4801e
child 130 f4b424b93e45
PMC goes fullscreen ... committer: Markus Bröker <mbroeker@largo.homelinux.org>
pmc/main.cc
pmc/surface.cc
--- a/pmc/main.cc
+++ b/pmc/main.cc
@@ -14,7 +14,7 @@
 #define STEP 1
 #endif
 
-#define MAX 3
+#define MAX 1
 
 using namespace algebra;
 
@@ -26,35 +26,28 @@
 
     int height;
 
+    surface = new Surface (0, 0, 32);
+
     if (argc != 2) {
         fprintf (stderr, "Usage: %s <HEIGHT>\n", argv[0]);
-        height = 250;
+        height = surface->getHeight () / 2;
     } else
         height = atoi (argv[1]);
 
-    if ((height < 10) || (height >= 360))
-        height = 200;
-
     Vector p1 (0, 0);
     Vector p2 (height, 0);
-    Vector p3 (height + 100, height + 100);
-    Vector p4 (100, height + 100);
+    Vector p3 (height, height);
+    Vector p4 (0, height);
 
-    surface = new Surface (1024, 768, 32);
     SDL_WM_SetCaption ("Pimp my Cube", NULL);
 
-    d[0] = new Rectangle (surface, p1, p2, p3, p4);
-    d[1] = new Cube (surface);
-    d[2] = new Cube (surface, p1, p2, p3, p4, height);
+    d[0] = new Cube (surface, p1, p2, p3, p4, height);
 
     bool running = true;
     int i, x, y;
 
     x = y = 0;
 
-    d[1]->move (Vector (3 * height, 25));
-    d[2]->move (Vector (290, 0));
-
     while (running) {
         SDL_PollEvent (&event);
 
--- a/pmc/surface.cc
+++ b/pmc/surface.cc
@@ -17,7 +17,9 @@
     depth = d;
 
     SDL_Init (SDL_INIT_VIDEO);
-    screen = SDL_SetVideoMode (width, height, depth, SDL_HWSURFACE);
+    screen = SDL_SetVideoMode (w, h, depth, SDL_HWSURFACE | SDL_FULLSCREEN);
+    width = screen->w;
+    height = screen->h;
     red = SDL_MapRGB (screen->format, 0xff, 0x00, 0x00);
     green = SDL_MapRGB (screen->format, 0x00, 0xff, 0x00);
     blue = SDL_MapRGB (screen->format, 0x00, 0x00, 0xff);