From d8a620710661149aecb6c95980f122bcdfdbea97 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 19 Oct 2002 10:03:16 +0000 Subject: initial import --- src/tests/testFont.cc | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/tests/testFont.cc diff --git a/src/tests/testFont.cc b/src/tests/testFont.cc new file mode 100644 index 0000000..d52c2af --- /dev/null +++ b/src/tests/testFont.cc @@ -0,0 +1,95 @@ + +#include "Font.hh" +#include "BaseDisplay.hh" + +#include +#include +#include + +#include +#include +using namespace std; + +class App:public BaseDisplay { +public: + App(const char *displayname):BaseDisplay("app", displayname) { + + // using screen 0 + m_win = XCreateSimpleWindow(getXDisplay(), + DefaultRootWindow(getXDisplay()), + 0, 0, + 640, 480, + 1, + 0, + 0xFFFF); + XSelectInput(getXDisplay(), m_win, KeyPressMask|ExposureMask); + XMapWindow(getXDisplay(), m_win); + } + ~App() { + XDestroyWindow(getXDisplay(), m_win); + } + + void handleEvent(XEvent * const ev) { + switch (ev->type) { + case KeyPress: + KeySym ks; + char keychar[1]; + XLookupString(&ev->xkey, keychar, 1, &ks, 0); + if (ks == XK_Escape) + shutdown(); + else { // toggle antialias + m_font.setAntialias(!m_font.isAntialias()); + cerr<