adding developer console connect with 'dev bl bla bla lb' command.
This commit is contained in:
parent
4e46d65c27
commit
ed32f515a3
11 changed files with 211 additions and 32 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#include "trace.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include "developer_console.hpp"
|
||||
|
||||
namespace game {
|
||||
void ShootCommand::apply(Player *player, State *state) const
|
||||
{
|
||||
|
|
@ -91,9 +93,20 @@ namespace game {
|
|||
|
||||
std::cout << "got developer command: '" << m_payload << "'" << std::endl;
|
||||
|
||||
if (m_payload == "reload shader") {
|
||||
// TODO: really do that ;)
|
||||
} else if (m_payload == "reload models") {
|
||||
std::string nextToken;
|
||||
std::string nextPayload;
|
||||
|
||||
if (util::splitIntoTokenAndRest(m_payload, nextToken, nextPayload)) {
|
||||
developer::DeveloperConsole::CallbackResult result =
|
||||
developer::DeveloperConsole::instance().dispatchInput(
|
||||
nextToken,
|
||||
nextPayload);
|
||||
|
||||
if (result.okay) {
|
||||
std::cout<<"[commands] developer callback success: " << result.answer << std::endl;
|
||||
} else {
|
||||
std::cout<<"[commands] developer callback failure: " << result.answer << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "util.hpp"
|
||||
|
||||
namespace game {
|
||||
void State::init(int numPlanets, bool devMode)
|
||||
void State::init(int numPlanets)
|
||||
{
|
||||
// clear
|
||||
for (Planet *planet : planets) {
|
||||
|
|
@ -38,7 +38,6 @@ namespace game {
|
|||
m_playerRespawnTime = 2.0;
|
||||
m_defaultEnergy = 10.0;
|
||||
m_maxNumTraces = 10;
|
||||
m_developerMode = devMode;
|
||||
|
||||
setPlayingFieldCenter(0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace game {
|
|||
|
||||
// called to setup the state (randomize planets, kill
|
||||
// traces/missiles/ships etc.)
|
||||
void init(int numPlanets=15, bool devMode=false);
|
||||
void init(int numPlanets=15);
|
||||
|
||||
// main method to advance the simulation by the given timestamp in
|
||||
// seconds.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue