[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3097 - in trunk/pingus/src: display editor
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3097 - in trunk/pingus/src: display editor |
Date: |
Thu, 6 Sep 2007 18:49:20 +0200 |
Author: grumbel
Date: 2007-09-06 18:49:19 +0200 (Thu, 06 Sep 2007)
New Revision: 3097
Modified:
trunk/pingus/src/display/drawing_context.cpp
trunk/pingus/src/display/drawing_context.hpp
trunk/pingus/src/editor/object_selector.cpp
trunk/pingus/src/editor/object_selector.hpp
Log:
- changed ObjectSelector to use DrawingContext instead of SceneContext
Modified: trunk/pingus/src/display/drawing_context.cpp
===================================================================
--- trunk/pingus/src/display/drawing_context.cpp 2007-09-06 16:12:02 UTC
(rev 3096)
+++ trunk/pingus/src/display/drawing_context.cpp 2007-09-06 16:49:19 UTC
(rev 3097)
@@ -160,21 +160,20 @@
class DrawingContextDrawingRequest : public DrawingRequest
{
private:
- DrawingContext* dc;
+ DrawingContext& dc;
public:
- DrawingContextDrawingRequest(DrawingContext* dc_, float z)
+ DrawingContextDrawingRequest(DrawingContext& dc_, float z)
: DrawingRequest(Vector3f(0,0,z)),
dc(dc_)
{}
virtual ~DrawingContextDrawingRequest()
{
- delete dc;
}
void render(SDL_Surface* target, const Rect& rect) {
- dc->render(target, rect);
+ dc.render(target, rect);
}
};
@@ -182,7 +181,7 @@
: rect(rect_),
do_clipping(clip)
{
-
+ translate_stack.push_back(Vector3f(0, 0));
}
DrawingContext::DrawingContext()
@@ -244,7 +243,7 @@
}
void
-DrawingContext::draw(DrawingContext* dc, float z)
+DrawingContext::draw(DrawingContext& dc, float z)
{
draw(new DrawingContextDrawingRequest(dc, z));
}
Modified: trunk/pingus/src/display/drawing_context.hpp
===================================================================
--- trunk/pingus/src/display/drawing_context.hpp 2007-09-06 16:12:02 UTC
(rev 3096)
+++ trunk/pingus/src/display/drawing_context.hpp 2007-09-06 16:49:19 UTC
(rev 3097)
@@ -69,7 +69,7 @@
ignored. DrawingContext ownership is transfered to this
DrawingContext FIXME: Not such a good feeling with this, but
worth a try */
- void draw(DrawingContext* dc, float z = 0);
+ void draw(DrawingContext& dc, float z = 0);
void draw(const Sprite& sprite, const Vector3f& pos);
void draw(const Sprite& sprite, float x, float y, float z = 0);
Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2007-09-06 16:12:02 UTC (rev
3096)
+++ trunk/pingus/src/editor/object_selector.cpp 2007-09-06 16:49:19 UTC (rev
3097)
@@ -29,14 +29,14 @@
#include "editor_screen.hpp"
#include "display/drawing_context.hpp"
#include "fonts.hpp"
-#include "display/scene_context.hpp"
+#include "display/drawing_context.hpp"
#include "gui/gui_manager.hpp"
#include "object_selector.hpp"
#include "resource.hpp"
namespace Editor {
-
+
class ObjectSelectorButton : public GUI::Component
{
private:
@@ -133,16 +133,13 @@
ObjectSelector::ObjectSelector(EditorScreen* editor_)
: editor(editor_),
button_pos(Display::get_width() - 242, 40),
- scene_context(new SceneContext()),
rect(Vector2i(Display::get_width() - 244 + 2, 38 + 3 + 62),
Size(240, 495)),
+ drawing_context(new DrawingContext(rect)),
offset(0),
old_offset(0),
mode(NOTHING)
{
- scene_context->translate(rect.left, rect.top);
- scene_context->set_cliprect(rect);
-
editor->get_gui_manager()->add(this, true);
add_button("core/editor/obj_entrance", "Entrance");
@@ -169,13 +166,6 @@
void
ObjectSelector::draw(DrawingContext& parent_gc)
{
- // FIXME: SceneContext is overkill for this, DrawingContext would be
- // enough, but that can't do cliprects right know
- scene_context->clear();
-
- scene_context->push_modelview();
- scene_context->translate(0, offset);
-
Rect rect(int(parent_gc.get_width()) - 244, 38,
int(parent_gc.get_width()), int(parent_gc.get_height()));
@@ -189,8 +179,13 @@
parent_gc.draw_fillrect(rect.left+1, rect.top+1, rect.right-1, rect.bottom-1,
Color(237, 233, 227));
- DrawingContext& gc = scene_context->color();
+ DrawingContext& gc = *drawing_context;
+ gc.clear();
+
+ gc.push_modelview();
+ gc.translate(0, offset);
+
// black
//gc.fill_screen(Color(0,0,0));
@@ -202,8 +197,10 @@
(((x-(y%2)) % 2) ? Color(0,0,0) :
Color(100,100,100)));
}
- parent_gc.draw(new SceneContextDrawingRequest(scene_context,
Vector3f(0,0,0)));
- scene_context->pop_modelview();
+ //parent_gc.draw(drawing_context);
+ gc.pop_modelview();
+
+ parent_gc.draw(gc);
}
void
@@ -268,7 +265,7 @@
offset = old_offset + (y - drag_start.y);
}
}
-
+
} // namespace Editor
/* EOF */
Modified: trunk/pingus/src/editor/object_selector.hpp
===================================================================
--- trunk/pingus/src/editor/object_selector.hpp 2007-09-06 16:12:02 UTC (rev
3096)
+++ trunk/pingus/src/editor/object_selector.hpp 2007-09-06 16:49:19 UTC (rev
3097)
@@ -28,7 +28,7 @@
#include "gui/component.hpp"
-class SceneContext;
+class DrawingContext;
namespace Editor {
@@ -40,8 +40,8 @@
private:
EditorScreen* editor;
Vector2i button_pos;
- SceneContext* scene_context;
Rect rect;
+ DrawingContext* drawing_context;
float offset;
float old_offset;
Vector2i drag_start;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3097 - in trunk/pingus/src: display editor,
grumbel at BerliOS <=