[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] [pingus] push by address@hidden - Removed globals::fullscre
From: |
pingus |
Subject: |
[Pingus-CVS] [pingus] push by address@hidden - Removed globals::fullscreen_enabled, ConfigManager still needs much mo... on 2011-10-14 02:06 GMT |
Date: |
Fri, 14 Oct 2011 02:10:29 +0000 |
Revision: bb6205676bf3
Author: Ingo Ruhnke <address@hidden>
Date: Thu Oct 13 19:03:23 2011
Log: Removed globals::fullscreen_enabled, ConfigManager still needs
much more cleanup
http://code.google.com/p/pingus/source/detail?r=bb6205676bf3
Modified:
/src/engine/display/delta/delta_framebuffer.cpp
/src/engine/display/delta/delta_framebuffer.hpp
/src/engine/display/display.cpp
/src/engine/display/display.hpp
/src/engine/display/font.cpp
/src/engine/display/framebuffer.hpp
/src/engine/display/null_framebuffer.cpp
/src/engine/display/null_framebuffer.hpp
/src/engine/display/opengl/opengl_framebuffer.cpp
/src/engine/display/opengl/opengl_framebuffer.hpp
/src/engine/display/sdl_framebuffer.cpp
/src/engine/display/sdl_framebuffer.hpp
/src/engine/display/sprite_impl.cpp
/src/engine/screen/screen_manager.cpp
/src/pingus/components/playfield.cpp
/src/pingus/config_manager.cpp
/src/pingus/config_manager.hpp
/src/pingus/fps_counter.cpp
/src/pingus/globals.cpp
/src/pingus/globals.hpp
/src/pingus/pingus_main.cpp
=======================================
--- /src/engine/display/delta/delta_framebuffer.cpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/delta/delta_framebuffer.cpp Thu Oct 13 19:03:23 2011
@@ -47,6 +47,18 @@
frontbuffer->clear();
framebuffer->set_video_mode(size, fullscreen, resizable);
}
+
+bool
+DeltaFramebuffer::is_fullscreen() const
+{
+ return framebuffer->is_fullscreen();
+}
+
+bool
+DeltaFramebuffer::is_resizable() const
+{
+ return framebuffer->is_resizable();
+}
void
DeltaFramebuffer::flip()
=======================================
--- /src/engine/display/delta/delta_framebuffer.hpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/delta/delta_framebuffer.hpp Thu Oct 13 19:03:23 2011
@@ -35,6 +35,8 @@
FramebufferSurface create_surface(const Surface& surface);
void set_video_mode(const Size& size, bool fullscreen, bool resizable);
+ bool is_fullscreen() const;
+ bool is_resizable() const;
void flip();
void push_cliprect(const Rect&);
=======================================
--- /src/engine/display/display.cpp Sun Oct 9 09:36:54 2011
+++ /src/engine/display/display.cpp Thu Oct 13 19:03:23 2011
@@ -67,11 +67,23 @@
// FIXME: Calling this causes horrible flicker, since the screen
// goes black on a size change. Seems to be an SDL issue.
// This call also shouldn't be part of ScreenManager, but
Framebuffer/Display internal
- Display::set_video_mode(size, globals::fullscreen_enabled, true);
+ Display::set_video_mode(size, is_fullscreen(), true);
if (ScreenManager::instance())
ScreenManager::instance()->resize(size);
}
+
+bool
+Display::is_fullscreen()
+{
+ return s_framebuffer->is_fullscreen();
+}
+
+bool
+Display::is_resizable()
+{
+ return s_framebuffer->is_resizable();
+}
void
Display::create_window(FramebufferType framebuffer_type, const Size& size,
bool fullscreen, bool resizable)
@@ -132,10 +144,10 @@
}
}
-Framebuffer&
+Framebuffer*
Display::get_framebuffer()
{
- return *s_framebuffer.get();
+ return s_framebuffer.get();
}
Size
=======================================
--- /src/engine/display/display.hpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/display.hpp Thu Oct 13 19:03:23 2011
@@ -43,8 +43,11 @@
static void create_window(FramebufferType framebuffer_type, const Size&
size, bool fullscreen, bool resizable);
static void set_video_mode(const Size& size, bool fullscreen, bool
resizable);
static void resize(const Size& size);
-
- static Framebuffer& get_framebuffer();
+
+ static bool is_fullscreen();
+ static bool is_resizable();
+
+ static Framebuffer* get_framebuffer();
static Size find_closest_fullscreen_video_mode(const Size& size);
static std::vector<Size> get_fullscreen_video_modes();
=======================================
--- /src/engine/display/font.cpp Mon Sep 5 14:46:01 2011
+++ /src/engine/display/font.cpp Thu Oct 13 19:03:23 2011
@@ -49,7 +49,7 @@
// Copyh Unicode -> Glyph mapping
for(std::vector<GlyphImageDescription>::size_type j = 0; j <
desc.images.size(); ++j)
{
-
framebuffer_surfaces.push_back(Display::get_framebuffer().create_surface(Surface(desc.images[j].pathname)));
+
framebuffer_surfaces.push_back(Display::get_framebuffer()->create_surface(Surface(desc.images[j].pathname)));
if (!framebuffer_surfaces.back())
{
=======================================
--- /src/engine/display/framebuffer.hpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/framebuffer.hpp Thu Oct 13 19:03:23 2011
@@ -37,6 +37,8 @@
virtual FramebufferSurface create_surface(const Surface& surface) =0;
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 void flip() =0;
virtual void push_cliprect(const Rect&) =0;
=======================================
--- /src/engine/display/null_framebuffer.cpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/null_framebuffer.cpp Thu Oct 13 19:03:23 2011
@@ -30,9 +30,11 @@
int get_width() const { return size.width; }
int get_height() const { return size.height; }
};
-
+
NullFramebuffer::NullFramebuffer() :
- size()
+ m_size(),
+ m_fullscreen(false),
+ m_resizable(false)
{
}
@@ -48,11 +50,26 @@
}
void
-NullFramebuffer::set_video_mode(const Size& size_, bool fullscreen, bool
resizable)
-{
- size = size_;
- log_info("size: " << size.width << "x" << size.height <<
- " fullscreen: " << fullscreen << " resizable: " << resizable);
+NullFramebuffer::set_video_mode(const Size& size, bool fullscreen, bool
resizable)
+{
+ m_size = size;
+ m_fullscreen = fullscreen;
+ m_resizable = resizable;
+
+ log_info("size: " << m_size.width << "x" << m_size.height <<
+ " fullscreen: " << m_fullscreen << " resizable: " <<
m_resizable);
+}
+
+bool
+NullFramebuffer::is_fullscreen() const
+{
+ return m_fullscreen;
+}
+
+bool
+NullFramebuffer::is_resizable() const
+{
+ return m_resizable;
}
void
@@ -98,7 +115,7 @@
Size
NullFramebuffer::get_size() const
{
- return size;
+ return m_size;
}
/* EOF */
=======================================
--- /src/engine/display/null_framebuffer.hpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/null_framebuffer.hpp Thu Oct 13 19:03:23 2011
@@ -23,7 +23,9 @@
class NullFramebuffer : public Framebuffer
{
private:
- Size size;
+ Size m_size;
+ bool m_fullscreen;
+ bool m_resizable;
public:
NullFramebuffer();
@@ -32,6 +34,8 @@
FramebufferSurface create_surface(const Surface& surface);
void set_video_mode(const Size& size, bool fullscreen, bool resizable);
+ bool is_fullscreen() const;
+ bool is_resizable() const;
void flip();
void push_cliprect(const Rect&);
=======================================
--- /src/engine/display/opengl/opengl_framebuffer.cpp Sat Oct 1 13:19:58
2011
+++ /src/engine/display/opengl/opengl_framebuffer.cpp Thu Oct 13 19:03:23
2011
@@ -23,7 +23,7 @@
OpenGLFramebuffer::OpenGLFramebuffer() :
screen(),
- cliprect_stack()
+ cliprect_stack()
{
}
@@ -78,6 +78,18 @@
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
+
+bool
+OpenGLFramebuffer::is_fullscreen() const
+{
+ return screen->flags | SDL_FULLSCREEN;
+}
+
+bool
+OpenGLFramebuffer::is_resizable() const
+{
+ return screen->flags | SDL_RESIZABLE;
+}
void
OpenGLFramebuffer::flip()
=======================================
--- /src/engine/display/opengl/opengl_framebuffer.hpp Sat Oct 1 13:19:58
2011
+++ /src/engine/display/opengl/opengl_framebuffer.hpp Thu Oct 13 19:03:23
2011
@@ -31,6 +31,8 @@
FramebufferSurface create_surface(const Surface& surface);
void set_video_mode(const Size& size, bool fullscreen, bool resizable);
+ bool is_fullscreen() const;
+ bool is_resizable() const;
void flip();
void push_cliprect(const Rect&);
=======================================
--- /src/engine/display/sdl_framebuffer.cpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/sdl_framebuffer.cpp Thu Oct 13 19:03:23 2011
@@ -135,7 +135,7 @@
}
} // namespace
-
+
SDLFramebuffer::SDLFramebuffer() :
screen(0),
cliprect_stack()
@@ -444,6 +444,18 @@
exit(1);
}
}
+
+bool
+SDLFramebuffer::is_fullscreen() const
+{
+ return screen->flags | SDL_FULLSCREEN;
+}
+
+bool
+SDLFramebuffer::is_resizable() const
+{
+ return screen->flags | SDL_RESIZABLE;
+}
void
SDLFramebuffer::push_cliprect(const Rect& rect)
=======================================
--- /src/engine/display/sdl_framebuffer.hpp Sat Oct 1 13:19:58 2011
+++ /src/engine/display/sdl_framebuffer.hpp Thu Oct 13 19:03:23 2011
@@ -32,6 +32,8 @@
FramebufferSurface create_surface(const Surface& surface);
void set_video_mode(const Size& size, bool fullscreen, bool resizable);
+ bool is_fullscreen() const;
+ bool is_resizable() const;
void flip();
void update_rects(const std::vector<Rect>& rects);
=======================================
--- /src/engine/display/sprite_impl.cpp Sat Sep 17 14:42:25 2011
+++ /src/engine/display/sprite_impl.cpp Thu Oct 13 19:03:23 2011
@@ -37,7 +37,7 @@
if (!surface) assert(!"Surface Couldn't find 404");
}
- return Display::get_framebuffer().create_surface(surface);
+ return Display::get_framebuffer()->create_surface(surface);
}
SpriteImpl::SpriteImpl() :
@@ -90,7 +90,7 @@
SpriteImpl::SpriteImpl(const Surface& surface) :
filename(),
- framebuffer_surface(Display::get_framebuffer().create_surface(surface)),
+ framebuffer_surface(Display::get_framebuffer()->create_surface(surface)),
offset(0,0),
frame_pos(0,0),
frame_size(surface.get_width(), surface.get_height()),
=======================================
--- /src/engine/screen/screen_manager.cpp Tue Oct 11 07:00:51 2011
+++ /src/engine/screen/screen_manager.cpp Thu Oct 13 19:03:23 2011
@@ -266,13 +266,13 @@
get_current_screen()->draw(*display_gc);
// Render the DrawingContext to the screen
- display_gc->render(Display::get_framebuffer(), Rect(Vector2i(0,0),
Size(Display::get_width(),
-
Display::get_height())));
+ display_gc->render(*Display::get_framebuffer(), Rect(Vector2i(0,0),
Size(Display::get_width(),
+
Display::get_height())));
display_gc->clear();
// Draw the mouse pointer
if (globals::software_cursor)
- cursor.render(mouse_pos.x, mouse_pos.y, Display::get_framebuffer());
+ cursor.render(mouse_pos.x, mouse_pos.y, *Display::get_framebuffer());
// Draw FPS Counter
if (globals::print_fps)
@@ -281,13 +281,13 @@
if (globals::developer_mode)
{
Fonts::pingus_small.render(origin_center, Display::get_width()/2, 60,
- "Developer Mode",
Display::get_framebuffer());
+ "Developer Mode",
*Display::get_framebuffer());
}
}
else if (globals::developer_mode)
{
Fonts::pingus_small.render(origin_center, Display::get_width()/2, 35,
- "Developer Mode",
Display::get_framebuffer());
+ "Developer Mode",
*Display::get_framebuffer());
}
Display::flip_display();
@@ -355,7 +355,7 @@
Uint32 last_ticks = SDL_GetTicks();
float progress = 0.0f;
- Framebuffer& fb = Display::get_framebuffer();
+ Framebuffer& fb = *Display::get_framebuffer();
while (progress <= 1.0f)
{
int border_x =
static_cast<int>(static_cast<float>(Display::get_width()/2) * (1.0f -
progress));
@@ -371,7 +371,7 @@
Display::get_height() - 2*border_y)));
new_screen->draw(*display_gc);
- display_gc->render(Display::get_framebuffer(), Rect(Vector2i(0,0),
Size(Display::get_width(),
+ display_gc->render(*Display::get_framebuffer(), Rect(Vector2i(0,0),
Size(Display::get_width(),
Display::get_height())));
display_gc->clear();
=======================================
--- /src/pingus/components/playfield.cpp Wed Sep 28 09:41:01 2011
+++ /src/pingus/components/playfield.cpp Thu Oct 13 19:03:23 2011
@@ -139,7 +139,7 @@
}
}
- if (globals::auto_scrolling && (globals::fullscreen_enabled ||
SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON))
+ if (globals::auto_scrolling && (Display::is_fullscreen() ||
SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON))
{
scroll_speed = static_cast<int>(800 * delta);
=======================================
--- /src/pingus/config_manager.cpp Sun Oct 9 09:35:56 2011
+++ /src/pingus/config_manager.cpp Thu Oct 13 19:03:23 2011
@@ -65,7 +65,7 @@
}
int
-ConfigManager::get_master_volume()
+ConfigManager::get_master_volume() const
{
return static_cast<int>(Sound::PingusSound::get_master_volume() * 100);
}
@@ -80,7 +80,7 @@
}
int
-ConfigManager::get_sound_volume()
+ConfigManager::get_sound_volume() const
{
return static_cast<int>(Sound::PingusSound::get_sound_volume() * 100);
}
@@ -95,7 +95,7 @@
}
int
-ConfigManager::get_music_volume()
+ConfigManager::get_music_volume() const
{
return static_cast<int>(Sound::PingusSound::get_music_volume() * 100);
}
@@ -107,9 +107,9 @@
if (size != get_fullscreen_resolution())
{
- if (globals::fullscreen_enabled)
- {
- Display::set_video_mode(size, globals::fullscreen_enabled, false);
+ if (Display::is_fullscreen())
+ {
+ Display::set_video_mode(size, Display::is_fullscreen(), false);
}
on_fullscreen_resolution_change(size);
}
@@ -118,7 +118,7 @@
}
Size
-ConfigManager::get_fullscreen_resolution()
+ConfigManager::get_fullscreen_resolution() const
{
return m_opts.fullscreen_resolution.get();
}
@@ -130,9 +130,7 @@
if (v != get_fullscreen())
{
- globals::fullscreen_enabled = v;
- Size screen_size = Display::get_size();
- Display::set_video_mode(screen_size, globals::fullscreen_enabled,
false);
+ Display::set_video_mode(Display::get_size(), Display::is_fullscreen(),
false);
on_fullscreen_change(v);
}
@@ -140,9 +138,9 @@
}
bool
-ConfigManager::get_fullscreen()
-{
- return globals::fullscreen_enabled;
+ConfigManager::get_fullscreen() const
+{
+ return m_opts.fullscreen.get();
}
void
@@ -171,9 +169,9 @@
}
bool
-ConfigManager::get_resizable()
-{
- return false;
+ConfigManager::get_resizable() const
+{
+ return m_opts.resizable.get();
}
void
@@ -191,7 +189,7 @@
}
bool
-ConfigManager::get_mouse_grab()
+ConfigManager::get_mouse_grab() const
{
return (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON);
}
@@ -211,7 +209,7 @@
}
bool
-ConfigManager::get_print_fps()
+ConfigManager::get_print_fps() const
{
return globals::print_fps;
}
@@ -231,7 +229,7 @@
}
tinygettext::Language
-ConfigManager::get_language()
+ConfigManager::get_language() const
{
return dictionary_manager.get_language();
}
@@ -251,7 +249,7 @@
}
bool
-ConfigManager::get_software_cursor()
+ConfigManager::get_software_cursor() const
{
return globals::software_cursor;
}
@@ -271,7 +269,7 @@
}
bool
-ConfigManager::get_auto_scrolling()
+ConfigManager::get_auto_scrolling() const
{
return globals::auto_scrolling;
}
@@ -288,11 +286,11 @@
}
bool
-ConfigManager::get_drag_drop_scrolling()
+ConfigManager::get_drag_drop_scrolling() const
{
return globals::drag_drop_scrolling;
}
-
+
Options
ConfigManager::get_options() const
{
=======================================
--- /src/pingus/config_manager.hpp Sun Oct 2 14:43:23 2011
+++ /src/pingus/config_manager.hpp Thu Oct 13 19:03:23 2011
@@ -38,23 +38,23 @@
Options get_options() const;
void set_master_volume(int);
- int get_master_volume();
+ int get_master_volume() const;
boost::signal<void(int)> on_master_volume_change;
void set_sound_volume(int);
- int get_sound_volume();
+ int get_sound_volume() const;
boost::signal<void(int)> on_sound_volume_change;
void set_music_volume(int);
- int get_music_volume();
+ int get_music_volume() const;
boost::signal<void(int)> on_music_volume_change;
void set_fullscreen_resolution(const Size& size);
- Size get_fullscreen_resolution();
+ Size get_fullscreen_resolution() const;
boost::signal<void(Size)> on_fullscreen_resolution_change;
void set_fullscreen(bool);
- bool get_fullscreen();
+ bool get_fullscreen() const;
boost::signal<void(bool)> on_fullscreen_change;
void set_renderer(FramebufferType type);
@@ -62,31 +62,31 @@
boost::signal<void(FramebufferType)> on_renderer_change;
void set_resizable(bool);
- bool get_resizable();
+ bool get_resizable() const;
boost::signal<void(bool)> on_resizable_change;
void set_mouse_grab(bool);
- bool get_mouse_grab();
+ bool get_mouse_grab() const;
boost::signal<void(bool)> on_mouse_grab_change;
void set_print_fps(bool);
- bool get_print_fps();
+ bool get_print_fps() const;
boost::signal<void(bool)> on_print_fps_change;
void set_language(const tinygettext::Language&);
- tinygettext::Language get_language();
+ tinygettext::Language get_language() const;
boost::signal<void(const tinygettext::Language&)> on_language_change;
void set_software_cursor(bool);
- bool get_software_cursor();
+ bool get_software_cursor() const;
boost::signal<void(bool)> on_software_cursor_change;
void set_auto_scrolling(bool);
- bool get_auto_scrolling();
+ bool get_auto_scrolling() const;
boost::signal<void(bool)> on_auto_scrolling_change;
void set_drag_drop_scrolling(bool);
- bool get_drag_drop_scrolling();
+ bool get_drag_drop_scrolling() const;
boost::signal<void(bool)> on_drag_drop_scrolling_change;
private:
=======================================
--- /src/pingus/fps_counter.cpp Wed Sep 28 11:32:13 2011
+++ /src/pingus/fps_counter.cpp Thu Oct 13 19:03:23 2011
@@ -45,12 +45,12 @@
if (odd_frame)
{
- Fonts::pingus_small.render(origin_center, Display::get_width()/2, 35,
fps_string, Display::get_framebuffer());
+ Fonts::pingus_small.render(origin_center, Display::get_width()/2, 35,
fps_string, *Display::get_framebuffer());
odd_frame = false;
}
else
{
- Fonts::pingus_small.render(origin_center, Display::get_width()/2,
35, "+ " + fps_string + " +", Display::get_framebuffer());
+ Fonts::pingus_small.render(origin_center, Display::get_width()/2,
35, "+ " + fps_string + " +", *Display::get_framebuffer());
odd_frame = true;
}
}
=======================================
--- /src/pingus/globals.cpp Sat Oct 1 11:09:48 2011
+++ /src/pingus/globals.cpp Thu Oct 13 19:03:23 2011
@@ -38,7 +38,6 @@
std::string global_email;
std::string default_language = "en";
-bool fullscreen_enabled = false;
bool delta_drawing = false;
bool static_graphics = false;
=======================================
--- /src/pingus/globals.hpp Sat Oct 1 11:09:48 2011
+++ /src/pingus/globals.hpp Thu Oct 13 19:03:23 2011
@@ -38,7 +38,6 @@
extern bool auto_scrolling; ///<
--enable-auto-scrolling
extern bool drag_drop_scrolling;
extern int tile_size; ///< --tile-size
-extern bool fullscreen_enabled; ///<
--enable-fullscreen
extern int default_screen_width; ///< default screen
width
extern int default_screen_height; ///< default screen
height
extern bool draw_collision_map; ///<
=======================================
--- /src/pingus/pingus_main.cpp Wed Oct 12 11:20:28 2011
+++ /src/pingus/pingus_main.cpp Thu Oct 13 19:03:23 2011
@@ -131,10 +131,6 @@
exit(EXIT_SUCCESS);
}
-
- // Display
- if (options.fullscreen.is_set())
- globals::fullscreen_enabled = options.fullscreen.get();
if (options.software_cursor.is_set())
globals::software_cursor = options.software_cursor.get();
@@ -495,12 +491,16 @@
else
std::cout << "music support: disabled" << std::endl;
- // FIXME: std::cout << "resolution: "
- // FIXME: << config_manager.get_resolution().width << "x"
- // FIXME: << config_manager.get_resolution().height <<
std::endl;
- std::cout << "fullscreen: "
- << (globals::fullscreen_enabled ? " enabled" : "disabled")
- << std::endl;
+ std::cout << "fullscreen: ";
+ if (config_manager.get_fullscreen())
+ {
+ std::cout << config_manager.get_fullscreen_resolution().width << "x"
+ << config_manager.get_fullscreen_resolution().height <<
std::endl;
+ }
+ else
+ {
+ std::cout << "disabled" << std::endl;
+ }
std::cout << std::endl;
}
@@ -608,13 +608,17 @@
SDLSystem system;
if (cmd_options.geometry.is_set())
{
- system.create_window(fbtype, cmd_options.geometry.get(),
globals::fullscreen_enabled,
- cmd_options.resizable.is_set() ?
cmd_options.resizable.get() : true);
+ system.create_window(fbtype,
+ cmd_options.geometry.get(),
+ cmd_options.fullscreen.is_set() ?
cmd_options.fullscreen.get() : false,
+ cmd_options.resizable.is_set() ?
cmd_options.resizable.get() : true);
}
else
{
- system.create_window(fbtype, Size(800, 600),
globals::fullscreen_enabled,
- cmd_options.resizable.is_set() ?
cmd_options.resizable.get() : true);
+ system.create_window(fbtype,
+ Size(800, 600),
+ cmd_options.fullscreen.is_set() ?
cmd_options.fullscreen.get() : false,
+ cmd_options.resizable.is_set() ?
cmd_options.resizable.get() : true);
}
SavegameManager savegame_manager("savegames/savegames.scm");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] [pingus] push by address@hidden - Removed globals::fullscreen_enabled, ConfigManager still needs much mo... on 2011-10-14 02:06 GMT,
pingus <=