textbox.h 744 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef IC_EXPLORER_TEXTBOX_H
  2. #define IC_EXPLORER_TEXTBOX_H
  3. #include "window.h"
  4. #include <SDL_ttf.h>
  5. #define TEXT_BOX_PADDING 0.005f
  6. typedef struct {
  7. float x;
  8. float y;
  9. float textSize;
  10. SDL_Color textColor;
  11. SDL_Texture *background;
  12. TTF_Font *font;
  13. char *text;
  14. size_t lineCount;
  15. SDL_Texture **renderedText;
  16. } TextBox;
  17. TextBox *textBoxNew(const char *text, float x, float y, float textSize,
  18. SDL_Color color, SDL_Texture *background, TTF_Font *font,
  19. const Window *window);
  20. void textBoxDelete(TextBox *textBox);
  21. void textBoxDraw(TextBox *textBox, const Window *window);
  22. void textBoxUpdate(TextBox *textBox, const Window *window);
  23. #endif /* IC_EXPLORER_TEXTBOX_H */