Closed Tech2890 closed 5 years ago
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.
Menu doesn't resize on move or the menu elements.
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");
} `