pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2688 - in branches/pingus_sdl: . src src/components src/gu


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2688 - in branches/pingus_sdl: . src src/components src/gui
Date: Thu, 18 Jan 2007 04:52:36 +0100

Author: grumbel
Date: 2007-01-18 04:52:35 +0100 (Thu, 18 Jan 2007)
New Revision: 2688

Modified:
   branches/pingus_sdl/
   branches/pingus_sdl/src/components/smallmap.cpp
   branches/pingus_sdl/src/console.cpp
   branches/pingus_sdl/src/console.hpp
   branches/pingus_sdl/src/credits.cpp
   branches/pingus_sdl/src/gui/display.cpp
   branches/pingus_sdl/src/gui/display.hpp
   branches/pingus_sdl/src/pingus_main.cpp
   branches/pingus_sdl/src/smallmap_image.cpp
   branches/pingus_sdl/src/smallmap_image.hpp
Log:
- fixed smallmap, some more input fixes


Property changes on: branches/pingus_sdl
___________________________________________________________________
Name: svn:ignore
   - 
*.a
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
.deps
*.gmo
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
*.o
pingus
.sconf_temp
.sconf_temp/
.sconsign
semantic.cache
stamp-h1

   + 
*.a
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
.deps
*.gmo
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
*.o
pingus
.sconf_temp
.sconf_temp/
.sconsign
.sconsign.dblite
semantic.cache
stamp-h1


Modified: branches/pingus_sdl/src/components/smallmap.cpp
===================================================================
--- branches/pingus_sdl/src/components/smallmap.cpp     2007-01-18 03:21:39 UTC 
(rev 2687)
+++ branches/pingus_sdl/src/components/smallmap.cpp     2007-01-18 03:52:35 UTC 
(rev 2688)
@@ -80,7 +80,6 @@
 void
 SmallMap::draw (DrawingContext& gc)
 {
-#if 0
   // FIXME: This is potentially dangerous, since we don't know how
   // long 'gc' will be alive. Should use a DrawingContext for caching.
   gc_ptr = &gc;
@@ -115,7 +114,6 @@
     }
 
   gc_ptr = 0;
-#endif
 }
 
 void

Modified: branches/pingus_sdl/src/console.cpp
===================================================================
--- branches/pingus_sdl/src/console.cpp 2007-01-18 03:21:39 UTC (rev 2687)
+++ branches/pingus_sdl/src/console.cpp 2007-01-18 03:52:35 UTC (rev 2688)
@@ -25,7 +25,6 @@
 
 using std::ostream;
 
-
 // Globale console
 Console console;
 
@@ -139,7 +138,7 @@
 Console::init()
 {
   // std::cout << "Console: Init..." << std::endl;
-  ////font = Fonts::xterm;
+  font = Fonts::xterm;
 
   //  (*this) << "Pingus Output Console (hide/show it with F1)\n"
   //     << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
@@ -152,24 +151,23 @@
 void
 Console::deinit()
 {
-  ////font = CL_Font();
+  font = Font();
 }
 
 void
 Console::draw()
 {
-#if 0
   assert(is_init);
 
   /** Callculate the position of the first line on the screen */
-  ////int start_y_pos =
-    ////  CL_Display::get_height() - (font.get_height() * (number_of_lines + 
3));
+  int start_y_pos =
+    Display::get_height() - (font.get_height() * (number_of_lines + 3));
 
   // The background of the console
-  ////CL_Display::fill_rect(CL_Rect(0, start_y_pos - 15,
-  ////                              CL_Display::get_width(),
-  ////CL_Display::get_height()),
-  ////Color(0, 0, 0, 128));
+  Display::fill_rect(Rect(0, start_y_pos - 15,
+                          Display::get_width(),
+                          Display::get_height()),
+                     Color(0, 0, 0, 128));
 
   const std::list<std::string>& buffer = streambuf.get_buffer ();
 
@@ -190,7 +188,6 @@
                 it->c_str()
                 );
     }
-#endif 
 }
 
 void

Modified: branches/pingus_sdl/src/console.hpp
===================================================================
--- branches/pingus_sdl/src/console.hpp 2007-01-18 03:21:39 UTC (rev 2687)
+++ branches/pingus_sdl/src/console.hpp 2007-01-18 03:52:35 UTC (rev 2688)
@@ -23,8 +23,8 @@
 #include <string>
 #include <iostream>
 #include "gui/display.hpp"
