The render namespace contains all the functions you need put simple shapes on screen, get various information about the system & more!
Declaration:
namespace render{ // empty rectanglevoidadd_rect(vec2_t pos,vec2_t size,color_t color,float rounding =0.f); // outlined empty rectanglevoidadd_rect_outlined(vec2_t pos,vec2_t size,color_t color,float rounding =0.f); // filled rectanglevoidadd_rect_filled(vec2_t pos,vec2_t size,color_t color,float rounding =0.f); // empty circlevoidadd_circle(vec2_t pos,color_t color,float radius); // filled circlevoidadd_circle_filled(vec2_t pos,color_t color,float radius); // text using a built-in fontvoidadd_text(vec2_t pos,string text,color_t color,int font); // text using a custom fontvoidadd_text(vec2_t pos,string text,color_t color,font_t@ font); // outlined text using a built-in fontvoidadd_text_shadowed(vec2_t pos,string text,color_t color,int font); // outlined text using a custom fontvoidadd_text_shadowed(vec2_t pos,string text,color_t color,font_t@ font); // create a custom font from a pathfont_t@ create_font(string file_name,float size); // turn a world position into a screen position // will return vec2_t(-1.f, -1.f) if they are off-screenvec2_tto_screen(vec3_t pos); // get the cursor positionvec2_tget_cursor_pos(); // get the last clicked positionvec2_tget_click_pos(); // get the display size (WIDTH, HEIGHT)vec2_tget_display_size(); // get the current delta-time between framesfloatget_delta_time(); // get the current timedoubleget_time(); // bounds checkboolarea_contains(vec2_t pos,vec2_t size,vec2_t test_pos); // checks whether "key" is pressed, google "windows virtual keycodes" for more infoboolget_key_state(int key);}
Information:
All of the "add_xxx" functions can only be called inside of a "render" callback, if you attempt to call them outside of this callback you will receive an error. "create_font" should only be called once at the start of your script to prevent issues.
Examples:
Drawing a red circle at the world origin
auto world_origin =vec3_t(0.f,0.f,0.f);voidrender(){auto world_screen = render::to_screen(world_origin); // check if the world origin is on screen // if so, draw a red circleif (world_screen.x >0.f&&world_screen.y >0.f) render::add_circle(world_screen, { 255,0,0,255 },12.f);}