forked from SuperTux/supertux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for skippable cutscenes (SuperTux#1513)
* Skippable cutscenes support. * Fixed the wrapper.cpp file.I rebuilt it the proper way (cmake -DGenerate_wrapper=on ..; make) so it fixed a few errors I made * Removed unnecessary property (added while testing methods for skippable cutscenes) * Skippable cutscenes now display a message in the top-left corner of the screen. FIXME: The text is sometimes not displayed when testing a level from the editor. * Fixed a problem with the cutscene skip message sometimes not showing * Fixed coding style * Improved code quality and removed unnecessary comment Co-authored-by: Semphris <semphris@protonmail.com>
- Loading branch information
1 parent
90f3d08
commit 67d52ec
Showing
17 changed files
with
345 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SuperTux | ||
// Copyright (C) 2006 Matthias Braun <matze@braunis.de> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#include "object/cutscene_info.hpp" | ||
|
||
#include <stdio.h> | ||
|
||
#include "object/camera.hpp" | ||
#include "supertux/resources.hpp" | ||
#include "video/drawing_context.hpp" | ||
|
||
CutsceneInfo::CutsceneInfo(/*const Vector& pos*/ const Camera& cam, const std::string& text_, const Level& parent) : | ||
position(cam.get_translation() + Vector(32, 32)), | ||
text(text_), | ||
camera(cam), | ||
level(parent) | ||
{ | ||
} | ||
|
||
void | ||
CutsceneInfo::update(float dt_sec) | ||
{ | ||
position = camera.get_translation() + Vector(32, 32); | ||
} | ||
|
||
void | ||
CutsceneInfo::draw(DrawingContext& context) | ||
{ | ||
if (level.m_is_in_cutscene && !level.m_skip_cutscene) | ||
{ | ||
context.color().draw_text(Resources::normal_font, text, position, ALIGN_LEFT, LAYER_OBJECTS + 1000, CutsceneInfo::text_color); | ||
} | ||
} | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SuperTux | ||
// Copyright (C) 2006 Matthias Braun <matze@braunis.de> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#ifndef HEADER_SUPERTUX_OBJECT_CUTSCENE_INFO_HPP | ||
#define HEADER_SUPERTUX_OBJECT_CUTSCENE_INFO_HPP | ||
|
||
#include "math/vector.hpp" | ||
#include "object/camera.hpp" | ||
#include "supertux/game_object.hpp" | ||
#include "supertux/level.hpp" | ||
#include "video/color.hpp" | ||
|
||
class CutsceneInfo final : public GameObject | ||
{ | ||
static Color text_color; | ||
public: | ||
CutsceneInfo(/*const Vector& pos*/ const Camera& cam, const std::string& text_, const Level& parent); | ||
virtual bool is_saveable() const override { | ||
return false; | ||
} | ||
|
||
virtual void update(float dt_sec) override; | ||
virtual void draw(DrawingContext& context) override; | ||
|
||
private: | ||
Vector position; | ||
std::string text; | ||
const Camera& camera; | ||
const Level& level; | ||
}; | ||
|
||
#endif | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.