Created
June 25, 2014 23:01
-
-
Save Lumaio/3a6e55c72c8ebb95476b to your computer and use it in GitHub Desktop.
This is rather interesting
This file contains hidden or 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 <stdio.h> | |
#include <conio.h> | |
#include "Room.h" | |
#include "System.h" | |
#include "Player.h" | |
int main(int argc, char **argv) | |
{ | |
System *sys = new System(); | |
Player *player = new Player(1, 1, "Lumaio"); | |
for (int i = 0; i < 49; i++) { | |
for (int j = 0; j < 49; j++) { | |
sys->map[i][j]=new Room(); | |
} | |
} | |
Room *r = sys->map[1][1]; | |
int dirs[4]; | |
dirs[0]=1; | |
dirs[1]=2; | |
dirs[2]=3; | |
dirs[3]=4; | |
printf("hello world\n"); | |
r->setDirections(dirs); | |
std::cout << player->getName() << std::endl; | |
_getch(); | |
return 0; | |
} |
This file contains hidden or 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 "Player.h" | |
#include <iostream> | |
Player::Player(int x, int y, std::string name) | |
{ | |
this->setX(x); | |
this->setY(y); | |
this->setName(name); | |
} | |
Player::~Player() | |
{ | |
} | |
void Player::setName(std::string name) | |
{ | |
this->name=name; | |
} | |
void Player::setX(int x) | |
{ | |
this->x=x; | |
} | |
void Player::setY(int y) | |
{ | |
this->y=y; | |
} | |
int Player::getX() | |
{ | |
return this->x; | |
} | |
int Player::getY() | |
{ | |
return this->y; | |
} | |
std::string Player::getName() | |
{ | |
return this->name; | |
} |
This file contains hidden or 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> | |
#ifndef PLAYER_H | |
#define PLAYER_H | |
class Player | |
{ | |
private: | |
int x; | |
int y; | |
std::string name; | |
public: | |
Player(int x, int y, std::string name); | |
~Player(); | |
void setName(std::string); | |
void setX(int x); | |
void setY(int y); | |
int getX(); | |
int getY(); | |
std::string getName(); | |
}; | |
#endif // PLAYER_H |
This file contains hidden or 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 "Room.h" | |
Room::Room() | |
{ | |
} | |
Room::~Room() | |
{ | |
} | |
void Room::setDirections(int dirs[4]) | |
{ | |
this->dir=dirs; | |
} | |
int *Room::getDirections() | |
{ | |
return this->dir; | |
} | |
This file contains hidden or 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 ROOM_H | |
#define ROOM_H | |
class Room | |
{ | |
private: | |
int EAST=0; | |
int WEST=1; | |
int NORTH=2; | |
int SOUTH=3; | |
int *dir; | |
public: | |
Room(); | |
~Room(); | |
void setDirections(int dirs[4]); | |
int *getDirections(); | |
}; | |
#endif // ROOM_H |
This file contains hidden or 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 "Room.h" | |
#ifndef SYSTEM_H | |
#define SYSTEM_H | |
class System | |
{ | |
public: | |
System(); | |
~System(); | |
Room *map[50][50]; | |
}; | |
#endif // SYSTEM_H |
This file contains hidden or 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 "System.h" | |
#include "Room.h" | |
System::System() | |
{ | |
} | |
System::~System() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment