1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 /* PlatformFactory: 14 * Abstract builder for platform dependent stuff. 15 */ 16 17 #ifndef BZF_PLATFORM_FACTORY_H 18 #define BZF_PLATFORM_FACTORY_H 19 20 #include "common.h" 21 22 class BzfDisplay; 23 class BzfVisual; 24 class BzfWindow; 25 class BzfMedia; 26 class BzfJoystick; 27 28 class PlatformFactory 29 { 30 public: 31 PlatformFactory(); 32 virtual ~PlatformFactory(); 33 34 virtual BzfDisplay* createDisplay(const char* name, 35 const char* videoFormat) = 0; 36 virtual BzfVisual* createVisual(const BzfDisplay*) = 0; 37 virtual BzfWindow* createWindow(const BzfDisplay*, BzfVisual*) = 0; 38 virtual BzfJoystick* createJoystick(); 39 40 static PlatformFactory* getInstance(); 41 static BzfMedia* getMedia(); 42 43 private: 44 PlatformFactory(const PlatformFactory&); 45 PlatformFactory& operator=(const PlatformFactory&); 46 47 virtual BzfMedia* createMedia() = 0; 48 49 private: 50 static PlatformFactory* instance; 51 static BzfMedia* media; 52 }; 53 54 #endif // BZF_PLATFORM_FACTORY_H 55 56 // Local Variables: *** 57 // mode: C++ *** 58 // tab-width: 4 *** 59 // c-basic-offset: 4 *** 60 // indent-tabs-mode: nil *** 61 // End: *** 62 // ex: shiftwidth=4 tabstop=4 63