Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu not resizing on move. #46

Closed
Tech2890 opened this issue May 6, 2019 · 1 comment
Closed

Menu not resizing on move. #46

Tech2890 opened this issue May 6, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Tech2890
Copy link

Tech2890 commented May 6, 2019

Menu doesn't resize on move or the menu elements.

image

I'm calling this in present btw.
The text moves accordingly but nothing else also I will post a fix if I find one.

Setting up like this:
`
void line(int x, int y, int x2, int y2, zgui::color c) noexcept
{
g_render.Line(x, y, x2, y2, { c.r, c.g, c.b, c.a });
}
void rect(int x, int y, int x2, int y2, zgui::color c) noexcept
{ /* draw outlined rectangle using your renderer /
g_render.Rect(x, y, x2, y2, { c.r, c.g, c.b, c.a });
}
void filled_rect(int x, int y, int x2, int y2, zgui::color c) noexcept
{ /
draw filled rectangle using your renderer /
g_render.RectFilled(x, y, x2, y2, { c.r, c.g, c.b, c.a });
}
void text(int x, int y, zgui::color color, int font, bool center, const char
text) noexcept
{ /* draw text using your renderer /
g_render.String(x, y, center ? FONT_CENTERED_X | FONT_DROPSHADOW : FONT_DROPSHADOW, { color.r, color.g, color.b, color.a }, g_fonts.fonts[font], text);
}
void get_text_size(unsigned long font, const char
text, int& wide, int& tall) noexcept
{ /* calculate text size here /
auto p = get_text_dimensions(g_fonts.fonts[font], true, text); wide = p.x; tall = p.y;
}
float get_frametime() noexcept
{ /
return frametime */
return g_globals->absoluteframetime;
}

zgui::functions.draw_line = line;
zgui::functions.draw_rect = rect;
zgui::functions.draw_filled_rect = filled_rect;
zgui::functions.draw_text = text;
zgui::functions.get_text_size = get_text_size;
zgui::functions.get_frametime = get_frametime;
`

Rendering:

`
void zgui_menu::render()
{
zgui::poll_input("Counter-Strike: Global Offensive");

static bool example = false;
static int example_int = 10;
if (zgui::begin_window("zgui example window", { 500, 350 }, FONT_ESP, zgui::zgui_window_flags_none))
{
	zgui::checkbox("sample checkbox #example", example);
	// value before hash is visible ^
	zgui::slider_int("#sample_slider", 0, 40, example_int);
	//                ^ value after hash is hidden"
	//
	// Hashing is demystified in zgui.hh
	// Search for [hashing controls names] to get more details.
	zgui::end_window();
}

}
`

@Tech2890 Tech2890 added the bug Something isn't working label May 6, 2019
@Tech2890
Copy link
Author

Tech2890 commented May 6, 2019

From:

g_render.Rect(x, y, x2, y2, { c.r, c.g, c.b, c.a });
g_render.RectFilled(x, y, x2, y2, { c.r, c.g, c.b, c.a });

To:

g_render.Rect(x, y, x + x2, y + y2, { c.r, c.g, c.b, c.a });
g_render.RectFilled(x, y, x + x2, y + y2, { c.r, c.g, c.b, c.a });

This is what I changed after looking your code. Just in case anyone else has this problem, it was just a stupid mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants