aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy.h
diff options
context:
space:
mode:
Diffstat (limited to 'teensy/teensy.h')
-rw-r--r--teensy/teensy.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/teensy/teensy.h b/teensy/teensy.h
index c272664..0e36a6e 100644
--- a/teensy/teensy.h
+++ b/teensy/teensy.h
@@ -6,10 +6,12 @@
#include "teensy_common.h"
#include "teensy_list.h"
-#define ty_vec2(x, y) ((ty_Vec2){x, y})
-#define ty_vec2i(x, y) ((ty_Vec2i){x, y})
-#define ty_color(R, G, B) ((ty_Color){R, G, B})
-#define ty_img_full(img) ((ty_Recti){0, 0, (img).width, (img).height})
+#define ty_vec2(x, y) ((ty_Vec2){x, y})
+#define ty_vec2i(x, y) ((ty_Vec2i){x, y})
+#define ty_color(R, G, B) ((ty_Color){R, G, B})
+#define ty_rect(x, y, w, h) ((ty_Rect){x, y, w, h})
+#define ty_recti(x, y, w, h) ((ty_Recti){x, y, w, h})
+#define ty_img_full(img) ((ty_Recti){0, 0, (img).width, (img).height})
#define ty_rect_start(rect) (ty_vec2(rect.x, rect.y))
#define ty_recti_start(rect) (ty_vec2i(rect.x, rect.y))
@@ -48,6 +50,9 @@ enum {
// for use in the editor
TY_BTN_DB_CTRL,
TY_BTN_DB_SHIFT,
+ TY_BTN_DB_LMB,
+ TY_BTN_DB_RMB,
+ TY_BTN_DB_MMB,
TY_BTN_COUNT,
};
@@ -107,6 +112,8 @@ void ty_deinit(void);
bool ty_button_down(ty_Button btn);
// If the button was pressed just now
bool ty_button_pressed(ty_Button btn);
+// Gets the mouse position; should only be used as debug or dev tools
+ty_Vec2i ty_mouse_pos(void);
// Whether or not the main loop should continue executing.
bool ty_is_game_running(void);
@@ -116,6 +123,9 @@ double ty_get_time(void);
// tic.
int ty_tick(void);
+bool ty_pointi_in_recti(ty_Vec2i point, ty_Recti rect);
+bool ty_point_in_rect(ty_Vec2 point, ty_Rect rect);
+
ty_Image ty_create_image(int w, int h, const ty_Color* data);
void ty_free_image(ty_Image img);
ty_Color ty_img_get_pixel(ty_Image img, ty_Vec2i pos);
@@ -149,9 +159,9 @@ void ty_draw_line(
ty_Vec2i end,
ty_Color color
);
-void ty_draw_text(ty_Font *font, ty_Vec2i pos, const char *text);
+void ty_draw_text(const ty_Font *font, ty_Vec2i pos, const char *text);
void ty_draw_text_fmt(
- ty_Font *font,
+ const ty_Font *font,
ty_Vec2i pos,
const char *fmt,
...