pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] [pingus] push by address@hidden - Implemented mouse grab st


From: pingus
Subject: [Pingus-CVS] [pingus] push by address@hidden - Implemented mouse grab stuff for SDLFramebuffer on 2014-07-27 18:10 GMT
Date: Sun, 27 Jul 2014 18:10:35 +0000

Revision: f4df3d8b5e24
Author:   Ingo Ruhnke <address@hidden>
Date:     Sun Jul 27 18:10:17 2014 UTC
Log:      Implemented mouse grab stuff for SDLFramebuffer

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

Modified:
 /src/engine/display/display.cpp
 /src/engine/display/display.hpp
 /src/engine/display/framebuffer.hpp
 /src/engine/display/sdl_framebuffer.cpp
 /src/engine/display/sdl_framebuffer.hpp
 /src/pingus/components/playfield.cpp

=======================================
--- /src/engine/display/display.cpp     Sun Jul 27 16:32:00 2014 UTC
+++ /src/engine/display/display.cpp     Sun Jul 27 18:10:17 2014 UTC
@@ -82,6 +82,12 @@
 {
   return s_framebuffer->is_resizable();
 }
+
+bool
+Display::has_grab()
+{
+  return s_framebuffer->has_grab();
+}

 void
Display::create_window(FramebufferType framebuffer_type, const Size& size, bool fullscreen, bool resizable)
=======================================
--- /src/engine/display/display.hpp     Fri Oct 14 02:03:23 2011 UTC
+++ /src/engine/display/display.hpp     Sun Jul 27 18:10:17 2014 UTC
@@ -46,6 +46,7 @@

   static bool is_fullscreen();
   static bool is_resizable();
+  static bool has_grab();

   static Framebuffer* get_framebuffer();

=======================================
--- /src/engine/display/framebuffer.hpp Sun Jul 27 16:32:00 2014 UTC
+++ /src/engine/display/framebuffer.hpp Sun Jul 27 18:10:17 2014 UTC
@@ -41,6 +41,7 @@
virtual void set_video_mode(const Size& size, bool fullscreen, bool resizable) =0;
   virtual bool is_fullscreen() const =0;
   virtual bool is_resizable() const =0;
+  virtual bool has_grab() const { return false; }
   virtual void flip() =0;

   virtual void push_cliprect(const Rect&) =0;
=======================================
--- /src/engine/display/sdl_framebuffer.cpp     Sun Jul 27 17:18:40 2014 UTC
+++ /src/engine/display/sdl_framebuffer.cpp     Sun Jul 27 18:10:17 2014 UTC
@@ -248,6 +248,12 @@
 {
   return SDL_GetWindowFlags(m_window) & SDL_WINDOW_RESIZABLE;
 }
+
+bool
+SDLFramebuffer::has_grab() const
+{
+  return SDL_GetWindowGrab(m_window);
+}

 void
 SDLFramebuffer::push_cliprect(const Rect& rect)
=======================================
--- /src/engine/display/sdl_framebuffer.hpp     Sun Jul 27 16:32:00 2014 UTC
+++ /src/engine/display/sdl_framebuffer.hpp     Sun Jul 27 18:10:17 2014 UTC
@@ -30,28 +30,29 @@
   SDLFramebuffer();
   ~SDLFramebuffer();

-  FramebufferSurface create_surface(const Surface& surface);
+  FramebufferSurface create_surface(const Surface& surface) override;

   Surface make_screenshot() const override;

-  void set_video_mode(const Size& size, bool fullscreen, bool resizable);
-  bool is_fullscreen() const;
-  bool is_resizable() const;
-  void flip();
+ void set_video_mode(const Size& size, bool fullscreen, bool resizable) override;
+  bool is_fullscreen() const override;
+  bool is_resizable() const override;
+  bool has_grab() const override;
+  void flip() override;
   void update_rects(const std::vector<Rect>& rects);

-  void push_cliprect(const Rect&);
-  void pop_cliprect();
+  void push_cliprect(const Rect&) override;
+  void pop_cliprect() override;

-  void draw_surface(const FramebufferSurface& src, const Vector2i& pos);
- void draw_surface(const FramebufferSurface& src, const Rect& srcrect, const Vector2i& pos); + void draw_surface(const FramebufferSurface& src, const Vector2i& pos) override; + void draw_surface(const FramebufferSurface& src, const Rect& srcrect, const Vector2i& pos) override;

- void draw_line(const Vector2i& pos1, const Vector2i& pos2, const Color& color); + void draw_line(const Vector2i& pos1, const Vector2i& pos2, const Color& color) override;

-  void draw_rect(const Rect& rect, const Color& color);
-  void fill_rect(const Rect& rect, const Color& color);
+  void draw_rect(const Rect& rect, const Color& color) override;
+  void fill_rect(const Rect& rect, const Color& color) override;

-  Size get_size() const;
+  Size get_size() const override;

 private:
   SDLFramebuffer (const SDLFramebuffer&);
=======================================
--- /src/pingus/components/playfield.cpp        Sun Jul 27 00:17:46 2014 UTC
+++ /src/pingus/components/playfield.cpp        Sun Jul 27 18:10:17 2014 UTC
@@ -139,8 +139,7 @@
     }
   }

-#ifdef OLD_SDL1
- if (globals::auto_scrolling && (Display::is_fullscreen() || SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)) + if (globals::auto_scrolling && (Display::is_fullscreen() || Display::has_grab()))
   {
     scroll_speed = static_cast<int>(800 * delta);

@@ -162,7 +161,6 @@
       state.set_pos(state.get_pos() + Vector2i(0, scroll_speed));
     }
   }
-#endif
 }

 void



reply via email to

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