mirror of
https://github.com/ProgramSnail/rts_game_backend.git
synced 2026-01-25 21:07:08 +00:00
some fixes
This commit is contained in:
parent
eea91417c9
commit
4f2bfac443
7 changed files with 85 additions and 32 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace draw {
|
||||
void initColorPairs() {
|
||||
init_pair(ColorScheme::blank, COLOR_BLACK, COLOR_WHITE);
|
||||
init_pair(ColorScheme::simple, COLOR_BLACK, COLOR_WHITE);
|
||||
init_pair(ColorScheme::map_simple, COLOR_BLACK, COLOR_WHITE);
|
||||
init_pair(ColorScheme::map_active, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(ColorScheme::menu_simple, COLOR_BLACK, COLOR_WHITE);
|
||||
|
|
@ -33,14 +33,14 @@ namespace draw {
|
|||
clear();
|
||||
}
|
||||
|
||||
void drawCh(uint32_t x, uint32_t y,
|
||||
void drawCh(size_t x, size_t y,
|
||||
Cell cell, ColorScheme colorScheme) {
|
||||
attron(COLOR_PAIR(colorScheme));
|
||||
mvaddch(y, x, cell);
|
||||
attroff(COLOR_PAIR(colorScheme));
|
||||
}
|
||||
|
||||
void getSize(uint32_t& x, uint32_t& y) {
|
||||
void getSize(size_t& x, size_t& y) { // is it work ??
|
||||
getmaxyx(stdscr, y, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#pragma once
|
||||
|
||||
namespace draw {
|
||||
using std::size_t;
|
||||
|
||||
enum ColorScheme {
|
||||
simple,
|
||||
|
|
@ -37,10 +38,10 @@ namespace draw {
|
|||
|
||||
void clearAll();
|
||||
|
||||
void drawCh(uint32_t x, uint32_t y,
|
||||
void drawCh(size_t x, size_t y,
|
||||
Cell cell, ColorScheme colorScheme = ColorScheme::simple);
|
||||
|
||||
// void setxy(uint32_t x, uint32_t y);
|
||||
|
||||
void getSize(uint32_t& x, uint32_t& y);
|
||||
void getSize(size_t& x, size_t& y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,30 @@
|
|||
#include "game_draw.hpp"
|
||||
|
||||
namespace game_draw {
|
||||
void draw() {
|
||||
std::size_t width;
|
||||
std::size_t height;
|
||||
const size_t MENU_WIDTH = 16;
|
||||
|
||||
void drawAll() {
|
||||
size_t width;
|
||||
size_t height;
|
||||
draw::getSize(width, height);
|
||||
// check width && height
|
||||
for(size_t i = 0; i < height; ++i) {
|
||||
draw::drawCh(i, 0, draw::Cell::menu_hb);
|
||||
draw::drawCh(i, width - 1, draw::Cell::menu_hb);
|
||||
draw::drawCh(i, width - MENU_WIDTH, draw::Cell::menu_hb);
|
||||
}
|
||||
for(size_t i = 0; i < width; ++i) {
|
||||
draw::drawCh(0, i, draw::Cell::menu_vb);
|
||||
draw::drawCh(height - 1, i, draw::Cell::menu_vb);
|
||||
}
|
||||
// draw corners
|
||||
}
|
||||
|
||||
void drawMenu(std::pair<size_t, size_t> start, std::pair<size_t, size_t> end) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawMap(std::pair<size_t, size_t> start, std::pair<size_t, size_t> end) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#pragma once
|
||||
|
||||
namespace game_draw {
|
||||
void draw();
|
||||
}
|
||||
using std::size_t;
|
||||
|
||||
void drawAll();
|
||||
|
||||
void drawMenu(size_t width, size_t height);
|
||||
|
||||
void drawMap(size_t width, size_t height);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue