diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/internal_rewrite/ui_render.h | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (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 'cheat/internal_rewrite/ui_render.h')
| -rw-r--r-- | cheat/internal_rewrite/ui_render.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/cheat/internal_rewrite/ui_render.h b/cheat/internal_rewrite/ui_render.h new file mode 100644 index 0000000..1f10223 --- /dev/null +++ b/cheat/internal_rewrite/ui_render.h @@ -0,0 +1,63 @@ +#pragma once + +#include "ui_base_item.h" + +namespace ui +{ + //recursively render all items + static void render_item( base_item* item, int offset = 0, bool allow_rect = true ) { + if( !item->get_visible( ) ) return; + + item->reset( ); + item->render( ); + bool reset = false; + RECT original; + + if( allow_rect && item->is_form( ) ) { + auto device = g_d3d.get_device( ); + device->GetScissorRect( &original ); + + auto x = item->get_relative_x( ); + auto y = item->get_relative_y( ); + + RECT new_rect{ + x, + y + 4, + x + item->w( ), + y + item->get_total_height( ) - 7 + }; + + device->SetScissorRect( &new_rect ); + reset = true; + } + + bool draw = true; + if( item->is_form( ) ) { + auto form_cast = static_cast< c_form* >( item ); + draw = !form_cast->is_collapsed( ); + } + + if( item->get_items( ).size( ) && draw ) { + //madr0fl + int* height_offset = ( int* )_alloca( sizeof( int ) * item->get_items( ).size( ) ); + int cur_offset = 0; + for( int i = ( int )item->get_items( ).size( ) - 1; i >= 0; --i ) { + auto& cur_item = item->get_items( )[ i ]; + height_offset[ i ] = cur_offset; + cur_offset += cur_item->get_visible( ) ? cur_item->get_total_height( ) + ITEM_OFFSET : 0; + } + + int i{ }; + for( auto& it : item->get_items( ) ) { + item->set_y_offset( height_offset[ i ] ); + render_item( it.get( ), height_offset[ i ], !reset && allow_rect ); + ++i; + } + } + + if( reset ) { + auto device = g_d3d.get_device( ); + device->SetScissorRect( &original ); + } + } +}
\ No newline at end of file |
