[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2543 - in trunk/src: components display editor
From: |
jave27 |
Subject: |
[Pingus-CVS] r2543 - in trunk/src: components display editor |
Date: |
Tue, 6 Dec 2005 04:28:37 +0100 |
Author: jave27
Date: 2005-12-06 04:28:27 +0100 (Tue, 06 Dec 2005)
New Revision: 2543
Modified:
trunk/src/components/playfield.cxx
trunk/src/display/scene_context.cxx
trunk/src/display/scene_context.hxx
trunk/src/editor/editor_viewport.cxx
trunk/src/editor/editor_viewport.hxx
Log:
A little more editor work.
Modified: trunk/src/components/playfield.cxx
===================================================================
--- trunk/src/components/playfield.cxx 2005-12-06 01:11:05 UTC (rev 2542)
+++ trunk/src/components/playfield.cxx 2005-12-06 03:28:27 UTC (rev 2543)
@@ -107,7 +107,7 @@
}
state.pop(*scene_context);
- gc.draw(new SceneContextDrawingRequest(scene_context, -10000));
+ gc.draw(new SceneContextDrawingRequest(scene_context,
CL_Vector(0,0,-10000)));
}
Pingu*
Modified: trunk/src/display/scene_context.cxx
===================================================================
--- trunk/src/display/scene_context.cxx 2005-12-06 01:11:05 UTC (rev 2542)
+++ trunk/src/display/scene_context.cxx 2005-12-06 03:28:27 UTC (rev 2543)
@@ -158,8 +158,8 @@
impl->highlight.clear();
}
-SceneContextDrawingRequest::SceneContextDrawingRequest(SceneContext* sc_,
float z)
- : DrawingRequest(CL_Vector(0, 0, z)),
+SceneContextDrawingRequest::SceneContextDrawingRequest(SceneContext* sc_,
const CL_Vector& pos_)
+ : DrawingRequest(pos_),
sc(sc_)
{
}
Modified: trunk/src/display/scene_context.hxx
===================================================================
--- trunk/src/display/scene_context.hxx 2005-12-06 01:11:05 UTC (rev 2542)
+++ trunk/src/display/scene_context.hxx 2005-12-06 03:28:27 UTC (rev 2543)
@@ -89,7 +89,7 @@
CL_Color color;
SceneContext* sc;
public:
- SceneContextDrawingRequest(SceneContext* sc, float z = 0);
+ SceneContextDrawingRequest(SceneContext* sc, const CL_Vector& pos_ =
CL_Vector(0,0,0,0));
virtual ~SceneContextDrawingRequest();
void draw(CL_GraphicContext* gc);
};
Modified: trunk/src/editor/editor_viewport.cxx
===================================================================
--- trunk/src/editor/editor_viewport.cxx 2005-12-06 01:11:05 UTC (rev
2542)
+++ trunk/src/editor/editor_viewport.cxx 2005-12-06 03:28:27 UTC (rev
2543)
@@ -36,7 +36,6 @@
EditorViewport::EditorViewport(EditorScreen* e) :
state((int)(end_pos.x - start_pos.x), (int)(end_pos.y - start_pos.y)),
scene_context(new SceneContext()),
- translate(0),
editor(e),
bg_surface(0),
start_pos(Vector(10.0f, 60.0f)),
@@ -68,24 +67,16 @@
void
EditorViewport::draw(DrawingContext &gc)
{
- // FIXME: Temporary hack to test translation
- if (translate == 0)
- gc.reset_modelview();
- else if (translate == 3)
- gc.translate(0, 5);
- else if (translate == 4)
- gc.translate(0, -5);
-
- //scene_context->clear();
- //state.push(*scene_context);
-
+ scene_context->clear();
+ state.push(*scene_context);
+
// Now, draw all of the objects
// FIXME: Should draw the background over the whole viewport (stretched
or tiled)
if (bg_surface)
- gc.draw(*bg_surface, start_pos);
+ scene_context->color().draw(*bg_surface, start_pos);
else
- gc.draw_fillrect(start_pos.x, start_pos.y,
+ scene_context->color().draw_fillrect(start_pos.x, start_pos.y,
end_pos.x, end_pos.y, CL_Color::darkgray, -5000);
@@ -93,12 +84,11 @@
// Draw the level objects
std::vector<LevelObj*> objs = editor->get_level()->get_objects();
for (unsigned i = 0; i < objs.size(); i++)
- objs[i]->draw(gc);
+ objs[i]->draw(scene_context->color());
- //state.pop(*scene_context);
-
- //gc.draw(new SceneContextDrawingRequest(scene_context, 0));
-
+ state.pop(*scene_context);
+ gc.draw(new SceneContextDrawingRequest(scene_context,
CL_Vector(state.get_pos().x,
+ state.get_pos().y)));
}
// Returns true if the viewport is at the x,y coordinate
@@ -120,25 +110,19 @@
EditorViewport::update(float delta)
{
// Autoscroll if necessary
- //if (autoscroll)
- if (0)
+ if (autoscroll)
{
const int autoscroll_border = 10;
if (autoscroll)
{
if (mouse_at.x - start_pos.x < autoscroll_border)
- std::cout << "AutoScroll left" << std::endl;
+ state.set_pos(state.get_pos() - CL_Pointf(5,
0));
else if (end_pos.x - mouse_at.x < autoscroll_border)
- std::cout << "AutoScroll right" << std::endl;
+ state.set_pos(state.get_pos() + CL_Pointf(5,
0));
else if (mouse_at.y - start_pos.y < autoscroll_border)
- // This should be the right code, I just need
to learn how it works:
- // state.set_pos(state.get_pos() - CL_Pointf(0,
5.0f));
- translate = 3;
+ state.set_pos(state.get_pos() - CL_Pointf(0,
5));
else if (end_pos.y - mouse_at.y < autoscroll_border)
- //state.set_pos(state.get_pos() + CL_Pointf(0,
5.0f));
- translate = 4;
- else
- translate = 0;
+ state.set_pos(state.get_pos() + CL_Pointf(0,
5));
}
}
}
Modified: trunk/src/editor/editor_viewport.hxx
===================================================================
--- trunk/src/editor/editor_viewport.hxx 2005-12-06 01:11:05 UTC (rev
2542)
+++ trunk/src/editor/editor_viewport.hxx 2005-12-06 03:28:27 UTC (rev
2543)
@@ -75,9 +75,6 @@
GraphicContextState state;
SceneContext* scene_context;
-
- // FIXME: Temporary hack for translation testing:
- int translate;
/** The EditorScreen to which this viewport belongs */
EditorScreen* editor;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2543 - in trunk/src: components display editor,
jave27 <=