File: xatom4.h

package info (click to toggle)
atom4 4.1-9
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 836 kB
  • ctags: 1,222
  • sloc: cpp: 4,451; makefile: 46; perl: 6
file content (62 lines) | stat: -rw-r--r-- 1,570 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * X11 client for Atom-4
 * Header file
 *
 * $Id: xatom4.h,v 1.16 2003/04/08 09:57:43 hsteoh Exp hsteoh $
 */

#ifndef XATOM4_H
#define XATOM4_H

#include "event.h"
#include "game.h"
#include "interface.h"
#include "xsprite.h"
#include "xscoreboard.h"
#include "xtriboard.h"
#include "xutil.h"


class XAtom4 : public appwindow {
  xconnection *conn;			// [R] connection to X server
  atom4 *game;				// [R] game engine
  xsprite_engine *eng;			// [O]
  xtriboard *boardpane;			// [O] game board
  xscoreboard *scorepane;		// [O] score panes

  int *exitflag;			// exit indicator checked by event
					// loop

  // Multiplayer support
  class gamestate_notifier : public atom4notifier {
    XAtom4 *app;			// [R]
  public:
    gamestate_notifier(XAtom4 *appwin) : app(appwin) {}
    void notify_move(atom4 *src, int player, elist<boardchange> &chg);
    void notify_clear(atom4 *src);
  } notifier;
public:
  // *exitflag should point to a variable which this class will use to
  // indicate to the event loop that it should exit. Of course, whether this
  // is actually what is monitored by the event loop is main()'s decision.
  XAtom4(xconnection *conn, atom4 *game, int *exitflag);
  ~XAtom4();

  // Maintenance
  void refresh();

  // Event handlers
  void expose(XExposeEvent ev);
  void key_press(XKeyPressedEvent ev);
  void mouse_buttondown(XButtonPressedEvent ev);
};

class x11ui : public interface {
  xconnection conn;
  XAtom4 game_app;
public:
  x11ui(char *xserver, atom4 *game, eventloop *loop, int *exitflag);
  ~x11ui();
};

#endif // XATOM4_H