[Plib-cvs] plib/examples/src/pui/fltk_demo Makefile,NONE,1.1 gui.fl,NONE,1.1 main.cxx,NONE,1.1 puf.c
Brought to you by:
sjbaker
From: M?rten Str?m. <str...@us...> - 2004-02-25 11:08:38
|
Update of /cvsroot/plib/plib/examples/src/pui/fltk_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23110 Added Files: Makefile gui.fl main.cxx puf.cxx puf.h Log Message: fltk_demo initial checkin --- NEW FILE: Makefile --- # -*-Makefile-*- $Id: Makefile,v 1.1 2004/02/25 11:01:30 stromberg Exp $ CXXFLAGS = $(shell fltk-config --use-gl --cxxflags) -Wall -O2 -DPU_USE_FLTK LDFLAGS = $(shell fltk-config --use-gl --ldflags) -lplibpu -lplibfnt -lplibul OBJS = main.o gui.o puf.o fltk_demo: $(OBJS) g++ $(OBJS) $(LDFLAGS) -o $@ clean: rm -f gui.{h,cxx} *.o *~ %.o: %.cxx g++ $(CXXFLAGS) -c $< %.h %.cxx: %.fl fluid -c $< main.o gui.o: gui.h puf.h puf.o: puf.h --- NEW FILE: gui.fl --- # data file for the Fltk User Interface Designer (fluid) version 1.0104 header_name {.h} code_name {.cxx} Function {make_window()} {open } { Fl_Window main_window { label {fluid window} open xywh {544 347 265 285} type Double hide } { Fl_Box gl_area {selected xywh {15 50 235 180} labelsize 12 align 1 code0 {\#include "puf.h"} class Puf_Window } Fl_Menu_Bar {} {open xywh {0 0 265 20} labelsize 12 textsize 12 } { submenu {} { label File open xywh {0 0 100 20} labelsize 12 } { menuitem {} { label Quit callback {exit(0);} xywh {0 0 100 20} labelsize 12 code0 {\#include <stdlib.h>} } } submenu {} { label Edit open xywh {0 0 100 20} labelsize 12 } {} submenu {} { label View open xywh {15 15 100 20} labelsize 12 } {} } Fl_Box {} { label {OpenGL Area} xywh {15 30 235 20} labelfont 1 labelsize 12 } Fl_Button toggle_other { label {Show / Hide} xywh {70 250 120 25} labelsize 12 } } } --- NEW FILE: main.cxx --- /* 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 [...104 lines suppressed...] make_window()->show(); window2 = gl_area; init_pui(); toggle_other->callback(toggle_fl); Fl::add_timeout(3.0, refresh); return Fl::run(); } /* Local Variables: mode: C++ c-basic-offset: 4 c-file-offsets: ((substatement-open 0) (case-label 0)) End: */ --- NEW FILE: puf.cxx --- /* 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 [...147 lines suppressed...] glBegin(GL_LINE_LOOP); glVertex2f(x0, y0); glVertex2f(x1, y0); glVertex2f(x1, y1); glVertex2f(x0, y1); glEnd(); #endif puDisplay(); } /* Local Variables: mode: C++ c-basic-offset: 4 c-file-offsets: ((substatement-open 0) (case-label 0)) End: */ --- NEW FILE: puf.h --- /* 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: puf.h,v 1.1 2004/02/25 11:01:31 stromberg Exp $ */ #ifndef puf_h #define puf_h #include <FL/Fl_Gl_Window.H> // Functions for passing FLTK events to PUI int puf_translate_key(int key_code); int puf_handle_event(Fl_Gl_Window *, int event); // An FLTK window class for simple PUI integration class Puf_Window : public Fl_Gl_Window { protected: virtual int handle(int); virtual void draw(); public: Puf_Window(int X, int Y, int W, int H, const char *L = 0) : Fl_Gl_Window(X, Y, W, H, L) {} Puf_Window(int W, int H, const char *L = 0) : Fl_Gl_Window(W, H, L) {} }; #endif /* Local Variables: mode: C++ c-basic-offset: 4 c-file-offsets: ((substatement-open 0) (case-label 0)) End: */ |