1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-02 19:13:31 +02:00
VVVVVV/desktop_version/src/Graphics.h

418 lines
11 KiB
C
Raw Normal View History

2020-01-01 21:29:24 +01:00
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <map>
2020-01-01 21:29:24 +01:00
#include <string>
#include <vector>
2020-01-01 21:29:24 +01:00
#include "Game.h"
#include "GraphicsResources.h"
#include "Textbox.h"
#include "TowerBG.h"
2020-01-01 21:29:24 +01:00
Enumify all fade modes This removes the magic numbers previously used for controlling the fade mode, which are really not readable at all unless you already know what they mean. 0: FADE_NONE 1: FADE_FULLY_BLACK 2: FADE_START_FADEOUT 3: FADE_FADING_OUT 4: FADE_START_FADEIN 5: FADE_FADING_IN There is also the macro FADEMODE_IS_FADING, which indicates when the intention is to only check if the game is fading right now, which wasn't clearly conveyed previously. I also took the opportunity to clean up the style of any lines I touched. This included rewriting if-else chains into case-switches, turning one-liner if-then statements into proper blocks, fixing up comments, and even commenting the `fademode == FADE_NONE` on the tower spike checks (which, it was previously undocumented why that check was there, but I think I know why it's there). As for type safety, we already get some by transforming the variable types into the enum. Assignment is prohibited without a cast. But, apparently, comparison is perfectly legal and won't even give so much as a warning. To work around this and make absolutely sure I made all existing comparisons now use the enum, I temporarily changed it to be an `enum class`, which is a C++11 feature that makes it so all comparisons are illegal. Unfortunately, it scopes them in a namespace with the same name as a class, so I had to temporarily define macros to make sure my existing code worked. I also had to temporarily up the standard in CMakeLists.txt to get it to compile. But after all that was done, I found the rest of the places where a comparison to an integer was used, and fixed them.
2022-04-25 09:57:47 +02:00
enum FadeBars
{
FADE_NONE,
FADE_FULLY_BLACK,
FADE_START_FADEOUT,
FADE_FADING_OUT,
FADE_START_FADEIN,
FADE_FADING_IN
};
enum ImageNames
{
IMAGE_LEVELCOMPLETE,
IMAGE_MINIMAP,
IMAGE_COVERED,
IMAGE_ELEPHANT,
IMAGE_GAMECOMPLETE,
IMAGE_FLIPLEVELCOMPLETE,
IMAGE_FLIPGAMECOMPLETE,
IMAGE_SITE,
IMAGE_SITE2,
IMAGE_SITE3,
IMAGE_ENDING,
IMAGE_SITE4,
IMAGE_CUSTOMMINIMAP,
NUM_IMAGES
};
Enumify all fade modes This removes the magic numbers previously used for controlling the fade mode, which are really not readable at all unless you already know what they mean. 0: FADE_NONE 1: FADE_FULLY_BLACK 2: FADE_START_FADEOUT 3: FADE_FADING_OUT 4: FADE_START_FADEIN 5: FADE_FADING_IN There is also the macro FADEMODE_IS_FADING, which indicates when the intention is to only check if the game is fading right now, which wasn't clearly conveyed previously. I also took the opportunity to clean up the style of any lines I touched. This included rewriting if-else chains into case-switches, turning one-liner if-then statements into proper blocks, fixing up comments, and even commenting the `fademode == FADE_NONE` on the tower spike checks (which, it was previously undocumented why that check was there, but I think I know why it's there). As for type safety, we already get some by transforming the variable types into the enum. Assignment is prohibited without a cast. But, apparently, comparison is perfectly legal and won't even give so much as a warning. To work around this and make absolutely sure I made all existing comparisons now use the enum, I temporarily changed it to be an `enum class`, which is a C++11 feature that makes it so all comparisons are illegal. Unfortunately, it scopes them in a namespace with the same name as a class, so I had to temporarily define macros to make sure my existing code worked. I also had to temporarily up the standard in CMakeLists.txt to get it to compile. But after all that was done, I found the rest of the places where a comparison to an integer was used, and fixed them.
2022-04-25 09:57:47 +02:00
#define FADEMODE_IS_FADING(mode) ((mode) != FADE_NONE && (mode) != FADE_FULLY_BLACK)
2020-01-01 21:29:24 +01:00
class Graphics
{
public:
void init(void);
void destroy(void);
2020-01-01 21:29:24 +01:00
void create_buffers(void);
void destroy_buffers(void);
GraphicsResources grphx;
2020-01-01 21:29:24 +01:00
SDL_Color huetilegetcol(int t);
SDL_Color bigchunkygetcol(int t);
2020-01-01 21:29:24 +01:00
void drawgravityline(int t);
2020-01-01 21:29:24 +01:00
bool MakeSpriteArray(void);
2020-01-01 21:29:24 +01:00
void drawcoloredtile(int x, int y, int t, int r, int g, int b);
2020-01-01 21:29:24 +01:00
void drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu);
2020-01-01 21:29:24 +01:00
void processfade(void);
void setfade(const int amount);
2020-01-01 21:29:24 +01:00
void drawfade(void);
2020-01-01 21:29:24 +01:00
void createtextboxreal(
const std::string& t,
int xp,
int yp,
int r,
int g,
int b,
bool flipme
);
void createtextbox(
const std::string& t,
int xp,
int yp,
int r,
int g,
int b
);
void createtextboxflipme(
const std::string& t,
int xp,
int yp,
int r,
int g,
int b
);
2020-01-01 21:29:24 +01:00
void textboxcenterx(void);
2020-01-01 21:29:24 +01:00
int textboxwidth(void);
2020-01-01 21:29:24 +01:00
void textboxmoveto(int xo);
2020-01-01 21:29:24 +01:00
void textboxcentery(void);
2020-01-01 21:29:24 +01:00
int textboxwrap(int pad);
void textboxpad(size_t left_pad, size_t right_pad);
void textboxpadtowidth(size_t new_w);
void textboxcentertext();
void textboxcommsrelay();
void textboxadjust(void);
2020-01-01 21:29:24 +01:00
void addline(const std::string& t);
2020-01-01 21:29:24 +01:00
void textboxtimer(int t);
2020-01-01 21:29:24 +01:00
void textboxremove(void);
2020-01-01 21:29:24 +01:00
void textboxremovefast(void);
2020-01-01 21:29:24 +01:00
void textboxactive(void);
2020-01-01 21:29:24 +01:00
void drawtextbox(int x, int y, int w, int h, int r, int g, int b);
2020-01-01 21:29:24 +01:00
void drawpixeltextbox(int x, int y, int w, int h, int r, int g, int b);
2020-01-01 21:29:24 +01:00
void drawcrewman(int x, int y, int t, bool act, bool noshift =false);
2020-01-01 21:29:24 +01:00
int crewcolour(const int t);
2020-01-01 21:29:24 +01:00
void cutscenebars(void);
void cutscenebarstimer(void);
void setbars(const int position);
2020-01-01 21:29:24 +01:00
void drawpartimage(int t, int xp, int yp, int wp, int hp);
2020-01-01 21:29:24 +01:00
void drawimage(int t, int xp, int yp, bool cent=false);
2020-01-01 21:29:24 +01:00
void drawimagecol(int t, int xp, int yp, SDL_Color ct, bool cent= false);
2020-01-01 21:29:24 +01:00
void draw_texture(SDL_Texture* image, int x, int y);
void draw_texture_part(SDL_Texture* image, int x, int y, int x2, int y2, int w, int h, int scalex, int scaley);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, int scalex, int scaley);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, int r, int g, int b, int a, int scalex, int scaley);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, int r, int g, int b, int a);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, int r, int g, int b, int scalex, int scaley);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, int r, int g, int b);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, SDL_Color color, int scalex, int scaley);
void draw_grid_tile(SDL_Texture* texture, int t, int x, int y, int width, int height, SDL_Color color);
void updatetextboxes(void);
void drawgui(void);
2020-01-01 21:29:24 +01:00
void draw_sprite(int x, int y, int t, int r, int g, int b);
void draw_sprite(int x, int y, int t, SDL_Color color);
void scroll_texture(SDL_Texture* texture, int x, int y);
2020-01-01 21:29:24 +01:00
void printcrewname(int x, int y, int t);
void printcrewnamedark(int x, int y, int t);
2020-01-01 21:29:24 +01:00
void printcrewnamestatus(int x, int y, int t, bool rescued);
int set_render_target(SDL_Texture* texture);
int set_texture_color_mod(SDL_Texture* texture, Uint8 r, Uint8 g, Uint8 b);
int set_texture_alpha_mod(SDL_Texture* texture, Uint8 alpha);
int query_texture(SDL_Texture* texture, Uint32* format, int* access, int* w, int* h);
int set_blendmode(SDL_BlendMode blendmode);
int set_blendmode(SDL_Texture* texture, SDL_BlendMode blendmode);
int clear(int r, int g, int b, int a);
int clear();
int copy_texture(SDL_Texture* texture, const SDL_Rect* src, const SDL_Rect* dest);
int copy_texture(SDL_Texture* texture, const SDL_Rect* src, const SDL_Rect* dest, double angle, const SDL_Point* center, SDL_RendererFlip flip);
int set_color(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
int set_color(Uint8 r, Uint8 g, Uint8 b);
int set_color(SDL_Color color);
int fill_rect(const SDL_Rect* rect, int r, int g, int b, int a);
int fill_rect(int x, int y, int w, int h, int r, int g, int b, int a);
int fill_rect(int x, int y, int w, int h, int r, int g, int b);
int fill_rect(int r, int g, int b, int a);
int fill_rect(const SDL_Rect* rect, int r, int g, int b);
int fill_rect(int r, int g, int b);
int fill_rect(const SDL_Rect* rect, SDL_Color color);
int fill_rect(int x, int y, int w, int h, SDL_Color color);
int fill_rect(SDL_Color color);
void map_tab(int opt, const char* text, bool selected = false);
void map_option(int opt, int num_opts, const std::string& text, bool selected = false);
void Print(int _x, int _y, const std::string& _s, int r, int g, int b, bool cen = false);
2020-01-01 21:29:24 +01:00
void PrintAlpha(int _x, int _y, const std::string& _s, int r, int g, int b, int a, bool cen = false);
int PrintWrap(int x, int y, const std::string& s, int r, int g, int b, bool cen = false, int linespacing = -1, int maxwidth = -1);
void bprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false);
2020-01-01 21:29:24 +01:00
void bprintalpha(int x, int y, const std::string& t, int r, int g, int b, int a, bool cen = false);
int len(const std::string& t);
void bigprint( int _x, int _y, const std::string& _s, int r, int g, int b, bool cen = false, int sc = 2 );
void bigbprint(int x, int y, const std::string& s, int r, int g, int b, bool cen = false, int sc = 2);
void drawspritesetcol(int x, int y, int t, int c);
2020-01-01 21:29:24 +01:00
void flashlight(void);
void screenshake(void);
void updatescreenshake(void);
int screenshake_x;
int screenshake_y;
2020-01-01 21:29:24 +01:00
void render(void);
void renderwithscreeneffects(void);
void renderfixedpre(void);
void renderfixedpost(void);
2020-01-01 21:29:24 +01:00
bool Hitest(SDL_Surface* surface1, SDL_Point p1, SDL_Surface* surface2, SDL_Point p2);
2020-01-01 21:29:24 +01:00
void drawentities(void);
2020-01-01 21:29:24 +01:00
void drawentity(const int i, const int yoff);
void drawtrophytext(void);
2020-01-01 21:29:24 +01:00
Implement first font::print function, fix most fading of colored glyphs There has always been a mess of different print functions that all had slightly different specifics and called each other: Print(x, y, text, r, g, b, cen) nothing special here, just does what the arguments say PrintAlpha(x, y, text, r, g, b, a, cen) just Print but with an alpha argument PrintWrap(x, y, text, r, g, b, cen, linespacing, maxwidth) added for wordwrapping, heavily used now bprint(x, y, text, r, g, b, cen) prints an outline, then just PrintAlpha bprintalpha(x, y, text, r, g, b, a, cen) just bprint but with an alpha argument bigprint(x, y, text, r, g, b, cen, sc) nothing special here, just does what the arguments say bigbprint(x, y, text, r, g, b, cen, sc) prints an outline, then just bigprint bigrprint(x, y, text, r, g, b, cen, sc) right-aligns text, unless cen is given in which case it just centers text like other functions already do? bigbrprint(x, y, text, r, g, b, cen, sc) prints an outline, then just bigrprint We need even more specifics with the new font system: we need to be able to specify whether CJK characters should be vertically centered or stick out on the top/bottom, and we sometimes need to pass in brightness variables for colored glyphs. And text printing functions now fit better in Font.cpp anyway. So there's now a big overhaul of print functions: all these functions will be replaced by font::print and font::print_wrap (the former of which now exists). These take flags as their first argument, which can be 0 for a basic left-aligned print, PR_CEN for centered text (set X to -1!!!) PR_BOR for a border (instead of functions like bprint and bigbprint), PR_2X, PR_3X etc for scaling, and these can be combined with |. Some text, for example [Press ESC to return to editor], fades in/out using the alpha value, which is passed to the print function. In some other places (like Press ENTER to teleport, textboxes, trophy text...) text can fade in or out by direct changes to the RGB values. This means regular color-adjusted white text can change color, but colored button glyphs can't, since there's no way to know in the print system what the maximum RGB values of a specific textbox are supposed to be, so the only thing it can do is draw the button glyphs at full brightness, which looks bad. Therefore, you can now also pass in the brightness value via the flags, with PR_COLORGLYPH_BRI(255).
2023-01-06 04:43:21 +01:00
void bigrprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false, int sc = 2);
void bigbrprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false, int sc = 2);
2020-01-01 21:29:24 +01:00
void drawtele(int x, int y, int t, SDL_Color c);
2020-01-01 21:29:24 +01:00
SDL_Color getRGBA(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
SDL_Color getRGB(Uint8 r, Uint8 g, Uint8 b);
2020-01-01 21:29:24 +01:00
SDL_Color RGBf(int r, int g, int b);
2020-01-01 21:29:24 +01:00
void drawbackground(int t);
void updatebackground(int t);
#ifndef NO_CUSTOM_LEVELS
bool shouldrecoloroneway(const int tilenum, const bool mounted);
#endif
void drawtile3( int x, int y, int t, int off, int height_subtract = 0 );
void drawtile2( int x, int y, int t );
void drawtile( int x, int y, int t );
void drawtowertile( int x, int y, int t );
void drawtowertile3( int x, int y, int t, TowerBG& bg_obj );
2020-01-01 21:29:24 +01:00
void drawmap(void);
2020-01-01 21:29:24 +01:00
void drawforetile(int x, int y, int t);
2020-01-01 21:29:24 +01:00
void drawforetile2(int x, int y, int t);
2020-01-01 21:29:24 +01:00
void drawforetile3(int x, int y, int t, int off);
2020-01-01 21:29:24 +01:00
void drawrect(int x, int y, int w, int h, int r, int g, int b);
2020-01-01 21:29:24 +01:00
void drawtowermap(void);
2020-01-01 21:29:24 +01:00
void drawtowerspikes(void);
2020-01-01 21:29:24 +01:00
bool onscreen(int t);
bool reloadresources(void);
#ifndef NO_CUSTOM_LEVELS
bool tiles1_mounted;
bool tiles2_mounted;
bool minimap_mounted;
#endif
2020-01-01 21:29:24 +01:00
bool gamecomplete_mounted;
bool levelcomplete_mounted;
bool flipgamecomplete_mounted;
bool fliplevelcomplete_mounted;
2020-01-01 21:29:24 +01:00
void menuoffrender(void);
2020-01-01 21:29:24 +01:00
void drawtowerbackground(const TowerBG& bg_obj);
void updatetowerbackground(TowerBG& bg_obj);
2020-01-01 21:29:24 +01:00
SDL_Color getcol(int t);
void drawfinalmap(void);
2020-01-01 21:29:24 +01:00
int rcol;
2020-01-01 21:29:24 +01:00
int m;
2020-01-01 21:29:24 +01:00
std::vector <SDL_Surface*> sprites_surf;
std::vector <SDL_Surface*> flipsprites_surf;
2020-01-01 21:29:24 +01:00
SDL_Texture* images[NUM_IMAGES];
2020-01-01 21:29:24 +01:00
bool flipmode;
bool setflipmode;
bool notextoutline;
SDL_Texture* gameTexture;
SDL_Texture* tempTexture;
SDL_Texture* gameplayTexture;
SDL_Texture* menuTexture;
SDL_Texture* ghostTexture;
SDL_Texture* backgroundTexture;
SDL_Texture* foregroundTexture;
2020-01-01 21:29:24 +01:00
TowerBG towerbg;
TowerBG titlebg;
SDL_Rect tiles_rect;
SDL_Rect sprites_rect;
SDL_Rect line_rect;
SDL_Rect tele_rect;
2020-01-01 21:29:24 +01:00
SDL_Rect prect;
SDL_Rect footerrect;
2020-01-01 21:29:24 +01:00
int linestate, linedelay;
int backoffset;
bool backgrounddrawn, foregrounddrawn;
2020-01-01 21:29:24 +01:00
int menuoffset;
int oldmenuoffset;
bool resumegamemode;
2020-01-01 21:29:24 +01:00
int crewframe;
int crewframedelay;
2020-01-01 21:29:24 +01:00
Enumify all fade modes This removes the magic numbers previously used for controlling the fade mode, which are really not readable at all unless you already know what they mean. 0: FADE_NONE 1: FADE_FULLY_BLACK 2: FADE_START_FADEOUT 3: FADE_FADING_OUT 4: FADE_START_FADEIN 5: FADE_FADING_IN There is also the macro FADEMODE_IS_FADING, which indicates when the intention is to only check if the game is fading right now, which wasn't clearly conveyed previously. I also took the opportunity to clean up the style of any lines I touched. This included rewriting if-else chains into case-switches, turning one-liner if-then statements into proper blocks, fixing up comments, and even commenting the `fademode == FADE_NONE` on the tower spike checks (which, it was previously undocumented why that check was there, but I think I know why it's there). As for type safety, we already get some by transforming the variable types into the enum. Assignment is prohibited without a cast. But, apparently, comparison is perfectly legal and won't even give so much as a warning. To work around this and make absolutely sure I made all existing comparisons now use the enum, I temporarily changed it to be an `enum class`, which is a C++11 feature that makes it so all comparisons are illegal. Unfortunately, it scopes them in a namespace with the same name as a class, so I had to temporarily define macros to make sure my existing code worked. I also had to temporarily up the standard in CMakeLists.txt to get it to compile. But after all that was done, I found the rest of the places where a comparison to an integer was used, and fixed them.
2022-04-25 09:57:47 +02:00
enum FadeBars fademode;
int fadeamount;
int oldfadeamount;
int fadebars[15];
Enumify all fade modes This removes the magic numbers previously used for controlling the fade mode, which are really not readable at all unless you already know what they mean. 0: FADE_NONE 1: FADE_FULLY_BLACK 2: FADE_START_FADEOUT 3: FADE_FADING_OUT 4: FADE_START_FADEIN 5: FADE_FADING_IN There is also the macro FADEMODE_IS_FADING, which indicates when the intention is to only check if the game is fading right now, which wasn't clearly conveyed previously. I also took the opportunity to clean up the style of any lines I touched. This included rewriting if-else chains into case-switches, turning one-liner if-then statements into proper blocks, fixing up comments, and even commenting the `fademode == FADE_NONE` on the tower spike checks (which, it was previously undocumented why that check was there, but I think I know why it's there). As for type safety, we already get some by transforming the variable types into the enum. Assignment is prohibited without a cast. But, apparently, comparison is perfectly legal and won't even give so much as a warning. To work around this and make absolutely sure I made all existing comparisons now use the enum, I temporarily changed it to be an `enum class`, which is a C++11 feature that makes it so all comparisons are illegal. Unfortunately, it scopes them in a namespace with the same name as a class, so I had to temporarily define macros to make sure my existing code worked. I also had to temporarily up the standard in CMakeLists.txt to get it to compile. But after all that was done, I found the rest of the places where a comparison to an integer was used, and fixed them.
2022-04-25 09:57:47 +02:00
enum FadeBars ingame_fademode;
2020-01-01 21:29:24 +01:00
bool trinketcolset;
int trinketr, trinketg, trinketb;
2020-01-01 21:29:24 +01:00
std::vector <textboxclass> textboxes;
2020-01-01 21:29:24 +01:00
bool showcutscenebars;
int cutscenebarspos;
int oldcutscenebarspos;
2020-01-01 21:29:24 +01:00
static const int numstars = 50;
SDL_Rect stars[numstars];
int starsspeed[numstars];
2020-01-01 21:29:24 +01:00
static const int numbackboxes = 18;
int spcol, spcoldel;
SDL_Rect backboxes[numbackboxes];
int backboxvx[numbackboxes];
int backboxvy[numbackboxes];
float backboxint[numbackboxes];
2020-01-01 21:29:24 +01:00
int warpskip;
2020-01-01 21:29:24 +01:00
bool translucentroomname;
#ifndef GAME_DEFINITION
float inline lerp(const float v0, const float v1)
{
if (game.physics_frozen())
{
return v1;
}
return v0 + alpha * (v1 - v0);
}
#endif
float alpha;
SDL_Color col_crewred;
SDL_Color col_crewyellow;
SDL_Color col_crewgreen;
SDL_Color col_crewcyan;
SDL_Color col_crewblue;
SDL_Color col_crewpurple; //actually pink
SDL_Color col_crewinactive;
SDL_Color col_clock;
SDL_Color col_trinket;
int col_tr;
int col_tg;
int col_tb;
void updatetitlecolours(void);
bool kludgeswnlinewidth;
SDL_Color crewcolourreal(int t);
void render_roomname(const char* roomname, int r, int g, int b);
char error[128];
char error_title[128]; /* for SDL_ShowSimpleMessageBox */
2020-01-01 21:29:24 +01:00
};
#ifndef GRAPHICS_DEFINITION
Allow using help/graphics/music/game/key/map/obj everywhere This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and `obj` essentially static global objects that can be used everywhere. This is useful in case we ever need to add a new function in the future, so we don't have to bother with passing a new argument in which means we have to pass a new argument in to the function that calls that function which means having to pass a new argument into the function that calls THAT function, etc. which is a real headache when working on fan mods of the source code. Note that this changes NONE of the existing function signatures, it merely just makes those variables accessible everywhere in the same way `script` and `ed` are. Also note that some classes had to be initialized after the filesystem was initialized, but C++ would keep initializing them before the filesystem got initialized, because I *had* to put them at the top of `main.cpp`, or else they wouldn't be global variables. The only way to work around this was to use entityclass's initialization style (which I'm pretty sure entityclass of all things doesn't need to be initialized this way), where you actually initialize the class in an `init()` function, and so then you do `graphics.init()` after the filesystem initialization, AFTER doing `Graphics graphics` up at the top. I've had to do this for `graphics` (but only because its child GraphicsResources `grphx` needs to be initialized this way), `music`, and `game`. I don't think this will affect anything. Other than that, `help`, `key`, and `map` are still using the C++-intended method of having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
extern Graphics graphics;
#endif
Allow using help/graphics/music/game/key/map/obj everywhere This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and `obj` essentially static global objects that can be used everywhere. This is useful in case we ever need to add a new function in the future, so we don't have to bother with passing a new argument in which means we have to pass a new argument in to the function that calls that function which means having to pass a new argument into the function that calls THAT function, etc. which is a real headache when working on fan mods of the source code. Note that this changes NONE of the existing function signatures, it merely just makes those variables accessible everywhere in the same way `script` and `ed` are. Also note that some classes had to be initialized after the filesystem was initialized, but C++ would keep initializing them before the filesystem got initialized, because I *had* to put them at the top of `main.cpp`, or else they wouldn't be global variables. The only way to work around this was to use entityclass's initialization style (which I'm pretty sure entityclass of all things doesn't need to be initialized this way), where you actually initialize the class in an `init()` function, and so then you do `graphics.init()` after the filesystem initialization, AFTER doing `Graphics graphics` up at the top. I've had to do this for `graphics` (but only because its child GraphicsResources `grphx` needs to be initialized this way), `music`, and `game`. I don't think this will affect anything. Other than that, `help`, `key`, and `map` are still using the C++-intended method of having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
2020-01-01 21:29:24 +01:00
#endif /* GRAPHICS_H */