Skip to content
fgrimau edited this page Dec 28, 2019 · 10 revisions

The Screen class

what a mess

This class is there to handle every screen related thing, such as the creation of the window, the calculation of fps, the loading/stretching of images, the time advance,...

Screen methods

Constructors

  • Screen()
  • Screen(const Screen&)
  • ~Screen()

Override

  • Screen& operator=(const Screen&)

Getters

  • int get_height() const
  • int get_width() const
  • SDL_Window* get_window() const
  • SDL_Color get_background_color() const
  • TTF_Font* get_font() const
  • bool is_running() const
  • bool get_key(SDL_Keycode)
  • SDL_Rect get_mouse_pos() const
  • SDL_Renderer* get_renderer() const

Setters

  • int set_height(int)
  • int set_width(int)
  • void set_background_color(SDL_Color)
  • void set_background_color(Uint8, Uint8, Uint8)
  • void toggle_fps_show()

Others

  • int init()
  • int build_window()
  • SDL_Texture* convert_surface_to_texure(SDL_Surface*)
  • int blit(SDL_Texture*, const SDL_Rect*, int, int)
  • int blit(SDL_Texture*, const SDL_Rect*, int, int, int)
  • int blit(SDL_Texture*, const SDL_Rect*, int, int, int, int)
  • int blit(SDL_Texture*, const SDL_Rect*, SDL_Rect)
  • void handle_events(SDL_Event*)
  • void update_screen()
  • void compute_fps()
  • int m_width
  • int m_height
  • int m_tile_size
  • Uint32 m_start_time
  • Uint32 m_time_elapsed
  • Uint32 m_time_since_last_fps_update
  • Uint32 m_fps
  • bool m_running
  • bool m_showing_fps
  • SDL_Texture* m_fps_texture
  • SDL_Surface* m_fps_surface
  • SDL_Window* m_window
  • SDL_Renderer* m_Renderer
  • SDL_Color m_font_color
  • SDL_Color m_background_color
  • TTF_Font* m_font
  • SDL_Rect m_mouse_pos

Clone this wiki locally