//
game::engine.init();
- // used three times below
- auto worldSys = game::engine.getSystem<WorldSystem>();
-
- //
- // initialize GLEW
- //
- #ifndef __WIN32__
- glewExperimental = GL_TRUE;
- #endif
-
- auto glewError = glewInit();
- if (glewError != GLEW_OK)
- UserError(std::string("GLEW was not able to initialize! Error: ")
- + reinterpret_cast<const char *>(glewGetErrorString(glewError)));
-
- //
- // start the random number generator (TODO our own?)
- //
+ // initialize the renderer
+ Render::init();
+ // start the random number generator
randInit(millis());
- //
- // some basic OpenGL setup stuff
- //
-
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
- // enable v-sync (TODO but 1000 fps?)
- SDL_GL_SetSwapInterval(0);
- // hide the cursor
- SDL_ShowCursor(SDL_DISABLE);
- // switch to pixel grid
- glViewport(0, 0, game::SCREEN_WIDTH, game::SCREEN_HEIGHT);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glClearColor(1, 1, 1, 1);
-
- //
- // initialize shaders
- //
-
- std::cout << "Initializing shaders!\n";
- Render::initShaders();
- Colors::init();
-
- //
- // load saved data
+ // load some saved data
- //
-
game::briceLoad();
game::briceUpdate();
std::string sname = sxml->Name();
if (sname == "src") {
foffset = (sxml->Attribute("offset") != nullptr) ?
- str2coord(sxml->Attribute("offset")) : vec2(0,0);
+ sxml->StrAttribute("offset") : vec2(0,0);
fdraw = (sxml->Attribute("drawOffset") != nullptr) ?
- str2coord(sxml->Attribute("drawOffset")) : vec2(0,0);
+ sxml->StrAttribute("drawOffset") : vec2(0,0);
-
+
if (sxml->Attribute("size") != nullptr) {
- fsize = str2coord(sxml->Attribute("size"));
- fsize = sxml->Attribute("size");
- tmpf.push_back(std::make_pair(SpriteData(sxml->GetText(), foffset, fsize), fdraw));
++ fsize = sxml->StrAttribute("size");
+ sd = new SpriteData(sxml->GetText(), foffset, fsize);
} else {
- tmpf.push_back(std::make_pair(SpriteData(sxml->GetText(), foffset), fdraw));
+ sd = new SpriteData(sxml->GetText(), foffset);
}
+ if (sxml->QueryUnsignedAttribute("limb", &limb) == XML_NO_ERROR)
+ sd->limb = limb;
+ tmpf.push_back(std::make_pair(*sd, fdraw));
}
sxml = sxml->NextSiblingElement();
}