pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] [pingus] 4 new revisions pushed by address@hidden on 2014-0


From: pingus
Subject: [Pingus-CVS] [pingus] 4 new revisions pushed by address@hidden on 2014-07-27 00:43 GMT
Date: Sun, 27 Jul 2014 00:44:01 +0000

feature/sdl2 moved from 7483a831509e to bd0879cdaf02

4 new revisions:

Revision: 21a5542ce8a4
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:17:46 2014 UTC
Log:      Fixed another scancode/keycode issue
http://code.google.com/p/pingus/source/detail?r=21a5542ce8a4

Revision: ca393e78d8fc
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:18:02 2014 UTC
Log:      Fixed window title and icon
http://code.google.com/p/pingus/source/detail?r=ca393e78d8fc

Revision: 6ce52bdeed1d
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:20:22 2014 UTC
Log:      Copy all surface flags in Blitter::create_surface_from_format()
http://code.google.com/p/pingus/source/detail?r=6ce52bdeed1d

Revision: bd0879cdaf02
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:38:16 2014 UTC
Log:      Fixed up some colorkey handling
http://code.google.com/p/pingus/source/detail?r=bd0879cdaf02

==============================================================================
Revision: 21a5542ce8a4
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:17:46 2014 UTC
Log:      Fixed another scancode/keycode issue

http://code.google.com/p/pingus/source/detail?r=21a5542ce8a4

Modified:
 /src/pingus/components/playfield.cpp

=======================================
--- /src/pingus/components/playfield.cpp        Sat Jul 26 19:58:06 2014 UTC
+++ /src/pingus/components/playfield.cpp        Sun Jul 27 00:17:46 2014 UTC
@@ -216,9 +216,8 @@

   if (globals::developer_mode)
   { // Some fun stuff that lets you draw directly on the level
-#ifdef OLD_SDL1
-    Uint8 *keystate = SDL_GetKeyState(NULL);
-    if (keystate[SDLK_DELETE])
+    const Uint8* keystate = SDL_GetKeyboardState(nullptr);
+    if (keystate[SDL_SCANCODE_DELETE])
     {
       CollisionMask mask("other/bash_radius_gfx");
       Vector2i p = state.screen2world(mouse_pos);
@@ -226,7 +225,7 @@
                                   p.x - mask.get_width()/2,
                                   p.y - mask.get_height()/2);
     }
-    else if (keystate[SDLK_INSERT])
+    else if (keystate[SDL_SCANCODE_INSERT])
     {
       CollisionMask mask("other/bash_radius_gfx");
       Vector2i p = state.screen2world(mouse_pos);
@@ -235,7 +234,7 @@
                                p.y - mask.get_height()/2,
                                Groundtype::GP_GROUND);
     }
-    else if (keystate[SDLK_HOME])
+    else if (keystate[SDL_SCANCODE_HOME])
     {
       CollisionMask mask("other/bash_radius_gfx");
       Vector2i p = state.screen2world(mouse_pos);
@@ -244,7 +243,6 @@
                                p.y - mask.get_height()/2,
                                Groundtype::GP_BRIDGE);
     }
-#endif
   }
 }


==============================================================================
Revision: ca393e78d8fc
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:18:02 2014 UTC
Log:      Fixed window title and icon

http://code.google.com/p/pingus/source/detail?r=ca393e78d8fc

Modified:
 /src/engine/display/opengl/opengl_framebuffer.cpp
 /src/engine/display/sdl_framebuffer.cpp
 /src/engine/system/sdl_system.cpp

=======================================
--- /src/engine/display/opengl/opengl_framebuffer.cpp Sat Jul 26 19:58:06 2014 UTC +++ /src/engine/display/opengl/opengl_framebuffer.cpp Sun Jul 27 00:18:02 2014 UTC
@@ -17,6 +17,7 @@
 #include "engine/display/opengl/opengl_framebuffer.hpp"

 #include <SDL.h>
+#include <SDL_image.h>
 #include <sstream>
 #include <stdexcept>

@@ -53,7 +54,7 @@
     flags |= SDL_WINDOW_RESIZABLE;
   }

-  m_window = SDL_CreateWindow("Pingus",
+  m_window = SDL_CreateWindow("Pingus " VERSION,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                               size.width, size.height,
                               flags);
@@ -63,6 +64,7 @@
msg << "Couldn't set video mode (" << size.width << "x" << size.height << "): " << SDL_GetError();
     throw std::runtime_error(msg.str());
   }