+#include "font.hpp"
 
-
 class ConsoleBuffer :
   public std::streambuf
 {
@@ -62,7 +62,7 @@
   ConsoleBuffer streambuf;
 
 public:
-  ////CL_Font font;
+  Font font;
   bool is_init;
   unsigned int current_pos;
 

Modified: branches/pingus_sdl/src/credits.cpp
===================================================================
--- branches/pingus_sdl/src/credits.cpp 2007-01-18 03:21:39 UTC (rev 2687)
+++ branches/pingus_sdl/src/credits.cpp 2007-01-18 03:52:35 UTC (rev 2688)
@@ -68,9 +68,6 @@
 
   gui_manager->add(new CreditsOkButton(this), true);
 
-  ////background.set_alignment(origin_center);
-  ////pingu.set_alignment(origin_center);
-
   font       = Fonts::chalk_normal;
   font_small = Fonts::chalk_large;
 
@@ -270,8 +267,8 @@
                 static_cast<float>(Display::get_height()/2 + 110),
                                                                _("Skip"));
 
-  ////Display::push_cliprect(Rect(0, static_cast<int>(gc.get_height()/2-225),
-  ////                        600, static_cast<int>(gc.get_height()/2+200)));
+  Display::push_cliprect(Rect(0, static_cast<int>(gc.get_height()/2-225),
+                              600, static_cast<int>(gc.get_height()/2+200)));
   yof = 0;
 
   for (std::vector<std::string>::iterator i = credits.begin(); i != 
credits.end(); ++i)
@@ -294,7 +291,7 @@
          break;
        }
     }
-  ////Display::pop_cliprect();
+  Display::pop_cliprect();
 }
 
 void

Modified: branches/pingus_sdl/src/gui/display.cpp
===================================================================
--- branches/pingus_sdl/src/gui/display.cpp     2007-01-18 03:21:39 UTC (rev 
2687)
+++ branches/pingus_sdl/src/gui/display.cpp     2007-01-18 03:52:35 UTC (rev 
2688)
@@ -21,9 +21,10 @@
 #include <stdio.h>
 #include <iostream>
 #include "../globals.hpp"
+#include "../math/rect.hpp"
+#include "../math/color.hpp"
 #include "display.hpp"
 
-
 std::list<DisplayHook*> Display::display_hooks;
 SDL_Surface* Display::screen;
 
@@ -110,4 +111,33 @@
   SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
 }
 
+void
+Display::draw_rect(const Rect&, const Color&)
+{
+  
+}
+
+void
+Display::fill_rect(const Rect& rect, const Color& color)
+{
+  SDL_Rect srcrect;
+
+  srcrect.x = rect.left;
+  srcrect.y = rect.right;
+  srcrect.w = rect.get_width();
+  srcrect.h = rect.get_height();
+
+  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, color.r, color.g, 
color.b));
+}
+
+void
+Display::push_cliprect(const Rect&)
+{
+}
+
+void
+Display::pop_cliprect()
+{
+}
+
 /* EOF */

Modified: branches/pingus_sdl/src/gui/display.hpp
===================================================================
--- branches/pingus_sdl/src/gui/display.hpp     2007-01-18 03:21:39 UTC (rev 
2687)
+++ branches/pingus_sdl/src/gui/display.hpp     2007-01-18 03:52:35 UTC (rev 
2688)
@@ -24,7 +24,8 @@
 #include "SDL.h"
 #include <list>
 
