~ubuntu-branches/ubuntu/hoary/plib-doc/hoary

« back to all changes in this revision

Viewing changes to src/pw/pw_pui.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Frauenfelder
  • Date: 2004-07-13 20:56:29 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040713205629-gw7kmoiiwaqi6rol
Tags: 1.8.1-4
Changed build depends: added xlibs-dev, removed g++. Additionally, added
-lpthread to LDFLAGS for configure call. Closes: #259131

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifdef WIN32
 
3
#define WIN32_LEAN_AND_MEAN
 
4
#include <windows.h>
 
5
#endif
 
6
 
 
7
#include <stdio.h>
 
8
#include <stdlib.h>
 
9
#include <ctype.h>
 
10
#include <GL/gl.h>
 
11
#include <plib/ul.h>
 
12
#include <plib/pw.h>    // This needs to be before <plib/pu.h>
 
13
#include <plib/pu.h>
 
14
 
 
15
void exFunc ()
 
16
{
 
17
  fprintf ( stderr, "Exiting.\n" ) ;
 
18
  pwCleanup () ;
 
19
  exit ( 0 ) ;
 
20
}
 
21
 
 
22
 
 
23
void rsFunc ( int w, int h )
 
24
{
 
25
  fprintf ( stderr, "Resized to %d x %d\n", w, h ) ;
 
26
}
 
27
 
 
28
 
 
29
void mpFunc ( int x, int y )
 
30
{
 
31
  puMouse ( x, y ) ;
 
32
}
 
33
 
 
34
 
 
35
void msFunc ( int button, int updn, int x, int y )
 
36
{
 
37
  puMouse ( button, updn, x, y ) ;
 
38
}
 
39
 
 
40
 
 
41
void kbFunc ( int key, int updn, int x, int y )
 
42
{
 
43
  puKeyboard ( key, updn, x, y ) ;
 
44
}
 
45
 
 
46
 
 
47
void button_cb ( puObject * )
 
48
{
 
49
  fprintf ( stderr, "Hello World.\n" ) ;
 
50
}
 
51
 
 
52
 
 
53
int main ( int, char ** )
 
54
{
 
55
  pwInit ( 100, 100, 640, 480, false, "PLIB Window Demo", true, 0 ) ;
 
56
  puInit () ;
 
57
 
 
58
  puOneShot *b = new puOneShot ( 50, 50, 200, 80 ) ;
 
59
 
 
60
  b -> setLegend   ( "Say Hello" ) ;
 
61
  b -> setCallback ( button_cb ) ;
 
62
 
 
63
  pwSetCallbacks ( kbFunc, msFunc, mpFunc, rsFunc, exFunc ) ;
 
64
  while ( 1 )
 
65
  {
 
66
    glClearColor ( 0.5, 0.1, 0.1, 1.0 ) ;
 
67
    glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
 
68
    puDisplay () ;
 
69
    pwSwapBuffers () ;
 
70
  }
 
71
 
 
72
  return 0;
 
73
}
 
74
 
 
75