1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00
VVVVVV/desktop_version/src/GraphicsResources.h
AllyTally 19b2a317f1 Move from surfaces to the SDL render system
Ever since VVVVVV was initially ported to C++ in 2.0, it has used surfaces from SDL. The downside is, that's all software rendering. This commit moves most things off of surfaces, and all into GPU, by using textures and SDL_Renderer.

Pixel-perfect collision has been kept by keeping a copy of sprites as surfaces. There's plans for pixel-perfect collision to use masks instead of reading pixel data directly, but that's out of scope for this commit.

- `graphics.reloadresources()` is now called later in `main`, because textures cannot be created without a renderer.

- This commit also removes a bunch of surface functions which are no longer needed.

- This also recaches target textures in certain places for d3d9.

- graphics.images was converted to a fixed-size array.

- fillbox and fillboxabs use SDL_RenderDrawRect instead of drawing an outline using four filled rectangles

- Update my name in the credits
2023-01-28 14:36:28 -08:00

50 lines
1.1 KiB
C++

#ifndef GRAPHICSRESOURCES_H
#define GRAPHICSRESOURCES_H
#include <SDL.h>
enum TextureLoadType
{
TEX_COLOR,
TEX_WHITE,
TEX_GRAYSCALE
};
class GraphicsResources
{
public:
void init(void);
void destroy(void);
SDL_Surface* im_sprites_surf;
SDL_Surface* im_flipsprites_surf;
SDL_Texture* im_tiles;
SDL_Texture* im_tiles_white;
SDL_Texture* im_tiles_tint;
SDL_Texture* im_tiles2;
SDL_Texture* im_tiles2_tint;
SDL_Texture* im_tiles3;
SDL_Texture* im_entcolours;
SDL_Texture* im_entcolours_tint;
SDL_Texture* im_sprites;
SDL_Texture* im_flipsprites;
SDL_Texture* im_bfont;
SDL_Texture* im_teleporter;
SDL_Texture* im_image0;
SDL_Texture* im_image1;
SDL_Texture* im_image2;
SDL_Texture* im_image3;
SDL_Texture* im_image4;
SDL_Texture* im_image5;
SDL_Texture* im_image6;
SDL_Texture* im_image7;
SDL_Texture* im_image8;
SDL_Texture* im_image9;
SDL_Texture* im_image10;
SDL_Texture* im_image11;
SDL_Texture* im_image12;
};
#endif /* GRAPHICSRESOURCES_H */