Update of /cvsroot/super-tux/supertux/lib/video
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27770/lib/video
Modified Files:
drawing_context.cpp drawing_context.h
Log Message:
Tweaks.
Index: drawing_context.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- drawing_context.cpp 16 Sep 2004 15:04:16 -0000 1.6
+++ drawing_context.cpp 24 Sep 2004 15:07:22 -0000 1.7
@@ -30,6 +30,7 @@
DrawingContext::DrawingContext()
{
transform.draw_effect = NONE_EFFECT;
+transform.zoom = 1;
}
DrawingContext::~DrawingContext()
@@ -50,6 +51,7 @@
request.pos = transform.apply(position);
request.drawing_effect = drawing_effect;
request.drawing_effect = transform.draw_effect | drawing_effect;
+ request.zoom = transform.zoom;
drawingrequests.push_back(request);
}
@@ -289,7 +291,13 @@
case SURFACE:
{
const Surface* surface = (const Surface*) i->request_data;
- surface->impl->draw(i->pos.x, i->pos.y, 255, i->drawing_effect);
+
+ if(i->zoom != 1.0)
+ surface->impl->draw_stretched(i->pos.x * i->zoom, i->pos.y * i->zoom,
+ (int)(surface->w * i->zoom), (int)(surface->h * i->zoom),
+ 255, i->drawing_effect);
+ else
+ surface->impl->draw(i->pos.x, i->pos.y, 255, i->drawing_effect);
break;
}
case SURFACE_PART:
@@ -336,3 +344,9 @@
{
transform.draw_effect = effect;
}
+
+void
+DrawingContext::set_zooming(float zoom)
+{
+ transform.zoom = zoom;
+}
Index: drawing_context.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- drawing_context.h 16 Sep 2004 15:04:16 -0000 1.7
+++ drawing_context.h 24 Sep 2004 15:07:22 -0000 1.8
@@ -79,19 +79,20 @@
void do_drawing();
const Vector& get_translation() const
- {
- return transform.translation;
- }
+ { return transform.translation; }
+ Uint32 get_drawing_effect() const
+ { return transform.draw_effect; }
+
void set_translation(const Vector& newtranslation)
- {
- transform.translation = newtranslation;
- }
+ { transform.translation = newtranslation; }
void push_transform();
void pop_transform();
/// Apply that effect in the next draws (effects are listed on surface.h).
void set_drawing_effect(int effect);
+ /// apply that zoom in the next draws */
+ void set_zooming(float zoom);
private:
class Transform
@@ -104,7 +105,8 @@
return v - translation;
}
- int draw_effect;
+ Uint32 draw_effect;
+ float zoom;
};
/// the transform stack
@@ -147,6 +149,7 @@
{
int layer;
Uint32 drawing_effect;
+ float zoom;
RequestType type;
Vector pos;
|