Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ** EPITECH PROJECT, 2020
- ** OOP_arcade_2019
- ** File description:
- ** main
- */
- #include "../DLLoader/Loader.hpp"
- #include "../Wrappers/WrSFML/WrSFML.hpp"
- #include "../Core/Core.hpp"
- std::unique_ptr<Arcade::Core> LoadCore(const std::string startLibPath)
- {
- LibraryHandler library = dlopen("core.so", RTLD_LAZY);
- void* core = dlsym(library, "GetCore");
- std::unique_ptr<Arcade::Core> engine = (reinterpret_cast<std::unique_ptr<Arcade::Core> (*)(const std::string&)>(core))(startLibPath);
- return engine;
- }
- int main(int ac, char** av)
- {
- std::unique_ptr<Arcade::Core> engine;
- if (ac >= 2)
- engine = LoadCore(av[1]);
- else
- return -1;
- engine->WindowCreate("Ma belle fenetre", 1280, 720);
- engine->ImageAdd("smiley", "assets/smiley.png", 0.2f);
- engine->EventAddKey("P", [&engine] {
- engine->WindowClose();
- });
- engine->ImageSetPosition("smiley", 500, 300);
- while (engine->WindowIsOpen())
- {
- engine->ImageMove("smiley", engine->InputGetAxis() * 2);
- engine->WindowClear();
- engine->WindowDraw("smiley");
- engine->WindowUpdate();
- }
- engine->WindowClose();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement