What does ShowError do? If its not an object and its fairly simple then it can just be brought into your main window/UI class. Of course it depends on various things but typically an error message would be a mode of your program. Hence the main class that handles all the UI business might look like:
class GameWindow {
public:
void showErrorMessage(...);
protected:
enum Mode {kPlaying, kShowingErrorMessage, ...};
Mode mode;
};
Where showErrorMessage(...) is just a function, the calling of which changes the state of the program. To access this from multiple parts of your program (which again may or may not be a problem), you could make GameWindow a singleton. Another approach would just be to let GameWindow know when errors occur, e.g., by throwing error messages from functions or having error flags in your other modules.
Fwiw, here's the current list of classes in my game: Moonman.
> grep -Rh "class [A-Za-z]* {" src\mm
class FileSystemWatcher {
class Profiler {
class Registry {
class Game {
class Widget {
class InputSystem {
class SensorTracer {
class BackgroundRenderer
class BlockSpriteManager
class Camera {
class Console {
class FunctionProfileVisu
class ImageResourceLoader {
class LightingManager {
class Renderer {
class SpriteLoader {
class Entity {
class FluidManager {
class ISystemBase {
class ItemManager {
class LuaSpecLoader {
class ResourceManagerListener {
class ResourceManagerBase {
class ResourceHash {
class ResourceManager {
class ResourceLoader {
class ResourcePackage {
class Root {
class ScriptManager {
class SoundManager {
class SubRegistry {
class SplitRegistry {
class SystemRegistry {
class BlockManager {
class SubChunkArray {
class ChunkArray {
class World {
class WorldGenerator {
So, at least for my app, most of the classes are just big controller/manager type things that operate on structs.. of which there are 74 and counting.. So it's more of a data-oriented app than a object-oriented app.
> C:\dev\moonman>grep -Rh "struct [A-Za-z]* {" src\mm | wc -l
74