Basic setup for Cpp based screeping.
This commit is contained in:
29
src/loop.cpp
Normal file
29
src/loop.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <Screeps/Context.hpp>
|
||||
#include <Screeps/Creep.hpp>
|
||||
#include <Screeps/StructureSpawn.hpp>
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
|
||||
#include "structures/spawn.hpp"
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
extern "C" void loop()
|
||||
{
|
||||
Screeps::Context::update();
|
||||
|
||||
EM_ASM({ console.log('Starting loop...'); });
|
||||
|
||||
auto spawnManager = SpawnManager();
|
||||
spawnManager.process();
|
||||
|
||||
auto creeps = Screeps::Game.creeps();
|
||||
for (auto& creep : creeps)
|
||||
creep.second.say("screepsxx");
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(loop)
|
||||
{
|
||||
emscripten::function("loop", &loop);
|
||||
}
|
||||
Reference in New Issue
Block a user