changes while making spider live debug
This commit is contained in:
@@ -38,7 +38,7 @@ OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJE
|
|||||||
all: directories $(TARGET)
|
all: directories $(TARGET)
|
||||||
|
|
||||||
#Remake
|
#Remake
|
||||||
remake: cleaner all
|
remake: clean all
|
||||||
|
|
||||||
#Make the Directories
|
#Make the Directories
|
||||||
directories:
|
directories:
|
||||||
@@ -49,10 +49,6 @@ directories:
|
|||||||
clean:
|
clean:
|
||||||
@$(RM) -rf $(BUILDDIR)
|
@$(RM) -rf $(BUILDDIR)
|
||||||
|
|
||||||
#Full Clean, Objects and Binaries
|
|
||||||
cleaner: clean
|
|
||||||
@$(RM) -rf $(TARGETDIR)
|
|
||||||
|
|
||||||
#Pull in dependency info for *existing* .o files
|
#Pull in dependency info for *existing* .o files
|
||||||
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
||||||
|
|
||||||
@@ -71,4 +67,4 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
|||||||
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||||
|
|
||||||
#Non-File Targets
|
#Non-File Targets
|
||||||
.PHONY: all remake clean cleaner resources
|
.PHONY: all remake clean
|
||||||
|
|||||||
+2
-6
@@ -37,7 +37,7 @@ OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJE
|
|||||||
all: directories $(TARGET)
|
all: directories $(TARGET)
|
||||||
|
|
||||||
#Remake
|
#Remake
|
||||||
remake: cleaner all
|
remake: clean all
|
||||||
|
|
||||||
#Make the Directories
|
#Make the Directories
|
||||||
directories:
|
directories:
|
||||||
@@ -48,10 +48,6 @@ directories:
|
|||||||
clean:
|
clean:
|
||||||
@$(RM) -rf $(BUILDDIR)
|
@$(RM) -rf $(BUILDDIR)
|
||||||
|
|
||||||
#Full Clean, Objects and Binaries
|
|
||||||
cleaner: clean
|
|
||||||
@$(RM) -rf $(TARGETDIR)
|
|
||||||
|
|
||||||
#Pull in dependency info for *existing* .o files
|
#Pull in dependency info for *existing* .o files
|
||||||
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
||||||
|
|
||||||
@@ -70,4 +66,4 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
|||||||
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||||
|
|
||||||
#Non-File Targets
|
#Non-File Targets
|
||||||
.PHONY: all remake clean cleaner
|
.PHONY: all remake clean
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
g++ -std=c++20 -O2 -Wall -Werror -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -Wsuggest-override -Wextra-semi -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -I./src/ -c -o bin/desktoplib/terminal/Terminal.o src/desktoplib/terminal/Terminal.cpp
|
|
||||||
g++ -std=c++20 -static-libstdc++ -static-libgcc -Wl,--fatal-warnings -Wl,--warn-common -o out/out.exe bin/desktoplib/main.o bin/desktoplib/os/unix.o bin/desktoplib/os/windows.o bin/desktoplib/terminal/Terminal.o
|
|
||||||
@@ -7,12 +7,7 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace ckitty {
|
|||||||
|
|
||||||
namespace os {
|
namespace os {
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
|
||||||
int getKey(bool blocking);
|
int getKey(bool blocking);
|
||||||
|
|
||||||
std::optional<std::string> getChar(bool blocking);
|
std::optional<std::string> getChar(bool blocking);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ namespace ckitty {
|
|||||||
namespace terminal {
|
namespace terminal {
|
||||||
namespace os {
|
namespace os {
|
||||||
|
|
||||||
|
void setup() {}
|
||||||
|
|
||||||
int getKey(bool blocking) {
|
int getKey(bool blocking) {
|
||||||
if (!blocking) {
|
if (!blocking) {
|
||||||
// Set non-blocking read
|
// Set non-blocking read
|
||||||
@@ -18,7 +20,7 @@ namespace ckitty {
|
|||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
int n = read(STDIN_FILENO, &ch, 1);
|
int n = read(STDIN_FILENO, &ch, 1);
|
||||||
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
fcntl(STDIN_FILENO, F_SETFL, oldf);
|
||||||
return (n > 0) ? ch : -1;
|
return (n > 0) ? ch : key::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char buf[3];
|
unsigned char buf[3];
|
||||||
|
|||||||
@@ -10,10 +10,16 @@ namespace ckitty {
|
|||||||
namespace terminal {
|
namespace terminal {
|
||||||
namespace os {
|
namespace os {
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
SetConsoleCP(CP_UTF8);
|
||||||
|
setRawMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
int getKey(bool blocking) {
|
int getKey(bool blocking) {
|
||||||
// Handle non-blocking check for the console
|
// Handle non-blocking check for the console
|
||||||
if (!blocking && !_kbhit()) {
|
if (!blocking && !_kbhit()) {
|
||||||
return -1;
|
return key::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _getch() blocks by default
|
// _getch() blocks by default
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ namespace ckitty {
|
|||||||
|
|
||||||
Terminal::Terminal()
|
Terminal::Terminal()
|
||||||
: _os(&std::cout), _is(&std::cin), _own(false) {
|
: _os(&std::cout), _is(&std::cin), _own(false) {
|
||||||
|
// setup the terminal if we don't own the
|
||||||
|
// streams, aka, the system terminal!
|
||||||
|
if(!_own) os::setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
Terminal::~Terminal() {
|
Terminal::~Terminal() {
|
||||||
@@ -176,10 +179,11 @@ namespace ckitty {
|
|||||||
// ------ //
|
// ------ //
|
||||||
|
|
||||||
Terminal& Terminal::fill(const std::string_view color) {
|
Terminal& Terminal::fill(const std::string_view color) {
|
||||||
// 1. Set background color
|
// 1. Apply color string
|
||||||
// 2. Clear screen (2J)
|
// 2. [3J] clears the entire terminal scrollback buffer with that active color
|
||||||
// 3. Move cursor to home (H)
|
// 3. [2J] clears the visible screen
|
||||||
(*_os) << color << CSI << "2J" << CSI << "H" << std::flush;
|
// 4. [H] returns cursor home
|
||||||
|
(*_os) << color << CSI << "3J" << CSI << "2J" << CSI << "H" << std::flush;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user