display.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Voxel-a-tord
  3. * display.h:
  4. * Copyright (c) 2021-2022 986-Studio. All rights reserved.
  5. *
  6. * Created by Manoël Trapier on 01/03/2021.
  7. */
  8. #ifndef VOXELATOR_SOURCE_INCLUDE_DISPLAY_H
  9. #define VOXELATOR_SOURCE_INCLUDE_DISPLAY_H
  10. #include <stdbool.h>
  11. #include <SDL.h>
  12. #include <colour.h>
  13. /***********************************************************************************************************************
  14. * Data types
  15. **********************************************************************************************************************/
  16. typedef struct window_t
  17. {
  18. int32_t height, width;
  19. } window_t;
  20. /***********************************************************************************************************************
  21. * Constants
  22. **********************************************************************************************************************/
  23. #define FPS (60)
  24. #define FRAME_TARGET_TIME (1000 / FPS)
  25. /***********************************************************************************************************************
  26. * Prototypes
  27. **********************************************************************************************************************/
  28. /* --- Window functions --- */
  29. bool initialiseWindow(int32_t screenWidth, int32_t screenHeight, bool fullScreen);
  30. void destroyWindow();
  31. void renderFrameBuffer();
  32. void getWindowSize(int32_t *width, int32_t *height);
  33. void displayWindowClear();
  34. void displayWindowRender();
  35. /* --- Drawing functions --- */
  36. void clearFrameBuffer(colour_t colour);
  37. void drawPixel(int32_t x, int32_t y, colour_t colour);
  38. void drawGrid(int spacing, colour_t colour);
  39. void drawRectangle(int32_t x, int32_t y, int32_t w, int32_t h, colour_t colour);
  40. void drawVLine(int32_t x, int32_t y0, int32_t y1, colour_t colour);
  41. void drawHLine(int32_t x0, int32_t y, int32_t x1, colour_t colour);
  42. void drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, colour_t colour);
  43. void drawText(int32_t x, int32_t y, colour_t colour, const char *format, ...);
  44. #endif /* VOXELATOR_SOURCE_INCLUDE_DISPLAY_H */