Skip to content

Commit

Permalink
✨ Added dungeon rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Coul33t committed Jun 20, 2024
1 parent dbab611 commit 5dfeab2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion oboyrog/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ void clear_console() {
clear();
}

void close_ncurses_rendering() {
endwin();
}

void render_entity(Entity* entity) {
mvaddch(entity->pos.y, entity->pos.x, entity->chr);
}

void render_dungeon(Dungeon* dungeon) {

for (int x = 0; x < DUNGEON_SIZE_X; x++) {
for (int y = 0; y < DUNGEON_SIZE_Y; y++) {
mvaddch(x, y, dungeon->map[(x * DUNGEON_SIZE_Y) + y]->chr);
}
}
}
3 changes: 2 additions & 1 deletion oboyrog/renderer.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#ifndef __RENDERER_H__
#define __RENDERER_H__

#include <ncurses.h>
#include "include_ncurses.h"
#include "entity.h"
#include "dungeon/dungeon.h"

void init_ncurses_rendering();
void clear_console();
void close_ncurses_rendering();

void render_entity(Entity* entity);
void render_dungeon(Dungeon* dungeon);
Expand Down

0 comments on commit 5dfeab2

Please sign in to comment.