Commit f78f55b7 authored by NTAuthority's avatar NTAuthority

add (clean) quit command

parent 9836b2cb
Pipeline #50 skipped
......@@ -4,70 +4,14 @@
#include "Game.h"
#include <stdio.h>
#include <iostream>
#include <CdImageDevice.h>
#include <Streaming.h>
#include <vfs/Manager.h>
#include <Console.h>
#include <Console.CommandHelpers.h>
#include <Streaming.tests.h>
#include <WorldMath.h>
namespace krt
{
int unknown()
{
vfs::StreamPtr stream = vfs::OpenRead("C:\\Windows\\system32\\License.rtf");
auto data = stream->ReadToEnd();
assert(false && "hey!");
return 0;
}
int Main::Run(const ProgramArguments& arguments)
{
Game TheGame;
Game TheGame;
TheGame.Run();
ConsoleCommand cmd("a", [] (int a, int b, int c)
{
printf("%d %d %d\n", a, b, c);
});
ConsoleCommand cmd2("a", [] (int a, int b, const std::string& c)
{
printf("%d %d %s\n", a, b, c.c_str());
});
console::ExecuteSingleCommand("a 5 4 1000");
console::AddToBuffer("a 1 2 3; a 1 2 \"hi world\"\r\na 1 2");
console::ExecuteBuffer();
// ))))))))))))))
math::Tests();
streaming::FaultTest1();
streaming::Test3();
unknown();
unknown();
unknown();
if (arguments.Count() >= 2)
{
printf("hi! %s\n", arguments[2].c_str());
}
else
{
printf("meow\n");
}
return 0;
}
}
\ No newline at end of file
......@@ -82,6 +82,8 @@ class GameUniverse
std::vector<streaming::ident_t> m_streamingIndices;
std::map<streaming::ident_t, streaming::ident_t> m_modelIndexMapping;
Game* m_game;
};
using GameUniversePtr = std::shared_ptr<GameUniverse>;
......
......@@ -117,6 +117,12 @@ void Game::Run()
bool wantsToExit = false;
uint64_t lastTime = 0;
// exit command
ConsoleCommand quitCommand("quit", [&] ()
{
wantsToExit = true;
});
while (!wantsToExit)
{
// limit frame rate and handle events
......
......@@ -14,7 +14,7 @@
namespace krt
{
GameUniverse::GameUniverse(const GameConfiguration& configuration)
: m_configuration(configuration)
: m_configuration(configuration), m_game(theGame)
{
}
......@@ -22,7 +22,7 @@ GameUniverse::~GameUniverse()
{
for (streaming::ident_t index : m_streamingIndices)
{
theGame->GetStreaming().UnlinkResource(index);
m_game->GetStreaming().UnlinkResource(index);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment