summaryrefslogtreecommitdiff
path: root/tf2/ui_checkbox.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 /tf2/ui_checkbox.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 'tf2/ui_checkbox.h')
-rw-r--r--tf2/ui_checkbox.h68
1 files changed, 0 insertions, 68 deletions
diff --git a/tf2/ui_checkbox.h b/tf2/ui_checkbox.h
deleted file mode 100644
index 50cad1c..0000000
--- a/tf2/ui_checkbox.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#pragma once
-#include "ui_base_item.h"
-
-namespace ui
-{
- class c_checkbox : public base_item {
- public:
- c_checkbox( int x, int y, const char* txt, bool* setting ) :
- base_item( x, y, 16, 16, txt ), m_setting( setting ) { }
-
- virtual bool is_hovered( ) override {
- if ( m_disabled ) return false;
-
- int mouse_x, mouse_y;
- ui_get_cursor_pos( mouse_x, mouse_y );
-
- int rel_x = get_relative_x( );
- int rel_y = get_relative_y( );
-
- return mouse_x >= rel_x && mouse_x <= rel_x + m_width
- && mouse_y >= rel_y && mouse_y <= rel_y + m_height;
- }
-
- inline void render_checkbox( const int& x, const int& y ) {
- clr_t col = ui_get_bg_col( );
- if ( is_hovered( ) ) {
- col = *m_setting ? ui_get_accent_col( ) * 0.8f : ui_get_bg_col( ) * 1.3f;
- }
- else if ( *m_setting ) {
- col = ui_get_accent_col( );
- }
-
- ui_draw_rect( x, y, m_width, m_height, ui_get_disabled_col( ) );
- ui_draw_rect( x + 1, y + 1, m_width - 2, m_height - 2, col );
-
- //ui_draw_outlined_rect( x, y, m_width, m_height, ui_get_accent_col( ) );
- }
-
- inline void input( ) {
- bool mouse_presesed = g_input.is_key_pressed( KEYS_MOUSE1 );
-
- if ( is_hovered( ) && mouse_presesed ) {
- if ( !m_mouse_held ) {
- *m_setting = !*m_setting;
- }
- m_mouse_held = true;
- }
- else {
- m_mouse_held = false;
- }
- }
-
- virtual void render( ) override {
- int x = get_relative_x( );
- int y = get_relative_y( );
-
- render_checkbox( x, y );
- input( );
-
-
- ui_draw_string( x + m_width + 6, y + 2, false, ui_get_text_col( ), m_text );
- }
-
- protected:
- bool* m_setting;
- bool m_mouse_held{ };
- };
-} \ No newline at end of file