find_package(SFML 2.5 COMPONENTS graphics system window REQUIRED) | 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") | include_directories("${PROJECT_SOURCE_DIR}/libswan/include") | ||||
add_subdirectory(libswan) | add_subdirectory(libswan) | ||||
add_subdirectory(core.mod) | add_subdirectory(core.mod) | ||||
extern "C" void mod_init(Swan::Mod &mod) { | extern "C" void mod_init(Swan::Mod &mod) { | ||||
mod.init("core"); | 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() { | int main() { |
std::string name_; | std::string name_; | ||||
std::vector<Tile> tiles_; | std::vector<Tile> tiles_; | ||||
bool inited_ = false;; | |||||
bool inited_ = false; | |||||
void init(const std::string &name); | void init(const std::string &name); | ||||
void registerTile(const std::string &name, const Tile &tile); | void registerTile(const std::string &name, const Tile &tile); |
Tile &t = tiles_.back(); | Tile &t = tiles_.back(); | ||||
t.name_ = name_ + "::" + name; | 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()); | |||||
} | } | ||||
} | } |