From: Matthias Braun Date: Fri, 6 May 2005 19:08:24 +0000 (+0000) Subject: - Made miniswig support HSQUIRRELVM arguments (and realized it was not needed X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f1e15f44f709d6b4fa45e858dc12d7d701ae8ddc;p=supertux.git - Made miniswig support HSQUIRRELVM arguments (and realized it was not needed later :) - added a text object for scripts to use and extended the example for it - removed the pointless uint32_t effect parameter from all the draw methods. Simply use DrawingContext.set_effect if you need it. SVN-Revision: 2419 --- diff --git a/data/levels/test/script.stl b/data/levels/test/script.stl index 75721cd5a..d56402440 100644 --- a/data/levels/test/script.stl +++ b/data/levels/test/script.stl @@ -110,7 +110,7 @@ ) (scriptedobject (name "PENNY") - (x 256) + (x 390) (y 448) (sprite "dummyguy") ) @@ -121,18 +121,25 @@ (sprite "dummyguy") (visible #f) (physic-enabled #f) + (solid #f) ) (init-script " -print(\"Making tux jump...\"); +function wait(time) { + set_wakeup_time(time); + suspend(); +} + +Text.set_text(translate(\"The Crazy Nolok Dance\")); +Text.fade_in(2); TUX.set_animation(\"jump\"); -TUX.set_velocity(150, 200); -wait(3); -suspend(); +wait(4); +Text.fade_out(1); +wait(1); +NOLOK.set_visible(true); PENNY.set_velocity(-200, 200); tuxjumps <- 2; while(true) { wait(0.8); - suspend(); Sound.play_sound(\"jump\"); if(tuxjumps >= 0) { TUX.set_velocity(50, 300); diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 6817efaa9..844fbfb38 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -48,7 +48,10 @@ BadGuy::draw(DrawingContext& context) if(state == STATE_INIT || state == STATE_INACTIVE) return; if(state == STATE_FALLING) { - sprite->draw(context, get_pos(), LAYER_OBJECTS, VERTICAL_FLIP); + uint32_t old_effect = context.get_drawing_effect(); + context.set_drawing_effect(old_effect & VERTICAL_FLIP); + sprite->draw(context, get_pos(), LAYER_OBJECTS); + context.set_drawing_effect(old_effect); } else { sprite->draw(context, get_pos(), LAYER_OBJECTS); } diff --git a/src/game_session.cpp b/src/game_session.cpp index b4d44ade8..cec4a015f 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -533,14 +533,19 @@ GameSession::run() if(!game_pause) global_time += elapsed_time; - skipdraw = false; - // regulate fps ticks = SDL_GetTicks(); if(ticks > fps_nextframe_ticks) { - // don't draw all frames when we're getting too slow - skipdraw = true; + if(skipdraw == true) { + // already skipped last frame? we have to slow down the game then... + skipdraw = false; + fps_nextframe_ticks -= (Uint32) (1000.0 / LOGICAL_FPS); + } else { + // don't draw all frames when we're getting too slow + skipdraw = true; + } } else { + skipdraw = false; while(fps_nextframe_ticks > ticks) { /* just wait */ // If we really have to wait long, then do an imprecise SDL_Delay() diff --git a/src/lisp/lisp.h b/src/lisp/lisp.h index e118298ff..fa4bda554 100644 --- a/src/lisp/lisp.h +++ b/src/lisp/lisp.h @@ -88,7 +88,7 @@ public: return true; } - /* conveniance functions which traverse the list until a child with a + /** conveniance functions which traverse the list until a child with a * specified name is found. The value part is then interpreted in a specific * way. The functions return true, if a child was found and could be * interpreted correctly, otherwise false is returned and the variable value diff --git a/src/object/ambient_sound.cpp b/src/object/ambient_sound.cpp index 2c8b80b8d..31e3f3a0e 100644 --- a/src/object/ambient_sound.cpp +++ b/src/object/ambient_sound.cpp @@ -16,9 +16,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. - #include +#include + #include "ambient_sound.h" #include "object_factory.h" #include "lisp/lisp.h" diff --git a/src/object/player.cpp b/src/object/player.cpp index 935713860..71a6241f5 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -79,17 +79,16 @@ TuxBodyParts::set_action(std::string action, int loops) } void -TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer, - Uint32 drawing_effect) +TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer) { if(head != NULL) - head->draw(context, pos, layer-1, drawing_effect); + head->draw(context, pos, layer-1); if(body != NULL) - body->draw(context, pos, layer-3, drawing_effect); + body->draw(context, pos, layer-3); if(arms != NULL) - arms->draw(context, pos, layer, drawing_effect); + arms->draw(context, pos, layer); if(feet != NULL) - feet->draw(context, pos, layer-2, drawing_effect); + feet->draw(context, pos, layer-2); } Player::Player(PlayerStatus* _player_status) diff --git a/src/object/player.h b/src/object/player.h index 2d4364c59..8a4c6c5c9 100644 --- a/src/object/player.h +++ b/src/object/player.h @@ -64,8 +64,7 @@ public: void set_action(std::string action, int loops = -1); void one_time_animation(); - void draw(DrawingContext& context, const Vector& pos, int layer, - Uint32 drawing_effect = NONE_EFFECT); + void draw(DrawingContext& context, const Vector& pos, int layer); Sprite* head; Sprite* body; diff --git a/src/object/text_object.cpp b/src/object/text_object.cpp new file mode 100644 index 000000000..03ca2b4cf --- /dev/null +++ b/src/object/text_object.cpp @@ -0,0 +1,105 @@ +#include + +#include "text_object.h" +#include "resources.h" +#include "video/drawing_context.h" + +TextObject::TextObject() + : visible(false) +{ + font = blue_text; +} + +TextObject::~TextObject() +{ +} + +void +TextObject::set_font(const std::string& name) +{ + if(name == "gold") { + font = gold_text; + } else if(name == "white") { + font = white_text; + } else if(name == "blue") { + font = blue_text; + } else if(name == "gray") { + font = gray_text; + } else if(name == "white") { + font = white_text; + } else if(name == "big") { + font = white_big_text; + } else if(name == "small") { + font = white_small_text; + } else { + std::cerr << "Unknown font '" << name << "'.\n"; + } +} + +void +TextObject::set_text(const std::string& text) +{ + this->text = text; +} + +void +TextObject::fade_in(float fadetime) +{ + this->fadetime = fadetime; + fading = fadetime; +} + +void +TextObject::fade_out(float fadetime) +{ + this->fadetime = fadetime; + fading = -fadetime; +} + +void +TextObject::set_visible(bool visible) +{ + this->visible = visible; + fading = 0; +} + +void +TextObject::draw(DrawingContext& context) +{ + context.push_transform(); + context.set_translation(Vector(0, 0)); + if(fading > 0) { + context.set_alpha(static_cast + ((fadetime-fading) * 255.0 / fadetime)); + } else if(fading < 0) { + context.set_alpha(static_cast (-fading * 255.0 / fadetime)); + } else if(!visible) { + context.pop_transform(); + return; + } + + context.draw_filled_rect(Vector(125, 50), Vector(550, 120), + Color(150, 180, 200, 125), LAYER_GUI-10); + context.draw_text(font, text, Vector(125+35, 50+35), LEFT_ALLIGN, LAYER_GUI); + + context.pop_transform(); +} + +void +TextObject::action(float elapsed_time) +{ + if(fading > 0) { + fading -= elapsed_time; + if(fading <= 0) { + fading = 0; + visible = true; + } + } else if(fading < 0) { + fading += elapsed_time; + if(fading >= 0) { + fading = 0; + visible = false; + } + } +} + diff --git a/src/object/text_object.h b/src/object/text_object.h new file mode 100644 index 000000000..c78945a8a --- /dev/null +++ b/src/object/text_object.h @@ -0,0 +1,35 @@ +#ifndef __TEXTOBJECT_H__ +#define __TEXTOBJECT_H__ + +#include "game_object.h" +#include "scripting/text.h" + +class Font; + +/** A text object intended for scripts that want to tell a story */ +class TextObject : public GameObject, public Scripting::Text +{ +public: + TextObject(); + virtual ~TextObject(); + + void set_text(const std::string& text); + void set_font(const std::string& name); + void fade_in(float fadetime); + void fade_out(float fadetime); + void set_visible(bool visible); + bool is_visible(); + + void draw(DrawingContext& context); + void action(float elapsed_time); + +private: + Font* font; + std::string text; + float fading; + float fadetime; + bool visible; +}; + +#endif + diff --git a/src/scripting/functions.cpp b/src/scripting/functions.cpp index fbff6d8a7..99e2c9af3 100644 --- a/src/scripting/functions.cpp +++ b/src/scripting/functions.cpp @@ -1,14 +1,23 @@ #include +#include +#include #include "functions.h" #include "script_interpreter.h" +#include "tinygettext/tinygettext.h" +#include "gettext.h" namespace Scripting { -void wait(float seconds) +void set_wakeup_time(float seconds) { ScriptInterpreter::current()->suspend(seconds); } +std::string translate(const std::string& text) +{ + return dictionary_manager.get_dictionary().translate(text); +} + } diff --git a/src/scripting/functions.h b/src/scripting/functions.h index 31218899e..f7c8f5c39 100644 --- a/src/scripting/functions.h +++ b/src/scripting/functions.h @@ -5,7 +5,11 @@ namespace Scripting { /** Suspends the script execution for the specified number of seconds */ -void wait(float seconds); +void set_wakeup_time(float seconds); +/** translates a give text into the users language (by looking it up in the .po + * files) + */ +std::string translate(const std::string& text); } diff --git a/src/scripting/script_interpreter.cpp b/src/scripting/script_interpreter.cpp index f2e53b287..64feaa70b 100644 --- a/src/scripting/script_interpreter.cpp +++ b/src/scripting/script_interpreter.cpp @@ -122,7 +122,6 @@ void ScriptInterpreter::suspend(float seconds) { resume_timer.start(seconds); - //sq_suspendvm(v); } void diff --git a/src/scripting/text.h b/src/scripting/text.h new file mode 100644 index 000000000..92a67fe18 --- /dev/null +++ b/src/scripting/text.h @@ -0,0 +1,25 @@ +#ifndef __TEXT_H__ +#define __TEXT_H__ + +namespace Scripting +{ + +class Text +{ +public: +#ifndef SCRIPTING_API + virtual ~Text() + { } +#endif + + virtual void set_text(const std::string& text) = 0; + virtual void set_font(const std::string& fontname) = 0; + virtual void fade_in(float fadetime) = 0; + virtual void fade_out(float fadetime) = 0; + virtual void set_visible(bool visible) = 0; +}; + +} + +#endif + diff --git a/src/scripting/wrapper.cpp b/src/scripting/wrapper.cpp index 42c7bad83..8b8263760 100644 --- a/src/scripting/wrapper.cpp +++ b/src/scripting/wrapper.cpp @@ -257,18 +257,90 @@ static int Sound_play_sound_wrapper(HSQUIRRELVM v) return 0; } -static int wait_wrapper(HSQUIRRELVM v) +static int Text_set_text_wrapper(HSQUIRRELVM v) { + Scripting::Text* _this; + sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0); + const char* arg0; + sq_getstring(v, 2, &arg0); + + _this->set_text(arg0); + + return 0; +} + +static int Text_set_font_wrapper(HSQUIRRELVM v) +{ + Scripting::Text* _this; + sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0); + const char* arg0; + sq_getstring(v, 2, &arg0); + + _this->set_font(arg0); + + return 0; +} + +static int Text_fade_in_wrapper(HSQUIRRELVM v) +{ + Scripting::Text* _this; + sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0); + float arg0; + sq_getfloat(v, 2, &arg0); + + _this->fade_in(arg0); + + return 0; +} + +static int Text_fade_out_wrapper(HSQUIRRELVM v) +{ + Scripting::Text* _this; + sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0); float arg0; sq_getfloat(v, 2, &arg0); - Scripting::wait(arg0); + _this->fade_out(arg0); return 0; } +static int Text_set_visible_wrapper(HSQUIRRELVM v) +{ + Scripting::Text* _this; + sq_getinstanceup(v, 1, (SQUserPointer*) &_this, 0); + SQBool arg0; + sq_getbool(v, 2, &arg0); + + _this->set_visible(arg0); + + return 0; +} + +static int set_wakeup_time_wrapper(HSQUIRRELVM v) +{ + float arg0; + sq_getfloat(v, 2, &arg0); + + Scripting::set_wakeup_time(arg0); + + return 0; +} + +static int translate_wrapper(HSQUIRRELVM v) +{ + const char* arg0; + sq_getstring(v, 2, &arg0); + + std::string return_value = Scripting::translate(arg0); + + sq_pushstring(v, return_value.c_str(), return_value.size()); + return 1; +} + WrappedFunction supertux_global_functions[] = { - { "wait", &wait_wrapper }, + { "set_wakeup_time", &set_wakeup_time_wrapper }, + { "translate", &translate_wrapper }, { 0, 0 } }; @@ -307,12 +379,21 @@ static WrappedFunction supertux_Sound_methods[] = { { "play_sound", &Sound_play_sound_wrapper }, }; +static WrappedFunction supertux_Text_methods[] = { + { "set_text", &Text_set_text_wrapper }, + { "set_font", &Text_set_font_wrapper }, + { "fade_in", &Text_fade_in_wrapper }, + { "fade_out", &Text_fade_out_wrapper }, + { "set_visible", &Text_set_visible_wrapper }, +}; + WrappedClass supertux_classes[] = { { "Display", supertux_Display_methods }, { "Camera", supertux_Camera_methods }, { "Level", supertux_Level_methods }, { "ScriptedObject", supertux_ScriptedObject_methods }, { "Sound", supertux_Sound_methods }, + { "Text", supertux_Text_methods }, { 0, 0 } }; diff --git a/src/scripting/wrapper.interface.h b/src/scripting/wrapper.interface.h index fe729d6a8..6c83c4f6e 100644 --- a/src/scripting/wrapper.interface.h +++ b/src/scripting/wrapper.interface.h @@ -4,5 +4,6 @@ #include "level.h" #include "scripted_object.h" #include "sound.h" +#include "text.h" #include "functions.h" diff --git a/src/sector.cpp b/src/sector.cpp index dfb2679c9..aeb453022 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -52,6 +52,7 @@ #include "object/block.h" #include "object/invisible_block.h" #include "object/bullet.h" +#include "object/text_object.h" #include "badguy/jumpy.h" #include "badguy/spike.h" #include "trigger/sequence_trigger.h" @@ -59,6 +60,7 @@ #include "scripting/script_interpreter.h" #include "scripting/sound.h" #include "scripting/scripted_object.h" +#include "scripting/text.h" //#define USE_GRID @@ -442,6 +444,10 @@ Sector::activate(const std::string& spawnpoint) } Scripting::Sound* sound = new Scripting::Sound(); interpreter->expose_object(sound, "Sound", "Sound"); + TextObject* text_object = new TextObject(); + add_object(text_object); + Scripting::Text* text = static_cast (text_object); + interpreter->expose_object(text, "Text", "Text"); std::string sourcename = std::string("Sector(") + name + ") - init"; std::istringstream in(init_script); diff --git a/src/sprite/sprite.cpp b/src/sprite/sprite.cpp index 28dc1fa55..ddc55354c 100644 --- a/src/sprite/sprite.cpp +++ b/src/sprite/sprite.cpp @@ -94,8 +94,7 @@ Sprite::update() } void -Sprite::draw(DrawingContext& context, const Vector& pos, int layer, - Uint32 drawing_effect) +Sprite::draw(DrawingContext& context, const Vector& pos, int layer) { assert(action != 0); update(); @@ -107,12 +106,12 @@ Sprite::draw(DrawingContext& context, const Vector& pos, int layer, else context.draw_surface(action->surfaces[(int)frame], pos - Vector(action->x_offset, action->y_offset), - layer + action->z_order, drawing_effect); + layer + action->z_order); } void Sprite::draw_part(DrawingContext& context, const Vector& source, - const Vector& size, const Vector& pos, int layer, Uint32 drawing_effect) + const Vector& size, const Vector& pos, int layer) { assert(action != 0); update(); @@ -124,7 +123,7 @@ Sprite::draw_part(DrawingContext& context, const Vector& source, else context.draw_surface_part(action->surfaces[(int)frame], source, size, pos - Vector(action->x_offset, action->y_offset), - layer + action->z_order, drawing_effect); + layer + action->z_order); } int diff --git a/src/sprite/sprite.h b/src/sprite/sprite.h index 8f3576f61..16537c473 100644 --- a/src/sprite/sprite.h +++ b/src/sprite/sprite.h @@ -37,12 +37,10 @@ public: ~Sprite(); /** Draw sprite, automatically calculates next frame */ - void draw(DrawingContext& context, const Vector& pos, int layer, - Uint32 drawing_effect = NONE_EFFECT); + void draw(DrawingContext& context, const Vector& pos, int layer); void draw_part(DrawingContext& context, const Vector& source, - const Vector& size, const Vector& pos, int layer, - Uint32 drawing_effect = NONE_EFFECT); + const Vector& size, const Vector& pos, int layer); /** Set action (or state) */ void set_action(std::string act, int loops = -1); diff --git a/src/title.cpp b/src/title.cpp index ebaf5b78a..ae2eaaf30 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -246,10 +246,10 @@ void draw_demo(float elapsed_time) controller->press(Controller::RIGHT); if(random_timer.check() || - (walking && (int) last_tux_x_pos == (int) tux->get_pos().x)) { + (walking && fabsf(last_tux_x_pos - tux->get_pos().x)) < .1) { walking = false; } else { - if(!walking && (int) tux->get_pos().y == (int) last_tux_y_pos) { + if(!walking && fabsf(tux->get_pos().y - last_tux_y_pos) < .1) { random_timer.start(float(rand() % 3000 + 3000) / 1000.); walking = true; } diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 15e886393..7e7aaff06 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -43,7 +43,7 @@ DrawingContext::~DrawingContext() void DrawingContext::draw_surface(const Surface* surface, const Vector& position, - int layer, uint32_t drawing_effect) + int layer) { assert(surface != 0); @@ -57,7 +57,7 @@ DrawingContext::draw_surface(const Surface* surface, const Vector& position, return; request.layer = layer; - request.drawing_effect = transform.drawing_effect | drawing_effect; + request.drawing_effect = transform.drawing_effect; request.zoom = transform.zoom; request.alpha = transform.alpha; request.request_data = const_cast (surface); @@ -67,7 +67,7 @@ DrawingContext::draw_surface(const Surface* surface, const Vector& position, void DrawingContext::draw_surface_part(const Surface* surface, const Vector& source, - const Vector& size, const Vector& dest, int layer, uint32_t drawing_effect) + const Vector& size, const Vector& dest, int layer) { assert(surface != 0); @@ -76,7 +76,7 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source, request.type = SURFACE_PART; request.pos = transform.apply(dest); request.layer = layer; - request.drawing_effect = transform.drawing_effect | drawing_effect; + request.drawing_effect = transform.drawing_effect; request.alpha = transform.alpha; SurfacePartRequest* surfacepartrequest = new SurfacePartRequest(); @@ -106,15 +106,14 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source, void DrawingContext::draw_text(const Font* font, const std::string& text, - const Vector& position, FontAlignment alignment, int layer, - uint32_t drawing_effect) + const Vector& position, FontAlignment alignment, int layer) { DrawingRequest request; request.type = TEXT; request.pos = transform.apply(position); request.layer = layer; - request.drawing_effect = transform.drawing_effect | drawing_effect; + request.drawing_effect = transform.drawing_effect; request.zoom = transform.zoom; request.alpha = transform.alpha; @@ -129,10 +128,10 @@ DrawingContext::draw_text(const Font* font, const std::string& text, void DrawingContext::draw_center_text(const Font* font, const std::string& text, - const Vector& position, int layer, uint32_t drawing_effect) + const Vector& position, int layer) { draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y), - CENTER_ALLIGN, layer, drawing_effect); + CENTER_ALLIGN, layer); } void @@ -173,6 +172,9 @@ DrawingContext::draw_filled_rect(const Vector& topleft, const Vector& size, FillRectRequest* fillrectrequest = new FillRectRequest; fillrectrequest->size = size; fillrectrequest->color = color; + fillrectrequest->color.alpha + = (int) ((float) fillrectrequest->color.alpha + * ((float) transform.alpha / 255.0)); request.request_data = fillrectrequest; drawingrequests.push_back(request); @@ -389,11 +391,17 @@ DrawingContext::pop_transform() } void -DrawingContext::set_drawing_effect(int effect) +DrawingContext::set_drawing_effect(uint32_t effect) { transform.drawing_effect = effect; } +uint32_t +DrawingContext::get_drawing_effect() const +{ + return transform.drawing_effect; +} + void DrawingContext::set_zooming(float zoom) { @@ -401,7 +409,13 @@ DrawingContext::set_zooming(float zoom) } void -DrawingContext::set_alpha(int alpha) +DrawingContext::set_alpha(uint8_t alpha) { transform.alpha = alpha; } + +uint8_t +DrawingContext::get_alpha() const +{ + return transform.alpha; +} diff --git a/src/video/drawing_context.h b/src/video/drawing_context.h index e396659fa..224ea11ae 100644 --- a/src/video/drawing_context.h +++ b/src/video/drawing_context.h @@ -24,6 +24,7 @@ #include #include +#include #include "math/vector.h" #include "video/screen.h" @@ -58,22 +59,19 @@ public: /// Adds a drawing request for a surface into the request list. void draw_surface(const Surface* surface, const Vector& position, - int layer, uint32_t drawing_effect = NONE_EFFECT); + int layer); /// Adds a drawing request for part of a surface. void draw_surface_part(const Surface* surface, const Vector& source, - const Vector& size, const Vector& dest, int layer, - uint32_t drawing_effect = NONE_EFFECT); + const Vector& size, const Vector& dest, int layer); /// Draws a text. void draw_text(const Font* font, const std::string& text, - const Vector& position, FontAlignment alignment, int layer, - uint32_t drawing_effect = NONE_EFFECT); + const Vector& position, FontAlignment alignment, int layer); /// Draws text on screen center (feed Vector.x with a 0). /// This is the same as draw_text() with a SCREEN_WIDTH/2 position and /// alignment set to LEFT_ALLIGN void draw_center_text(const Font* font, const std::string& text, - const Vector& position, int layer, - uint32_t drawing_effect = NONE_EFFECT); + const Vector& position, int layer); /// Draws a color gradient onto the whole screen */ void draw_gradient(Color from, Color to, int layer); /// Fills a rectangle. @@ -85,8 +83,6 @@ public: const Vector& get_translation() const { return transform.translation; } - uint32_t get_drawing_effect() const - { return transform.drawing_effect; } void set_translation(const Vector& newtranslation) { transform.translation = newtranslation; } @@ -95,11 +91,15 @@ public: void pop_transform(); /// Apply that effect in the next draws (effects are listed on surface.h). - void set_drawing_effect(int effect); + void set_drawing_effect(uint32_t effect); + /// return currently applied drawing effect + uint32_t get_drawing_effect() const; /// apply that zoom in the next draws */ void set_zooming(float zoom); /// apply that alpha in the next draws */ - void set_alpha(int alpha); + void set_alpha(uint8_t alpha); + /// return currently set alpha + uint8_t get_alpha() const; private: class Transform @@ -108,7 +108,7 @@ private: Vector translation; uint32_t drawing_effect; float zoom; - int alpha; + uint8_t alpha; Transform() : drawing_effect(NONE_EFFECT), zoom(1), alpha(255) diff --git a/src/video/semantic.cache b/src/video/semantic.cache index 9e308c633..3b1f439fe 100644 --- a/src/video/semantic.cache +++ b/src/video/semantic.cache @@ -5,16 +5,16 @@ :tables (list (semanticdb-table "drawing_context.h" :file "drawing_context.h" - :pointmax 5205 + :pointmax 5111 :major-mode 'c++-mode - :tokens '(("SUPERTUX_DRAWINGCONTEXT_H" variable nil nil ((const . t)) nil nil [915 951]) ("vector" include t nil nil [950 967]) ("string" include t nil nil [968 985]) ("stdint.h" include t nil nil [986 1005]) ("SDL.h" include t nil nil [1007 1023]) ("math/vector.h" include nil nil nil [1025 1049]) ("video/screen.h" include nil nil nil [1050 1075]) ("video/surface.h" include nil nil nil [1076 1102]) ("video/font.h" include nil nil nil [1103 1126]) ("Surface" type "class" nil nil nil nil nil [1155 1169]) ("" type "enum" (("LAYER_BACKGROUND0" variable "int" (1219 1223) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1226 1250]) ("LAYER_BACKGROUND1" variable "int" (1247 1251) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1254 1278]) ("LAYER_BACKGROUNDTILES" variable "int" (1279 1283) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1282 1310]) ("LAYER_TILES" variable "int" (1301 1302) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1314 1329]) ("LAYER_OBJECTS" variable "int" (1322 1325) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1333 1352]) ("LAYER_FOREGROUNDTILES" variable "int" (1353 1356) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1356 1383]) ("LAYER_FOREGROUND0" variable "int" (1380 1383) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1387 1410]) ("LAYER_FOREGROUND1" variable "int" (1407 1410) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1414 1437]) ("LAYER_GUI" variable "int" (1434 1437) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1441 1464])) nil nil nil nil [1217 1467]) ("DrawingContext" type "class" (("public" label ((reparse-symbol . classsubparts)) [1667 1674]) ("DrawingContext" function ("DrawingContext" type "class") nil ((constructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [1677 1694]) ("DrawingContext" function "void" nil ((destructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [1697 1715]) ("draw_surface" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1805 1828]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [1829 1852]) ("layer" variable "int" nil nil nil nil [1873 1883]) ("drawing_effect" variable ("uint32_t" type "class") "NONE_EFFECT)" nil nil nil [1884 1922])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [1787 1923]) ("draw_surface_part" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [2001 2024]) ("source" variable ("Vector" type "class") nil ((const . t)) nil nil [2025 2046]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [2072 2091]) ("dest" variable ("Vector" type "class") nil ((const . t)) nil nil [2092 2111]) ("layer" variable "int" nil nil nil nil [2112 2122]) ("drawing_effect" variable ("uint32_t" type "class") "NONE_EFFECT)" nil nil nil [2148 2186])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [1978 2187]) ("draw_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [2225 2242]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [2243 2267]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [2285 2308]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [2309 2333]) ("layer" variable "int" nil nil nil nil [2334 2344]) ("drawing_effect" variable ("uint32_t" type "class") "NONE_EFFECT)" nil nil nil [2362 2400])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2210 2401]) ("draw_center_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [2597 2614]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [2615 2639]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [2664 2687]) ("layer" variable "int" nil nil nil nil [2688 2698]) ("drawing_effect" variable ("uint32_t" type "class") "NONE_EFFECT)" nil nil nil [2723 2761])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2575 2762]) ("draw_gradient" function ("void") (("from" variable ("Color" type "class") nil nil nil nil [2838 2849]) ("to" variable ("Color" type "class") nil nil nil nil [2850 2859]) ("layer" variable "int" nil nil nil nil [2860 2870])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2819 2871]) ("draw_filled_rect" function ("void") (("topleft" variable ("Vector" type "class") nil ((const . t)) nil nil [2921 2943]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [2944 2963]) ("color" variable ("Color" type "class") nil nil nil nil [2988 3000]) ("layer" variable "int" nil nil nil nil [3001 3011])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2899 3012]) ("do_drawing" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3085 3103]) ("get_translation" function ("Vector" type "class") nil ((const . t)) nil ((reparse-symbol . classsubparts)) [3109 3184]) ("get_drawing_effect" function ("uint32_t" type "class") nil nil nil ((reparse-symbol . classsubparts)) [3187 3263]) ("set_translation" function ("void") (("newtranslation" variable ("Vector" type "class") nil ((const . t)) nil nil [3290 3319])) nil nil ((reparse-symbol . classsubparts)) [3269 3367]) ("push_transform" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3373 3395]) ("pop_transform" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3398 3419]) ("set_drawing_effect" function ("void") (("effect" variable "int" nil nil nil nil [3526 3537])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3502 3538]) ("set_zooming" function ("void") (("zoom" variable "float" nil nil nil nil [3601 3612])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3584 3613]) ("set_alpha" function ("void") (("alpha" variable "int" nil nil nil nil [3675 3685])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3660 3686]) ("private" label ((reparse-symbol . classsubparts)) [3690 3698]) ("Transform" type "class" (("public" label ((reparse-symbol . classsubparts)) [3723 3730]) ("translation" variable ("Vector" type "class") nil nil nil nil [3735 3754]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [3759 3783]) ("zoom" variable "float" nil nil nil nil [3788 3799]) ("alpha" variable "int" nil nil nil nil [3804 3814]) ("Transform" function ("Transform" type "class") nil ((constructor . t)) nil ((reparse-symbol . classsubparts)) [3824 3900]) ("apply" function ("Vector" type "class") (("v" variable ("Vector" type "class") nil ((const . t)) nil nil [3923 3939])) nil nil ((reparse-symbol . classsubparts)) [3910 3987])) nil nil nil ((reparse-symbol . classsubparts)) [3701 3992]) ("transformstack" variable ("std::vector" type "class") nil nil nil nil [4024 4062]) ("transform" variable ("Transform" type "class") nil nil nil nil [4102 4122]) ("RequestType" type "enum" (("SURFACE" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4153 4161]) ("SURFACE_PART" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4162 4175]) ("TEXT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4176 4181]) ("GRADIENT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4182 4191]) ("FILLRECT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4192 4204])) nil nil nil ((reparse-symbol . classsubparts)) [4128 4205]) ("SurfacePartRequest" type "struct" (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [4245 4268]) ("source" variable ("Vector" type "class") nil nil nil nil [4273 4293]) ("size" variable ("Vector" type "class") nil nil nil nil [4273 4293])) nil nil nil ((reparse-symbol . classsubparts)) [4211 4298]) ("TextRequest" type "struct" (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [4331 4348]) ("text" variable ("std::string" type "class") nil nil nil nil [4353 4370]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [4375 4399])) nil nil nil ((reparse-symbol . classsubparts)) [4304 4404]) ("GradientRequest" type "struct" (("top" variable ("Color" type "class") nil nil nil nil [4441 4459]) ("bottom" variable ("Color" type "class") nil nil nil nil [4441 4459]) ("size" variable ("Vector" type "class") nil nil nil nil [4464 4476])) nil nil nil ((reparse-symbol . classsubparts)) [4410 4481]) ("FillRectRequest" type "struct" (("color" variable ("Color" type "class") nil nil nil nil [4518 4530]) ("size" variable ("Vector" type "class") nil nil nil nil [4535 4547])) nil nil nil ((reparse-symbol . classsubparts)) [4487 4552]) ("DrawingRequest" type "struct" (("type" variable ("RequestType" type "class") nil nil nil nil [4588 4605]) ("pos" variable ("Vector" type "class") nil nil nil nil [4610 4621]) ("layer" variable "int" nil nil nil nil [4647 4657]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [4662 4686]) ("zoom" variable "float" nil nil nil nil [4691 4702]) ("alpha" variable "int" nil nil nil nil [4707 4717]) ("request_data" variable "void" nil ((pointer . 1)) nil nil [4727 4746]) ("<" function ("bool" type "class") (("other" variable ("DrawingRequest" type "class") nil ((const . t)) nil nil [4771 4799])) nil nil ((reparse-symbol . classsubparts)) [4756 4851])) nil nil nil ((reparse-symbol . classsubparts)) [4558 4856]) ("draw_surface_part" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4885 4909])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4862 4910]) ("draw_text" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4928 4952])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4913 4953]) ("draw_text_center" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4978 5002])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4956 5003]) ("draw_gradient" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [5025 5049])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [5006 5050]) ("draw_filled_rect" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [5075 5099])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [5053 5100]) ("DrawingRequests" type "typedef" nil ("std::vector") ((typedef "std::vector" type "class")) nil nil [5106 5158]) ("drawingrequests" variable ("DrawingRequests" type "class") nil nil nil nil [5161 5193])) nil nil nil nil [1644 5196])) + :tokens '(("SUPERTUX_DRAWINGCONTEXT_H" variable nil nil ((const . t)) nil nil [915 951]) ("vector" include t nil nil [950 967]) ("string" include t nil nil [968 985]) ("stdint.h" include t nil nil [986 1005]) ("SDL.h" include t nil nil [1007 1023]) ("stdint.h" include t nil nil [1024 1043]) ("math/vector.h" include nil nil nil [1045 1069]) ("video/screen.h" include nil nil nil [1070 1095]) ("video/surface.h" include nil nil nil [1096 1122]) ("video/font.h" include nil nil nil [1123 1146]) ("Surface" type "class" nil nil nil nil nil [1148 1162]) ("" type "enum" (("LAYER_BACKGROUND0" variable "int" (1239 1243) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1219 1243]) ("LAYER_BACKGROUND1" variable "int" (1267 1271) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1247 1271]) ("LAYER_BACKGROUNDTILES" variable "int" (1299 1303) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1275 1303]) ("LAYER_TILES" variable "int" (1321 1322) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1307 1322]) ("LAYER_OBJECTS" variable "int" (1342 1345) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1326 1345]) ("LAYER_FOREGROUNDTILES" variable "int" (1373 1376) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1349 1376]) ("LAYER_FOREGROUND0" variable "int" (1400 1403) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1380 1403]) ("LAYER_FOREGROUND1" variable "int" (1427 1430) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1407 1430]) ("LAYER_GUI" variable "int" (1454 1457) ((const . t)) nil ((reparse-symbol . enumsubparts)) [1434 1457])) nil nil nil nil [1210 1460]) ("DrawingContext" type "class" (("public" label ((reparse-symbol . classsubparts)) [1660 1667]) ("DrawingContext" function ("DrawingContext" type "class") (("targetsurface" variable ("SDL_Surface" type "class") "0" ((pointer . 1)) nil nil [1685 1715])) ((constructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [1670 1717]) ("DrawingContext" function "void" nil ((destructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [1720 1738]) ("draw_surface" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1828 1851]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [1852 1875]) ("layer" variable "int" nil nil nil nil [1896 1906])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [1810 1907]) ("draw_surface_part" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1985 2008]) ("source" variable ("Vector" type "class") nil ((const . t)) nil nil [2009 2030]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [2056 2075]) ("dest" variable ("Vector" type "class") nil ((const . t)) nil nil [2076 2095]) ("layer" variable "int" nil nil nil nil [2096 2106])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [1962 2107]) ("draw_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [2145 2162]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [2163 2187]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [2205 2228]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [2229 2253]) ("layer" variable "int" nil nil nil nil [2254 2264])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2130 2265]) ("draw_center_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [2461 2478]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [2479 2503]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [2528 2551]) ("layer" variable "int" nil nil nil nil [2552 2562])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2439 2563]) ("draw_gradient" function ("void") (("from" variable ("Color" type "class") nil nil nil nil [2639 2650]) ("to" variable ("Color" type "class") nil nil nil nil [2651 2660]) ("layer" variable "int" nil nil nil nil [2661 2671])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2620 2672]) ("draw_filled_rect" function ("void") (("topleft" variable ("Vector" type "class") nil ((const . t)) nil nil [2722 2744]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [2745 2764]) ("color" variable ("Color" type "class") nil nil nil nil [2789 2801]) ("layer" variable "int" nil nil nil nil [2802 2812])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2700 2813]) ("do_drawing" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [2886 2904]) ("get_translation" function ("Vector" type "class") nil ((const . t)) nil ((reparse-symbol . classsubparts)) [2910 2985]) ("set_translation" function ("void") (("newtranslation" variable ("Vector" type "class") nil ((const . t)) nil nil [3012 3041])) nil nil ((reparse-symbol . classsubparts)) [2991 3089]) ("push_transform" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3095 3117]) ("pop_transform" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3120 3141]) ("set_drawing_effect" function ("void") (("effect" variable ("uint32_t" type "class") nil nil nil nil [3248 3264])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3224 3265]) ("get_drawing_effect" function ("uint32_t" type "class") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3314 3350]) ("set_zooming" function ("void") (("zoom" variable "float" nil nil nil nil [3413 3424])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3396 3425]) ("set_alpha" function ("void") (("alpha" variable ("uint8_t" type "class") nil nil nil nil [3487 3501])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3472 3502]) ("get_alpha" function ("uint8_t" type "class") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [3538 3564]) ("private" label ((reparse-symbol . classsubparts)) [3568 3576]) ("Transform" type "class" (("public" label ((reparse-symbol . classsubparts)) [3601 3608]) ("translation" variable ("Vector" type "class") nil nil nil nil [3613 3632]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [3637 3661]) ("zoom" variable "float" nil nil nil nil [3666 3677]) ("alpha" variable ("uint8_t" type "class") nil nil nil nil [3682 3696]) ("Transform" function ("Transform" type "class") nil ((constructor . t)) nil ((reparse-symbol . classsubparts)) [3706 3782]) ("apply" function ("Vector" type "class") (("v" variable ("Vector" type "class") nil ((const . t)) nil nil [3805 3821])) nil nil ((reparse-symbol . classsubparts)) [3792 3869])) nil nil nil ((reparse-symbol . classsubparts)) [3579 3874]) ("transformstack" variable ("std::vector" type "class") nil nil nil nil [3906 3944]) ("transform" variable ("Transform" type "class") nil nil nil nil [3984 4004]) ("RequestType" type "enum" (("SURFACE" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4035 4043]) ("SURFACE_PART" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4044 4057]) ("TEXT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4058 4063]) ("GRADIENT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4064 4073]) ("FILLRECT" variable "int" nil ((const . t)) nil ((reparse-symbol . enumsubparts)) [4074 4086])) nil nil nil ((reparse-symbol . classsubparts)) [4010 4087]) ("SurfacePartRequest" type "struct" (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [4127 4150]) ("source" variable ("Vector" type "class") nil nil nil nil [4155 4175]) ("size" variable ("Vector" type "class") nil nil nil nil [4155 4175])) nil nil nil ((reparse-symbol . classsubparts)) [4093 4180]) ("TextRequest" type "struct" (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [4213 4230]) ("text" variable ("std::string" type "class") nil nil nil nil [4235 4252]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [4257 4281])) nil nil nil ((reparse-symbol . classsubparts)) [4186 4286]) ("GradientRequest" type "struct" (("top" variable ("Color" type "class") nil nil nil nil [4323 4341]) ("bottom" variable ("Color" type "class") nil nil nil nil [4323 4341]) ("size" variable ("Vector" type "class") nil nil nil nil [4346 4358])) nil nil nil ((reparse-symbol . classsubparts)) [4292 4363]) ("FillRectRequest" type "struct" (("color" variable ("Color" type "class") nil nil nil nil [4400 4412]) ("size" variable ("Vector" type "class") nil nil nil nil [4417 4429])) nil nil nil ((reparse-symbol . classsubparts)) [4369 4434]) ("DrawingRequest" type "struct" (("type" variable ("RequestType" type "class") nil nil nil nil [4470 4487]) ("pos" variable ("Vector" type "class") nil nil nil nil [4492 4503]) ("layer" variable "int" nil nil nil nil [4529 4539]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [4544 4568]) ("zoom" variable "float" nil nil nil nil [4573 4584]) ("alpha" variable "int" nil nil nil nil [4589 4599]) ("request_data" variable "void" nil ((pointer . 1)) nil nil [4609 4628]) ("<" function ("bool" type "class") (("other" variable ("DrawingRequest" type "class") nil ((const . t)) nil nil [4653 4681])) nil nil ((reparse-symbol . classsubparts)) [4638 4733])) nil nil nil ((reparse-symbol . classsubparts)) [4440 4738]) ("draw_surface_part" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4767 4791])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4744 4792]) ("draw_text" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4810 4834])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4795 4835]) ("draw_text_center" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4860 4884])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4838 4885]) ("draw_gradient" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4907 4931])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4888 4932]) ("draw_filled_rect" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4957 4981])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [4935 4982]) ("DrawingRequests" type "typedef" nil ("std::vector") ((typedef "std::vector" type "class")) nil nil [4988 5040]) ("drawingrequests" variable ("DrawingRequests" type "class") nil nil nil nil [5043 5075]) ("screen" variable ("SDL_Surface" type "class") nil ((pointer . 1)) nil nil [5079 5099])) nil nil nil nil [1637 5102])) :unmatched-syntax 'nil ) (semanticdb-table "drawing_context.cpp" :file "drawing_context.cpp" - :pointmax 11591 + :pointmax 11560 :major-mode 'c++-mode - :tokens '(("config.h" include t nil nil [883 902]) ("algorithm" include t nil nil [904 924]) ("cassert" include t nil nil [925 943]) ("iostream" include t nil nil [944 963]) ("drawing_context.h" include nil nil nil [965 993]) ("surface.h" include nil nil nil [994 1014]) ("app/globals.h" include nil nil nil [1015 1039]) ("font.h" include nil nil nil [1040 1057]) ("gameconfig.h" include nil nil nil [1058 1081]) ("DrawingContext" function ("DrawingContext" type "class") (("targetsurface" variable ("SDL_Surface" type "class") nil ((pointer . 1)) nil nil [1141 1168])) ((parent . "DrawingContext") (constructor . t)) nil nil [1110 1273]) ("DrawingContext" function "void" nil ((parent . "DrawingContext") (destructor . t)) nil nil [1275 1312]) ("draw_surface" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1348 1371]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [1372 1395]) ("layer" variable "int" nil nil nil nil [1400 1410]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [1411 1435])) ((parent . "DrawingContext")) nil nil [1314 1981]) ("draw_surface_part" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [2022 2045]) ("source" variable ("Vector" type "class") nil ((const . t)) nil nil [2046 2067]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [2072 2091]) ("dest" variable ("Vector" type "class") nil ((const . t)) nil nil [2092 2111]) ("layer" variable "int" nil nil nil nil [2112 2122]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [2123 2147])) ((parent . "DrawingContext")) nil nil [1983 3117]) ("draw_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [3150 3167]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [3168 3192]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [3197 3220]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [3221 3245]) ("layer" variable "int" nil nil nil nil [3246 3256]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [3261 3285])) ((parent . "DrawingContext")) nil nil [3119 3763]) ("draw_center_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [3803 3820]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [3821 3845]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [3850 3873]) ("layer" variable "int" nil nil nil nil [3874 3884]) ("drawing_effect" variable ("uint32_t" type "class") nil nil nil nil [3885 3909])) ((parent . "DrawingContext")) nil nil [3765 4031]) ("draw_gradient" function ("void") (("top" variable ("Color" type "class") nil nil nil nil [4068 4078]) ("bottom" variable ("Color" type "class") nil nil nil nil [4079 4092]) ("layer" variable "int" nil nil nil nil [4093 4103])) ((parent . "DrawingContext")) nil nil [4033 4543]) ("draw_filled_rect" function ("void") (("topleft" variable ("Vector" type "class") nil ((const . t)) nil nil [4583 4605]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [4606 4625]) ("color" variable ("Color" type "class") nil nil nil nil [4634 4646]) ("layer" variable "int" nil nil nil nil [4647 4657])) ((parent . "DrawingContext")) nil nil [4545 5130]) ("draw_surface_part" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [5171 5195])) ((parent . "DrawingContext")) nil nil [5132 5579]) ("draw_gradient" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [5616 5640])) ((parent . "DrawingContext")) nil nil [5581 6879]) ("draw_text" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [6912 6936])) ((parent . "DrawingContext")) nil nil [6881 7158]) ("draw_filled_rect" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [7198 7222])) ((parent . "DrawingContext")) nil nil [7160 9958]) ("do_drawing" function ("void") nil ((parent . "DrawingContext")) nil nil [9960 11121]) ("push_transform" function ("void") nil ((parent . "DrawingContext")) nil nil [11123 11203]) ("pop_transform" function ("void") nil ((parent . "DrawingContext")) nil nil [11205 11347]) ("set_drawing_effect" function ("void") (("effect" variable "int" nil nil nil nil [11389 11400])) ((parent . "DrawingContext")) nil nil [11349 11441]) ("set_zooming" function ("void") (("zoom" variable "float" nil nil nil nil [11476 11487])) ((parent . "DrawingContext")) nil nil [11443 11516]) ("set_alpha" function ("void") (("alpha" variable "int" nil nil nil nil [11549 11559])) ((parent . "DrawingContext")) nil nil [11518 11590])) + :tokens '(("config.h" include t nil nil [883 902]) ("algorithm" include t nil nil [904 924]) ("cassert" include t nil nil [925 943]) ("iostream" include t nil nil [944 963]) ("drawing_context.h" include nil nil nil [965 993]) ("surface.h" include nil nil nil [994 1014]) ("font.h" include nil nil nil [1015 1032]) ("main.h" include nil nil nil [1033 1050]) ("gameconfig.h" include nil nil nil [1051 1074]) ("DrawingContext" function ("DrawingContext" type "class") (("targetsurface" variable ("SDL_Surface" type "class") nil ((pointer . 1)) nil nil [1107 1134])) ((parent . "DrawingContext") (constructor . t)) nil nil [1076 1239]) ("DrawingContext" function "void" nil ((parent . "DrawingContext") (destructor . t)) nil nil [1241 1278]) ("draw_surface" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1314 1337]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [1338 1361]) ("layer" variable "int" nil nil nil nil [1366 1376])) ((parent . "DrawingContext")) nil nil [1280 1905]) ("draw_surface_part" function ("void") (("surface" variable ("Surface" type "class") nil ((const . t) (pointer . 1)) nil nil [1946 1969]) ("source" variable ("Vector" type "class") nil ((const . t)) nil nil [1970 1991]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [1996 2015]) ("dest" variable ("Vector" type "class") nil ((const . t)) nil nil [2016 2035]) ("layer" variable "int" nil nil nil nil [2036 2046])) ((parent . "DrawingContext")) nil nil [1907 2999]) ("draw_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [3032 3049]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [3050 3074]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [3079 3102]) ("alignment" variable ("FontAlignment" type "class") nil nil nil nil [3103 3127]) ("layer" variable "int" nil nil nil nil [3128 3138])) ((parent . "DrawingContext")) nil nil [3001 3599]) ("draw_center_text" function ("void") (("font" variable ("Font" type "class") nil ((const . t) (pointer . 1)) nil nil [3639 3656]) ("text" variable ("std::string" type "class") nil ((const . t)) nil nil [3657 3681]) ("position" variable ("Vector" type "class") nil ((const . t)) nil nil [3686 3709]) ("layer" variable "int" nil nil nil nil [3710 3720])) ((parent . "DrawingContext")) nil nil [3601 3826]) ("draw_gradient" function ("void") (("top" variable ("Color" type "class") nil nil nil nil [3863 3873]) ("bottom" variable ("Color" type "class") nil nil nil nil [3874 3887]) ("layer" variable "int" nil nil nil nil [3888 3898])) ((parent . "DrawingContext")) nil nil [3828 4338]) ("draw_filled_rect" function ("void") (("topleft" variable ("Vector" type "class") nil ((const . t)) nil nil [4378 4400]) ("size" variable ("Vector" type "class") nil ((const . t)) nil nil [4401 4420]) ("color" variable ("Color" type "class") nil nil nil nil [4429 4441]) ("layer" variable "int" nil nil nil nil [4442 4452])) ((parent . "DrawingContext")) nil nil [4340 4925]) ("draw_surface_part" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [4966 4990])) ((parent . "DrawingContext")) nil nil [4927 5374]) ("draw_gradient" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [5411 5435])) ((parent . "DrawingContext")) nil nil [5376 6674]) ("draw_text" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [6707 6731])) ((parent . "DrawingContext")) nil nil [6676 6953]) ("draw_filled_rect" function ("void") (("request" variable ("DrawingRequest" type "class") nil nil nil nil [6993 7017])) ((parent . "DrawingContext")) nil nil [6955 9753]) ("do_drawing" function ("void") nil ((parent . "DrawingContext")) nil nil [9755 10916]) ("push_transform" function ("void") nil ((parent . "DrawingContext")) nil nil [10918 10998]) ("pop_transform" function ("void") nil ((parent . "DrawingContext")) nil nil [11000 11142]) ("set_drawing_effect" function ("void") (("effect" variable ("uint32_t" type "class") nil nil nil nil [11184 11200])) ((parent . "DrawingContext")) nil nil [11144 11241]) ("get_drawing_effect" function ("uint32_t" type "class") nil ((parent . "DrawingContext")) nil nil [11243 11333]) ("set_zooming" function ("void") (("zoom" variable "float" nil nil nil nil [11368 11379])) ((parent . "DrawingContext")) nil nil [11335 11408]) ("set_alpha" function ("void") (("alpha" variable ("uint8_t" type "class") nil nil nil nil [11441 11455])) ((parent . "DrawingContext")) nil nil [11410 11486]) ("get_alpha" function ("uint8_t" type "class") nil ((parent . "DrawingContext")) nil nil [11488 11559])) :unmatched-syntax 'nil ) (semanticdb-table "screen.h" diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 173e9363f..ac500a1b2 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -911,7 +911,7 @@ WorldMap::draw_status(DrawingContext& context) Vector(SCREEN_WIDTH - gold_text->get_text_width(str) - tux_life->w, 0), LEFT_ALLIGN, LAYER_FOREGROUND1); context.draw_surface(tux_life, Vector(SCREEN_WIDTH - - gold_text->get_text_width("9"), 0), LEFT_ALLIGN, LAYER_FOREGROUND1); + gold_text->get_text_width("9"), 0), LAYER_FOREGROUND1); } else { diff --git a/tools/miniswig/create_wrapper.cpp b/tools/miniswig/create_wrapper.cpp index 83c6d2aab..2233f8334 100644 --- a/tools/miniswig/create_wrapper.cpp +++ b/tools/miniswig/create_wrapper.cpp @@ -139,12 +139,17 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function) // declare and retrieve arguments int i = 0; + int arg_offset = 2; for(std::vector::iterator p = function->parameters.begin(); p != function->parameters.end(); ++p) { - char argname[64]; - snprintf(argname, sizeof(argname), "arg%d", i); - prepare_argument(p->type, i + 2, argname); - + if(i == 0 && p->type.atomic_type == HSQUIRRELVMType::instance()) { + out << ind << "HSQUIRRELVM arg0 = v;\n"; + arg_offset++; + } else { + char argname[64]; + snprintf(argname, sizeof(argname), "arg%d", i); + prepare_argument(p->type, i + arg_offset, argname); + } ++i; } diff --git a/tools/miniswig/lexer.ll b/tools/miniswig/lexer.ll index 0e6229c2a..65b0ca1dc 100644 --- a/tools/miniswig/lexer.ll +++ b/tools/miniswig/lexer.ll @@ -49,14 +49,9 @@ namespace { return T_NAMESPACE; } if(ns == 0) ns = current_namespace; // is it a type? - for(std::vector::iterator i = ns->types.begin(); - i != ns->types.end(); ++i) { - AtomicType* type = *i; - if(type->name == yytext) { - yylval->atomic_type = type; - return T_ATOMIC_TYPE; - } - } + yylval->atomic_type = ns->_findType(yytext, search_down); + if(yylval->atomic_type) + return T_ATOMIC_TYPE; // or a namespace? (hack for now...) yylval->_namespace = ns->_findNamespace(yytext, search_down); if(yylval->_namespace) { diff --git a/tools/miniswig/main.cpp b/tools/miniswig/main.cpp index 24171985d..f28e3f731 100644 --- a/tools/miniswig/main.cpp +++ b/tools/miniswig/main.cpp @@ -85,6 +85,7 @@ int main(int argc, char** argv) std_namespace->name = "std"; std_namespace->types.push_back(new StringType()); unit->namespaces.push_back(std_namespace); + unit->types.push_back(new HSQUIRRELVMType()); yyparse(); diff --git a/tools/miniswig/tree.cpp b/tools/miniswig/tree.cpp index d05a38af6..e26452da7 100644 --- a/tools/miniswig/tree.cpp +++ b/tools/miniswig/tree.cpp @@ -10,3 +10,4 @@ BasicType BasicType::FLOAT("float"); BasicType BasicType::DOUBLE("double"); StringType* StringType::_instance = 0; +HSQUIRRELVMType* HSQUIRRELVMType::_instance = 0; diff --git a/tools/miniswig/tree.h b/tools/miniswig/tree.h index b6f855466..387012ece 100644 --- a/tools/miniswig/tree.h +++ b/tools/miniswig/tree.h @@ -84,6 +84,28 @@ public: int ref; }; +class HSQUIRRELVMType : public AtomicType { +public: + HSQUIRRELVMType() + { + this->name = "HSQUIRRELVM"; + assert(_instance == 0); + _instance = this; + } + virtual ~HSQUIRRELVMType() + { + assert(_instance == this); + _instance = 0; + } + + static HSQUIRRELVMType* instance() + { + return _instance; + } +private: + static HSQUIRRELVMType* _instance; +}; + class StringType : public AtomicType { public: StringType() @@ -181,6 +203,19 @@ public: namespaces.push_back(ns); ns->parent = this; } + AtomicType* _findType(const std::string& name, bool godown = false) { + for(std::vector::iterator i = types.begin(); + i != types.end(); ++i) { + AtomicType* type = *i; + if(type->name == name) + return type; + } + if(godown && parent) + return parent->_findType(name, true); + + return 0; + } + Namespace* _findNamespace(const std::string& name, bool godown = false) { for(std::vector::iterator i = namespaces.begin(); i != namespaces.end(); ++i) {