changed test for windows, to be removed
This commit is contained in:
@@ -14,7 +14,8 @@ OBJEXT := o
|
||||
|
||||
#Flags, Libraries and Includes
|
||||
ROOT := ./
|
||||
CFLAGS := -std=c++20 -O2 \
|
||||
CDEFS := -DDESKTOPLIB_TEST
|
||||
CFLAGS := -std=c++20 -O2 $(CDEFS) \
|
||||
-Wall -Werror -Wextra \
|
||||
-Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align \
|
||||
-Wunused -Woverloaded-virtual -Wconversion \
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
int main() {
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
SetConsoleCP(CP_UTF8);
|
||||
|
||||
using namespace ckitty::terminal;
|
||||
Terminal term;
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace ckitty::terminal {
|
||||
int thumbH = std::max(1, (viewH * viewH) / totalH);
|
||||
|
||||
// Calculate thumb position
|
||||
float scrollPercent = float(scrollY) / (totalH - viewH);
|
||||
int thumbPos = int(scrollPercent * (viewH - thumbH));
|
||||
float scrollPercent = float(scrollY) / float(totalH - viewH);
|
||||
int thumbPos = int(scrollPercent * float(viewH - thumbH));
|
||||
|
||||
t << thumbColor;
|
||||
for (int y = 0; y < thumbH; ++y) {
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
namespace ckitty::terminal {
|
||||
|
||||
MenuMap::MenuMap(int width, int height)
|
||||
: _w(width), _h(height), _grid(width* height, 0) {
|
||||
: _w(width), _h(height), _grid(size_t(width * height), 0) {
|
||||
}
|
||||
|
||||
void MenuMap::set(int x, int y, int id) {
|
||||
if (x >= 0 && x < _w && y >= 0 && y < _h) {
|
||||
_grid[y * _w + x] = id;
|
||||
_grid[size_t(y * _w + x)] = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ckitty::terminal {
|
||||
|
||||
int MenuMap::get(int x, int y) const {
|
||||
if (x < 0 || x >= _w || y < 0 || y >= _h) return 0;
|
||||
return _grid[y * _w + x];
|
||||
return _grid[size_t(y * _w + x)];
|
||||
}
|
||||
|
||||
void MenuMap::setWrap(bool x, bool y) {
|
||||
|
||||
Reference in New Issue
Block a user