Created
November 21, 2012 08:28
-
-
Save anonymous/4123800 to your computer and use it in GitHub Desktop.
honey_spiders game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "FloorSprites.h" | |
#include "TileProperties.h" | |
#include <SFML/Graphics.hpp> | |
int loadFloorGFX(struct tileInformation pixelMatrix[MAPSIZE][MAPSIZE]){ | |
//loading the four wall tiles | |
//top wall | |
sf::Texture floorTile1; | |
if (!floorTile1.loadFromFile("floorsGFX/floor1.jpg")) | |
return EXIT_FAILURE; | |
else | |
std::cout<<"Texture loaded"<<std::endl; | |
} | |
int drawFloor(struct tileInformation pixelMatrix[MAPSIZE][MAPSIZE],,){ | |
//loads and initialises the floor tiles | |
sf::Sprite floor(floorTile1); | |
for (int i=0; i<MAPSIZE; i++){ | |
for (int j=0; j<MAPSIZE; j++){ | |
//map the floor sprites to wallsGFX[][].wallsFGX | |
floor.setPosition(pixelMatrix[i][j].pixelXPos, pixelMatrix[i][j].pixelYPos); | |
window.draw(floor); | |
} | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef H_FloorSprites | |
#define H_FloorSprites | |
#include "TileProperties.h" | |
int loadFloorGFX(struct tileInformation pixelMatrix[MAPSIZE][MAPSIZE]); | |
int drawFloor(struct tileInformation pixelMatrix[MAPSIZE][MAPSIZE],,); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include "TileProperties.h" | |
#include "Maps.h" | |
#include "WallSprites.h" | |
#include "CharacterSheet.h" | |
#include "FloorSprites.h" | |
#include <SFML/Graphics.hpp> | |
int main(){ | |
//pixelMatrix stores the values for the 32x32 tile locations | |
struct tileInformation pixelMatrix[MAPSIZE][MAPSIZE]; | |
//walls stores the locations of impassible walls and terrain | |
struct tileInformation walls[MAPSIZE][MAPSIZE]; | |
//wallsGFX stores the information for the wall tiles | |
struct tileInformation wallsGFX[MAPSIZE][MAPSIZE]; | |
//creates the player character object | |
characterSheet playerCharacter; | |
//testing the program flow | |
std::cout<<"PixelMatrix initialising"<<std::endl; | |
initPixelMatrix(pixelMatrix); | |
std::cout<<"Walls initialising"<<std::endl; | |
initWalls(walls); | |
std::cout<<"Walls initialised"<<std::endl; | |
std::cout<<"Loading wall sprite locations from file"<<std::endl; | |
initWallsGFX(wallsGFX); | |
std::cout<<"Loading wall sprites from file"<<std::endl; | |
loadWallGFX(); | |
std::cout<<"Loading floor sprites from file"<<std::endl; | |
loadFloorGFX(pixelMatrix); | |
////////////////////////////////////////////////////////////////////////////////////////// | |
// // | |
// END OF DATA INIT // | |
// // | |
////////////////////////////////////////////////////////////////////////////////////////// | |
sf::RenderWindow window(sf::VideoMode(1024, 768), "Helaical Rising"); | |
//unsure about next line, needs to send sf::Texture floorTile1, and | |
//sf::RenderWindow window(), as parametesto the drawFloor function. | |
drawFloor(pixelMatrix,,); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment