Salut!
J'ai essayé de faire un code, le plus minimal possible mais pas facile quand on est sur un gros projet.
#include "application.h"
using namespace odfaeg::core;
using namespace odfaeg::graphic;
using namespace odfaeg::physic;
using namespace odfaeg::math;
using namespace odfaeg::network;
namespace sorrok {
MyAppli::MyAppli(sf::VideoMode wm, std::string title) : Application (wm, title, sf::Style::Default, sf::ContextSettings(0, 0, 4, 3, 0)) {
}
void MyAppli::onLoad() {
TextureManager<> tm;
tm.fromFileWithAlias("tilesets/herbe.png", "GRASS");
tm.fromFileWithAlias("tilesets/murs.png", "WALLS");
tm.fromFileWithAlias("tilesets/maison.png", "HOUSE");
tm.fromFileWithAlias("tilesets/flemmes1.png", "FIRE1");
tm.fromFileWithAlias("tilesets/flemmes2.png", "FIRE2");
tm.fromFileWithAlias("tilesets/flemmes3.png", "FIRE3");
FontManager<Fonts> fm;
fm.fromFileWithAlias("fonts/FreeSerif.ttf", Serif);
cache.addResourceManager(fm, "FontManager");
cache.addResourceManager(tm, "TextureManager");
//shader.loadFromFile("Shaders/SimpleVertexShader.vertexshader", "Shaders/SimpleFragmentShader.fragmentshader");
}
void MyAppli::onInit () {
TextureManager<> &tm = cache.resourceManager<Texture, std::string>("TextureManager");
Vec2f pos (getView().getPosition().x - getView().getSize().x * 0.5f, getView().getPosition().y - getView().getSize().y * 0.5f);
BoundingBox bx (pos.x, pos.y, 0, getView().getSize().x, getView().getSize().y, 0);
theMap = new Map(&getRenderComponentManager(), "Map test", 100, 50);
BaseChangementMatrix bcm;
bcm.set2DIsoMatrix();
theMap->setBaseChangementMatrix(bcm);
World::addEntityManager(theMap);
World::setCurrentEntityManager("Map test");
eu = new EntitiesUpdater();
World::addWorker(eu);
tiles.push_back(new Tile(tm.getResourceByAlias("GRASS"), Vec3f(0, 0, 0), Vec3f(120, 60, 0),sf::IntRect(0, 0, 100, 50)));
BoundingBox mapZone(0, 0, 0, 1500, 1000, 0);
World::generate_map(tiles, walls,Vec2f(100, 50),mapZone,false);
ZSortingRenderComponent *frc1 = new ZSortingRenderComponent(getRenderWindow(),0, "E_BIGTILE");
View view = getView();
frc1->setView(view);
getRenderComponentManager().addComponent(frc1);
World::update();
wResuHero = new RenderWindow (sf::VideoMode(400, 300), "Create ODFAEG Application", sf::Style::Titlebar, sf::ContextSettings(24, 0, 4, 3, 0));
View wView = wResuHero->getDefaultView();
wView.setCenter(Vec3f(wResuHero->getSize().x * 0.5f, wResuHero->getSize().y * 0.5f, 0));
wResuHero->setView(wView);