Skip to content

Commit 0826fc8

Browse files
committed
Initial commit
Initial commit
0 parents  commit 0826fc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1386
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libtcod-first-person

bin/Debug/dungeon_ceiling.png

6.28 KB
Loading

bin/Debug/dungeon_door.png

8.79 KB
Loading

bin/Debug/dungeon_floor.png

3.53 KB
Loading

bin/Debug/dungeon_wall.png

7.44 KB
Loading

bin/Debug/libtcod.so

1.19 MB
Binary file not shown.

bin/Debug/libtcodgui.so

369 KB
Binary file not shown.

bin/Debug/libtodsampleproject

686 KB
Binary file not shown.

bin/Debug/terminal.png

145 KB
Loading

dungeon_ceiling.png

6.28 KB
Loading

dungeon_door.png

8.79 KB
Loading

dungeon_floor.png

3.53 KB
Loading

dungeon_wall.png

7.44 KB
Loading

gfx/chest_exterior.png

5.81 KB
Loading

gfx/chest_interior.png

8.56 KB
Loading

gfx/death_speaker.png

6.79 KB
Loading

gfx/dungeon_ceiling.png

6.28 KB
Loading

gfx/dungeon_door.png

8.79 KB
Loading

gfx/dungeon_floor.png

3.53 KB
Loading

gfx/dungeon_wall.png

7.44 KB
Loading

gfx/grass.png

3.3 KB
Loading

gfx/grave_cross.png

5.57 KB
Loading

gfx/grave_stone.png

4.13 KB
Loading

gfx/hay_pile.png

8.05 KB
Loading

gfx/locked_door.png

9.57 KB
Loading

gfx/medieval_door.png

9.96 KB
Loading

gfx/medieval_house.png

9.63 KB
Loading

gfx/pillar_exterior.png

6.64 KB
Loading

gfx/pillar_interior.png

8.7 KB
Loading

gfx/skull_pile.png

8.88 KB
Loading

gfx/template_floor.png

3.6 KB
Loading

gfx/terminal.png

145 KB
Loading

gfx/tree_evergreen.png

9.6 KB
Loading

gfx/water.png

1.91 KB
Loading

inc/actor.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Actor {
2+
public :
3+
int x,y; // position on map
4+
int ch; // ascii code
5+
TCODColor col; // color
6+
7+
Actor(int x, int y, int ch, const TCODColor &col, bool is_player);
8+
void render() const;
9+
10+
private:
11+
12+
bool is_player;
13+
const int offsetx = 82;
14+
const int offsety = 1;
15+
};

inc/engine.hpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
class Engine {
2+
public :
3+
TCODList<Actor *> actors;
4+
Actor *player;
5+
Map *map;
6+
int fovRadius;
7+
8+
int facing;
9+
10+
Engine();
11+
~Engine();
12+
void update();
13+
void render();
14+
void render_3d();
15+
void render_tile(int pos_x, int pos_y, int position);
16+
void setup_render();
17+
18+
private :
19+
bool computeFov;
20+
21+
TCODConsole* OffScreenConsole;
22+
TCODConsole* DungeonWalls;
23+
TCODConsole* DungeonFloor;
24+
TCODConsole* DungeonCeiling;
25+
26+
unsigned int width[13];
27+
unsigned int height[13];
28+
unsigned int src_x[13];
29+
unsigned int src_y[13];
30+
unsigned int dest_x[13];
31+
unsigned int dest_y[13];
32+
};
33+
34+
extern Engine engine;

inc/map.hpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
struct Tile {
2+
bool explored; // has the player already seen this tile ?
3+
Tile() : explored(false) {}
4+
};
5+
6+
class Map {
7+
public :
8+
int width,height;
9+
10+
Map(int width, int height);
11+
~Map();
12+
bool isWall(int x, int y) const;
13+
bool isInFov(int x, int y) const;
14+
bool isExplored(int x, int y) const;
15+
void computeFov();
16+
void render() const;
17+
protected :
18+
Tile *tiles;
19+
TCODMap *map;
20+
friend class BspListener;
21+
22+
void dig(int x1, int y1, int x2, int y2);
23+
void createRoom(bool first, int x1, int y1, int x2, int y2);
24+
25+
private:
26+
27+
const int offsetx = 82;
28+
const int offsety = 1;
29+
};

lib/libtcod.so

1.19 MB
Binary file not shown.

libtodfirstperson.cbp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="libtod-firstperson" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/libtodsampleproject" prefix_auto="1" extension_auto="1" />
11+
<Option object_output="obj/Debug/" />
12+
<Option type="1" />
13+
<Option compiler="gcc" />
14+
<Compiler>
15+
<Add option="-g" />
16+
</Compiler>
17+
</Target>
18+
<Target title="Release">
19+
<Option output="bin/Release/libtodsampleproject" prefix_auto="1" extension_auto="1" />
20+
<Option object_output="obj/Release/" />
21+
<Option type="1" />
22+
<Option compiler="gcc" />
23+
<Compiler>
24+
<Add option="-O2" />
25+
</Compiler>
26+
<Linker>
27+
<Add option="-s" />
28+
</Linker>
29+
</Target>
30+
</Build>
31+
<Compiler>
32+
<Add option="-Wall" />
33+
<Add option="-Wno-narrowing" />
34+
<Add option="-Wno-switch" />
35+
<Add option="-std=c++2a" />
36+
<Add option="-pthread" />
37+
<Add directory="inc" />
38+
<Add directory="../libtcod-1.11.1/src" />
39+
</Compiler>
40+
<Linker>
41+
<Add option="-lstdc++fs" />
42+
<Add option="-pthread" />
43+
<Add option="-lsqlite3" />
44+
<Add option="-ltcod" />
45+
<Add option="-Wl,-rpath=." />
46+
<Add library="../libtcod-1.11.1/libtcod.so" />
47+
<Add directory="../../libtcod-1.7" />
48+
</Linker>
49+
<ExtraCommands>
50+
<Add before="cp lib/libtcod.so $(TARGET_OUTPUT_DIR)" />
51+
<Add after='cp &quot;$(PROJECT_DIR)/gfx/terminal.png&quot; $(TARGET_OUTPUT_DIR)' />
52+
<Mode after="always" />
53+
</ExtraCommands>
54+
<Unit filename="inc/actor.hpp" />
55+
<Unit filename="inc/engine.hpp" />
56+
<Unit filename="inc/map.hpp" />
57+
<Unit filename="src/actor.cpp" />
58+
<Unit filename="src/engine.cpp" />
59+
<Unit filename="src/main.cpp" />
60+
<Unit filename="src/map.cpp" />
61+
<Extensions>
62+
<envvars />
63+
<code_completion />
64+
<debugger />
65+
<lib_finder disable_auto="1" />
66+
</Extensions>
67+
</Project>
68+
</CodeBlocks_project_file>

0 commit comments

Comments
 (0)