+ SDL_SetWindowIcon(m_window, IMG_Load(Pathname("images/icons/pingus.png", Pathname::DATA_PATH).get_sys_path().c_str()));

   glEnableClientState(GL_VERTEX_ARRAY);
   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
=======================================
--- /src/engine/display/sdl_framebuffer.cpp     Sat Jul 26 23:58:44 2014 UTC
+++ /src/engine/display/sdl_framebuffer.cpp     Sun Jul 27 00:18:02 2014 UTC
@@ -16,6 +16,8 @@

 #include "engine/display/sdl_framebuffer.hpp"

+#include <SDL_image.h>
+
 #include "engine/display/sdl_framebuffer_surface_impl.hpp"
 #include "util/log.hpp"

@@ -282,7 +284,7 @@
     flags |= SDL_WINDOW_RESIZABLE;
   }

-  m_window = SDL_CreateWindow("Pingus",
+  m_window = SDL_CreateWindow("Pingus " VERSION,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                               size.width, size.height,
                               flags);
@@ -292,6 +294,7 @@
msg << "Couldn't set video mode (" << size.width << "x" << size.height << "): " << SDL_GetError();
     throw std::runtime_error(msg.str());
   }
+ SDL_SetWindowIcon(m_window, IMG_Load(Pathname("images/icons/pingus.png", Pathname::DATA_PATH).get_sys_path().c_str()));

   m_renderer = SDL_CreateRenderer(m_window, -1, SDL_RENDERER_ACCELERATED);
   m_screen = SDL_CreateRGBSurface(0, size.width, size.height, 32,
=======================================
--- /src/engine/system/sdl_system.cpp   Sat Jul 26 19:58:06 2014 UTC
+++ /src/engine/system/sdl_system.cpp   Sun Jul 27 00:18:02 2014 UTC
@@ -43,10 +43,6 @@
 void
SDLSystem::create_window(FramebufferType framebuffer_type, const Size& size, bool fullscreen, bool resizable)
 {
-#ifdef OLD_SDL1
-  SDL_WM_SetCaption("Pingus " VERSION, "Pingus " VERSION);
- SDL_WM_SetIcon(IMG_Load(Pathname("images/icons/pingus.png", Pathname::DATA_PATH).get_sys_path().c_str()), 0);
-#endif
   Display::create_window(framebuffer_type, size, fullscreen, resizable);
 }


==============================================================================
Revision: 6ce52bdeed1d
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:20:22 2014 UTC
Log:      Copy all surface flags in Blitter::create_surface_from_format()

http://code.google.com/p/pingus/source/detail?r=6ce52bdeed1d

Modified:
 /src/engine/display/blitter.cpp

=======================================
--- /src/engine/display/blitter.cpp     Sat Jul 26 21:37:49 2014 UTC
+++ /src/engine/display/blitter.cpp     Sun Jul 27 00:20:22 2014 UTC
@@ -218,17 +218,24 @@
                                                   surface->format->Bmask,
                                                   surface->format->Amask);

-#ifdef OLD_SDL1
-  if (surface->flags & SDL_SRCALPHA)
- SDL_SetSurfaceAlphaMod(new_surface, SDL_SRCALPHA, surface->format->alpha);
+  Uint8 alpha;
+  if (SDL_GetSurfaceAlphaMod(surface, &alpha) == 0)
+    SDL_SetSurfaceAlphaMod(new_surface, alpha);
+
+  SDL_BlendMode blend_mode;
+  if (SDL_GetSurfaceBlendMode(surface, &blend_mode) == 0)
+    SDL_SetSurfaceBlendMode(new_surface, blend_mode);
+
+  Uint8 r, g, b;
+  if (SDL_GetSurfaceColorMod(surface, &r, &g, &b) == 0)
+    SDL_SetSurfaceColorMod(new_surface, r, g, b);

   if (surface->format->palette)
- SDL_SetPalette(new_surface, SDL_LOGPAL, surface->format->palette->colors,
-                   0, surface->format->palette->ncolors);
+    SDL_SetSurfacePalette(new_surface, surface->format->palette);

