[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3783 - in trunk/pingus/src: . display screen
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3783 - in trunk/pingus/src: . display screen |
Date: |
Fri, 11 Jul 2008 13:08:39 +0200 |
Author: grumbel
Date: 2008-07-11 13:08:37 +0200 (Fri, 11 Jul 2008)
New Revision: 3783
Modified:
trunk/pingus/src/display/drawing_context.cpp
trunk/pingus/src/display/framebuffer.hpp
trunk/pingus/src/screen/screen_manager.cpp
trunk/pingus/src/sprite.cpp
trunk/pingus/src/sprite.hpp
trunk/pingus/src/sprite_impl.cpp
trunk/pingus/src/sprite_impl.hpp
Log:
Change some more code to use Framebuffer
Modified: trunk/pingus/src/display/drawing_context.cpp
===================================================================
--- trunk/pingus/src/display/drawing_context.cpp 2008-07-11 10:43:21 UTC
(rev 3782)
+++ trunk/pingus/src/display/drawing_context.cpp 2008-07-11 11:08:37 UTC
(rev 3783)
@@ -72,7 +72,7 @@
virtual ~SpriteDrawingRequest() {}
void render(Framebuffer& fb, const Rect& rect) {
- sprite.render(pos.x + rect.left, pos.y + rect.top, fb.get_screen());
+ sprite.render(pos.x + rect.left, pos.y + rect.top, fb);
}
};
@@ -80,6 +80,7 @@
{
private:
Color color;
+
public:
FillScreenDrawingRequest(const Color& color_)
: DrawingRequest(Vector3f(0, 0, -1000.0f)), color(color_)
@@ -88,12 +89,7 @@
virtual ~FillScreenDrawingRequest() {}
void render(Framebuffer& fb, const Rect& rect) {
- SDL_Rect r;
- r.x = rect.left;
- r.y = rect.top;
- r.w = rect.get_width();
- r.h = rect.get_height();
- SDL_FillRect(fb.get_screen(), &r, SDL_MapRGB(fb.get_screen()->format,
color.r, color.g, color.b));
+ fb.fill_rect(rect, color);
}
};
@@ -118,8 +114,8 @@
void render(Framebuffer& fb, const Rect& rect)
{
- Display::draw_line(pos1 + Vector2i(rect.left, rect.top),
- pos2 + Vector2i(rect.left, rect.top), color);
+ fb.draw_line(pos1 + Vector2i(rect.left, rect.top),
+ pos2 + Vector2i(rect.left, rect.top), color);
}
};
@@ -140,17 +136,17 @@
{
if (filled)
{
- Display::fill_rect(Rect(Vector2i(d_rect.left + rect.left,
- d_rect.top + rect.top),
- d_rect.get_size()),
- color);
+ fb.fill_rect(Rect(Vector2i(d_rect.left + rect.left,
+ d_rect.top + rect.top),
+ d_rect.get_size()),
+ color);
}
else
{
- Display::draw_rect(Rect(Vector2i(d_rect.left + rect.left,
- d_rect.top + rect.top),
- d_rect.get_size()),
- color);
+ fb.draw_rect(Rect(Vector2i(d_rect.left + rect.left,
+ d_rect.top + rect.top),
+ d_rect.get_size()),
+ color);
}
}
};
@@ -204,7 +200,7 @@
Math::min(rect.bottom + parent_rect.top,
parent_rect.bottom));
if (do_clipping)
- Display::push_cliprect(this_rect);
+ fb.push_cliprect(this_rect);
std::stable_sort(drawingrequests.begin(), drawingrequests.end(),
DrawingRequestsSorter());
@@ -222,7 +218,7 @@
}
if (do_clipping)
- Display::pop_cliprect();
+ fb.pop_cliprect();
}
void
Modified: trunk/pingus/src/display/framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/framebuffer.hpp 2008-07-11 10:43:21 UTC (rev
3782)
+++ trunk/pingus/src/display/framebuffer.hpp 2008-07-11 11:08:37 UTC (rev
3783)
@@ -23,7 +23,6 @@
#include "math/vector2i.hpp"
#include "math/rect.hpp"
-/** */
class Framebuffer
{
private:
Modified: trunk/pingus/src/screen/screen_manager.cpp
===================================================================
--- trunk/pingus/src/screen/screen_manager.cpp 2008-07-11 10:43:21 UTC (rev
3782)
+++ trunk/pingus/src/screen/screen_manager.cpp 2008-07-11 11:08:37 UTC (rev
3783)
@@ -264,7 +264,7 @@
// Draw the mouse pointer
if (swcursor_enabled)
- cursor.render(mouse_pos.x, mouse_pos.y, Display::get_screen());
+ cursor.render(mouse_pos.x, mouse_pos.y, Display::get_framebuffer());
// Draw FPS Counter
if (print_fps)
Modified: trunk/pingus/src/sprite.cpp
===================================================================
--- trunk/pingus/src/sprite.cpp 2008-07-11 10:43:21 UTC (rev 3782)
+++ trunk/pingus/src/sprite.cpp 2008-07-11 11:08:37 UTC (rev 3783)
@@ -86,10 +86,10 @@
}
void
-Sprite::render(float x, float y, SDL_Surface* target)
+Sprite::render(float x, float y, Framebuffer& fb)
{
if (impl.get())
- impl->render(x, y, target);
+ impl->render(x, y, fb);
}
int
Modified: trunk/pingus/src/sprite.hpp
===================================================================
--- trunk/pingus/src/sprite.hpp 2008-07-11 10:43:21 UTC (rev 3782)
+++ trunk/pingus/src/sprite.hpp 2008-07-11 11:08:37 UTC (rev 3783)
@@ -29,6 +29,7 @@
class SpriteImpl;
class SpriteDescription;
class ResDescriptor;
+class Framebuffer;
class Sprite
{
@@ -46,7 +47,7 @@
void update(float delta = 0.033f);
- void render(float x, float y, SDL_Surface* target);
+ void render(float x, float y, Framebuffer& target);
void set_hotspot(Origin origin, int x, int y);
Vector2i get_offset() const;
void set_frame(int i);
Modified: trunk/pingus/src/sprite_impl.cpp
===================================================================
--- trunk/pingus/src/sprite_impl.cpp 2008-07-11 10:43:21 UTC (rev 3782)
+++ trunk/pingus/src/sprite_impl.cpp 2008-07-11 11:08:37 UTC (rev 3783)
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
+#include "display/framebuffer.hpp"
#include "sprite_description.hpp"
#include "sprite_impl.hpp"
@@ -110,7 +111,7 @@
}
void
-SpriteImpl::render(float x, float y, SDL_Surface* dst)
+SpriteImpl::render(float x, float y, Framebuffer& fb)
{
if (!optimized)
optimize();
@@ -128,7 +129,7 @@
srcrect.x = frame_pos.x + (srcrect.w * (frame%array.width));
srcrect.y = frame_pos.y + (srcrect.h * (frame/array.width));
- SDL_BlitSurface(surface.get_surface(), &srcrect, dst, &dstrect);
+ SDL_BlitSurface(surface.get_surface(), &srcrect, fb.get_screen(), &dstrect);
}
void
Modified: trunk/pingus/src/sprite_impl.hpp
===================================================================
--- trunk/pingus/src/sprite_impl.hpp 2008-07-11 10:43:21 UTC (rev 3782)
+++ trunk/pingus/src/sprite_impl.hpp 2008-07-11 11:08:37 UTC (rev 3783)
@@ -20,6 +20,7 @@
#include "surface.hpp"
#include "math/vector2i.hpp"
+class Framebuffer;
class SpriteDescription;
class SpriteImpl
@@ -54,7 +55,7 @@
void optimize();
void update(float delta);
- void render(float x, float y, SDL_Surface* dst);
+ void render(float x, float y, Framebuffer& fb);
void restart();
void finish();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3783 - in trunk/pingus/src: . display screen,
grumbel at BerliOS <=