add wraparound support to C2 physics
[openc2e.git] / Blackboard.h
blob959688e5a1bfeb2e2aa5974dfbffbc4a16f45328
1 /*
2 * Blackboard.h
3 * openc2e
5 * Created by Alyssa Milburn on Sat Jan 12 2008.
6 * Copyright (c) 2008 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #include "CompoundAgent.h"
22 #ifndef _C2E_BLACKBOARD_H
23 #define _C2E_BLACKBOARD_H
25 class Blackboard : public CompoundAgent {
26 friend class BlackboardPart;
28 protected:
29 class BlackboardPart *ourPart;
31 // configuration
32 unsigned int textx, texty;
33 unsigned int backgroundcolour, chalkcolour, aliascolour;
35 // state
36 std::vector<std::pair<unsigned int, std::string> > strings;
37 std::string currenttext;
38 bool editing;
39 unsigned int editingindex;
41 void renderText(class Surface *renderer, int xoffset, int yoffset);
42 std::string getText();
44 void startEditing();
45 void stopEditing(bool losingfocus);
47 public:
48 Blackboard(std::string spritefile, unsigned int firstimage, unsigned int imagecount,
49 unsigned int tx, unsigned int ty, unsigned int bgcolour, unsigned int ckcolour,
50 unsigned int alcolour);
52 void addBlackboardString(unsigned int n, unsigned int id, std::string text);
53 void showText(bool show);
55 void addPart(CompoundPart *); // override
56 class BlackboardPart *getBlackboardPart() { return ourPart; }
58 void broadcast(bool audible);
61 class BlackboardPart : public CompoundPart {
62 friend class Blackboard;
64 protected:
65 BlackboardPart(Blackboard *p, unsigned int _id);
67 public:
68 void partRender(class Surface *renderer, int xoffset, int yoffset);
69 unsigned int getWidth() { return 0; }
70 unsigned int getHeight() { return 0; }
72 bool canGainFocus() { return true; }
73 void gainFocus();
74 void loseFocus();
75 void handleKey(char c);
76 void handleSpecialKey(char c);
79 #endif
80 /* vim: set noet: */