-
+class Rect;
+class Color;
 class DisplayHook;
 
 /** A flip display hook can be used to attach an event to a
@@ -55,6 +56,8 @@
   static SDL_Surface* screen;
 public:
   static void draw_rect(int x1, int y1, int x2, int y2, float r, float g, 
float b, float a);
+  static void draw_rect(const Rect&, const Color&);
+  static void fill_rect(const Rect&, const Color&);
 
   static void flip_display(bool sync=false);
 
@@ -69,6 +72,9 @@
   static void clear();
 
   static SDL_Surface* get_screen() { return screen; }
+
+  static void push_cliprect(const Rect&);
+  static void pop_cliprect();
 private:
   Display ();
   Display (const Display&);

Modified: branches/pingus_sdl/src/pingus_main.cpp
===================================================================
--- branches/pingus_sdl/src/pingus_main.cpp     2007-01-18 03:21:39 UTC (rev 
2687)
+++ branches/pingus_sdl/src/pingus_main.cpp     2007-01-18 03:52:35 UTC (rev 
2688)
@@ -736,12 +736,13 @@
 
       if (successfull)
         {
-          ////ScreenManager::instance()->push_screen
-          ////(new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
-          ////true);
           ScreenManager::instance()->push_screen
-            (new 
PingusGameSession(PLFResMgr::load_plf_from_filename(levelfile), false),
-           true);
+          (new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
+          true);
+          if (0)
+            ScreenManager::instance()->push_screen
+              (new 
PingusGameSession(PLFResMgr::load_plf_from_filename(levelfile), false),
+               true);
         }
     }
   else if (!demo_file.empty()) // start a demo
@@ -817,13 +818,6 @@
       init_sdl();
       init_pingus();
 
-      // Avoid uglyness on window opening
-      if (!render_preview)
-        {
-          ////CL_Display::clear();
-          ////CL_Display::flip();
-        }
-
       if (blitter_test)
         {
           ////BlitterTest test;

Modified: branches/pingus_sdl/src/smallmap_image.cpp
===================================================================
--- branches/pingus_sdl/src/smallmap_image.cpp  2007-01-18 03:21:39 UTC (rev 
2687)
+++ branches/pingus_sdl/src/smallmap_image.cpp  2007-01-18 03:52:35 UTC (rev 
2688)
@@ -25,7 +25,7 @@
 
 SmallMapImage::SmallMapImage(Server* s, int width, int height)
   : server(s),
-    ////canvas(width, height, width*4, CL_PixelFormat::rgba8888),
+    canvas(width, height),
     update_count(0),
     colmap_serial(0)
 {
@@ -68,7 +68,6 @@
 void
 SmallMapImage::update_surface()
 {
-#if 0
   unsigned char* buffer;
   unsigned char* cbuffer;
   unsigned char  current_pixel;
@@ -104,7 +103,7 @@
          switch (current_pixel)
             {
             case Groundtype::GP_NOTHING:
-              if (!CL_Endian::is_system_big())
+              if (0) //!CL_Endian::is_system_big())
               {
                 cbuffer[i + 0] = alpha;
                 cbuffer[i + 1] = 0;
@@ -121,7 +120,7 @@
               break;
 
             case Groundtype::GP_BRIDGE:
-              if (!CL_Endian::is_system_big())
+              if (0) //!CL_Endian::is_system_big())
               {
                 cbuffer[i + 0] = 255;
                 cbuffer[i + 1] = 100;
@@ -139,7 +138,7 @@
 
             case Groundtype::GP_WATER:
             case Groundtype::GP_LAVA:
-              if (!CL_Endian::is_system_big())
+              if (0) //!CL_Endian::is_system_big())
               {
                 cbuffer[i + 0] = 255;
                 cbuffer[i + 1] = 200;
@@ -176,7 +175,7 @@
 #endif
 
             case Groundtype::GP_SOLID:
-              if (!CL_Endian::is_system_big())
+              if (0)//!CL_Endian::is_system_big())
               {
                 cbuffer[i + 0] = 255;
                 cbuffer[i + 1] = 100;
@@ -193,7 +192,7 @@
               break;
 
             default:
-              if (!CL_Endian::is_system_big())
+              if (0)///!CL_Endian::is_system_big())
               {
                 cbuffer[i + 0] = 255;
                 cbuffer[i + 1] = 200;
@@ -212,10 +211,7 @@
        }
     }
   canvas.unlock();
-       CL_SpriteDescription desc;
-       desc.add_frame(canvas);
-  sur = CL_Sprite(desc);
-#endif
+  sur = Sprite(canvas);
 }
 
 

Modified: branches/pingus_sdl/src/smallmap_image.hpp
===================================================================
--- branches/pingus_sdl/src/smallmap_image.hpp  2007-01-18 03:21:39 UTC (rev 
2687)
+++ branches/pingus_sdl/src/smallmap_image.hpp  2007-01-18 03:52:35 UTC (rev 
2688)
@@ -33,7 +33,7 @@
   Server* server;
 
   /** The canvas that represents the small-colmap */
-  ////PixelBuffer canvas;
+  PixelBuffer canvas;
 
   /** Graphic surface for the generated rectanglar background of the small map 
*/
   Sprite sur;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]