-  if (surface->flags & SDL_SRCCOLORKEY)
- SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, surface->format->colorkey);
-#endif
+  Uint32 colorkey;
+  if (SDL_GetColorKey(surface, &colorkey) == 0)
+    SDL_SetColorKey(new_surface, SDL_TRUE, colorkey);

   return new_surface;
 }

==============================================================================
Revision: bd0879cdaf02
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 00:38:16 2014 UTC
Log:      Fixed up some colorkey handling

http://code.google.com/p/pingus/source/detail?r=bd0879cdaf02

Modified:
 /src/engine/display/blitter.cpp
 /src/engine/display/surface.cpp
 /src/pingus/collision_mask.cpp
 /src/pingus/ground_map.cpp

=======================================
--- /src/engine/display/blitter.cpp     Sun Jul 27 00:20:22 2014 UTC
+++ /src/engine/display/blitter.cpp     Sun Jul 27 00:38:16 2014 UTC
@@ -33,12 +33,12 @@
   bpp = surface->format->BytesPerPixel;
   if (bpp == 1) {
     SDL_Palette* pal = SDL_AllocPalette(256);
-#ifdef OLD_SDL1
+
     Uint32 ckey;
     int useckey = 0;

-    useckey = surface->flags & SDL_SRCCOLORKEY;
-#endif
+    useckey = SDL_GetColorKey(surface, &ckey) == 0;
+
     new_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);

     SDL_LockSurface(surface);
@@ -49,9 +49,6 @@
     new_pitch  = new_surface->pitch;

