changed test for windows, to be removed

This commit is contained in:
2026-06-07 12:50:59 -06:00
parent edcc3bcfea
commit ce5508f8e4
4 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ OBJEXT := o
#Flags, Libraries and Includes #Flags, Libraries and Includes
ROOT := ./ ROOT := ./
CFLAGS := -std=c++20 -O2 \ CDEFS := -DDESKTOPLIB_TEST
CFLAGS := -std=c++20 -O2 $(CDEFS) \
-Wall -Werror -Wextra \ -Wall -Werror -Wextra \
-Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align \ -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align \
-Wunused -Woverloaded-virtual -Wconversion \ -Wunused -Woverloaded-virtual -Wconversion \
+5
View File
@@ -7,7 +7,12 @@
#include <thread> #include <thread>
#include <chrono> #include <chrono>
#include <Windows.h>
int main() { int main() {
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
using namespace ckitty::terminal; using namespace ckitty::terminal;
Terminal term; Terminal term;
+2 -2
View File
@@ -46,8 +46,8 @@ namespace ckitty::terminal {
int thumbH = std::max(1, (viewH * viewH) / totalH); int thumbH = std::max(1, (viewH * viewH) / totalH);
// Calculate thumb position // Calculate thumb position
float scrollPercent = float(scrollY) / (totalH - viewH); float scrollPercent = float(scrollY) / float(totalH - viewH);
int thumbPos = int(scrollPercent * (viewH - thumbH)); int thumbPos = int(scrollPercent * float(viewH - thumbH));
t << thumbColor; t << thumbColor;
for (int y = 0; y < thumbH; ++y) { for (int y = 0; y < thumbH; ++y) {
+3 -3
View File
@@ -5,12 +5,12 @@
namespace ckitty::terminal { namespace ckitty::terminal {
MenuMap::MenuMap(int width, int height) 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) { void MenuMap::set(int x, int y, int id) {
if (x >= 0 && x < _w && y >= 0 && y < _h) { 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 { int MenuMap::get(int x, int y) const {
if (x < 0 || x >= _w || y < 0 || y >= _h) return 0; 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) { void MenuMap::setWrap(bool x, bool y) {