summaryrefslogtreecommitdiff
path: root/legacy/loader/console.h
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /legacy/loader/console.h
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'legacy/loader/console.h')
-rw-r--r--legacy/loader/console.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/legacy/loader/console.h b/legacy/loader/console.h
new file mode 100644
index 0000000..1494d94
--- /dev/null
+++ b/legacy/loader/console.h
@@ -0,0 +1,69 @@
+#pragma once
+#include <Windows.h>
+
+#define STD_HANDLE GetStdHandle( STD_OUTPUT_HANDLE )
+
+namespace con
+{
+ enum class concol : int {
+ black = 0,
+ dark_blue = 1,
+ dark_green = 2,
+ dark_aqua, dark_cyan = 3,
+ dark_red = 4,
+ dark_purple = 5, dark_pink = 5, dark_magenta = 5,
+ dark_yellow = 6,
+ dark_white = 7,
+ gray = 8,
+ blue = 9,
+ green = 10,
+ aqua = 11, cyan = 11,
+ red = 12,
+ purple = 13, pink = 13, magenta = 13,
+ yellow = 14,
+ white = 15
+ };
+
+ inline void set_console_cursor( bool cursor ) {
+ CONSOLE_CURSOR_INFO cursor_info;
+ cursor_info.bVisible = cursor;
+ cursor_info.dwSize = 1;
+ SetConsoleCursorInfo( STD_HANDLE, &cursor_info );
+ }
+
+ inline void set_cursor_pos( int x, int y ) {
+ COORD cursor_pos = { static_cast< short >( x ), static_cast< short >( y ) };
+ SetConsoleCursorPosition( STD_HANDLE, cursor_pos );
+ }
+
+ inline void set_console_color( concol text, concol bg ) {
+ SetConsoleTextAttribute( STD_HANDLE, ( ( int )text + ( ( int )bg * 16 ) ) );
+ }
+
+ inline void clear_console( ) {
+ CONSOLE_SCREEN_BUFFER_INFO buf_info;
+ HANDLE std_out;
+ DWORD count;
+ DWORD cell_count;
+ COORD null_coord{ };
+
+ std_out = STD_HANDLE;
+ if ( std_out == INVALID_HANDLE_VALUE ) return;
+
+ if ( !GetConsoleScreenBufferInfo( std_out, &buf_info ) ) return;
+ cell_count = buf_info.dwSize.X * buf_info.dwSize.Y;
+
+ if ( !FillConsoleOutputCharacter( std_out, ( TCHAR )' ', cell_count, null_coord, &count ) ) return;
+ if ( !FillConsoleOutputAttribute( std_out, buf_info.wAttributes, cell_count, null_coord, &count ) ) return;
+
+ set_cursor_pos( 0, 0 );
+ }
+
+ inline void set_size( int w, int h ) {
+ auto con = GetConsoleWindow( );
+ RECT r;
+
+ GetWindowRect( con, &r );
+ MoveWindow( con, r.left, r.top, w, h, 1 );
+ }
+} \ No newline at end of file