私はゲーム開発の初心者で、C++ で簡単なプラットフォーム ゲームを作成したいと考えています。問題は、2 つのクラス (ゲームとグラフィックス) を作成するときに、既に Graphics.h を Game.h に含めているため、Game.h を Graphics.h に含めることができないことです。誰でも私を助けることができますか?コード: Game.h:
#pragma once
#include "Graphics.h"
struct Game {
Game();
void init();
void handle();
bool running;
Graphics g;
};
Graphics.h:
#pragma once
#include <SDL.h>
struct Graphics {
SDL_Surface* screen;
void init();
void rect(SDL_Rect rect, Uint32 color);
void rect(SDL_Rect rect, int r, int g, int b);
void rect(int x, int y, int w, int h, Uint32 color);
void rect(int x, int y, int w, int h, int r, int g, int b);
void render(Game* game);
};