Move input callback creation

This commit is contained in:
Kae 2023-07-04 20:45:43 +10:00
parent e3461e9053
commit bf7418073d
2 changed files with 3 additions and 7 deletions

View File

@ -16,6 +16,7 @@
#include "StarRootLoader.hpp" #include "StarRootLoader.hpp"
#include "StarInterfaceLuaBindings.hpp" #include "StarInterfaceLuaBindings.hpp"
#include "StarInputLuaBindings.hpp"
namespace Star { namespace Star {
@ -483,6 +484,7 @@ void ClientApplication::changeState(MainAppState newState) {
m_playerStorage = make_shared<PlayerStorage>(m_root->toStoragePath("player")); m_playerStorage = make_shared<PlayerStorage>(m_root->toStoragePath("player"));
m_statistics = make_shared<Statistics>(m_root->toStoragePath("player"), appController()->statisticsService()); m_statistics = make_shared<Statistics>(m_root->toStoragePath("player"), appController()->statisticsService());
m_universeClient = make_shared<UniverseClient>(m_playerStorage, m_statistics); m_universeClient = make_shared<UniverseClient>(m_playerStorage, m_statistics);
m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks());
m_mainMixer->setUniverseClient(m_universeClient); m_mainMixer->setUniverseClient(m_universeClient);
m_titleScreen = make_shared<TitleScreen>(m_playerStorage, m_mainMixer->mixer()); m_titleScreen = make_shared<TitleScreen>(m_playerStorage, m_mainMixer->mixer());
@ -601,6 +603,7 @@ void ClientApplication::changeState(MainAppState newState) {
m_worldPainter = make_shared<WorldPainter>(); m_worldPainter = make_shared<WorldPainter>();
m_mainInterface = make_shared<MainInterface>(m_universeClient, m_worldPainter, m_cinematicOverlay); m_mainInterface = make_shared<MainInterface>(m_universeClient, m_worldPainter, m_cinematicOverlay);
m_universeClient->setLuaCallbacks("interface", LuaBindings::makeInterfaceCallbacks(m_mainInterface.get())); m_universeClient->setLuaCallbacks("interface", LuaBindings::makeInterfaceCallbacks(m_mainInterface.get()));
m_mainMixer->setWorldPainter(m_worldPainter); m_mainMixer->setWorldPainter(m_worldPainter);
if (auto renderer = Application::renderer()) { if (auto renderer = Application::renderer()) {

View File

@ -283,11 +283,6 @@ void LuaWorldComponent<Base>::init(World* world) {
Base::setLuaRoot(world->luaRoot()); Base::setLuaRoot(world->luaRoot());
Base::addCallbacks("world", LuaBindings::makeWorldCallbacks(world)); Base::addCallbacks("world", LuaBindings::makeWorldCallbacks(world));
if (world->isClient()) {
Base::addCallbacks("input", LuaBindings::makeInputCallbacks());
}
Base::init(); Base::init();
} }
@ -295,8 +290,6 @@ template <typename Base>
void LuaWorldComponent<Base>::uninit() { void LuaWorldComponent<Base>::uninit() {
Base::uninit(); Base::uninit();
Base::removeCallbacks("world"); Base::removeCallbacks("world");
Base::removeCallbacks("input");
} }
template <typename Base> template <typename Base>