memcpy(pal->colors, surface->format->palette->colors, sizeof(SDL_Color) * 256);
-#ifdef OLD_SDL1
-    ckey = surface->format->colorkey;
-#endif

     for (i = 0; i < height; ++i) {
       x = i * new_pitch;
@@ -65,11 +62,11 @@
     SDL_UnlockSurface(new_surface);

     SDL_SetSurfacePalette(new_surface, pal);
-#ifdef OLD_SDL1
-    if (useckey) {
-      SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, ckey);
+    if (useckey)
+    {
+      SDL_SetColorKey(new_surface, SDL_TRUE, ckey);
+      SDL_SetSurfaceRLE(new_surface, SDL_TRUE);
     }
-#endif
   } else {
     int ix, iy;
     float fx, fy, fz;
=======================================
--- /src/engine/display/surface.cpp     Sat Jul 26 21:37:49 2014 UTC
+++ /src/engine/display/surface.cpp     Sun Jul 27 00:38:16 2014 UTC
@@ -295,7 +295,6 @@
 Color
 Surface::get_pixel(int x, int y) const
 {
-#ifdef OLD_SDL1
Uint8 *p = static_cast<Uint8 *>(get_surface()->pixels) + y * get_surface()->pitch + x * get_surface()->format->BytesPerPixel;
   Uint32 pixel;

@@ -307,8 +306,9 @@

         if (impl->surface->format->palette)
         {
-          if (impl->surface->flags & SDL_SRCCOLORKEY &&
-              pixel == impl->surface->format->colorkey)
+          Uint32 colorkey;
+          if (SDL_GetColorKey(impl->surface, &colorkey) == 0 &&
+              pixel == colorkey)
           {
             return Color(0,0,0,0);
           }
@@ -341,9 +341,6 @@
   Color color;
SDL_GetRGBA(pixel, get_surface()->format, &color.r, &color.g, &color.b, &color.a);
   return color;
-#else
-  return Color();
-#endif
 }

 Surface
@@ -502,11 +499,8 @@
 bool
 Surface::has_colorkey() const
 {
-#ifdef OLD_SDL1
-  return impl->surface->flags & SDL_SRCCOLORKEY;
-#else
-  return false;
-#endif
+  Uint32 colorkey;
+  return SDL_GetColorKey(impl->surface, &colorkey) == 0;
 }

 bool
@@ -518,7 +512,6 @@
 void
 Surface::print(std::ostream& out)
 {
-#ifdef OLD_SDL1
   out << boost::format("Pointer: 0x%p\n"
                        "Rmask:   0x%08x\n"
                        "Gmask:   0x%08x\n"
@@ -534,18 +527,28 @@
     % impl->surface->format->Bmask
     % impl->surface->format->Amask
     % impl->surface->flags
-    % ((impl->surface->flags & SDL_HWSURFACE) ? "HWSURFACE " : "")
-    % ((impl->surface->flags & SDL_SWSURFACE) ? "SWSURFACE " : "")
-    % ((impl->surface->flags & SDL_SRCCOLORKEY) ? "SRCCOLORKEY " : "")
-    % ((impl->surface->flags & SDL_SRCALPHA) ? "SRCALPHA " : "")
     % impl->surface->format->palette
     % static_cast<int>(impl->surface->format->BitsPerPixel);

-  if (impl->surface->flags & SDL_SRCCOLORKEY)
- out << "Colorkey: " << static_cast<int>(impl->surface->format->colorkey) << std::endl;
+  Uint32 colorkey;
+  if (SDL_GetColorKey(impl->surface, &colorkey) == 0)
+  {
+    out << "Colorkey: " << boost::format("0x%08x") % colorkey << std::endl;
+  }
+  else
+  {
+    out << "Colorkey: <none>" << std::endl;
+  }

-  if (impl->surface->flags & SDL_SRCALPHA)
- out << "Alpha: " << static_cast<int>(impl->surface->format->alpha) << std::endl;
+  Uint8 alpha;
+  if (SDL_GetSurfaceAlphaMod(impl->surface, &alpha) == 0)
+  {
+    out << "Alpha: " << static_cast<int>(alpha) << std::endl;
+  }
+  else
+  {
+    out << "Alpha: <none>" << std::endl;
+  }

   if (0)
   {
@@ -560,7 +563,6 @@
     out << std::endl;
     SDL_UnlockSurface(impl->surface);
   }
-#endif
 }

 /* EOF */
=======================================
--- /src/pingus/collision_mask.cpp      Sat Jul 26 19:58:06 2014 UTC
+++ /src/pingus/collision_mask.cpp      Sun Jul 27 00:38:16 2014 UTC
@@ -73,14 +73,14 @@

   if (sdl_surface->format->palette)
   {
-#ifdef OLD_SDL1
     uint8_t* source = static_cast<uint8_t*>(sdl_surface->pixels);
-    if (sdl_surface->flags & SDL_SRCCOLORKEY)
+    Uint32 colorkey;
+    if (SDL_GetColorKey(sdl_surface, &colorkey) == 0)
     { // surface with transparent areas
       for(int y = 0; y < height; ++y)
         for(int x = 0; x < width; ++x)
         {
-          if (source[y*pitch + x] == sdl_surface->format->colorkey)
+          if (source[y*pitch + x] == colorkey)
             buffer[y*width + x] = 0;
           else
             buffer[y*width + x] = 1;
@@ -90,7 +90,6 @@
     { // completly opaque surface
       memset(buffer.get(), 1, width*height);
     }
-#endif
   }
   else if (sdl_surface->format->BitsPerPixel == 24)
   {
=======================================
--- /src/pingus/ground_map.cpp  Sat Jul 26 19:58:06 2014 UTC
+++ /src/pingus/ground_map.cpp  Sun Jul 27 00:38:16 2014 UTC
@@ -201,7 +201,6 @@
 GroundMap::put_alpha_surface(Surface provider, Surface sprovider,
int x_pos, int y_pos, int real_x_arg, int real_y_arg)
 {
-#ifdef OLD_SDL1
   if (sprovider.get_surface()->format->BitsPerPixel != 8  &&
       sprovider.get_surface()->format->BitsPerPixel != 24 &&
       sprovider.get_surface()->format->BitsPerPixel != 32)
@@ -231,7 +230,7 @@

   Uint8* target_buf = static_cast<Uint8*>(provider.get_data());
   Uint8* source_buf = static_cast<Uint8*>(sprovider.get_data());
-
+  Uint32 colorkey;
   if (sprovider.get_surface()->format->BitsPerPixel == 32)
   {
     for (int y = start_y; y < end_y; ++y)
@@ -252,10 +251,8 @@
       }
     }
   }
-  else if (sprovider.get_surface()->flags & SDL_SRCCOLORKEY)
+  else if (SDL_GetColorKey(sprovider.get_surface(), &colorkey) == 0)
   {
-    Uint32 colorkey = sprovider.get_surface()->format->colorkey;
-
     for (int y = start_y; y < end_y; ++y)
     {
       Uint8* tptr = target_buf + tpitch*(y+y_pos) + 4*(x_pos + start_x);
@@ -294,7 +291,6 @@

   sprovider.unlock();
   provider.unlock();
-#endif
 }

 void



reply via email to

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