diff --git a/.cproject b/.cproject index 1d5b7a84..60c83d49 100644 --- a/.cproject +++ b/.cproject @@ -116,26 +116,29 @@ - + - + - + + - + - + + + diff --git a/include/common.hpp b/include/common.hpp index d3bb8900..40ad17e6 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -51,7 +51,7 @@ #include #include "macros.hpp" -#include "colors.hpp" +#include #if ENABLE_VISUALS == 1 @@ -59,14 +59,13 @@ extern "C" { #include } -#include "ftrender.hpp" -#include "drawing.hpp" +#include +#include #include "fidgetspinner.hpp" -#include DRAW_API -#include "EffectGlow.hpp" -#include "atlas.hpp" -#include "EffectChams.hpp" -#include "drawmgr.hpp" +#include#include +#include +#include +#include #endif diff --git a/include/fidgetspinner.hpp b/include/fidgetspinner.hpp index aed256eb..bfffcb5c 100644 --- a/include/fidgetspinner.hpp +++ b/include/fidgetspinner.hpp @@ -7,8 +7,8 @@ #pragma once +#include #include "common.hpp" -#include "atlas.hpp" class CatVar; diff --git a/include/EffectChams.hpp b/include/visual/EffectChams.hpp similarity index 100% rename from include/EffectChams.hpp rename to include/visual/EffectChams.hpp diff --git a/include/EffectGlow.hpp b/include/visual/EffectGlow.hpp similarity index 100% rename from include/EffectGlow.hpp rename to include/visual/EffectGlow.hpp diff --git a/include/atlas.hpp b/include/visual/atlas.hpp similarity index 100% rename from include/atlas.hpp rename to include/visual/atlas.hpp diff --git a/include/colors.hpp b/include/visual/colors.hpp similarity index 100% rename from include/colors.hpp rename to include/visual/colors.hpp diff --git a/include/drawex.hpp b/include/visual/drawex.hpp similarity index 100% rename from include/drawex.hpp rename to include/visual/drawex.hpp diff --git a/include/drawgl.hpp b/include/visual/drawgl.hpp similarity index 91% rename from include/drawgl.hpp rename to include/visual/drawgl.hpp index b67a04f3..d255ef05 100644 --- a/include/drawgl.hpp +++ b/include/visual/drawgl.hpp @@ -8,15 +8,13 @@ #ifndef DRAWGL_HPP_ #define DRAWGL_HPP_ -#include +#include + +#include +#include #define draw_api drawgl -extern "C" { -#include "freetype-gl/vec234.h" -#include "freetype-gl/vertex-buffer.h" -} - namespace drawgl { struct vertex_v2c4_t { diff --git a/include/drawing.hpp b/include/visual/drawing.hpp similarity index 100% rename from include/drawing.hpp rename to include/visual/drawing.hpp diff --git a/include/drawmgr.hpp b/include/visual/drawmgr.hpp similarity index 100% rename from include/drawmgr.hpp rename to include/visual/drawmgr.hpp diff --git a/include/ftrender.hpp b/include/visual/ftrender.hpp similarity index 100% rename from include/ftrender.hpp rename to include/visual/ftrender.hpp diff --git a/makefile b/makefile index ff589d69..160db078 100644 --- a/makefile +++ b/makefile @@ -74,6 +74,8 @@ DEFINES= ifeq ($(RENDERING_ENGINE), XOVERLAY) ENABLE_GUI=0 +INCLUDES+= -Ixoverlay +LDLIBS+=-loverlay endif DEFINES+=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO=1 RAD_TELEMETRY_DISABLED=1 LINUX=1 USE_SDL=1 _LINUX=1 POSIX=1 GNUC=1 NO_MALLOC_OVERRIDE=1 diff --git a/src/hack.cpp b/src/hack.cpp index dfed6d9e..2b3f62a5 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -12,7 +12,7 @@ #define TO_STRING(x) STRINGIFY(x) #if ENABLE_VISUALS == 1 -#include "ftrender.hpp" +#include #endif diff --git a/src/EffectChams.cpp b/src/visual/EffectChams.cpp similarity index 99% rename from src/EffectChams.cpp rename to src/visual/EffectChams.cpp index 8235739d..0ab99bdb 100644 --- a/src/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -5,8 +5,8 @@ * Author: nullifiedcat */ +#include #include "common.hpp" -#include "EffectChams.hpp" //static CatVar chams_experimental(CV_SWITCH, "chams_effect", "0", "Experimental Chams"); diff --git a/src/EffectGlow.cpp b/src/visual/EffectGlow.cpp similarity index 99% rename from src/EffectGlow.cpp rename to src/visual/EffectGlow.cpp index 42601166..7ba7ec36 100644 --- a/src/EffectGlow.cpp +++ b/src/visual/EffectGlow.cpp @@ -5,8 +5,8 @@ * Author: nullifiedcat */ +#include #include "common.hpp" -#include "EffectGlow.hpp" IMaterialSystem* materials = nullptr; diff --git a/src/atlas.cpp b/src/visual/atlas.cpp similarity index 100% rename from src/atlas.cpp rename to src/visual/atlas.cpp diff --git a/src/colors.cpp b/src/visual/colors.cpp similarity index 100% rename from src/colors.cpp rename to src/visual/colors.cpp diff --git a/src/drawex.cpp b/src/visual/drawex.cpp similarity index 100% rename from src/drawex.cpp rename to src/visual/drawex.cpp diff --git a/src/drawgl.cpp b/src/visual/drawgl.cpp similarity index 99% rename from src/drawgl.cpp rename to src/visual/drawgl.cpp index 30c47f90..812bb41e 100644 --- a/src/drawgl.cpp +++ b/src/visual/drawgl.cpp @@ -5,9 +5,9 @@ * Author: nullifiedcat */ -#include "drawgl.hpp" +#include +#include #include "common.hpp" -#include "atlas.hpp" extern "C" { #include diff --git a/src/drawing.cpp b/src/visual/drawing.cpp similarity index 100% rename from src/drawing.cpp rename to src/visual/drawing.cpp diff --git a/src/drawmgr.cpp b/src/visual/drawmgr.cpp similarity index 100% rename from src/drawmgr.cpp rename to src/visual/drawmgr.cpp diff --git a/src/ftrender.cpp b/src/visual/ftrender.cpp similarity index 100% rename from src/ftrender.cpp rename to src/visual/ftrender.cpp diff --git a/xoverlay/fontapi.h b/xoverlay/fontapi.h new file mode 100644 index 00000000..dcd268b6 --- /dev/null +++ b/xoverlay/fontapi.h @@ -0,0 +1,20 @@ +/* + * fontapi.h + * + * Created on: Nov 11, 2017 + * Author: nullifiedcat + */ + +#pragma once + +typedef unsigned int xoverlay_font_handle_t; +#define XOVERLAY_FONT_COUNT 64 + +xoverlay_font_handle_t +xoverlay_font_load(const char *path, float size); + +void +xoverlay_font_unload(xoverlay_font_handle_t handle); + +void +xoverlay_string_size(xoverlay_font_handle_t handle, const char *string, int *x, int *y); diff --git a/xoverlay/overlay.h b/xoverlay/overlay.h new file mode 100644 index 00000000..c50dfbfb --- /dev/null +++ b/xoverlay/overlay.h @@ -0,0 +1,114 @@ +/* + * overlay.hpp + * + * Created on: Nov 8, 2017 + * Author: nullifiedcat + */ + +#pragma once + +#include "fontapi.h" +#include "textureapi.h" + +#include +#include + +typedef void(*xoverlay_callback_keypress)(unsigned int keycode, int action); +typedef void(*xoverlay_callback_click)(unsigned int buttoncode, int action); +typedef void(*xoverlay_callback_scroll)(int value); +typedef void(*xoverlay_callback_mousemove)(int dx, int dy, int x, int y); + +struct xoverlay_library +{ + xoverlay_callback_keypress cb_keypress; + xoverlay_callback_click cb_click; + xoverlay_callback_scroll cb_scroll; + xoverlay_callback_mousemove cb_mousemove; + + Display *display; + Window window; + Colormap colormap; + GC gc; + XGCValues gcvalues; + XFontStruct font; + int screen; + + int width; + int height; + + struct + { + int x; + int y; + } mouse; + + char init; + char drawing; + char mapped; +}; + +struct xoverlay_library xoverlay_library; + +typedef struct xoverlay_vec4_t +{ + union + { + float data[4]; + struct + { + float r; + float g; + float b; + float a; + }; + struct + { + float x; + float y; + float z; + float w; + }; + }; +} xoverlay_vec4_t, xoverlay_rgba_t; + +int xoverlay_init(); +void xoverlay_destroy(); + +void xoverlay_install_keyboard_callback(xoverlay_callback_keypress callback); +void xoverlay_install_click_callback(xoverlay_callback_click callback); +void xoverlay_install_scroll_callback(xoverlay_callback_scroll callback); +void xoverlay_install_mouse_callback(xoverlay_callback_mousemove callback); + +void +xoverlay_show(); + +void +xoverlay_hide(); + +xoverlay_rgba_t +xoverlay_rgba(int r, int g, int b, int a); + +void +xoverlay_draw_line(float x, float y, float dx, float dy, xoverlay_rgba_t color, float thickness); + +void +xoverlay_draw_rect(float x, float y, float w, float h, xoverlay_rgba_t color); + +void +xoverlay_draw_rect_outline(float x, float y, float w, float h, xoverlay_rgba_t color, float thickness); + +void +xoverlay_draw_rect_textured(float x, float y, float w, float h, xoverlay_rgba_t color, xoverlay_texture_handle_t texture, float tx, float ty, float tw, float th); + +void +xoverlay_draw_string(float x, float y, const char *string, xoverlay_font_handle_t font, xoverlay_vec4_t color, float *out_x, float *out_y); + +void +xoverlay_draw_string_with_outline(float x, float y, const char *string, xoverlay_font_handle_t font, xoverlay_vec4_t color, xoverlay_vec4_t outline_color, float outline_width, int adjust_outline_alpha, float *out_x, float *out_y); + +void +xoverlay_draw_circle(float x, float y, float radius, xoverlay_rgba_t color, float thickness, int steps); + +void xoverlay_poll_events(); +void xoverlay_draw_begin(); +void xoverlay_draw_end(); diff --git a/xoverlay/textureapi.h b/xoverlay/textureapi.h new file mode 100644 index 00000000..e149a915 --- /dev/null +++ b/xoverlay/textureapi.h @@ -0,0 +1,19 @@ +/* + * textureapi.h + * + * Created on: Nov 11, 2017 + * Author: nullifiedcat + */ + +#pragma once + +typedef unsigned xoverlay_texture_handle_t; + +xoverlay_texture_handle_t +xoverlay_texture_load_png_rgba(const char *path); + +void +xoverlay_texture_unload(xoverlay_texture_handle_t handle); + +void +xoverlay_texture_get_size(xoverlay_texture_handle_t handle, int *width, int *height);