@@ -3,7 +3,9 @@ project(swan) | |||
find_package(SFML 2.5 COMPONENTS graphics system window REQUIRED) | |||
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter) | |||
include_directories("${PROJECT_SOURCE_DIR}/libswan/include") | |||
add_subdirectory(libswan) | |||
add_subdirectory(core.mod) | |||
@@ -4,8 +4,9 @@ | |||
extern "C" void mod_init(Swan::Mod &mod) { | |||
mod.init("core"); | |||
mod.registerTile("test1", Swan::Tile()); | |||
mod.registerTile("test2", Swan::Tile()); | |||
mod.registerTile("stone", Swan::Tile("assets/tiles/stone.png")); | |||
mod.registerTile("dirt", Swan::Tile("assets/tiles/dirt.png")); | |||
mod.registerTile("grass", Swan::Tile("assets/tiles/grass.png")); | |||
} | |||
int main() { |
@@ -14,7 +14,7 @@ public: | |||
std::string name_; | |||
std::vector<Tile> tiles_; | |||
bool inited_ = false;; | |||
bool inited_ = false; | |||
void init(const std::string &name); | |||
void registerTile(const std::string &name, const Tile &tile); |
@@ -16,7 +16,7 @@ void Mod::registerTile(const std::string &name, const Tile &tile) { | |||
Tile &t = tiles_.back(); | |||
t.name_ = name_ + "::" + name; | |||
fprintf(stderr, "Mod %s added tile %s.\n", name_.c_str(), t.name_.c_str()); | |||
fprintf(stderr, "Added tile: %s\n", t.name_.c_str()); | |||
} | |||
} |