/usr/share/doc/libplib-doc/examples/pui/simple.cxx is in libplib-doc 1:1.8.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | /*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: simple.cxx 1551 2002-09-01 12:04:53Z ude $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/pu.h>
//#define VOODOO 1
void motionfn ( int x, int y )
{
puMouse ( x, y ) ;
glutPostRedisplay () ;
}
void mousefn ( int button, int updown, int x, int y )
{
puMouse ( button, updown, x, y ) ;
glutPostRedisplay () ;
}
void displayfn ( void )
{
glClearColor ( 0.1f, 0.4f, 0.1f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT ) ;
puDisplay () ;
glutSwapBuffers () ;
/* The next line is not neccessary - you could remove it safely without
affecting the functionality of this simple example program.
It exists because in every application which does some more stuff
than creating user interface widgets, you normally do want to
redraw your scenery as often as possible for smooth animation. */
glutPostRedisplay () ;
}
void button_cb ( puObject * )
{
fprintf ( stderr, "Hello World.\n" ) ;
}
int main ( int argc, char **argv )
{
#ifdef VOODOO
glutInitWindowPosition ( 0, 0 ) ;
#endif
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
/* Note that in order for PUI and this example program to work, you
definitely don't need a depth buffer.
However, most applications using PUI do some more things than rendering
PUI widgets. In every "real" program, you usually do need a depth
buffer - we are requesting one in the next line so that PLIB programmers
can write their applications upon this example code without running
into problems. */
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( "PUI Application" ) ;
glutDisplayFunc ( displayfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
#ifdef VOODOO
glutPassiveMotionFunc ( motionfn ) ;
#endif
puInit () ;
#ifdef VOODOO
puShowCursor () ;
#endif
puOneShot *b = new puOneShot ( 50, 50, 200, 80 ) ;
b -> setLegend ( "Say Hello" ) ;
b -> setCallback ( button_cb ) ;
printf ( "%d\n", PLIB_VERSION ) ;
glutMainLoop () ;
return 0 ;
}
|