From 4ee191fbf43dc51dcbac0223cb547b2b8fba9136 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 22 Feb 2019 13:38:00 +0100 Subject: [PATCH] engine: start working on a tickable object, cleaner than entities. --- doc/samples/physics/lolbtphysicsintegration.h | 11 +- src/Makefile.am | 5 +- src/camera.cpp | 4 +- src/debug/record.cpp | 4 +- src/debug/stats.cpp | 16 +-- src/engine/entity.cpp | 6 +- src/engine/entity.h | 61 ++-------- src/engine/tickable.cpp | 33 ++++++ src/engine/ticker.cpp | 40 +++---- src/engine/ticker.h | 28 +++-- src/font.cpp | 2 +- src/light.cpp | 18 +-- src/lol-core.vcxproj | 3 + src/lol-core.vcxproj.filter | 12 ++ src/lol/engine/all.h | 16 +++ src/lol/engine/tickable.h | 111 ++++++++++++++++++ src/lol/public.h | 5 +- src/text.cpp | 2 +- src/textureimage.cpp | 6 +- src/ui/controller.cpp | 6 +- src/ui/d3d9-input.cpp | 2 +- src/ui/gui.cpp | 4 +- src/ui/sdl-input.cpp | 2 +- 23 files changed, 267 insertions(+), 130 deletions(-) create mode 100644 src/engine/tickable.cpp create mode 100644 src/lol/engine/all.h create mode 100644 src/lol/engine/tickable.h diff --git a/doc/samples/physics/lolbtphysicsintegration.h b/doc/samples/physics/lolbtphysicsintegration.h index c9097512..0b1a85e0 100644 --- a/doc/samples/physics/lolbtphysicsintegration.h +++ b/doc/samples/physics/lolbtphysicsintegration.h @@ -1,8 +1,8 @@ // // Lol Engine // -// Copyright © 2010—2013 Benjamin “Touky” Huet -// © 2009—2013 Sam Hocevar +// Copyright © 2009—2019 Sam Hocevar +// © 2010—2013 Benjamin “Touky” Huet // // This library is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -24,11 +24,8 @@ namespace lol // Override Gamegroups names for Physic-usage // "_ENT_" means that this is a group for Entities that use EasyPhysic primitives. // "_EZP_" means that this is a group for EasyPhysic primitives. -#define GAMEGROUP_ENT_INPUT GAMEGROUP_INPUT -#define GAMEGROUP_ENT_PLATFORM GAMEGROUP_ENTITY -#define GAMEGROUP_ENT_MAIN GAMEGROUP_OTHER_1 -#define GAMEGROUP_EZP_CHAR_CTRLR GAMEGROUP_OTHER_2 -#define GAMEGROUP_SIMULATION GAMEGROUP_OTHER_3 +#define GAMEGROUP_EZP_CHAR_CTRLR tickable::group::game::other_2 +#define GAMEGROUP_SIMULATION tickable::group::game::other_3 #define LOL2BT_UNIT 1.0f #define BT2LOL_UNIT 1.0f diff --git a/src/Makefile.am b/src/Makefile.am index ea650aac..11abaff3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -52,6 +52,9 @@ liblol_core_headers = \ lol/audio/all.h \ lol/audio/audio.h lol/audio/sample.h \ \ + lol/engine/all.h \ + lol/engine/tickable.h \ + \ lol/sys/all.h \ lol/sys/init.h lol/sys/file.h lol/sys/getopt.h lol/sys/thread.h \ lol/sys/threadtypes.h lol/sys/timer.h \ @@ -130,7 +133,7 @@ liblol_core_sources = \ image/filter/dilate.cpp image/filter/median.cpp image/filter/yuv.cpp \ image/movie.cpp \ \ - engine/ticker.cpp engine/ticker.h \ + engine/tickable.cpp engine/ticker.cpp engine/ticker.h \ engine/entity.cpp engine/entity.h \ engine/world.cpp engine/world.h \ engine/worldentity.cpp engine/worldentity.h \ diff --git a/src/camera.cpp b/src/camera.cpp index 272b17c1..709e5c6c 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -27,8 +27,8 @@ namespace lol Camera::Camera() { - m_gamegroup = GAMEGROUP_CAMERA; - m_drawgroup = DRAWGROUP_CAMERA; + m_gamegroup = tickable::group::game::camera; + m_drawgroup = tickable::group::draw::camera; //Arbitrary values when scene renderer is not ready. ivec2 screen_size = (Scene::GetCount()) ? (Video::GetSize()) : (ivec2(800, 600)); diff --git a/src/debug/record.cpp b/src/debug/record.cpp index 43ce793a..98c1cf8d 100644 --- a/src/debug/record.cpp +++ b/src/debug/record.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -56,7 +56,7 @@ DebugRecord::DebugRecord(std::string const &path, float fps) m_data->m_sequence = nullptr; #endif - m_drawgroup = DRAWGROUP_CAPTURE; + m_drawgroup = tickable::group::draw::capture; } void DebugRecord::tick_game(float seconds) diff --git a/src/debug/stats.cpp b/src/debug/stats.cpp index c9069171..c3664c36 100644 --- a/src/debug/stats.cpp +++ b/src/debug/stats.cpp @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #include @@ -38,7 +40,7 @@ DebugStats::DebugStats(char const *path) { data->fp = fopen(path, "w+"); - m_gamegroup = GAMEGROUP_STATS; + m_gamegroup = tickable::group::game::stats; } void DebugStats::tick_game(float seconds) diff --git a/src/engine/entity.cpp b/src/engine/entity.cpp index 21d9ee0d..14c86432 100644 --- a/src/engine/entity.cpp +++ b/src/engine/entity.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -29,8 +29,8 @@ Entity::Entity() : #if !LOL_BUILD_RELEASE m_tickstate = STATE_IDLE; #endif - m_gamegroup = GAMEGROUP_ENTITY; - m_drawgroup = DRAWGROUP_ENTITY; + m_gamegroup = tickable::group::game::entity; + m_drawgroup = tickable::group::draw::entity; /* FIXME: is this a problem? because the object can * be ticked before the constructor is finished! */ Ticker::Register(this); diff --git a/src/engine/entity.h b/src/engine/entity.h index d284fcb2..816ad519 100644 --- a/src/engine/entity.h +++ b/src/engine/entity.h @@ -20,7 +20,9 @@ // Ticker class for the ticking logic and the linked list implementation. // -#include +#include + +#include namespace lol { @@ -44,7 +46,7 @@ struct InitState class Entity { friend class Scene; - friend class Ticker; + friend class ticker; friend class TickerData; friend class Emcee; @@ -64,58 +66,6 @@ protected: virtual void tick_game(float seconds); virtual void tick_draw(float seconds, class Scene &scene); - enum - { - GAMEGROUP_BEGIN = 0, // must be the first element - - GAMEGROUP_INPUT, // input should be polled before everything else - GAMEGROUP_IMGUI, // debug update needs to be called before the rest for init purposes - GAMEGROUP_APP, // main application update - GAMEGROUP_ENTITY, // default entity update - // ----------------- // split entity update: - GAMEGROUP_PLAYER, // player updates before AI to ensure player actions is prevalent - GAMEGROUP_AI, // AI update - GAMEGROUP_OTHER_0, // other misc updates here - GAMEGROUP_OTHER_1, // (same) - GAMEGROUP_OTHER_2, // (same) - GAMEGROUP_OTHER_3, // (same) - // ----------------- // primitives updates - GAMEGROUP_MESH, // update Mesh/Animation to ensure correct sync with PLY/AI - GAMEGROUP_FX, // update FX/other to ensure correct sync with WorldPos and Meshes - GAMEGROUP_LIGHT, // update after FX because it could some - GAMEGROUP_CAMERA, // update camera at the end of the frame, once everything is settled - GAMEGROUP_STATS, // stats update - - GAMEGROUP_END // must be the last element - } - m_gamegroup; - - enum - { - DRAWGROUP_BEGIN = GAMEGROUP_END, - - DRAWGROUP_CAMERA, // update camera first for rendering - DRAWGROUP_TEXTURE, // texture - DRAWGROUP_LIGHT, // - DRAWGROUP_WORLD, // other misc updates here - DRAWGROUP_ENTITY, // - DRAWGROUP_FX, // - DRAWGROUP_OTHER_0, // other misc updates here - DRAWGROUP_OTHER_1, // (same) - DRAWGROUP_OTHER_2, // (same) - DRAWGROUP_OTHER_3, // (same) - DRAWGROUP_APP, // main application Draw - DRAWGROUP_HUD, - DRAWGROUP_IMGUI, - DRAWGROUP_CAPTURE, - - DRAWGROUP_END, // must be the next-to-last element - DRAWGROUP_NONE, // this group is for non draw-ticked - } - m_drawgroup; - - static int const ALLGROUP_END = DRAWGROUP_END; - /* The initialisation state */ InitState m_initstate; @@ -131,6 +81,9 @@ protected: m_tickstate; #endif + tickable::group::game m_gamegroup; + tickable::group::draw m_drawgroup; + // Emcee begin private: void SetState(uint32_t newstate); diff --git a/src/engine/tickable.cpp b/src/engine/tickable.cpp new file mode 100644 index 00000000..b78a7d73 --- /dev/null +++ b/src/engine/tickable.cpp @@ -0,0 +1,33 @@ +// +// Lol Engine +// +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#include + +#include +#include +#include + +namespace lol +{ + +//auto p = tickable::create(); + +tickable::tickable() +{ +} + +tickable::~tickable() +{ +} + +} /* namespace lol */ + diff --git a/src/engine/ticker.cpp b/src/engine/ticker.cpp index 052bbd4c..b6d545d4 100644 --- a/src/engine/ticker.cpp +++ b/src/engine/ticker.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include namespace lol @@ -25,7 +25,7 @@ namespace lol static class TickerData { - friend class Ticker; + friend class ticker; public: TickerData() : @@ -57,8 +57,8 @@ public: private: /* Entity management */ array m_todolist, m_todolist_delayed, m_autolist; - array m_list[Entity::ALLGROUP_END]; - array m_scenes[Entity::ALLGROUP_END]; + array m_list[(int)tickable::group::all::end]; + array m_scenes[(int)tickable::group::all::end]; int nentities; /* Fixed framerate management */ @@ -214,10 +214,10 @@ void TickerData::GameThreadTick() #if 0 msg::debug("-------------------------------------\n"); - for (int g = 0; g < Entity::ALLGROUP_END; ++g) + for (int g = 0; g < (int)tickable::group::all::end; ++g) { msg::debug("%s Group %d\n", - (g < Entity::GAMEGROUP_END) ? "Game" : "Draw", g); + (g < (int)tickable::group::game::end) ? "Game" : "Draw", g); for (int i = 0; i < data->m_list[g].count(); ++i) { @@ -269,7 +269,7 @@ void TickerData::GameThreadTick() int n = 0; data->panic = 2 * (data->panic + 1); - for (int g = 0; g < Entity::ALLGROUP_END && n < data->panic; ++g) + for (int g = 0; g < (int)tickable::group::all::end && n < data->panic; ++g) for (int i = 0; i < data->m_list[g].count() && n < data->panic; ++i) { Entity * e = data->m_list[g][i]; @@ -297,13 +297,13 @@ void TickerData::GameThreadTick() * in the tick lists can be marked for destruction. */ array destroy_list; bool do_reserve = true; - for (int g = 0; g < Entity::ALLGROUP_END; ++g) + for (int g = 0; g < (int)tickable::group::all::end; ++g) { for (int i = data->m_list[g].count(); i--;) { Entity *e = data->m_list[g][i]; - if (e->m_destroy && g < Entity::GAMEGROUP_END) + if (e->m_destroy && g < (int)tickable::group::game::end) { /* Game tick list: * If entity is to be destroyed, remove it */ @@ -328,7 +328,7 @@ void TickerData::GameThreadTick() if (Scene::GetScene(j).IsRelevant(e)) removal_count++; //Update scene index - data->m_scenes[e->m_drawgroup][j] -= removal_count; + data->m_scenes[(int)e->m_drawgroup][j] -= removal_count; } if (do_reserve) { @@ -339,7 +339,7 @@ void TickerData::GameThreadTick() } else { - if (e->m_ref <= 0 && g >= Entity::DRAWGROUP_BEGIN) + if (e->m_ref <= 0 && g >= (int)tickable::group::draw::begin) e->m_destroy = 1; } } @@ -363,11 +363,11 @@ void TickerData::GameThreadTick() } data->m_todolist.remove(-1); - data->m_list[e->m_gamegroup].push(e); - if (e->m_drawgroup != Entity::DRAWGROUP_NONE) + data->m_list[(int)e->m_gamegroup].push(e); + if (e->m_drawgroup != tickable::group::draw::none) { - if (data->m_scenes[e->m_drawgroup].count() < Scene::GetCount()) - data->m_scenes[e->m_drawgroup].resize(Scene::GetCount()); + if (data->m_scenes[(int)e->m_drawgroup].count() < Scene::GetCount()) + data->m_scenes[(int)e->m_drawgroup].resize(Scene::GetCount()); int added_count = 0; for (int i = 0; i < Scene::GetCount(); i++) @@ -375,11 +375,11 @@ void TickerData::GameThreadTick() //If entity is concerned by this scene, add it in the list if (Scene::GetScene(i).IsRelevant(e)) { - data->m_list[e->m_drawgroup].insert(e, data->m_scenes[e->m_drawgroup][i]); + data->m_list[(int)e->m_drawgroup].insert(e, data->m_scenes[(int)e->m_drawgroup][i]); added_count++; } //Update scene index - data->m_scenes[e->m_drawgroup][i] += added_count; + data->m_scenes[(int)e->m_drawgroup][i] += added_count; } } @@ -391,7 +391,7 @@ void TickerData::GameThreadTick() data->m_todolist_delayed.clear(); /* Tick objects for the game loop */ - for (int g = Entity::GAMEGROUP_BEGIN; g < Entity::GAMEGROUP_END && !data->quit /* Stop as soon as required */; ++g) + for (int g = (int)tickable::group::game::begin; g < (int)tickable::group::game::end && !data->quit /* Stop as soon as required */; ++g) { for (int i = 0; i < data->m_list[g].count() && !data->quit /* Stop as soon as required */; ++i) { @@ -435,11 +435,11 @@ void TickerData::DrawThreadTick() scene.pre_render(data->deltatime); /* Tick objects for the draw loop */ - for (int g = Entity::DRAWGROUP_BEGIN; g < Entity::DRAWGROUP_END && !data->quit /* Stop as soon as required */; ++g) + for (int g = (int)tickable::group::draw::begin; g < (int)tickable::group::draw::end && !data->quit /* Stop as soon as required */; ++g) { switch (g) { - case Entity::DRAWGROUP_BEGIN: + case (int)tickable::group::draw::begin: scene.Reset(); break; default: diff --git a/src/engine/ticker.h b/src/engine/ticker.h index d8bcb99d..873a5138 100644 --- a/src/engine/ticker.h +++ b/src/engine/ticker.h @@ -1,29 +1,31 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #pragma once // -// The Ticker class -// ---------------- -// The Ticker is a static class that registers entities and ticks them. +// The ticker class +// ———————————————— +// The ticker is a static class that registers entities and ticks them. // -#include +#include #include "engine/entity.h" namespace lol { -class Ticker +class ticker { public: static void Register(Entity *entity); @@ -46,8 +48,10 @@ public: static int Finished(); private: - Ticker() {} + ticker() {} }; +typedef ticker Ticker; + } /* namespace lol */ diff --git a/src/font.cpp b/src/font.cpp index 6733b5cb..859dd717 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -60,7 +60,7 @@ Font::Font(std::string const &path) data->tileset = TileSet::create(path, ivec2::zero, ivec2(16)); data->size = data->tileset->GetTileSize(0); - m_drawgroup = DRAWGROUP_TEXTURE; + m_drawgroup = tickable::group::draw::texture; } Font::~Font() diff --git a/src/light.cpp b/src/light.cpp index c4aeb580..c15928a4 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #include @@ -20,8 +22,8 @@ Light::Light() : m_color(1.f), m_type(LightType::Directional) { - m_gamegroup = GAMEGROUP_LIGHT; - m_drawgroup = DRAWGROUP_LIGHT; + m_gamegroup = tickable::group::game::light; + m_drawgroup = tickable::group::draw::light; SetPosition(vec3::zero); } diff --git a/src/lol-core.vcxproj b/src/lol-core.vcxproj index 819a5779..ce8f5a2d 100644 --- a/src/lol-core.vcxproj +++ b/src/lol-core.vcxproj @@ -106,6 +106,7 @@ + @@ -228,6 +229,8 @@ + + diff --git a/src/lol-core.vcxproj.filter b/src/lol-core.vcxproj.filter index d5cf41b1..9e368cb1 100644 --- a/src/lol-core.vcxproj.filter +++ b/src/lol-core.vcxproj.filter @@ -31,6 +31,9 @@ {39f6f872-186f-48af-8e87-bcceb06b1b21} + + {a20b47c1-a0f8-4a02-a7a8-6da2ccd8bb02} + {f25b3187-b24c-469a-b038-5a968eaa83f6} @@ -360,6 +363,9 @@ engine + + engine + engine @@ -656,6 +662,12 @@ lol\debug + + lol\engine + + + lol\engine + lol\image diff --git a/src/lol/engine/all.h b/src/lol/engine/all.h new file mode 100644 index 00000000..56028f2b --- /dev/null +++ b/src/lol/engine/all.h @@ -0,0 +1,16 @@ +// +// Lol Engine +// +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +#include + diff --git a/src/lol/engine/tickable.h b/src/lol/engine/tickable.h new file mode 100644 index 00000000..e71361b1 --- /dev/null +++ b/src/lol/engine/tickable.h @@ -0,0 +1,111 @@ +// +// Lol Engine +// +// Copyright © 2010—2019 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +// +// The tickable class +// —————————————————— +// Tickables are objects that can be ticked by the game loop and/or the render +// loop. +// + +#include + +namespace lol +{ + +class game_tickable +{ + virtual void tick_game(float seconds) = 0; +}; + +class draw_tickable +{ + virtual void tick_draw(float seconds, class Scene &scene) = 0; +}; + +class tickable : public std::enable_shared_from_this +{ +public: + tickable(); + virtual ~tickable(); + + // Auto-registering factory + template + static typename std::enable_if::value, std::shared_ptr>::type + create() + { + auto p = std::make_shared(); + return p; + } + + // Tick groups + struct group + { + enum class game + { + begin = 0, // must be the first element + + input, // input should be polled before everything else + gui, // debug update needs to be called before the rest for init purposes + app, // main application update + entity, // default entity update + // ----------------- // split entity update: + player, // player updates before AI to ensure player actions is prevalent + ai, // AI update + other_0, // other misc updates here + other_1, // (same) + other_2, // (same) + other_3, // (same) + // ----------------- // primitives updates + mesh, // update Mesh/Animation to ensure correct sync with PLY/AI + fx, // update FX/other to ensure correct sync with WorldPos and Meshes + light, // update after FX because it could some + camera, // update camera at the end of the frame, once everything is settled + stats, // stats update + + end, // must be the last element + }; + + enum class draw + { + begin = (int)game::end, + + camera, // update camera first for rendering + texture, // texture + light, // + world, // other misc updates here + entity, // + fx, // + other_0, // other misc updates here + other_1, // (same) + other_2, // (same) + other_3, // (same) + app, // main application Draw + hud, + gui, + capture, + + end, // must be the next-to-last element + none, // this group is for non draw-ticked + }; + + enum class all + { + end = (int)draw::end, + }; + }; +}; + +} /* namespace lol */ + diff --git a/src/lol/public.h b/src/lol/public.h index 626ae221..183135eb 100644 --- a/src/lol/public.h +++ b/src/lol/public.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2016 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -14,7 +14,7 @@ // // The main header -// --------------- +// ——————————————— // #include @@ -25,4 +25,5 @@ #include #include #include +#include diff --git a/src/text.cpp b/src/text.cpp index 3c61aa38..f0edff87 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -50,7 +50,7 @@ Text::Text(std::string const &text, char const *font) data->m_scale = vec2(1.f); data->m_spacing = 0.f; - m_drawgroup = DRAWGROUP_HUD; + m_drawgroup = tickable::group::draw::entity; } void Text::SetText(std::string const &text) diff --git a/src/textureimage.cpp b/src/textureimage.cpp index 87e605e8..cf7f1585 100644 --- a/src/textureimage.cpp +++ b/src/textureimage.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -12,8 +12,8 @@ #include -#include #include +#include #include #if defined _WIN32 @@ -84,7 +84,7 @@ void TextureImage::Init(std::string const &path, image* img) m_data->m_texture_size = ivec2(PotUp(m_data->m_image_size.x), PotUp(m_data->m_image_size.y)); - m_drawgroup = DRAWGROUP_TEXTURE; + m_drawgroup = tickable::group::draw::texture; } void TextureImage::tick_draw(float seconds, Scene &scene) diff --git a/src/ui/controller.cpp b/src/ui/controller.cpp index cb6d9ce5..4fe42a9c 100644 --- a/src/ui/controller.cpp +++ b/src/ui/controller.cpp @@ -1,8 +1,8 @@ // // Lol Engine // -// Copyright © 2010—2015 Benjamin Litzelmann -// © 2017—2019 Sam Hocevar +// Copyright © 2017—2019 Sam Hocevar +// © 2010—2015 Benjamin Litzelmann // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -223,7 +223,7 @@ static uint32_t g_active_layer = ~((uint32_t)0); //----------------------------------------------------------------------------- Controller::Controller(std::string const &name) { - m_gamegroup = GAMEGROUP_INPUT; + m_gamegroup = tickable::group::game::input; m_name = name; m_activate_nextframe = true; m_deactivate_nextframe = false; diff --git a/src/ui/d3d9-input.cpp b/src/ui/d3d9-input.cpp index 0cfdb97c..22cd4f1f 100644 --- a/src/ui/d3d9-input.cpp +++ b/src/ui/d3d9-input.cpp @@ -103,7 +103,7 @@ D3d9Input::D3d9Input() } #endif - m_gamegroup = GAMEGROUP_INPUT; + m_gamegroup = tickable::group::game::input; } D3d9Input::~D3d9Input() diff --git a/src/ui/gui.cpp b/src/ui/gui.cpp index ad4647e6..96a7b16a 100644 --- a/src/ui/gui.cpp +++ b/src/ui/gui.cpp @@ -45,8 +45,8 @@ gui::gui(ImFontAtlas *shared_font_atlas) { ImGui::CreateContext(shared_font_atlas); - m_gamegroup = GAMEGROUP_IMGUI; - m_drawgroup = DRAWGROUP_IMGUI; + m_gamegroup = tickable::group::game::gui; + m_drawgroup = tickable::group::draw::gui; // Build shader code ------------------------------------------------------- ShaderVar out_vertex = ShaderVar::GetShaderOut(ShaderProgram::Vertex); diff --git a/src/ui/sdl-input.cpp b/src/ui/sdl-input.cpp index 922f6d89..290d628c 100644 --- a/src/ui/sdl-input.cpp +++ b/src/ui/sdl-input.cpp @@ -128,7 +128,7 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) } #endif - m_gamegroup = GAMEGROUP_INPUT; + m_gamegroup = tickable::group::game::input; } SdlInput::~SdlInput()