*/
void kill_me(int score);
+ /** initializes the badguy (when he appears on screen) */
+ void activate(Direction direction); // should only be used by BadGuy's objects
+
private:
void init();
void action_wingling(double frame_ratio);
void action_walkingtree(double frame_ratio);
- /** initializes the badguy (when he appears on screen) */
- void activate(Direction direction);
-
/** handles falling down. disables gravity calculation when we're back on
* ground */
void fall();
writer->write_int("time", time_left);
for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i)
+ {
+ writer->start_list("sector");
i->second->write(*writer);
+ writer->end_list("sector");
+ }
writer->end_list("supertux-level");
void
DrawingContext::draw_text(Font* font, const std::string& text,
- const Vector& position, int layer)
+ const Vector& position, int layer, Uint32 drawing_effect)
{
DrawingRequest request;
request.type = TEXT;
request.layer = layer;
request.pos = transform.apply(position);
+ request.drawing_effect = drawing_effect;
TextRequest* textrequest = new TextRequest;
textrequest->font = font;
void
DrawingContext::draw_text_center(Font* font, const std::string& text,
- const Vector& position, int layer)
+ const Vector& position, int layer, Uint32 drawing_effect)
{
DrawingRequest request;
request.layer = layer;
request.pos = transform.apply(position) + Vector(screen->w/2 -
font->get_text_width(text)/2, 0);
+ request.drawing_effect = drawing_effect;
TextRequest* textrequest = new TextRequest;
textrequest->font = font;
{
TextRequest* textrequest = (TextRequest*) request.request_data;
- textrequest->font->draw(textrequest->text, request.pos);
+ textrequest->font->draw(textrequest->text, request.pos, request.drawing_effect);
delete textrequest;
}
float y = request.pos.y;
float w = fillrectrequest->size.x;
float h = fillrectrequest->size.y;
+
#ifndef NOOPENGL
if(use_gl)
{
Uint32 drawing_effect = NONE_EFFECT);
/** draws a text */
void draw_text(Font* font, const std::string& text, const Vector& position,
- int layer);
+ int layer, Uint32 drawing_effect = NONE_EFFECT);
/** draws aligned text */
void draw_text_center(Font* font, const std::string& text,
- const Vector& position, int layer);
+ const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT);
/** draws a color gradient onto the whole screen */
void draw_gradient(Color from, Color to, int layer);
/** fills a rectangle */
}
void
-Font::draw(const std::string& text, const Vector& pos)
+Font::draw(const std::string& text, const Vector& pos, Uint32 drawing_effect)
{
if(shadowsize > 0)
- draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize));
+ draw_chars(shadow_chars, text, pos + Vector(shadowsize, shadowsize),
+ drawing_effect);
- draw_chars(chars, text, pos);
+ draw_chars(chars, text, pos, drawing_effect);
}
void
-Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos)
+Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos,
+ Uint32 drawing_effect)
{
SurfaceImpl* impl = pchars->impl;
int source_x = (index % 16) * w;
int source_y = (index / 16) * h;
- impl->draw_part(source_x, source_y, p.x, p.y, w, h, 255);
+ impl->draw_part(source_x, source_y, p.x, p.y, w, h, 255, drawing_effect);
p.x += w;
}
}
private:
friend class DrawingContext;
- void draw(const std::string& text, const Vector& pos);
+ void draw(const std::string& text, const Vector& pos,
+ Uint32 drawing_effect = NONE_EFFECT);
void draw_chars(Surface* pchars, const std::string& text,
- const Vector& position);
+ const Vector& position, Uint32 drawing_effect);
Surface* chars;
Surface* shadow_chars;
{
writer.write_string("name", name);
writer.write_float("gravity", gravity);
+ writer.write_string("music", song_title);
for(GameObjects::iterator i = gameobjects.begin();
i != gameobjects.end(); ++i) {
else if(layer == "foreground")
layer = LAYER_FOREGROUNDTILES;
else
- std::cout << "Unknown layer '" << layer << "' in tilemap.\n";
+ std::cerr << "Unknown layer '" << layer << "' in tilemap.\n";
}
reader.read_bool("solid", solid);
else if(layer == LAYER_FOREGROUNDTILES)
writer.write_string("layer", "foreground");
else {
- std::cout << "Warning unknown layer in tilemap.\n";
+ writer.write_string("layer", "unknown");
+ std::cerr << "Warning unknown layer in tilemap.\n";
}
writer.write_bool("solid", solid);