Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "menu.hpp"
- #include <d3d9.h>
- #include <d3dx9.h>
- #include "../sdk/helper/render.hpp"
- #include "tab_font.hpp"
- #define NK_INCLUDE_FIXED_TYPES
- #define NK_INCLUDE_STANDARD_IO
- #define NK_INCLUDE_STANDARD_VARARGS
- #define NK_INCLUDE_DEFAULT_ALLOCATOR
- #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
- #define NK_INCLUDE_FONT_BAKING
- #define NK_INCLUDE_DEFAULT_FONT
- #define NK_IMPLEMENTATION
- #define NK_D3D9_IMPLEMENTATION
- #include "framework/nuklear.h"
- #include "framework/nuklear_d3d9.h"
- menu_t::~menu_t()
- {
- nk_d3d9_shutdown();
- }
- struct nk_image legitbot_icon;
- struct nk_image ragebot_icon;
- struct nk_image visuals_icon;
- struct nk_image misc_icon;
- struct nk_image inventory_icon;
- struct nk_image settings_icon;
- static int tab_state = 1;
- bool font_init = false;
- NK_API int nk_tab(struct nk_context* ctx, const char* title, int icon, int active)
- {
- struct nk_style_item c = ctx->style.button.normal;
- if (active) { ctx->style.button.normal = ctx->style.button.active; }
- int r = nk_button_label(ctx, title, icon);
- ctx->style.button.normal = c;
- return r;
- }
- auto menu_t::gui() -> void
- {
- if (nk_begin(ctx, "cookiecheat alpha", nk_rect(50, 50, 800, 600), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_TITLE)) {
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Legitbot", 1, tab_state == 1)) {
- tab_state = 1;
- }
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Ragebot", 2, tab_state == 2)) {
- tab_state = 2;
- }
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Visuals", 3, tab_state == 3)) {
- tab_state = 3;
- }
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Misc", 4, tab_state == 4)) {
- tab_state = 4;
- }
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Inventory", 5, tab_state == 5)) {
- tab_state = 5;
- }
- nk_layout_row_static(ctx, 40, 200, 1);
- if (nk_tab(ctx, "Settings", 6, tab_state == 6)) {
- tab_state = 6;
- }
- if(tab_state == 1) {
- }
- else if (tab_state == 2) {
- }
- else if (tab_state == 3) {
- }
- else if (tab_state == 4) {
- }
- else if (tab_state == 5) {
- }
- else if (tab_state == 6) {
- }
- }
- nk_end(ctx);
- }
- auto menu_t::initialize(IDirect3DDevice9* device) -> void
- {
- is_initialized = true;
- auto viewport = D3DVIEWPORT9();
- device->GetViewport(&viewport);
- ctx = nk_d3d9_init(device, viewport.Width, viewport.Height);
- struct nk_font_atlas* atlas_menu = nullptr;
- struct nk_font_atlas* atlas_tabs = nullptr;
- struct nk_font_config config_menu = nk_font_config(17);
- struct nk_font_config config_tabs = nk_font_config(30);
- nk_d3d9_font_stash_begin(&atlas_menu);
- struct nk_font* font = nk_font_atlas_add_from_memory(atlas_menu, (void*)(menu_font_byte), nk_size(sizeof(menu_font_byte)), 17, &config_menu);
- nk_d3d9_font_stash_end();
- nk_d3d9_font_stash_begin(&atlas_tabs);
- tabfont = nk_font_atlas_add_from_memory(atlas_tabs, (void*)(tab_font_byte), nk_size(sizeof(tab_font_byte)), 30, &config_tabs);
- nk_d3d9_font_stash_end();
- //set the font
- if (font)
- nk_style_set_font(ctx, &font->handle);
- }
- auto menu_t::on_reset(IDirect3DDevice9* device, D3DPRESENT_PARAMETERS* present_parameters) -> void
- {
- if (ctx)
- {
- nk_free(ctx);
- ctx = nullptr;
- }
- nk_d3d9_release();
- is_initialized = false;
- }
- auto menu_t::after_reset(IDirect3DDevice9* device, D3DPRESENT_PARAMETERS* present_parameters) -> void
- {
- initialize(device);
- }
- auto menu_t::on_endscene(IDirect3DDevice9* device) -> void
- {
- if (!is_initialized)
- initialize(device);
- if (ctx::menu.get()->is_open) {
- gui();
- nk_d3d9_render(NK_ANTI_ALIASING_ON);
- nk_input_begin(ctx);
- nk_input_end(ctx);
- }
- }
- auto menu_t::on_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -> void
- {
- nk_d3d9_handle_event(hwnd, msg, wparam, lparam);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement