-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added settings Squirrel proprety to worldmaps (allows dynamic changes to ambient light and music) * Refactored Secter/Worldmap scripting to use inheritance * Marked scripting::WorlMap's internal variable as unused * Fixed copyright headers * Fixed build error * Fixed MSVC not recognising the 'unused' attribute * Removed needless attribute * Added timeshift to worldmap Co-authored-by: Semphris <semphris@protonmail.com>
- Loading branch information
Showing
15 changed files
with
732 additions
and
404 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// SuperTux | ||
// Copyright (C) 2015 Ingo Ruhnke <grumbel@gmail.com> | ||
// 2021 A. Semphris <semphris@protonmail.com> | ||
// | ||
// 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 "scripting/game_object_manager.hpp" | ||
|
||
#include "object/ambient_light.hpp" | ||
#include "object/music_object.hpp" | ||
#include "supertux/game_object_manager.hpp" | ||
#include "video/color.hpp" | ||
|
||
namespace scripting { | ||
|
||
GameObjectManager::GameObjectManager(::GameObjectManager* parent) : | ||
m_gom_parent(parent) | ||
{ | ||
} | ||
|
||
void | ||
GameObjectManager::fade_to_ambient_light(float red, float green, float blue, float fadetime) | ||
{ | ||
auto& ambient_light = m_gom_parent->get_singleton_by_type<AmbientLight>(); | ||
ambient_light.fade_to_ambient_light(red, green, blue, fadetime); | ||
} | ||
|
||
void | ||
GameObjectManager::set_ambient_light(float red, float green, float blue) | ||
{ | ||
auto& ambient_light = m_gom_parent->get_singleton_by_type<AmbientLight>(); | ||
ambient_light.set_ambient_light(Color(red, green, blue)); | ||
} | ||
|
||
float | ||
GameObjectManager::get_ambient_red() const | ||
{ | ||
auto& ambient_light = m_gom_parent->get_singleton_by_type<AmbientLight>(); | ||
return ambient_light.get_ambient_light().red; | ||
} | ||
|
||
float | ||
GameObjectManager::get_ambient_green() const | ||
{ | ||
auto& ambient_light = m_gom_parent->get_singleton_by_type<AmbientLight>(); | ||
return ambient_light.get_ambient_light().green; | ||
} | ||
|
||
float | ||
GameObjectManager::get_ambient_blue() const | ||
{ | ||
auto& ambient_light = m_gom_parent->get_singleton_by_type<AmbientLight>(); | ||
return ambient_light.get_ambient_light().blue; | ||
} | ||
|
||
void | ||
GameObjectManager::set_music(const std::string& filename) | ||
{ | ||
auto& music = m_gom_parent->get_singleton_by_type<MusicObject>(); | ||
music.set_music(filename); | ||
} | ||
|
||
} // namespace scripting | ||
|
||
/* 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,56 @@ | ||
// SuperTux | ||
// Copyright (C) 2021 A. Semphris <semphris@protonmail.com> | ||
// | ||
// 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_SCRIPTING_GAME_OBJECT_MANAGER_HPP | ||
#define HEADER_SUPERTUX_SCRIPTING_GAME_OBJECT_MANAGER_HPP | ||
|
||
#ifndef SCRIPTING_API | ||
#include <string> | ||
class GameObjectManager; | ||
#endif | ||
|
||
namespace scripting { | ||
|
||
/** Superclass for sectors and worldmaps */ | ||
class GameObjectManager | ||
{ | ||
#ifndef SCRIPTING_API | ||
private: | ||
::GameObjectManager* m_gom_parent; | ||
|
||
public: | ||
GameObjectManager(::GameObjectManager* parent); | ||
|
||
private: | ||
GameObjectManager(const GameObjectManager&) = delete; | ||
GameObjectManager& operator=(const GameObjectManager&) = delete; | ||
#endif | ||
|
||
public: | ||
void set_ambient_light(float red, float green, float blue); | ||
void fade_to_ambient_light(float red, float green, float blue, float fadetime); | ||
float get_ambient_red() const; | ||
float get_ambient_green() const; | ||
float get_ambient_blue() const; | ||
|
||
void set_music(const std::string& music); | ||
}; | ||
|
||
} // namespace scripting | ||
|
||
#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
Oops, something went wrong.