From bb16c32bde58cba70e4877aa2d3ebd04332eb575 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Tue, 4 Jan 2022 13:35:02 +0100 Subject: linux compile and imgs --- graphics/graphics.h | 156 ++++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) (limited to 'graphics/graphics.h') diff --git a/graphics/graphics.h b/graphics/graphics.h index af8630a..a5b5eee 100644 --- a/graphics/graphics.h +++ b/graphics/graphics.h @@ -1,79 +1,79 @@ -#ifndef GRAPHICS_H -#define GRAPHICS_H - -#include -#include - -#define SDL_MAIN_HANDLED -#include - -#include "../game/gst.h" -#include "../game/view.h" -#include "cam.h" - -#include - - -class Graphics_sdl_text { - public: - Graphics_sdl_text(); - int get_width (std::string str); - void render_text (std::string str, vec2 off); - void render_text (std::string str, vec2 off, int r, int g, int b); - SDL_Renderer* gRenderer; - SDL_Texture *tex; - int char_width[128]; -}; - - -class Graphics_sdl { - public: - Graphics_sdl (int resx, int resy); - ~Graphics_sdl (); - SDL_Renderer* get_renderer (); - void load_sheet (); - void present (); - void change_res (int resx, int resy) { - SDL_SetWindowSize(window, resx, resy); - } - void render_sprite ( - int x, int y, int w, int h, - int u, int v, int s, int t); - void render_rect ( - int r, int g, int b, int a, - int x, int y, int w, int h); - void render_sprite ( - int x, int y, int w, int h, - int u, int v, int s, int t, - int r, int g, int b); - - Graphics_sdl_text txt; - - private: - SDL_Window* window = NULL; - SDL_Surface* screenSurface = NULL; - SDL_Renderer* rend = NULL; - SDL_Texture* txsprites = NULL; -}; - - -class Graphics { - public: - Graphics (int resx, int resy) - : resx(resx), resy(resy), backend(resx, resy) {} - ~Graphics (); - - Graphics_sdl backend; - - int resx, resy; - Cam cam; - - void render (Gst &gst, View &view); - void present (); - void change_res (int x, int y) { - resx = x; resy = y; - backend.change_res(x, y); - } -}; - +#ifndef GRAPHICS_H +#define GRAPHICS_H + +#include +#include + +#define SDL_MAIN_HANDLED +#include + +#include "../game/gst.h" +#include "../game/view.h" +#include "cam.h" + +#include + + +class Graphics_sdl_text { + public: + Graphics_sdl_text(); + int get_width (std::string str); + void render_text (std::string str, vec2 off); + void render_text (std::string str, vec2 off, int r, int g, int b); + SDL_Renderer* gRenderer; + SDL_Texture *tex; + int char_width[128]; +}; + + +class Graphics_sdl { + public: + Graphics_sdl (int resx, int resy); + ~Graphics_sdl (); + SDL_Renderer* get_renderer (); + void load_sheet (); + void present (); + void change_res (int resx, int resy) { + SDL_SetWindowSize(window, resx, resy); + } + void render_sprite ( + int x, int y, int w, int h, + int u, int v, int s, int t); + void render_rect ( + int r, int g, int b, int a, + int x, int y, int w, int h); + void render_sprite ( + int x, int y, int w, int h, + int u, int v, int s, int t, + int r, int g, int b); + + Graphics_sdl_text txt; + + private: + SDL_Window* window = NULL; + SDL_Surface* screenSurface = NULL; + SDL_Renderer* rend = NULL; + SDL_Texture* txsprites = NULL; +}; + + +class Graphics { + public: + Graphics (int resx, int resy) + : resx(resx), resy(resy), backend(resx, resy) {} + ~Graphics (); + + Graphics_sdl backend; + + int resx, resy; + Cam cam; + + void render (Gst &gst, View &view); + void present (); + void change_res (int x, int y) { + resx = x; resy = y; + backend.change_res(x, y); + } +}; + #endif \ No newline at end of file -- cgit v1.2.3-54-g00ecf