MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / initializeTextures

Method initializeTextures

engine/src/game.cpp:371–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369void GL_initializeTextures() { game.initializeTextures(); }
370
371void Game::initializeTextures()
372{
373 atlases.test.initialize(&textures.sprites);
374 atlases.test.loadFromFile(resolveResourcePath("sprites/smw.spr").c_str());
375
376 textures.sprites =
377 loadBMPTexture_ARGB(resolveResourcePath(atlasInfo.sprites.file).c_str());
378 atlases.sprites.initialize(&textures.sprites, atlasInfo.sprites.framesWide,
379 atlasInfo.sprites.framesHigh,
380 atlasInfo.sprites.frameWidth,
381 atlasInfo.sprites.frameHeight);
382 textures.tiles =
383 loadBMPTexture_ARGB(resolveResourcePath(atlasInfo.tiles.file).c_str());
384 atlases.tiles.initialize(
385 &textures.tiles, atlasInfo.tiles.framesWide, atlasInfo.tiles.framesHigh,
386 atlasInfo.tiles.frameWidth, atlasInfo.tiles.frameHeight);
387 textures.bgs =
388 loadBMPTexture_ARGB(resolveResourcePath(atlasInfo.bgs.file).c_str());
389 atlases.bgs.initialize(&textures.bgs, atlasInfo.bgs.framesWide,
390 atlasInfo.bgs.framesHigh, atlasInfo.bgs.frameWidth,
391 atlasInfo.bgs.frameHeight);
392 textures.abgs =
393 loadBMPTexture_ARGB(resolveResourcePath(atlasInfo.abgs.file).c_str());
394 if (!textures.abgs)
395 {
396 textures.abgs = textures.bgs;
397 atlases.abgs.initialize(&textures.abgs, atlasInfo.bgs.framesWide,
398 atlasInfo.bgs.framesHigh,
399 atlasInfo.bgs.frameWidth,
400 atlasInfo.bgs.frameHeight);
401 }
402 else
403 {
404 atlases.abgs.initialize(&textures.abgs, atlasInfo.abgs.framesWide,
405 atlasInfo.abgs.framesHigh,
406 atlasInfo.abgs.frameWidth,
407 atlasInfo.abgs.frameHeight);
408 }
409
410 textures.font =
411 loadBMPTexture_ARGB(resolveResourcePath("textures/font_8x8.bmp").c_str());
412 atlases.font.initialize(&game.textures.font, 16, 16, 8, 8);
413
414 textures.light =
415 loadBMPTexture_ARGB(resolveResourcePath("textures/light.bmp").c_str());
416 textures.cursor =
417 loadBMPTexture_ARGB(resolveResourcePath("textures/cursor.bmp").c_str());
418 textures.slider =
419 loadBMPTexture_ARGB(resolveResourcePath("textures/slider.bmp").c_str());
420};
421
422void Game::loadConfig(const char* filename)
423{

Callers 1

GL_initializeTexturesFunction · 0.80

Calls 4

resolveResourcePathFunction · 0.85
loadBMPTexture_ARGBFunction · 0.85
loadFromFileMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected