Commit 6f43a5fe authored by Stuart John Watson's avatar Stuart John Watson

Tried fixing tile rendering

Segfaults
parent f24f7c7c
......@@ -30,8 +30,6 @@ DungeonGenerator::DungeonGenerator(int _width,int _height,int seed) : Dungeon(_w
void DungeonGenerator::populate(){
Space::populate();
std::cerr << "cdp";
//Chance we put a room instead of a corridor down
std::uniform_real_distribution<float> roomChance(0.0,1.0);
......
......@@ -174,10 +174,12 @@ void Vision::drawTiles(Display *& dpy, Window &w, GC &gc,int scale, unsigned cha
colormap = DefaultColormap(dpy, 0);
const int VIEW_DIAM = viewDistance * 2 + 1;
for(int sx=0;sx<VIEW_DIAM;sx++){
for(int sy=0;sy<VIEW_DIAM;sy++){
int mapX = (x+sx-viewDistance);
int mapY = (y+sy-viewDistance);
unsigned char *tData = tiles[fov[ mapY*dungeon.getWidth() + mapX ]];
XCreatePixmapFromBitmapData(dpy, w, (char*) tData, 32, 32, 0, 0, 32);
}
}
}
......@@ -121,7 +121,7 @@ void Game::loop(){
for(int _nMob = 0; _nMob < entities.size(); _nMob++){
entities[_nMob]->draw(dpy,double_buffer,gc,scale);
//entities[_nMob]->draw(dpy,double_buffer,gc,scale);
}
XCopyArea(dpy, double_buffer, w, gc, 0, 0, wa.width, wa.height, 0, 0);
......
......@@ -22,7 +22,7 @@ class Game {
protected:
int nTiles;
int const rootWindow;
int tileHeight;
unsigned int tileHeight;
std::vector<std::shared_ptr<Dungeon>> levels;
std::vector<std::shared_ptr<Entity>> entities;
Hero *theHero;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment