1 /* -*- c++ -*- 2 FILE: Machine.h 3 RCS REVISION: $Revision: 1.16 $ 4 5 COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software 6 7 LICENSE: Free to use and modify for non-commercial purposes as long as the 8 following conditions are adhered to: 9 1) Obvious credit for the source of this code and the designs it embodies 10 are clearly made, and 11 2) Ports and derived versions of 4D Magic Cube programs are not distributed 12 without the express written permission of the authors. 13 14 DESCRIPTION: 15 Generic Machine interface. This class defines a generic 16 interface that can be used as a base class for the 17 machine-dependent (or sytem-dependent) code that handles the 18 display. See EventHandler.h for caveats. 19 */ 20 21 #ifndef MACHINE_H 22 #define MACHINE_H 23 24 #include "EventHandler.h" 25 26 class Widgets; 27 class PuzzleState; 28 class Preferences; 29 30 class Machine 31 { 32 public: 33 typedef void (EventHandler::*event_handler)(EventHandler::Event*, 34 void *arg); ~Machine()35 virtual ~Machine() {}; 36 37 static Machine* createMachine(EventHandler*, int& argc, char *argv[], 38 Preferences& prefs, 39 char const* machine_type); 40 41 virtual void init(PuzzleState*) = 0; 42 virtual void drawFrame(struct frame *) = 0; 43 virtual void frontBuffer() = 0; 44 virtual void backBuffer() = 0; 45 virtual void swapBuffers() = 0; 46 virtual void addEventHandler(unsigned int eventmask, 47 event_handler handler, 48 void *arg = 0) = 0; 49 virtual void eventLoop() = 0; 50 virtual void setColors() = 0; 51 virtual void toggleOutline() = 0; 52 virtual void turnBackgroundBlack() = 0; 53 virtual void turnBackgroundWhite() = 0; 54 virtual void bell() = 0; 55 virtual bool getEventIfThereIsOne(int eventmask, 56 EventHandler::Event* event) = 0; 57 virtual Widgets* getWidgets() = 0; 58 59 protected: Machine()60 Machine() {}; 61 62 // puzzle_state is under external control 63 PuzzleState* puzzle_state; 64 65 private: 66 // Prohibit copying and assignment 67 Machine(Machine const&); 68 Machine& operator=(Machine&); 69 }; 70 71 #endif 72 73 // Local Variables: 74 // c-basic-offset: 4 75 // c-comment-only-line-offset: 0 76 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0)) 77 // indent-tabs-mode: nil 78 // End: 79