diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-02-25 15:49:18 -0500 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2011-07-11 20:05:26 +0100 |
commit | 6bbdabbab542d7b3b18f73f1c96fc4eb55789f95 (patch) | |
tree | 982278aa8610b53275c7f6d08bd0cbdc91e9ef23 | |
parent | 105435fb95b39eb2226deed1e963bc8456179a0f (diff) |
Remove directfb support
-rw-r--r-- | src/glut/directfb/Makefile | 87 | ||||
-rw-r--r-- | src/glut/directfb/NOTES | 9 | ||||
-rw-r--r-- | src/glut/directfb/callback.c | 300 | ||||
-rw-r--r-- | src/glut/directfb/color.c | 39 | ||||
-rw-r--r-- | src/glut/directfb/cursor.c | 175 | ||||
-rw-r--r-- | src/glut/directfb/cursors.h | 306 | ||||
-rw-r--r-- | src/glut/directfb/events.c | 492 | ||||
-rw-r--r-- | src/glut/directfb/ext.c | 202 | ||||
-rw-r--r-- | src/glut/directfb/font.c | 213 | ||||
-rw-r--r-- | src/glut/directfb/font.h | 58 | ||||
-rw-r--r-- | src/glut/directfb/game.c | 153 | ||||
-rw-r--r-- | src/glut/directfb/globals.c | 63 | ||||
-rw-r--r-- | src/glut/directfb/init.c | 128 | ||||
-rw-r--r-- | src/glut/directfb/internal.h | 188 | ||||
-rw-r--r-- | src/glut/directfb/menu.c | 87 | ||||
-rw-r--r-- | src/glut/directfb/models.c | 599 | ||||
-rw-r--r-- | src/glut/directfb/overlay.c | 62 | ||||
-rw-r--r-- | src/glut/directfb/state.c | 219 | ||||
-rw-r--r-- | src/glut/directfb/teapot.c | 212 | ||||
-rw-r--r-- | src/glut/directfb/window.c | 597 |
20 files changed, 0 insertions, 4189 deletions
diff --git a/src/glut/directfb/Makefile b/src/glut/directfb/Makefile deleted file mode 100644 index bf93d63..0000000 --- a/src/glut/directfb/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# subset glut - -TOP = ../../.. -include $(TOP)/configs/current - -MARK = $(TOP)/src/glut/glx - -GLUT_MAJOR = 3 -GLUT_MINOR = 7 -GLUT_TINY = 1 - -INCLUDES = -I$(TOP)/include -I$(MARK) $(shell pkg-config --cflags directfb) - -GLUT_LIB_DEPS += $(shell pkg-config --libs directfb) - -CORE_SOURCES = \ - callback.c \ - color.c \ - cursor.c \ - ext.c \ - events.c \ - font.c \ - game.c \ - globals.c \ - init.c \ - menu.c \ - models.c \ - overlay.c \ - state.c \ - teapot.c \ - window.c \ - - -MARK_SOURCES = \ - $(MARK)/glut_8x13.c \ - $(MARK)/glut_9x15.c \ - $(MARK)/glut_hel10.c \ - $(MARK)/glut_hel12.c \ - $(MARK)/glut_hel18.c \ - $(MARK)/glut_tr10.c \ - $(MARK)/glut_tr24.c - -SOURCES = $(CORE_SOURCES) $(MARK_SOURCES) - -OBJECTS = $(SOURCES:.c=.o) - - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - - -# Make the library -$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) - $(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \ - $(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \ - $(MKLIB_OPTIONS) $(OBJECTS) - - -# Run 'make -f Makefile.solo dep' to update the dependencies if you change -# what's included by any source file. -depend: $(SOURCES) - rm -f depend - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -# Remove .o and backup files -clean: depend - -rm -f depend depend.bak - -rm -f *.o *~ *.o *~ *.so libglut.so.3.7 - -include depend diff --git a/src/glut/directfb/NOTES b/src/glut/directfb/NOTES deleted file mode 100644 index af917c6..0000000 --- a/src/glut/directfb/NOTES +++ /dev/null @@ -1,9 +0,0 @@ -DirectFB GLUT Implementation NOTES ----------------------------------- - -* To have high performance rendering, it's really important to - use glutEnterGameMode() instead of glutCreateWindow()/glutFullScreen(). - You can also force a windowed application to game mode by setting - the environment variable "__GLUT_GAME_MODE". - - diff --git a/src/glut/directfb/callback.c b/src/glut/directfb/callback.c deleted file mode 100644 index 7c9768a..0000000 --- a/src/glut/directfb/callback.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/time.h> - -#include "internal.h" - - -typedef void (GLUTCALLBACK *__GlutTimerCallback) ( int value ); - -typedef struct __GlutTimer_s { - struct timeval interval; - struct timeval expire; - - __GlutTimerCallback func; - int value; - - struct __GlutTimer_s *next; -} __GlutTimer; - -/*****************************************************************************/ - -static __GlutTimer *g_timers = NULL; - -/*****************************************************************************/ - - -void GLUTAPIENTRY -glutDisplayFunc( void (GLUTCALLBACK *func) (void) ) -{ - display_func = func; -} - - -void GLUTAPIENTRY -glutReshapeFunc( void (GLUTCALLBACK *func) (int width, int height) ) -{ - reshape_func = func; -} - - -void GLUTAPIENTRY -glutKeyboardFunc( void (GLUTCALLBACK *func) (unsigned char key, int x, int y) ) -{ - keyboard_func = func; -} - - -void GLUTAPIENTRY -glutMouseFunc( void (GLUTCALLBACK *func) (int button, int state, int x, int y) ) -{ - mouse_func = func; -} - - -void GLUTAPIENTRY -glutMotionFunc( void (GLUTCALLBACK *func) (int x, int y) ) -{ - motion_func = func; -} - - -void GLUTAPIENTRY -glutPassiveMotionFunc( void (GLUTCALLBACK *func) (int x, int y) ) -{ - passive_motion_func = func; -} - - -void GLUTAPIENTRY -glutEntryFunc( void (GLUTCALLBACK *func) (int state) ) -{ - entry_func = func; -} - - -void GLUTAPIENTRY -glutVisibilityFunc( void (GLUTCALLBACK *func) (int state) ) -{ - visibility_func = func; -} - - -void GLUTAPIENTRY -glutMenuStateFunc( void (GLUTCALLBACK *func) (int state) ) -{ - menu_state_func = func; -} - - -void GLUTAPIENTRY -glutSpecialFunc( void (GLUTCALLBACK *func) (int key, int x, int y) ) -{ - special_func = func; -} - - -void GLUTAPIENTRY -glutSpaceballMotionFunc( void (GLUTCALLBACK *func) (int x, int y, int z) ) -{ -} - - -void GLUTAPIENTRY -glutSpaceballRotateFunc( void (GLUTCALLBACK *func) (int x, int y, int z) ) -{ -} - - -void GLUTAPIENTRY -glutSpaceballButtonFunc( void (GLUTCALLBACK *func) (int button, int state) ) -{ -} - - -void GLUTAPIENTRY -glutButtonBoxFunc( void (GLUTCALLBACK *func) (int button, int state) ) -{ -} - - -void GLUTAPIENTRY -glutDialsFunc( void (GLUTCALLBACK *func) (int dial, int value) ) -{ -} - - -void GLUTAPIENTRY -glutTabletMotionFunc( void (GLUTCALLBACK *func) (int x, int y) ) -{ -} - - -void GLUTAPIENTRY -glutTabletButtonFunc( void (GLUTCALLBACK *func) (int button, int state, int x, int y) ) -{ -} - - -void GLUTAPIENTRY -glutMenuStatusFunc( void (GLUTCALLBACK *func) (int status, int x, int y) ) -{ -} - - -void GLUTAPIENTRY -glutOverlayDisplayFunc( void (GLUTCALLBACK *func) (void) ) -{ -} - - -void GLUTAPIENTRY -glutWindowStatusFunc( void (GLUTCALLBACK *func) (int state) ) -{ -} - - -void GLUTAPIENTRY -glutKeyboardUpFunc( void (GLUTCALLBACK *func) (unsigned char key, int x, int y) ) -{ - keyboard_up_func = func; -} - - -void GLUTAPIENTRY -glutSpecialUpFunc( void (GLUTCALLBACK *func) (int key, int x, int y) ) -{ - special_up_func = func; -} - - -void GLUTAPIENTRY -glutJoystickFunc( void (GLUTCALLBACK *func)(unsigned int buttons, int x, int y, int z), int pollInterval ) -{ - joystick_func = func; - /* FIXME: take care of pollInterval */ -} - - -void GLUTAPIENTRY -glutIdleFunc( void (GLUTCALLBACK *func) (void) ) -{ - idle_func = func; -} - - -void GLUTAPIENTRY -glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int value ) -{ - __GlutTimer *timer; - - if (!func) - return; - - timer = calloc( 1, sizeof(__GlutTimer) ); - if (!timer) - __glutFatalError( "out of memory" ); - - timer->interval.tv_sec = msec / 1000; - timer->interval.tv_usec = (msec % 1000) * 1000; - - gettimeofday( &timer->expire, NULL ); - timer->expire.tv_usec += timer->interval.tv_usec; - timer->expire.tv_sec += timer->interval.tv_sec + timer->expire.tv_usec/1000000; - timer->expire.tv_usec %= 1000000; - - timer->func = func; - timer->value = value; - - timer->next = g_timers; - g_timers = timer; -} - - -void -__glutHandleTimers( void ) -{ - __GlutTimer *cur; - struct timeval now; - - for (cur = g_timers; cur; cur = cur->next ) { - gettimeofday( &now, NULL ); - - if (cur->expire.tv_sec > now.tv_sec || - (cur->expire.tv_sec == now.tv_sec && - cur->expire.tv_usec >= now.tv_usec)) - { - g_idle = GL_FALSE; - - cur->func( cur->value ); - - cur->expire.tv_usec += cur->interval.tv_usec; - cur->expire.tv_sec += cur->interval.tv_sec + cur->expire.tv_usec/1000000; - cur->expire.tv_usec %= 1000000; - } - } -} - - -GLboolean -__glutGetTimeout( int *ret_msec ) -{ - __GlutTimer *cur; - struct timeval *time = NULL; - struct timeval now; - - for (cur = g_timers; cur; cur = cur->next) { - if (time == NULL || - time->tv_sec > cur->expire.tv_sec || - (time->tv_sec == cur->expire.tv_sec && - time->tv_usec > cur->expire.tv_usec)) { - time = &cur->expire; - } - } - - if (time == NULL) - return GL_FALSE; - - gettimeofday( &now, NULL ); - - *ret_msec = (time->tv_sec - now.tv_sec) * 1000 + - (time->tv_usec - now.tv_usec + 999) / 1000; - - return GL_TRUE; -} - - -void -__glutFreeTimers( void ) -{ - __GlutTimer *cur = g_timers; - - while (cur) { - __GlutTimer *next = cur->next; - free( cur ); - cur = next; - } - - g_timers = NULL; -} - diff --git a/src/glut/directfb/color.c b/src/glut/directfb/color.c deleted file mode 100644 index 26c514c..0000000 --- a/src/glut/directfb/color.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "internal.h" - - -void GLUTAPIENTRY -glutSetColor( int index, GLfloat red, GLfloat green, GLfloat blue ) -{ -} - - -GLfloat GLUTAPIENTRY -glutGetColor( int index, int component ) -{ - return 0.0; -} - - -void GLUTAPIENTRY -glutCopyColormap( int win ) -{ -} diff --git a/src/glut/directfb/cursor.c b/src/glut/directfb/cursor.c deleted file mode 100644 index aca3fcc..0000000 --- a/src/glut/directfb/cursor.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "internal.h" - -#include "cursors.h" - - -void GLUTAPIENTRY -glutSetCursor( int type ) -{ - const unsigned char *cursor; - DFBSurfaceDescription dsc; - IDirectFBSurface *shape; - - if (!g_current || !g_current->window) - return; - - if (g_current->cursor == type) - return; - - switch (type) { - case GLUT_CURSOR_RIGHT_ARROW: - cursor = &cur_right_arrow[0]; - break; - case GLUT_CURSOR_LEFT_ARROW: - cursor = &cur_left_arrow[0]; - break; - case GLUT_CURSOR_INFO: - cursor = &cur_info[0]; - break; - case GLUT_CURSOR_DESTROY: - cursor = &cur_destroy[0]; - break; - case GLUT_CURSOR_HELP: - cursor = &cur_help[0]; - break; - case GLUT_CURSOR_CYCLE: - cursor = &cur_cycle[0]; - break; - case GLUT_CURSOR_SPRAY: - cursor = &cur_spray[0]; - break; - case GLUT_CURSOR_WAIT: - cursor = &cur_wait[0]; - break; - case GLUT_CURSOR_TEXT: - cursor = &cur_text[0]; - break; - case GLUT_CURSOR_CROSSHAIR: - cursor = &cur_crosshair[0]; - break; - case GLUT_CURSOR_UP_DOWN: - cursor = &cur_up_down[0]; - break; - case GLUT_CURSOR_LEFT_RIGHT: - cursor = &cur_left_right[0]; - break; - case GLUT_CURSOR_TOP_SIDE: - cursor = &cur_top_side[0]; - break; - case GLUT_CURSOR_BOTTOM_SIDE: - cursor = &cur_bottom_side[0]; - break; - case GLUT_CURSOR_LEFT_SIDE: - cursor = &cur_left_side[0]; - break; - case GLUT_CURSOR_RIGHT_SIDE: - cursor = &cur_right_side[0]; - break; - case GLUT_CURSOR_TOP_LEFT_CORNER: - cursor = &cur_top_left[0]; - break; - case GLUT_CURSOR_TOP_RIGHT_CORNER: - cursor = &cur_top_right[0]; - break; - case GLUT_CURSOR_BOTTOM_RIGHT_CORNER: - cursor = &cur_bottom_right[0]; - break; - case GLUT_CURSOR_BOTTOM_LEFT_CORNER: - cursor = &cur_bottom_left[0]; - break; - case GLUT_CURSOR_NONE: - cursor = NULL; - break; - default: - cursor = &cur_right_arrow[0]; - break; - } - - dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; - dsc.width = - dsc.height = cursor ? cursor[0] : 8; - dsc.pixelformat = DSPF_ARGB; - - if (dfb->CreateSurface( dfb, &dsc, &shape )) - return; - - if (cursor) { - __u8 *src = (__u8*) &cursor[3]; - __u8 *msk = src + cursor[0]*cursor[0]/8; - void *dst; - int pitch; - int x, y; - - if (shape->Lock( shape, DSLF_WRITE, &dst, &pitch )) { - shape->Release( shape ); - return; - } - - for (y = 0; y < cursor[0]; y++) { - for (x = 0; x < cursor[0]; x++) { - ((__u32*)dst)[x] = - ((src[x>>3] & (0x80 >> (x&7))) ? 0 : 0x00ffffff) | - ((msk[x>>3] & (0x80 >> (x&7))) ? 0xff000000 : 0); - } - - dst += pitch; - src += cursor[0]/8; - msk += cursor[0]/8; - } - - shape->Unlock( shape ); - } - else { - /* Invisible cursor */ - shape->Clear( shape, 0, 0, 0, 0 ); - } - - g_current->window->SetCursorShape( g_current->window, shape, - cursor ? cursor[1] : 0, - cursor ? cursor[2] : 0 ); - g_current->cursor = type; - - shape->Release( shape ); -} - - -void GLUTAPIENTRY -glutWarpPointer( int x, int y ) -{ - if (g_current) { - if (!g_game) { - int wx, wy; - g_current->window->GetPosition( g_current->window, &wx, &wy ); - primary->WarpCursor( primary, wx+x, wy+y ); - } - else { - g_current->cx = x; - g_current->cy = y; - } - } -} - - diff --git a/src/glut/directfb/cursors.h b/src/glut/directfb/cursors.h deleted file mode 100644 index 30ab7c3..0000000 --- a/src/glut/directfb/cursors.h +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef __GLUT_CURSORS_H__ -#define __GLUT_CURSORS_H__ - - -static const unsigned char cur_right_arrow[] = { - 16, /* size */ - 1, 2, /* hotspot */ - /* data */ - 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x3e, 0x00, - 0x3f, 0x80, 0x1f, 0xe0, 0x1f, 0xf8, 0x0f, 0x80, - 0x0f, 0xc0, 0x06, 0xe0, 0x06, 0x70, 0x02, 0x38, - 0x02, 0x1c, 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, - /* mask */ - 0xe0, 0x00, 0xf8, 0x00, 0xfe, 0x00, 0x7f, 0x80, - 0x7f, 0xe0, 0x3f, 0xf8, 0x3f, 0xfc, 0x1f, 0xfc, - 0x1f, 0xe0, 0x0f, 0xf0, 0x0f, 0xf8, 0x07, 0x7c, - 0x07, 0x3e, 0x02, 0x1f, 0x00, 0x0e, 0x00, 0x04, -}; - -static const unsigned char cur_left_arrow[] = { - 16, /* size */ - 1, 15, /* hotspot */ - /* data */ - 0x00, 0x00, 0x80, 0x06, 0x00, 0x1e, 0x00, 0x7c, - 0x01, 0xfc, 0x07, 0xf8, 0x1f, 0xf8, 0x01, 0xf0, - 0x01, 0xf0, 0x02, 0x60, 0x04, 0x60, 0x08, 0x40, - 0x10, 0x40, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, - /* mask */ - 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x01, 0xfe, - 0x07, 0xfe, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xf8, - 0x03, 0xf8, 0x07, 0xf0, 0x0e, 0xf0, 0x1c, 0xe0, - 0x38, 0xe0, 0x70, 0xe0, 0xe0, 0x00, 0xc0, 0x00, -}; - -static const unsigned char cur_info[] = { - 16, /* size */ - 0, 2, /* hotspot */ - /* data */ - 0x30, 0x00, 0x3c, 0x00, 0x0f, 0x00, 0x07, 0x80, - 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x07, 0xf4, - 0x0f, 0xfe, 0x0f, 0xfa, 0x07, 0xe0, 0x03, 0xe0, - 0x00, 0x52, 0x00, 0x46, 0x00, 0x2c, 0x00, 0x18, - /* mask */ - 0xb8, 0x00, 0x3e, 0x00, 0x1f, 0x80, 0x0f, 0xc0, - 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xfc, 0x1f, 0xfe, - 0x1f, 0xfe, 0x1f, 0xfe, 0x0f, 0xfe, 0x07, 0xfe, - 0x03, 0xfe, 0x00, 0xfe, 0x00, 0x7e, 0x00, 0x3c, -}; - -static const unsigned char cur_destroy[] = { - 16, /* size */ - 12, 8, /* hotspot */ - /* data */ - 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0c, 0xcc, - 0x0c, 0xcc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0xe0, - 0x21, 0xe1, 0x61, 0xe1, 0x10, 0xc2, 0x0e, 0x1c, - 0x01, 0xe0, 0x47, 0xf8, 0x7c, 0x0f, 0x20, 0x01, - /* mask */ - 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe, - 0x1f, 0xfe, 0x0f, 0xfc, 0x07, 0xf8, 0x83, 0xf1, - 0xe3, 0xf1, 0xf3, 0xf3, 0x39, 0xef, 0x1e, 0x1e, - 0x01, 0xe0, 0xc7, 0xfe, 0xff, 0xff, 0x7c, 0x0f, -}; - -static const unsigned char cur_help[] = { - 16, /* size */ - 7, 8, /* hotspot */ - /* data */ - 0x83, 0xe0, 0x07, 0xf0, 0x0e, 0x38, 0x0c, 0x18, - 0x0c, 0x38, 0x0e, 0x30, 0x07, 0x00, 0x03, 0xc0, - 0x01, 0xc0, 0x01, 0x40, 0x01, 0x40, 0x07, 0x70, - 0x03, 0x60, 0x01, 0xc0, 0x00, 0x80, 0x00, 0x00, - /* mask */ - 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8, 0x1f, 0xfc, - 0x1e, 0x3c, 0x1e, 0x7c, 0x1f, 0x78, 0x0f, 0xf0, - 0x07, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0, - 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0, -}; - -static const unsigned char cur_cycle[] = { - 16, /* size */ - 7, 9, /* hotspot */ - /* data */ - 0x00, 0x00, 0x07, 0xe2, 0x0f, 0xf6, 0x18, 0x3e, - 0x10, 0x12, 0x00, 0x32, 0x00, 0x7e, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x00, 0x4c, 0x00, 0x48, 0x08, - 0x7c, 0x18, 0x6f, 0xf0, 0x47, 0xe0, 0x00, 0x00, - /* mask */ - 0x07, 0xe3, 0x0f, 0xf7, 0x1f, 0xff, 0x3f, 0xff, - 0x38, 0x3f, 0x30, 0xff, 0x00, 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, 0x00, 0xfe, 0x0c, 0xfc, 0x1c, - 0xff, 0xfc, 0xff, 0xf8, 0xef, 0xf0, 0xc7, 0xe0, -}; - -static const unsigned char cur_spray[] = { - 16, /* size */ - 2, 4, /* hotspot */ - /* data */ - 0x98, 0x00, 0x02, 0x00, 0x18, 0xb0, 0x02, 0x78, - 0x18, 0x58, 0x00, 0xfc, 0x00, 0x84, 0x00, 0x9c, - 0x00, 0x94, 0x00, 0x9c, 0x00, 0x94, 0x00, 0x9c, - 0x00, 0x9c, 0x00, 0x84, 0x00, 0x84, 0x00, 0xfc, - /* mask */ - 0x30, 0x00, 0x34, 0x60, 0x35, 0xf0, 0x35, 0xf0, - 0x35, 0xf8, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, - 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, - 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, -}; - -static const unsigned char cur_wait[] = { - 16, /* size */ - 9, 1, /* hotspot */ - /* data */ - 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x0f, 0xfc, - 0x18, 0x86, 0x30, 0x83, 0xe0, 0x81, 0xe1, 0xc1, - 0xe1, 0xc1, 0xe0, 0x21, 0x30, 0x13, 0x18, 0x06, - 0x0f, 0xfc, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xf8, - /* mask */ - 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x1f, 0xfe, - 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, - 0x1f, 0xfe, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, -}; - -static const unsigned char cur_text[] = { - 16, /* size */ - 8, 8, /* hotspot */ - /* data */ - 0x00, 0x00, 0x0f, 0x70, 0x09, 0xc0, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x01, 0xc0, 0x07, 0x70, 0x00, 0x00, - /* mask */ - 0x0f, 0x78, 0x0f, 0xf8, 0x0f, 0xf8, 0x03, 0xe0, - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, - 0x03, 0xe0, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0x78, -}; - -static const unsigned char cur_crosshair[] = { - 16, /* size */ - 7, 9, /* hotspot */ - /* data */ - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0xff, 0x7f, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, - /* mask */ - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, - 0x01, 0xc0, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, -}; - -static const unsigned char cur_up_down[] = { - 16, /* size */ - 7, 8, /* hotspot */ - /* data */ - 0x00, 0x80, 0x09, 0xc0, 0x03, 0xe0, 0x07, 0xf0, - 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, - 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x07, 0xf0, - 0x03, 0xe0, 0x01, 0xc0, 0x00, 0x80, 0x00, 0x00, - /* mask */ - 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8, - 0x0f, 0xf8, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0, - 0x03, 0xe0, 0x03, 0xe0, 0x0f, 0xf8, 0x0f, 0xf8, - 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0, 0x00, 0x00, -}; - -static const unsigned char cur_left_right[] = { - 16, /* size */ - 7, 8, /* hotspot */ - /* data */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x08, 0x18, 0x0c, 0x3f, 0xfe, 0x78, 0x0f, - 0x3f, 0xfe, 0x18, 0x0c, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* mask */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x18, - 0x1c, 0x1c, 0x3f, 0xfe, 0x7f, 0xff, 0x7f, 0xff, - 0x7f, 0xff, 0x3f, 0xfe, 0x1c, 0x1c, 0x0c, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const unsigned char cur_top_side[] = { - 16, /* size */ - 1, 8, /* hotspot */ - /* data */ - 0x00, 0x00, 0xff, 0xfe, 0x3f, 0xfe, 0x00, 0x00, - 0x00, 0x80, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90, - 0x08, 0x88, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, - /* mask */ - 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, - 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8, - 0x1d, 0xdc, 0x19, 0xcc, 0x01, 0xc0, 0x01, 0xc0, - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, -}; - -static const unsigned char cur_bottom_side[] = { - 16, /* size */ - 14, 8, /* hotspot */ - /* data */ - 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x08, 0x88, - 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x00, 0x80, - 0x00, 0x00, 0x3f, 0xfe, 0x3f, 0xfe, 0x00, 0x00, - /* mask */ - 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, - 0x01, 0xc0, 0x01, 0xc0, 0x19, 0xcc, 0x1d, 0xdc, - 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0, - 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, -}; - -static const unsigned char cur_left_side[] = { - 16, /* size */ - 7, 15, /* hotspot */ - /* data */ - 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x01, 0x06, - 0x00, 0x86, 0x00, 0x46, 0x00, 0x26, 0x7f, 0xf6, - 0x00, 0x26, 0x00, 0x46, 0x00, 0x86, 0x01, 0x06, - 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - /* mask */ - 0x00, 0x0f, 0x00, 0x0f, 0x03, 0x0f, 0x03, 0x8f, - 0x01, 0xcf, 0x00, 0xef, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xef, 0x01, 0xcf, 0x03, 0x8f, - 0x03, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x00, -}; - -static const unsigned char cur_right_side[] = { - 16, /* size */ - 7, 2, /* hotspot */ - /* data */ - 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x80, - 0x61, 0x00, 0x62, 0x00, 0x64, 0x00, 0x6f, 0xfe, - 0x64, 0x00, 0x62, 0x00, 0x61, 0x00, 0x60, 0x80, - 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - /* mask */ - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0xc0, 0xf1, 0xc0, - 0xf3, 0x80, 0xf7, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xf7, 0x00, 0xf3, 0x80, 0xf1, 0xc0, - 0xf0, 0xc0, 0xf0, 0x00, 0xf0, 0x00, 0x00, 0x00, -}; - -static const unsigned char cur_top_left[] = { - 16, /* size */ - 1, 15, /* hotspot */ - /* data */ - 0x00, 0x00, 0xff, 0xfe, 0x7f, 0xfe, 0x00, 0x06, - 0x00, 0x06, 0x00, 0x06, 0x1f, 0xc6, 0x00, 0xc6, - 0x01, 0x46, 0x02, 0x46, 0x04, 0x46, 0x08, 0x46, - 0x10, 0x46, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, - /* mask */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x0f, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef, - 0x03, 0xef, 0x07, 0xef, 0x0e, 0xef, 0x1c, 0xef, - 0x38, 0xef, 0x30, 0xef, 0x00, 0x0f, 0x00, 0x0f, -}; - -static const unsigned char cur_top_right[] = { - 16, /* size */ - 1, 2, /* hotspot */ - /* data */ - 0x00, 0x00, 0xff, 0xfe, 0x7f, 0xfe, 0x60, 0x00, - 0x60, 0x00, 0x60, 0x00, 0x63, 0xf8, 0x63, 0x00, - 0x62, 0x80, 0x62, 0x40, 0x62, 0x20, 0x62, 0x10, - 0x62, 0x08, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, - /* mask */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf0, 0x00, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, - 0xf7, 0xc0, 0xf7, 0xe0, 0xf7, 0x70, 0xf7, 0x38, - 0xf7, 0x1c, 0xf7, 0x0c, 0xf0, 0x00, 0xf0, 0x00, -}; - -static const unsigned char cur_bottom_right[] = { - 16, /* size */ - 14, 2, /* hotspot */ - /* data */ - 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x62, 0x08, - 0x62, 0x10, 0x62, 0x20, 0x62, 0x40, 0x62, 0x80, - 0x63, 0x00, 0x63, 0xf8, 0x60, 0x00, 0x60, 0x00, - 0x60, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, - /* mask */ - 0xf0, 0x00, 0xf0, 0x00, 0xf7, 0x0c, 0xf7, 0x1c, - 0xf7, 0x38, 0xf7, 0x70, 0xf7, 0xe0, 0xf7, 0xc0, - 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf0, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -}; - -static const unsigned char cur_bottom_left[] = { - 16, /* size */ - 14, 15, /* hotspot */ - /* data */ - 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x10, 0x46, - 0x08, 0x46, 0x04, 0x46, 0x02, 0x46, 0x01, 0x46, - 0x00, 0xc6, 0x1f, 0xc6, 0x00, 0x06, 0x00, 0x06, - 0x00, 0x06, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, - /* mask */ - 0x00, 0x0f, 0x00, 0x0f, 0x30, 0xef, 0x38, 0xef, - 0x1c, 0xef, 0x0e, 0xef, 0x07, 0xef, 0x03, 0xef, - 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x00, 0x0f, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -}; - - -#endif /* __GLUT_CURSORS_H__ */ diff --git a/src/glut/directfb/events.c b/src/glut/directfb/events.c deleted file mode 100644 index 6ebdd16..0000000 --- a/src/glut/directfb/events.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "internal.h" - - -/*****************************************************************************/ - -static int g_ignore_key_repeat = 0; - -/*****************************************************************************/ - - -int GLUTAPIENTRY -glutDeviceGet( GLenum type ) -{ - switch (type) { - case GLUT_HAS_KEYBOARD: - return (keyboard != NULL); - case GLUT_HAS_MOUSE: - return (mouse != NULL); - case GLUT_NUM_MOUSE_BUTTONS: - if (mouse) { - DFBInputDeviceDescription dsc; - mouse->GetDescription( mouse, &dsc ); - return dsc.max_button+1; - } - break; - case GLUT_DEVICE_IGNORE_KEY_REPEAT: - return g_ignore_key_repeat; - case GLUT_DEVICE_KEY_REPEAT: - return (g_ignore_key_repeat) ? GLUT_KEY_REPEAT_OFF - : GLUT_KEY_REPEAT_ON; - case GLUT_HAS_JOYSTICK: - case GLUT_OWNS_JOYSTICK: - return (g_game && joystick); /* only available in game mode */ - case GLUT_JOYSTICK_BUTTONS: - if (joystick) { - DFBInputDeviceDescription dsc; - joystick->GetDescription( joystick, &dsc ); - return dsc.max_button+1; - } - break; - case GLUT_JOYSTICK_AXES: - if (joystick) { - DFBInputDeviceDescription dsc; - joystick->GetDescription( joystick, &dsc ); - return dsc.max_axis+1; - } - break; - case GLUT_JOYSTICK_POLL_RATE: - if (joystick) - return 1; /* hack */ - break; - default: - break; - } - - return 0; -} - - -int GLUTAPIENTRY -glutGetModifiers( void ) -{ - if (g_current) - return g_current->modifiers; - return 0; -} - - -void GLUTAPIENTRY -glutIgnoreKeyRepeat( int ignore ) -{ - g_ignore_key_repeat = ignore; -} - - -void GLUTAPIENTRY -glutSetKeyRepeat( int mode ) -{ - g_ignore_key_repeat = (mode == GLUT_KEY_REPEAT_OFF); -} - - -void GLUTAPIENTRY -glutForceJoystickFunc( void ) -{ - if (g_game && joystick && joystick_func) { - joystick_func( g_game->buttons, - g_game->jx, g_game->jy, g_game->jz ); - } -} - - -static int -__glutSpecialKey( DFBInputDeviceKeySymbol key ) -{ - switch (key) { - case DIKS_F1: - return GLUT_KEY_F1; - case DIKS_F2: - return GLUT_KEY_F2; - case DIKS_F3: - return GLUT_KEY_F3; - case DIKS_F4: - return GLUT_KEY_F4; - case DIKS_F5: - return GLUT_KEY_F5; - case DIKS_F6: - return GLUT_KEY_F6; - case DIKS_F7: - return GLUT_KEY_F7; - case DIKS_F8: - return GLUT_KEY_F8; - case DIKS_F9: - return GLUT_KEY_F9; - case DIKS_F10: - return GLUT_KEY_F10; - case DIKS_F11: - return GLUT_KEY_F11; - case DIKS_F12: - return GLUT_KEY_F12; - case DIKS_CURSOR_LEFT: - return GLUT_KEY_LEFT; - case DIKS_CURSOR_UP: - return GLUT_KEY_UP; - case DIKS_CURSOR_RIGHT: - return GLUT_KEY_RIGHT; - case DIKS_CURSOR_DOWN: - return GLUT_KEY_DOWN; - case DIKS_PAGE_UP: - return GLUT_KEY_PAGE_UP; - case DIKS_PAGE_DOWN: - return GLUT_KEY_PAGE_DOWN; - case DIKS_HOME: - return GLUT_KEY_HOME; - case DIKS_END: - return GLUT_KEY_END; - case DIKS_INSERT: - return GLUT_KEY_INSERT; - default: - break; - } - - return 0; -} - - -static int -__glutButton( DFBInputDeviceButtonIdentifier button ) -{ - switch (button) { - case DIBI_LEFT: - return GLUT_LEFT_BUTTON; - case DIBI_MIDDLE: - return GLUT_MIDDLE_BUTTON; - case DIBI_RIGHT: - return GLUT_RIGHT_BUTTON; - default: - break; - } - - return 0; -} - - -static int -__glutModifiers( DFBInputDeviceModifierMask mask ) -{ - return ((mask & DIMM_SHIFT) ? GLUT_ACTIVE_SHIFT : 0) | - ((mask & DIMM_CONTROL) ? GLUT_ACTIVE_CTRL : 0) | - ((mask & DIMM_ALT) ? GLUT_ACTIVE_ALT : 0); -} - - -static void -__glutWindowEvent( DFBWindowEvent *e, DFBWindowEvent *p ) -{ - __GlutWindow *window; - - window = __glutFindWindow( e->window_id ); - if (!window) /* window was destroyed */ - return; - - switch (e->type) { - case DWET_KEYDOWN: - window->modifiers = __glutModifiers( e->modifiers ); - if (g_ignore_key_repeat && p) { - if (p->type == DWET_KEYDOWN && - p->window_id == e->window_id && - p->key_symbol == e->key_symbol) - break; - } - if (DFB_KEY_IS_ASCII( e->key_symbol )) { - if (keyboard_func) { - __glutSetWindow( window ); - keyboard_func( e->key_symbol, e->x, e->y ); - } - } - else { - int key = __glutSpecialKey( e->key_symbol ); - if (key && special_func) { - __glutSetWindow( window ); - special_func( key, e->x, e->y ); - } - } - break; - case DWET_KEYUP: - window->modifiers = __glutModifiers( e->modifiers ); - if (DFB_KEY_IS_ASCII( e->key_symbol )) { - if (keyboard_up_func) { - __glutSetWindow( window ); - keyboard_up_func( e->key_symbol, e->x, e->y ); - } - } - else { - int key = __glutSpecialKey( e->key_symbol ); - if (key && special_up_func) { - __glutSetWindow( window ); - special_up_func( key, e->x, e->y ); - } - } - break; - case DWET_BUTTONDOWN: - if (mouse_func) { - __glutSetWindow( window ); - mouse_func( __glutButton( e->button ), GLUT_DOWN, e->x, e->y ); - } - break; - case DWET_BUTTONUP: - if (mouse_func) { - __glutSetWindow( window ); - mouse_func( __glutButton( e->button ), GLUT_UP, e->x, e->y ); - } - break; - case DWET_MOTION: - if (e->buttons) { - if (motion_func) { - __glutSetWindow( window ); - motion_func( e->cx, e->cy ); - } - } - else { - if (passive_motion_func) { - __glutSetWindow( window ); - passive_motion_func( e->cx, e->cy ); - } - } - break; - case DWET_ENTER: - if (entry_func) { - __glutSetWindow( window ); - entry_func( GLUT_ENTERED ); - } - break; - case DWET_LEAVE: - if (entry_func) { - __glutSetWindow( window ); - entry_func( GLUT_LEFT ); - } - break; - case DWET_SIZE: - window->reshape = GL_TRUE; - window->redisplay = GL_TRUE; - break; - default: - break; - } -} - - -static void -__glutInputEvent( DFBInputEvent *e, DFBInputEvent *p ) -{ - __glutAssert( g_game != NULL ); - - switch (e->type) { - case DIET_KEYPRESS: - g_game->modifiers = __glutModifiers( e->modifiers ); - if (g_ignore_key_repeat && p) { - if (p->type == DIET_KEYPRESS && - p->key_symbol == e->key_symbol) - break; - } - if (DFB_KEY_IS_ASCII( e->key_symbol )) { - if (keyboard_func) { - __glutSetWindow( g_game ); - keyboard_func( e->key_symbol, g_game->cx, g_game->cy ); - } - } - else { - int key = __glutSpecialKey( e->key_symbol ); - if (key && special_func) { - __glutSetWindow( g_game ); - special_func( key, g_game->cx, g_game->cy ); - } - } - break; - case DIET_KEYRELEASE: - g_game->modifiers = __glutModifiers( e->modifiers ); - if (DFB_KEY_IS_ASCII( e->key_symbol )) { - if (keyboard_up_func) { - __glutSetWindow( g_game ); - keyboard_up_func( e->key_symbol, g_game->cx, g_game->cy ); - } - } - else { - int key = __glutSpecialKey( e->key_symbol ); - if (key && special_up_func) { - __glutSetWindow( g_game ); - special_up_func( key, g_game->cx, g_game->cy ); - } - } - break; - case DIET_BUTTONPRESS: - if (e->device_id == DIDID_JOYSTICK) { - g_game->buttons = e->buttons; - if (joystick_func) { - __glutSetWindow( g_game ); - joystick_func( g_game->buttons, - g_game->jx, g_game->jy, g_game->jz ); - } - } - else { - if (mouse_func) { - __glutSetWindow( g_game ); - mouse_func( __glutButton( e->button ), - GLUT_DOWN, g_game->cx, g_game->cy ); - } - } - break; - case DIET_BUTTONRELEASE: - if (e->device_id == DIDID_JOYSTICK) { - g_game->buttons = e->buttons; - if (joystick_func) { - __glutSetWindow( g_game ); - joystick_func( g_game->buttons, - g_game->jx, g_game->jy, g_game->jz ); - } - } - else { - if (mouse_func) { - __glutSetWindow( g_game ); - mouse_func( __glutButton( e->button ), - GLUT_UP, g_game->cx, g_game->cy ); - } - } - break; - case DIET_AXISMOTION: - if (e->device_id == DIDID_JOYSTICK) { - switch (e->axis) { - case DIAI_X: - if (e->flags & DIEF_AXISABS) - g_game->jx = e->axisabs; - else if (e->flags & DIEF_AXISREL) - g_game->jx += e->axisrel; - break; - case DIAI_Y: - if (e->flags & DIEF_AXISABS) - g_game->jy = e->axisabs; - else if (e->flags & DIEF_AXISREL) - g_game->jy += e->axisrel; - break; - case DIAI_Z: - if (e->flags & DIEF_AXISABS) - g_game->jz = e->axisabs; - else if (e->flags & DIEF_AXISREL) - g_game->jz += e->axisrel; - break; - default: - break; - } - if (joystick_func) { - __glutSetWindow( g_game ); - joystick_func( g_game->buttons, - g_game->jx, g_game->jy, g_game->jz ); - } - } - else { - switch (e->axis) { - case DIAI_X: - if (e->flags & DIEF_AXISABS) - g_game->cx = e->axisabs; - else if (e->flags & DIEF_AXISREL) - g_game->cx += e->axisrel; - break; - case DIAI_Y: - if (e->flags & DIEF_AXISABS) - g_game->cy = e->axisabs; - else if (e->flags & DIEF_AXISREL) - g_game->cy += e->axisrel; - break; - default: - return; - } - if (e->buttons && motion_func) { - __glutSetWindow( g_game ); - motion_func( g_game->cx, g_game->cy ); - } - else if (!e->buttons && passive_motion_func) { - __glutSetWindow( g_game ); - passive_motion_func( g_game->cx, g_game->cy ); - } - } - break; - default: - break; - } -} - - -void GLUTAPIENTRY -glutMainLoop( void ) -{ - __glutAssert( events != NULL ); - - __glutHandleWindows(); - - while (GL_TRUE) { - DFBEvent evt, prev; - - g_idle = GL_TRUE; - - __glutHandleTimers(); - - prev.clazz = DFEC_NONE; - - while (events->GetEvent( events, &evt ) == DFB_OK) { - g_idle = GL_FALSE; - - switch (evt.clazz) { - case DFEC_WINDOW: - if (prev.clazz == DFEC_WINDOW) - __glutWindowEvent( &evt.window, &prev.window ); - else - __glutWindowEvent( &evt.window, NULL ); - break; - case DFEC_INPUT: - if (prev.clazz == DFEC_INPUT) - __glutInputEvent( &evt.input, &prev.input ); - else - __glutInputEvent( &evt.input, NULL ); - break; - default: - __glutWarning( "unexpected event class %d!\n", evt.clazz ); - break; - } - - prev = evt; - - __glutHandleTimers(); - } - - __glutHandleWindows(); - - if (g_idle) { - if (idle_func) { - idle_func(); - } - else { - int msec; - __glutSetWindow( NULL ); - if (__glutGetTimeout( &msec )) - events->WaitForEventWithTimeout( events, msec/1000, msec%1000 ); - else - events->WaitForEvent( events ); - } - } - } -} - diff --git a/src/glut/directfb/ext.c b/src/glut/directfb/ext.c deleted file mode 100644 index e37ecf5..0000000 --- a/src/glut/directfb/ext.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "internal.h" - - -static const struct { - const char *name; - const GLUTproc address; -} glut_functions[] = { - { "glutInit", (const GLUTproc) glutInit }, - { "glutInitDisplayMode", (const GLUTproc) glutInitDisplayMode }, - { "glutInitDisplayString", (const GLUTproc) glutInitDisplayString }, - { "glutInitWindowPosition", (const GLUTproc) glutInitWindowPosition }, - { "glutInitWindowSize", (const GLUTproc) glutInitWindowSize }, - { "glutMainLoop", (const GLUTproc) glutMainLoop }, - { "glutCreateWindow", (const GLUTproc) glutCreateWindow }, - { "glutCreateSubWindow", (const GLUTproc) glutCreateSubWindow }, - { "glutDestroyWindow", (const GLUTproc) glutDestroyWindow }, - { "glutPostRedisplay", (const GLUTproc) glutPostRedisplay }, - { "glutPostWindowRedisplay", (const GLUTproc) glutPostWindowRedisplay }, - { "glutSwapBuffers", (const GLUTproc) glutSwapBuffers }, - { "glutGetWindow", (const GLUTproc) glutGetWindow }, - { "glutSetWindow", (const GLUTproc) glutSetWindow }, - { "glutSetWindowTitle", (const GLUTproc) glutSetWindowTitle }, - { "glutSetIconTitle", (const GLUTproc) glutSetIconTitle }, - { "glutPositionWindow", (const GLUTproc) glutPositionWindow }, - { "glutReshapeWindow", (const GLUTproc) glutReshapeWindow }, - { "glutPopWindow", (const GLUTproc) glutPopWindow }, - { "glutPushWindow", (const GLUTproc) glutPushWindow }, - { "glutIconifyWindow", (const GLUTproc) glutIconifyWindow }, - { "glutShowWindow", (const GLUTproc) glutShowWindow }, - { "glutHideWindow", (const GLUTproc) glutHideWindow }, - { "glutFullScreen", (const GLUTproc) glutFullScreen }, - { "glutSetCursor", (const GLUTproc) glutSetCursor }, - { "glutWarpPointer", (const GLUTproc) glutWarpPointer }, - { "glutEstablishOverlay", (const GLUTproc) glutEstablishOverlay }, - { "glutRemoveOverlay", (const GLUTproc) glutRemoveOverlay }, - { "glutUseLayer", (const GLUTproc) glutUseLayer }, - { "glutPostOverlayRedisplay", (const GLUTproc) glutPostOverlayRedisplay }, - { "glutPostWindowOverlayRedisplay", (const GLUTproc) glutPostWindowOverlayRedisplay }, - { "glutShowOverlay", (const GLUTproc) glutShowOverlay }, - { "glutHideOverlay", (const GLUTproc) glutHideOverlay }, - { "glutCreateMenu", (const GLUTproc) glutCreateMenu }, - { "glutDestroyMenu", (const GLUTproc) glutDestroyMenu }, - { "glutGetMenu", (const GLUTproc) glutGetMenu }, - { "glutSetMenu", (const GLUTproc) glutSetMenu }, - { "glutAddMenuEntry", (const GLUTproc) glutAddMenuEntry }, - { "glutAddSubMenu", (const GLUTproc) glutAddSubMenu }, - { "glutChangeToMenuEntry", (const GLUTproc) glutChangeToMenuEntry }, - { "glutChangeToSubMenu", (const GLUTproc) glutChangeToSubMenu }, - { "glutRemoveMenuItem", (const GLUTproc) glutRemoveMenuItem }, - { "glutAttachMenu", (const GLUTproc) glutAttachMenu }, - { "glutDetachMenu", (const GLUTproc) glutDetachMenu }, - { "glutDisplayFunc", (const GLUTproc) glutDisplayFunc }, - { "glutReshapeFunc", (const GLUTproc) glutReshapeFunc }, - { "glutKeyboardFunc", (const GLUTproc) glutKeyboardFunc }, - { "glutMouseFunc", (const GLUTproc) glutMouseFunc }, - { "glutMotionFunc", (const GLUTproc) glutMotionFunc }, - { "glutPassiveMotionFunc", (const GLUTproc) glutPassiveMotionFunc }, - { "glutEntryFunc", (const GLUTproc) glutEntryFunc }, - { "glutVisibilityFunc", (const GLUTproc) glutVisibilityFunc }, - { "glutIdleFunc", (const GLUTproc) glutIdleFunc }, - { "glutTimerFunc", (const GLUTproc) glutTimerFunc }, - { "glutMenuStateFunc", (const GLUTproc) glutMenuStateFunc }, - { "glutSpecialFunc", (const GLUTproc) glutSpecialFunc }, - { "glutSpaceballMotionFunc", (const GLUTproc) glutSpaceballMotionFunc }, - { "glutSpaceballRotateFunc", (const GLUTproc) glutSpaceballRotateFunc }, - { "glutSpaceballButtonFunc", (const GLUTproc) glutSpaceballButtonFunc }, - { "glutButtonBoxFunc", (const GLUTproc) glutButtonBoxFunc }, - { "glutDialsFunc", (const GLUTproc) glutDialsFunc }, - { "glutTabletMotionFunc", (const GLUTproc) glutTabletMotionFunc }, - { "glutTabletButtonFunc", (const GLUTproc) glutTabletButtonFunc }, - { "glutMenuStatusFunc", (const GLUTproc) glutMenuStatusFunc }, - { "glutOverlayDisplayFunc", (const GLUTproc) glutOverlayDisplayFunc }, - { "glutWindowStatusFunc", (const GLUTproc) glutWindowStatusFunc }, - { "glutKeyboardUpFunc", (const GLUTproc) glutKeyboardUpFunc }, - { "glutSpecialUpFunc", (const GLUTproc) glutSpecialUpFunc }, - { "glutJoystickFunc", (const GLUTproc) glutJoystickFunc }, - { "glutSetColor", (const GLUTproc) glutSetColor }, - { "glutGetColor", (const GLUTproc) glutGetColor }, - { "glutCopyColormap", (const GLUTproc) glutCopyColormap }, - { "glutGet", (const GLUTproc) glutGet }, - { "glutDeviceGet", (const GLUTproc) glutDeviceGet }, - { "glutExtensionSupported", (const GLUTproc) glutExtensionSupported }, - { "glutGetModifiers", (const GLUTproc) glutGetModifiers }, - { "glutLayerGet", (const GLUTproc) glutLayerGet }, - { "glutGetProcAddress", (const GLUTproc) glutGetProcAddress }, - { "glutBitmapCharacter", (const GLUTproc) glutBitmapCharacter }, - { "glutBitmapWidth", (const GLUTproc) glutBitmapWidth }, - { "glutStrokeCharacter", (const GLUTproc) glutStrokeCharacter }, - { "glutStrokeWidth", (const GLUTproc) glutStrokeWidth }, - { "glutBitmapLength", (const GLUTproc) glutBitmapLength }, - { "glutStrokeLength", (const GLUTproc) glutStrokeLength }, - { "glutWireSphere", (const GLUTproc) glutWireSphere }, - { "glutSolidSphere", (const GLUTproc) glutSolidSphere }, - { "glutWireCone", (const GLUTproc) glutWireCone }, - { "glutSolidCone", (const GLUTproc) glutSolidCone }, - { "glutWireCube", (const GLUTproc) glutWireCube }, - { "glutSolidCube", (const GLUTproc) glutSolidCube }, - { "glutWireTorus", (const GLUTproc) glutWireTorus }, - { "glutSolidTorus", (const GLUTproc) glutSolidTorus }, - { "glutWireDodecahedron", (const GLUTproc) glutWireDodecahedron }, - { "glutSolidDodecahedron", (const GLUTproc) glutSolidDodecahedron }, - { "glutWireTeapot", (const GLUTproc) glutWireTeapot }, - { "glutSolidTeapot", (const GLUTproc) glutSolidTeapot }, - { "glutWireOctahedron", (const GLUTproc) glutWireOctahedron }, - { "glutSolidOctahedron", (const GLUTproc) glutSolidOctahedron }, - { "glutWireTetrahedron", (const GLUTproc) glutWireTetrahedron }, - { "glutSolidTetrahedron", (const GLUTproc) glutSolidTetrahedron }, - { "glutWireIcosahedron", (const GLUTproc) glutWireIcosahedron }, - { "glutSolidIcosahedron", (const GLUTproc) glutSolidIcosahedron }, -// { "glutVideoResizeGet", (const GLUTproc) glutVideoResizeGet }, -// { "glutSetupVideoResizing", (const GLUTproc) glutSetupVideoResizing }, -// { "glutStopVideoResizing", (const GLUTproc) glutStopVideoResizing }, -// { "glutVideoResize", (const GLUTproc) glutVideoResize }, -// { "glutVideoPan", (const GLUTproc) glutVideoPan }, - { "glutReportErrors", (const GLUTproc) glutReportErrors }, - { "glutIgnoreKeyRepeat", (const GLUTproc) glutIgnoreKeyRepeat }, - { "glutSetKeyRepeat", (const GLUTproc) glutSetKeyRepeat }, - { "glutForceJoystickFunc", (const GLUTproc) glutForceJoystickFunc }, - { "glutGameModeString", (const GLUTproc) glutGameModeString }, - { "glutEnterGameMode", (const GLUTproc) glutEnterGameMode }, - { "glutLeaveGameMode", (const GLUTproc) glutLeaveGameMode }, - { "glutGameModeGet", (const GLUTproc) glutGameModeGet }, -}; - - -GLUTproc GLUTAPIENTRY -glutGetProcAddress( const char *name ) -{ - int i; - - for (i = 0; i < sizeof(glut_functions)/sizeof(glut_functions[0]); i++) { - if (!strcmp( name, glut_functions[i].name )) - return glut_functions[i].address; - } - -#if DIRECTFBGL_INTERFACE_VERSION >= 1 - if (g_current) { - void *address = NULL; - g_current->gl->GetProcAddress( g_current->gl, name, &address ); - return address; - } -#endif - return NULL; -} - - -int GLUTAPIENTRY -glutExtensionSupported( const char *name ) -{ - GLubyte *extensions; - int length; - - if (!name || !*name) - return 0; - - length = strlen( name ); - extensions = (GLubyte*) glGetString( GL_EXTENSIONS ); - - while (extensions && *extensions) { - GLubyte *next; - - next = strchr( extensions, ' ' ); - if (next) { - if (length == (int)(next - extensions)) { - if (!strncmp( extensions, name, length )) - return 1; - } - extensions = next+1; - } - else { - if (!strcmp( extensions, name )) - return 1; - break; - } - } - - return 0; -} - diff --git a/src/glut/directfb/font.c b/src/glut/directfb/font.c deleted file mode 100644 index 0139cdd..0000000 --- a/src/glut/directfb/font.c +++ /dev/null @@ -1,213 +0,0 @@ -/* Copyright (c) Mark J. Kilgard, 1994, 1998. - - This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "internal.h" -#include "font.h" - - -#if defined(_WIN32) || defined (GLUT_IMPORT_LIB) - -static inline void* -__glutFont( void *font ) -{ - switch((long)font) { - case (long)GLUT_STROKE_ROMAN: - return &glutStrokeRoman; - case (long)GLUT_STROKE_MONO_ROMAN: - return &glutStrokeMonoRoman; - case (long)GLUT_BITMAP_9_BY_15: - return &glutBitmap9By15; - case (long)GLUT_BITMAP_8_BY_13: - return &glutBitmap8By13; - case (long)GLUT_BITMAP_TIMES_ROMAN_10: - return &glutBitmapTimesRoman10; - case (long)GLUT_BITMAP_TIMES_ROMAN_24: - return &glutBitmapTimesRoman24; - case (long)GLUT_BITMAP_HELVETICA_10: - return &glutBitmapHelvetica10; - case (long)GLUT_BITMAP_HELVETICA_12: - return &glutBitmapHelvetica12; - case (long)GLUT_BITMAP_HELVETICA_18: - return &glutBitmapHelvetica18; - } - - return NULL; -} - -#else - -static inline void* -__glutFont( void *font ) -{ - return font; -} - -#endif - - -void GLUTAPIENTRY -glutBitmapCharacter( GLUTbitmapFont font, int c ) -{ - const BitmapCharRec *ch; - BitmapFontPtr fontinfo; - GLint swapbytes, lsbfirst, rowlength; - GLint skiprows, skippixels, alignment; - - fontinfo = (BitmapFontPtr) __glutFont( font ); - - if (!fontinfo || c < fontinfo->first || - c >= fontinfo->first + fontinfo->num_chars) - return; - - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) { - /* Save current modes. */ - glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); - glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); - glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); - glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); - glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); - /* Little endian machines (DEC Alpha for example) could - benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE - instead of GL_FALSE, but this would require changing the - generated bitmaps too. */ - glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, - ch->advance, 0, ch->bitmap); - /* Restore saved modes. */ - glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); - glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); - glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); - glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); - } -} - - -int GLUTAPIENTRY -glutBitmapWidth( GLUTbitmapFont font, int c ) -{ - BitmapFontPtr fontinfo; - const BitmapCharRec *ch; - - fontinfo = (BitmapFontPtr) __glutFont( font ); - - if (!fontinfo || c < fontinfo->first || - c >= fontinfo->first + fontinfo->num_chars) - return 0; - - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) - return ch->advance; - - return 0; -} - - -int GLUTAPIENTRY -glutBitmapLength( GLUTbitmapFont font, const unsigned char *string ) -{ - int c, length; - BitmapFontPtr fontinfo; - const BitmapCharRec *ch; - - fontinfo = (BitmapFontPtr) __glutFont( font ); - if (!fontinfo) - return 0; - - for (length = 0; *string != '\0'; string++) { - c = *string; - if (c >= fontinfo->first && - c < fontinfo->first + fontinfo->num_chars) { - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) - length += ch->advance; - } - } - - return length; -} - - -void GLUTAPIENTRY -glutStrokeCharacter( GLUTstrokeFont font, int c ) -{ - const StrokeCharRec *ch; - const StrokeRec *stroke; - const CoordRec *coord; - StrokeFontPtr fontinfo; - int i, j; - - fontinfo = (StrokeFontPtr) __glutFont( font ); - - if (!fontinfo || c < 0 || c >= fontinfo->num_chars) - return; - - ch = &(fontinfo->ch[c]); - if (ch) { - for (i = ch->num_strokes, stroke = ch->stroke; - i > 0; i--, stroke++) { - glBegin(GL_LINE_STRIP); - for (j = stroke->num_coords, coord = stroke->coord; - j > 0; j--, coord++) { - glVertex2f(coord->x, coord->y); - } - glEnd(); - } - glTranslatef(ch->right, 0.0, 0.0); - } -} - - -int GLUTAPIENTRY -glutStrokeWidth( GLUTstrokeFont font, int c ) -{ - StrokeFontPtr fontinfo; - const StrokeCharRec *ch; - - fontinfo = (StrokeFontPtr) __glutFont( font ); - - if (!fontinfo || c < 0 || c >= fontinfo->num_chars) - return 0; - - ch = &(fontinfo->ch[c]); - if (ch) - return ch->right; - - return 0; -} - - -int GLUTAPIENTRY -glutStrokeLength( GLUTstrokeFont font, const unsigned char *string ) -{ - int c, length; - StrokeFontPtr fontinfo; - const StrokeCharRec *ch; - - fontinfo = (StrokeFontPtr) __glutFont( font ); - if (!fontinfo) - return 0; - - for (length = 0; *string != '\0'; string++) { - c = *string; - if (c >= 0 && c < fontinfo->num_chars) { - ch = &(fontinfo->ch[c]); - if (ch) - length += ch->right; - } - } - - return length; -} - diff --git a/src/glut/directfb/font.h b/src/glut/directfb/font.h deleted file mode 100644 index b1e7683..0000000 --- a/src/glut/directfb/font.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#ifndef __GLUT_FONT_H__ -#define __GLUT_FONT_H__ - - -typedef struct { - const GLsizei width; - const GLsizei height; - const GLfloat xorig; - const GLfloat yorig; - const GLfloat advance; - const GLubyte *bitmap; -} BitmapCharRec, *BitmapCharPtr; - -typedef struct { - const char *name; - const int num_chars; - const int first; - const BitmapCharRec * const *ch; -} BitmapFontRec, *BitmapFontPtr; - -typedef void *GLUTbitmapFont; - - -typedef struct { - float x; - float y; -} CoordRec, *CoordPtr; - -typedef struct { - int num_coords; - const CoordRec *coord; -} StrokeRec, *StrokePtr; - -typedef struct { - int num_strokes; - const StrokeRec *stroke; - float center; - float right; -} StrokeCharRec, *StrokeCharPtr; - -typedef struct { - const char *name; - int num_chars; - const StrokeCharRec *ch; - float top; - float bottom; -} StrokeFontRec, *StrokeFontPtr; - -typedef void *GLUTstrokeFont; - - -#endif /* __GLUT_FONT_H__ */ diff --git a/src/glut/directfb/game.c b/src/glut/directfb/game.c deleted file mode 100644 index 4c027a6..0000000 --- a/src/glut/directfb/game.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "internal.h" - - -/*****************************************************************************/ - -static int g_display_changed = 0; - -/*****************************************************************************/ - - -void GLUTAPIENTRY -glutGameModeString( const char *string ) -{ - int x, y, bpp; - char *tmp; - - if (!string) - return; - - tmp = strchr( string, 'x' ); - if (tmp) { - x = strtol( string, NULL, 10 ); - y = strtol( tmp+1, NULL, 10 ); - - if (x > 0 && y > 0) { - g_width = x; - g_height = y; - } - } - - tmp = strchr( string, ':' ); - if (tmp) { - bpp = strtol( tmp+1, NULL, 10 ); - - if (bpp > 0) - g_bpp = bpp; - } -} - - -int GLUTAPIENTRY -glutEnterGameMode( void ) -{ - DFBDisplayLayerConfig prev, cur; - - glutInit( NULL, NULL ); - - primary->GetConfiguration( primary, &prev ); - primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE ); - - if (g_game) - __glutDestroyWindow( g_game ); - - g_game = __glutCreateWindow( GL_TRUE ); - if (!g_game) - return 0; - - __glutSetWindow( g_game ); - g_game->cursor = GLUT_CURSOR_NONE; - - primary->GetConfiguration( primary, &cur ); - g_display_changed = (cur.width != prev.width || - cur.height != prev.height || - cur.pixelformat != prev.pixelformat); - - return g_game->id; -} - - -void GLUTAPIENTRY -glutLeaveGameMode( void ) -{ - if (g_game) - __glutDestroyWindow( g_game ); - - primary->SetCooperativeLevel( primary, DLSCL_ADMINISTRATIVE ); -} - - -int GLUTAPIENTRY -glutGameModeGet( GLenum type ) -{ - switch (type) { - case GLUT_GAME_MODE_ACTIVE: - return (g_game != NULL); - case GLUT_GAME_MODE_POSSIBLE: - if (primary) { - DFBDisplayLayerConfig c; - c.flags = DLCONF_WIDTH | DLCONF_HEIGHT; - c.width = g_width; - c.height = g_height; - /* XXX: bpp */ - if (primary->TestConfiguration( primary, &c, 0 ) == DFB_OK) - return 1; - } - break; - case GLUT_GAME_MODE_WIDTH: - if (g_game) { - int w; - g_game->surface->GetSize( g_game->surface, &w, 0 ); - return w; - } - break; - case GLUT_GAME_MODE_HEIGHT: - if (g_game) { - int h; - g_game->surface->GetSize( g_game->surface, 0, &h ); - return h; - } - break; - case GLUT_GAME_MODE_PIXEL_DEPTH: - if (g_game) { - DFBSurfacePixelFormat f; - g_game->surface->GetPixelFormat( g_game->surface, &f ); - return DFB_COLOR_BITS_PER_PIXEL( f ); - } - break; - case GLUT_GAME_MODE_REFRESH_RATE: - return 60; /* assume 60hz */ - case GLUT_GAME_MODE_DISPLAY_CHANGED: - return g_display_changed; - default: - break; - } - - return 0; -} - - - diff --git a/src/glut/directfb/globals.c b/src/glut/directfb/globals.c deleted file mode 100644 index 2a52911..0000000 --- a/src/glut/directfb/globals.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "internal.h" - -IDirectFB *dfb = NULL; -IDirectFBDisplayLayer *primary = NULL; -IDirectFBEventBuffer *events = NULL; -IDirectFBInputDevice *keyboard = NULL; -IDirectFBInputDevice *mouse = NULL; -IDirectFBInputDevice *joystick = NULL; - -GLenum g_display_mode = 0; -GLuint g_width = DEFAULT_WIDTH; -GLuint g_height = DEFAULT_HEIGHT; -GLint g_xpos = 0; -GLint g_ypos = 0; -GLint g_bpp = 0; -GLboolean g_idle = GL_TRUE; -__GlutWindow *g_current = NULL; -__GlutWindow *g_game = NULL; - - -void (GLUTCALLBACK *display_func) (void) = 0; -void (GLUTCALLBACK *reshape_func) (int width, int height) = 0; -void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = 0; -void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = 0; -void (GLUTCALLBACK *motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *passive_motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *entry_func) (int state) = 0; -void (GLUTCALLBACK *visibility_func) (int state) = 0; -void (GLUTCALLBACK *idle_func) (void) = 0; -void (GLUTCALLBACK *menu_state_func) (int state) = 0; -void (GLUTCALLBACK *special_func) (int key, int x, int y) = 0; -void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = 0; -void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = 0; -void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = 0; -void (GLUTCALLBACK *button_box_func) (int button, int state) = 0; -void (GLUTCALLBACK *dials_func) (int dial, int value) = 0; -void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = 0; -void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = 0; -void (GLUTCALLBACK *overlay_display_func) (void) = 0; -void (GLUTCALLBACK *window_status_func) (int state) = 0; -void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y) = 0; -void (GLUTCALLBACK *special_up_func) (int key, int x, int y) = 0; -void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z) = 0; diff --git a/src/glut/directfb/init.c b/src/glut/directfb/init.c deleted file mode 100644 index ba1a49a..0000000 --- a/src/glut/directfb/init.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "internal.h" - - -static void -__glutExit( void ) -{ - __glutFreeTimers(); - __glutDestroyWindows(); - - if (events) { - events->Release( events ); - events = NULL; - } - - if (joystick) { - joystick->Release( joystick ); - joystick = NULL; - } - - if (mouse) { - mouse->Release( mouse ); - mouse = NULL; - } - - if (keyboard) { - keyboard->Release( keyboard ); - keyboard = NULL; - } - - if (primary) { - primary->Release( primary ); - primary = NULL; - } - - if (dfb) { - dfb->Release( dfb ); - dfb = NULL; - } -} - - -void GLUTAPIENTRY -glutInit( int *argcp, char **argv ) -{ - DFBResult ret; - - if (dfb) - return; - - glutGet( GLUT_ELAPSED_TIME ); - - ret = DirectFBInit( argcp, argv ? &argv : NULL ); - if (ret) - DirectFBErrorFatal( "DirectFBInit()", ret ); - - ret = DirectFBCreate( &dfb ); - if (ret) - DirectFBErrorFatal( "DirectFBCreate()", ret ); - - ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &primary ); - if (ret) - DirectFBErrorFatal( "IDirectFB::GetDisplayLayer()", ret ); - - ret = dfb->CreateEventBuffer( dfb, &events ); - if (ret) - DirectFBErrorFatal( "IDirectFB::CreateEventBuffer()", ret ); - - dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard ); - dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse ); - dfb->GetInputDevice( dfb, DIDID_JOYSTICK, &joystick ); - - primary->SetCooperativeLevel( primary, DLSCL_ADMINISTRATIVE ); - - atexit( __glutExit ); -} - - -void GLUTAPIENTRY -glutInitDisplayMode( unsigned int mode ) -{ - g_display_mode = mode; -} - - -void GLUTAPIENTRY -glutInitWindowPosition( int x, int y ) -{ - g_xpos = x; - g_ypos = y; -} - - -void GLUTAPIENTRY -glutInitWindowSize( int width, int height ) -{ - g_width = width; - g_height = height; -} - - -void GLUTAPIENTRY -glutInitDisplayString( const char *string ) -{ -} - diff --git a/src/glut/directfb/internal.h b/src/glut/directfb/internal.h deleted file mode 100644 index 55c4b5c..0000000 --- a/src/glut/directfb/internal.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef __GLUT_INTERNAL_H__ -#define __GLUT_INTERNAL_H__ - -#include <stdio.h> -#include <stdlib.h> - -#include <directfb.h> -#include <directfb_version.h> - -#include <directfbgl.h> - -#include "GL/glut.h" - - -#define VERSION_CODE( M, m, r ) (((M) << 16) | ((m) << 8) | ((r))) - -#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \ - DIRECTFB_MINOR_VERSION, \ - DIRECTFB_MICRO_VERSION ) - - -#define DEFAULT_WIDTH 640 -#define DEFAULT_HEIGHT 480 - -/* - * Window request flags - */ -#define WINDOW_REQUEST_POSITION 0x00000001 -#define WINDOW_REQUEST_RESIZE 0x00000002 -#define WINDOW_REQUEST_RESTACK 0x00000004 -#define WINDOW_REQUEST_SHOW 0x00000008 -#define WINDOW_REQUEST_HIDE 0x00000010 -#define WINDOW_REQUEST_DESTROY 0x00000020 - -/* - * GLUT Window implementation - */ -typedef struct __GlutWindow_s { - int id; - DFBWindowID wid; - - IDirectFBWindow *window; /* NULL = fullscreen (game mode) */ - IDirectFBSurface *surface; - IDirectFBGL *gl; - - /* display mode */ - GLenum mode; - - /* cursor position in fullscreen mode */ - int cx; - int cy; - /* joystick position */ - int jx; - int jy; - int jz; - /* pressed modifiers */ - int modifiers; - /* pressed buttons */ - int buttons; - /* current cursor shape */ - int cursor; - - struct { - int flags; - int x; - int y; - int w; - int h; - int z; - } req; - - GLboolean visible; - GLboolean redisplay; - GLboolean reshape; - GLboolean visibility; - - struct __GlutWindow_s *next; - struct __GlutWindow_s *prev; -} __GlutWindow; - - -/* Global Vars */ -extern IDirectFB *dfb; -extern IDirectFBDisplayLayer *primary; -extern IDirectFBEventBuffer *events; -extern IDirectFBInputDevice *keyboard; -extern IDirectFBInputDevice *mouse; -extern IDirectFBInputDevice *joystick; - -extern GLenum g_display_mode; -extern GLuint g_width; -extern GLuint g_height; -extern GLint g_xpos; -extern GLint g_ypos; -extern GLint g_bpp; -extern GLboolean g_idle; -extern __GlutWindow *g_current; -extern __GlutWindow *g_game; - - -/* Global Funcs */ -/* window.c */ -extern __GlutWindow* __glutCreateWindow( GLboolean fullscreen ); -extern __GlutWindow* __glutFindWindow( DFBWindowID id ); -extern void __glutSetWindow( __GlutWindow *window ); -extern void __glutHandleWindows( void ); -extern void __glutDestroyWindow( __GlutWindow *window ); -extern void __glutDestroyWindows( void ); -/* callback.c */ -extern void __glutHandleTimers( void ); -extern GLboolean __glutGetTimeout( int *ret_msec ); -extern void __glutFreeTimers( void ); - - -/* Global Callbacks */ -extern void (GLUTCALLBACK *display_func) (void); -extern void (GLUTCALLBACK *reshape_func) (int width, int height); -extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y); -extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y); -extern void (GLUTCALLBACK *motion_func) (int x, int y); -extern void (GLUTCALLBACK *passive_motion_func) (int x, int y); -extern void (GLUTCALLBACK *entry_func) (int state); -extern void (GLUTCALLBACK *visibility_func) (int state); -extern void (GLUTCALLBACK *idle_func) (void); -extern void (GLUTCALLBACK *menu_state_func) (int state); -extern void (GLUTCALLBACK *special_func) (int key, int x, int y); -extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z); -extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z); -extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state); -extern void (GLUTCALLBACK *button_box_func) (int button, int state); -extern void (GLUTCALLBACK *dials_func) (int dial, int value); -extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y); -extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y); -extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y); -extern void (GLUTCALLBACK *overlay_display_func) (void); -extern void (GLUTCALLBACK *window_status_func) (int state); -extern void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y); -extern void (GLUTCALLBACK *special_up_func) (int key, int x, int y); -extern void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z); - - -#ifdef DEBUG -# define __glutAssert( exp ) {\ - if (!(exp)) {\ - fprintf( stderr, "(!!) *** Assertion [%s] failed in %s() ***\n",\ - #exp, __FUNCTION__ ); - fflush( stderr );\ - exit( -1 );\ - }\ - } -#else -# define __glutAssert( exp ) -#endif - -#define __glutWarning( format, ... ) {\ - fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\ - fflush( stderr );\ -} - -#define __glutFatalError( format, ... ) {\ - fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\ - fprintf( stderr, "\t-> from %s() at line %d\n", __FUNCTION__, __LINE__ );\ - fflush( stderr );\ - exit( -1 );\ -} - - -#endif /* __GLUT_INTERNAL_H__ */ - diff --git a/src/glut/directfb/menu.c b/src/glut/directfb/menu.c deleted file mode 100644 index 400e966..0000000 --- a/src/glut/directfb/menu.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "internal.h" - - -int GLUTAPIENTRY -glutCreateMenu( void (GLUTCALLBACK *func) (int) ) -{ - return 0; -} - -void GLUTAPIENTRY -glutDestroyMenu( int menu ) -{ -} - - -int GLUTAPIENTRY -glutGetMenu( void ) -{ - return 0; -} - - -void GLUTAPIENTRY -glutSetMenu( int menu ) -{ -} - - -void GLUTAPIENTRY -glutAddMenuEntry( const char *label, int value ) -{ -} - - -void GLUTAPIENTRY -glutAddSubMenu( const char *label, int submenu ) -{ -} - - -void GLUTAPIENTRY -glutChangeToMenuEntry( int item, const char *label, int value ) -{ -} - - -void GLUTAPIENTRY -glutChangeToSubMenu( int item, const char *label, int submenu ) -{ -} - - -void GLUTAPIENTRY -glutRemoveMenuItem( int item ) -{ -} - - -void GLUTAPIENTRY -glutAttachMenu( int button ) -{ -} - - -void GLUTAPIENTRY -glutDetachMenu( int button ) -{ -} diff --git a/src/glut/directfb/models.c b/src/glut/directfb/models.c deleted file mode 100644 index d96a8f5..0000000 --- a/src/glut/directfb/models.c +++ /dev/null @@ -1,599 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/** -(c) Copyright 1993, Silicon Graphics, Inc. - -ALL RIGHTS RESERVED - -Permission to use, copy, modify, and distribute this software -for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that -both the copyright notice and this permission notice appear in -supporting documentation, and that the name of Silicon -Graphics, Inc. not be used in advertising or publicity -pertaining to distribution of the software without specific, -written prior permission. - -THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU -"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR -OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO -EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE -ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, -INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, -SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR -NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY -OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR -PERFORMANCE OF THIS SOFTWARE. - -US Government Users Restricted Rights - -Use, duplication, or disclosure by the Government is subject to -restrictions set forth in FAR 52.227.19(c)(2) or subparagraph -(c)(1)(ii) of the Rights in Technical Data and Computer -Software clause at DFARS 252.227-7013 and/or in similar or -successor clauses in the FAR or the DOD or NASA FAR -Supplement. Unpublished-- rights reserved under the copyright -laws of the United States. Contractor/manufacturer is Silicon -Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA -94039-7311. - -OpenGL(TM) is a trademark of Silicon Graphics, Inc. -*/ - -#include <math.h> -#include <GL/gl.h> -#include <GL/glu.h> - -#include "internal.h" - -/* Some <math.h> files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -static GLUquadricObj *quadObj; - -#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); } - -static void -initQuadObj(void) -{ - quadObj = gluNewQuadric(); - if (!quadObj) - __glutFatalError("out of memory"); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void GLUTAPIENTRY -glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void GLUTAPIENTRY -glutWireCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -void GLUTAPIENTRY -glutSolidCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -/* ENDCENTRY */ - -static void -drawBox(GLfloat size, GLenum type) -{ - static GLfloat n[6][3] = - { - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} - }; - static GLint faces[6][4] = - { - {0, 1, 2, 3}, - {3, 2, 6, 7}, - {7, 6, 5, 4}, - {4, 5, 1, 0}, - {5, 6, 2, 1}, - {7, 4, 0, 3} - }; - GLfloat v[8][3]; - GLint i; - - v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; - v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; - v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; - v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; - v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; - v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; - - for (i = 5; i >= 0; i--) { - glBegin(type); -/* glNormal3fv(&n[i][0]); */ - glVertex3fv(&v[faces[i][0]][0]); - glVertex3fv(&v[faces[i][1]][0]); - glVertex3fv(&v[faces[i][2]][0]); - glVertex3fv(&v[faces[i][3]][0]); - glEnd(); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireCube(GLdouble size) -{ - drawBox(size, GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidCube(GLdouble size) -{ - drawBox(size, GL_QUADS); -} - -/* ENDCENTRY */ - -static void -doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) -{ - int i, j; - GLfloat theta, phi, theta1; - GLfloat cosTheta, sinTheta; - GLfloat cosTheta1, sinTheta1; - GLfloat ringDelta, sideDelta; - - ringDelta = 2.0 * M_PI / rings; - sideDelta = 2.0 * M_PI / nsides; - - theta = 0.0; - cosTheta = 1.0; - sinTheta = 0.0; - for (i = rings - 1; i >= 0; i--) { - theta1 = theta + ringDelta; - cosTheta1 = cos(theta1); - sinTheta1 = sin(theta1); - glBegin(GL_QUAD_STRIP); - phi = 0.0; - for (j = nsides; j >= 0; j--) { - GLfloat cosPhi, sinPhi, dist; - - phi += sideDelta; - cosPhi = cos(phi); - sinPhi = sin(phi); - dist = R + r * cosPhi; - -/* glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); */ - glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); -/* glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); */ - glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ -/* glPushAttrib(GL_POLYGON_BIT); */ -/* glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); */ - doughnut(innerRadius, outerRadius, nsides, rings); -/* glPopAttrib(); */ -} - -void GLUTAPIENTRY -glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ - doughnut(innerRadius, outerRadius, nsides, rings); -} - -/* ENDCENTRY */ - -static GLfloat dodec[20][3]; - -static void -initDodecahedron(void) -{ - GLfloat alpha, beta; - - alpha = sqrt(2.0 / (3.0 + sqrt(5.0))); - beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) - - 2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0)))); - /* *INDENT-OFF* */ - dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; - dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; - dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; - dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; - dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; - dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; - dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; - dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; - dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; - dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; - dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; - dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; - dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; - dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; - dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; - dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; - dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; - dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; - dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; - dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; - /* *INDENT-ON* */ - -} - -#define DIFF3(_a,_b,_c) { \ - (_c)[0] = (_a)[0] - (_b)[0]; \ - (_c)[1] = (_a)[1] - (_b)[1]; \ - (_c)[2] = (_a)[2] - (_b)[2]; \ -} - -static void -crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3]) -{ - GLfloat p[3]; /* in case prod == v1 or v2 */ - - p[0] = v1[1] * v2[2] - v2[1] * v1[2]; - p[1] = v1[2] * v2[0] - v2[2] * v1[0]; - p[2] = v1[0] * v2[1] - v2[0] * v1[1]; - prod[0] = p[0]; - prod[1] = p[1]; - prod[2] = p[2]; -} - -static void -normalize(GLfloat v[3]) -{ - GLfloat d; - - d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - if (d == 0.0) { -/* __glutWarning("normalize: zero length vector"); */ - v[0] = d = 1.0; - } - d = 1 / d; - v[0] *= d; - v[1] *= d; - v[2] *= d; -} - -static void -pentagon(int a, int b, int c, int d, int e, GLenum shadeType) -{ - GLfloat n0[3], d1[3], d2[3]; - - DIFF3(dodec[a], dodec[b], d1); - DIFF3(dodec[b], dodec[c], d2); - crossprod(d1, d2, n0); - normalize(n0); - - glBegin(shadeType); -/* glNormal3fv(n0); */ - glVertex3fv(&dodec[a][0]); - glVertex3fv(&dodec[b][0]); - glVertex3fv(&dodec[c][0]); - glVertex3fv(&dodec[d][0]); - glVertex3fv(&dodec[e][0]); - glEnd(); -} - -static void -dodecahedron(GLenum type) -{ - static int inited = 0; - - if (inited == 0) { - inited = 1; - initDodecahedron(); - } - pentagon(0, 1, 9, 16, 5, type); - pentagon(1, 0, 3, 18, 7, type); - pentagon(1, 7, 11, 10, 9, type); - pentagon(11, 7, 18, 19, 6, type); - pentagon(8, 17, 16, 9, 10, type); - pentagon(2, 14, 15, 6, 19, type); - pentagon(2, 13, 12, 4, 14, type); - pentagon(2, 19, 18, 3, 13, type); - pentagon(3, 0, 5, 12, 13, type); - pentagon(6, 15, 8, 10, 11, type); - pentagon(4, 17, 8, 15, 14, type); - pentagon(4, 12, 5, 16, 17, type); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireDodecahedron(void) -{ - dodecahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidDodecahedron(void) -{ - dodecahedron(GL_TRIANGLE_FAN); -} - -/* ENDCENTRY */ - -static void -recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3, - GLenum shadeType) -{ - GLfloat q0[3], q1[3]; - - DIFF3(n1, n2, q0); - DIFF3(n2, n3, q1); - crossprod(q0, q1, q1); - normalize(q1); - - glBegin(shadeType); -/* glNormal3fv(q1); */ - glVertex3fv(n1); - glVertex3fv(n2); - glVertex3fv(n3); - glEnd(); -} - -static void -subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2, - GLenum shadeType) -{ - int depth; - GLfloat w0[3], w1[3], w2[3]; - GLfloat l; - int i, j, k, n; - - depth = 1; - for (i = 0; i < depth; i++) { - for (j = 0; i + j < depth; j++) { - k = depth - i - j; - for (n = 0; n < 3; n++) { - w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; - w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) - / depth; - w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) - / depth; - } - l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); - w0[0] /= l; - w0[1] /= l; - w0[2] /= l; - l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); - w1[0] /= l; - w1[1] /= l; - w1[2] /= l; - l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); - w2[0] /= l; - w2[1] /= l; - w2[2] /= l; - recorditem(w1, w0, w2, shadeType); - } - } -} - -static void -drawtriangle(int i, GLfloat data[][3], int ndx[][3], - GLenum shadeType) -{ - GLfloat *x0, *x1, *x2; - - x0 = data[ndx[i][0]]; - x1 = data[ndx[i][1]]; - x2 = data[ndx[i][2]]; - subdivide(x0, x1, x2, shadeType); -} - -/* octahedron data: The octahedron produced is centered at the - origin and has radius 1.0 */ -static GLfloat odata[6][3] = -{ - {1.0, 0.0, 0.0}, - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} -}; - -static int ondex[8][3] = -{ - {0, 4, 2}, - {1, 2, 4}, - {0, 3, 4}, - {1, 4, 3}, - {0, 2, 5}, - {1, 5, 2}, - {0, 5, 3}, - {1, 3, 5} -}; - -static void -octahedron(GLenum shadeType) -{ - int i; - - for (i = 7; i >= 0; i--) { - drawtriangle(i, odata, ondex, shadeType); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireOctahedron(void) -{ - octahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidOctahedron(void) -{ - octahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* icosahedron data: These numbers are rigged to make an - icosahedron of radius 1.0 */ - -#define X .525731112119133606 -#define Z .850650808352039932 - -static GLfloat idata[12][3] = -{ - {-X, 0, Z}, - {X, 0, Z}, - {-X, 0, -Z}, - {X, 0, -Z}, - {0, Z, X}, - {0, Z, -X}, - {0, -Z, X}, - {0, -Z, -X}, - {Z, X, 0}, - {-Z, X, 0}, - {Z, -X, 0}, - {-Z, -X, 0} -}; - -static int index[20][3] = -{ - {0, 4, 1}, - {0, 9, 4}, - {9, 5, 4}, - {4, 5, 8}, - {4, 8, 1}, - {8, 10, 1}, - {8, 3, 10}, - {5, 3, 8}, - {5, 2, 3}, - {2, 7, 3}, - {7, 10, 3}, - {7, 6, 10}, - {7, 11, 6}, - {11, 0, 6}, - {0, 1, 6}, - {6, 1, 10}, - {9, 0, 11}, - {9, 11, 2}, - {9, 2, 5}, - {7, 2, 11}, -}; - -static void -icosahedron(GLenum shadeType) -{ - int i; - - for (i = 19; i >= 0; i--) { - drawtriangle(i, idata, index, shadeType); - } -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireIcosahedron(void) -{ - icosahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidIcosahedron(void) -{ - icosahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* tetrahedron data: */ - -#define T 1.73205080756887729 - -static GLfloat tdata[4][3] = -{ - {T, T, T}, - {T, -T, -T}, - {-T, T, -T}, - {-T, -T, T} -}; - -static int tndex[4][3] = -{ - {0, 1, 3}, - {2, 1, 0}, - {3, 2, 0}, - {1, 2, 3} -}; - -static void -tetrahedron(GLenum shadeType) -{ - int i; - - for (i = 3; i >= 0; i--) - drawtriangle(i, tdata, tndex, shadeType); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutWireTetrahedron(void) -{ - tetrahedron(GL_LINE_LOOP); -} - -void GLUTAPIENTRY -glutSolidTetrahedron(void) -{ - tetrahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ diff --git a/src/glut/directfb/overlay.c b/src/glut/directfb/overlay.c deleted file mode 100644 index 714be5f..0000000 --- a/src/glut/directfb/overlay.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "internal.h" - - -void GLUTAPIENTRY -glutEstablishOverlay( void ) -{ -} - - -void GLUTAPIENTRY -glutRemoveOverlay( void ) -{ -} - - -void GLUTAPIENTRY -glutUseLayer( GLenum layer ) -{ -} - - -void GLUTAPIENTRY -glutPostOverlayRedisplay( void ) -{ -} - - -void GLUTAPIENTRY -glutPostWindowOverlayRedisplay( int win ) -{ -} - - -void GLUTAPIENTRY -glutShowOverlay( void ) -{ -} - - -void GLUTAPIENTRY -glutHideOverlay( void ) -{ -} diff --git a/src/glut/directfb/state.c b/src/glut/directfb/state.c deleted file mode 100644 index 194d5bb..0000000 --- a/src/glut/directfb/state.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> - -#include "GL/glu.h" - -#include "internal.h" - - -int GLUTAPIENTRY -glutGet( GLenum type ) -{ - switch (type) { - case GLUT_WINDOW_X: - if (g_current && g_current->window) { - int x; - g_current->window->GetPosition( g_current->window, &x, 0 ); - return x; - } - break; - case GLUT_WINDOW_Y: - if (g_current && g_current->window) { - int y; - g_current->window->GetPosition( g_current->window, 0, &y ); - return y; - } - break; - - case GLUT_WINDOW_WIDTH: - if (g_current) { - int w; - g_current->surface->GetSize( g_current->surface, &w, 0 ); - return w; - } - break; - case GLUT_WINDOW_HEIGHT: - if (g_current) { - int h; - g_current->surface->GetSize( g_current->surface, 0, &h ); - return h; - } - break; - - case GLUT_WINDOW_BUFFER_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.buffer_size; - } - break; - case GLUT_WINDOW_STENCIL_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.stencil_size; - } - break; - case GLUT_WINDOW_DEPTH_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.depth_size; - } - break; - case GLUT_WINDOW_RED_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.red_size; - } - break; - case GLUT_WINDOW_GREEN_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.green_size; - } - break; - case GLUT_WINDOW_BLUE_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.blue_size; - } - break; - case GLUT_WINDOW_ALPHA_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.alpha_size; - } - break; - case GLUT_WINDOW_ACCUM_RED_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.accum_red_size; - } - break; - case GLUT_WINDOW_ACCUM_GREEN_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.accum_green_size; - } - break; - case GLUT_WINDOW_ACCUM_BLUE_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.accum_blue_size; - } - break; - case GLUT_WINDOW_ACCUM_ALPHA_SIZE: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.accum_alpha_size; - } - break; - case GLUT_WINDOW_DOUBLEBUFFER: - if (g_current) { - DFBGLAttributes a; - g_current->gl->GetAttributes( g_current->gl, &a ); - return a.double_buffer; - } - break; - - case GLUT_WINDOW_RGBA: - return 1; - - case GLUT_WINDOW_CURSOR: - if (g_current) - return g_current->cursor; - break; - - case GLUT_SCREEN_WIDTH: - if (primary) { - DFBDisplayLayerConfig c; - primary->GetConfiguration( primary, &c ); - return c.width; - } - break; - case GLUT_SCREEN_HEIGHT: - if (primary) { - DFBDisplayLayerConfig c; - primary->GetConfiguration( primary, &c ); - return c.height; - } - break; - - case GLUT_INIT_DISPLAY_MODE: - return g_display_mode; - case GLUT_INIT_WINDOW_X: - return g_xpos; - case GLUT_INIT_WINDOW_Y: - return g_ypos; - case GLUT_INIT_WINDOW_WIDTH: - return g_width; - case GLUT_INIT_WINDOW_HEIGHT: - return g_height; - - case GLUT_ELAPSED_TIME: - { - static long long start = -1; - struct timeval t; - - gettimeofday( &t, NULL ); - if (start == -1) { - start = t.tv_sec * 1000ll + t.tv_usec / 1000ll; - return 0; - } - return (t.tv_sec * 1000ll + t.tv_usec / 1000ll - start); - } - break; - - default: - break; - } - - return 0; -} - - -int GLUTAPIENTRY -glutLayerGet( GLenum type ) -{ - return 0; -} - -void GLUTAPIENTRY -glutReportErrors( void ) -{ - GLenum error; - - while ((error = glGetError()) != GL_NO_ERROR) - __glutWarning( "**OpenGL Error** %s", gluErrorString( error ) ); -} - - diff --git a/src/glut/directfb/teapot.c b/src/glut/directfb/teapot.c deleted file mode 100644 index e7f1ee8..0000000 --- a/src/glut/directfb/teapot.c +++ /dev/null @@ -1,212 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/** -(c) Copyright 1993, Silicon Graphics, Inc. - -ALL RIGHTS RESERVED - -Permission to use, copy, modify, and distribute this software -for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that -both the copyright notice and this permission notice appear in -supporting documentation, and that the name of Silicon -Graphics, Inc. not be used in advertising or publicity -pertaining to distribution of the software without specific, -written prior permission. - -THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU -"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR -OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO -EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE -ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, -INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, -SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR -NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY -OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR -PERFORMANCE OF THIS SOFTWARE. - -US Government Users Restricted Rights - -Use, duplication, or disclosure by the Government is subject to -restrictions set forth in FAR 52.227.19(c)(2) or subparagraph -(c)(1)(ii) of the Rights in Technical Data and Computer -Software clause at DFARS 252.227-7013 and/or in similar or -successor clauses in the FAR or the DOD or NASA FAR -Supplement. Unpublished-- rights reserved under the copyright -laws of the United States. Contractor/manufacturer is Silicon -Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA -94039-7311. - -OpenGL(TM) is a trademark of Silicon Graphics, Inc. -*/ - -#include <GL/gl.h> -#include <GL/glu.h> -#include "GL/glut.h" - -/* Rim, body, lid, and bottom data must be reflected in x and - y; handle and spout data across the y axis only. */ - -static int patchdata[][16] = -{ - /* rim */ - {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15}, - /* body */ - {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27}, - {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40}, - /* lid */ - {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, - 101, 0, 1, 2, 3,}, - {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117}, - /* bottom */ - {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, - 125, 120, 40, 39, 38, 37}, - /* handle */ - {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56}, - {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 28, 65, 66, 67}, - /* spout */ - {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83}, - {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95} -}; -/* *INDENT-OFF* */ - -static float cpdata[][3] = -{ - {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, - -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, - {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, - 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, - 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, - 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, - {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, - 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, - {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, - 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, - 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, - {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, - {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, - -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, - -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, - 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, - 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, - 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, - {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, - -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, - 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, - -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, - 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, - 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, - 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, - {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, - -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, - 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, - {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, - {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, - {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, - 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, - 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, - -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, - 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, - 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, - 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, - {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, - -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, - 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, - {0.84, -1.5, 0.075} -}; - -static float tex[2][2][2] = -{ - { {0, 0}, - {1, 0}}, - { {0, 1}, - {1, 1}} -}; - -/* *INDENT-ON* */ - -static void -teapot(GLint grid, GLdouble scale, GLenum type) -{ - float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; - long i, j, k, l; - - glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); - glEnable(GL_AUTO_NORMAL); - glEnable(GL_NORMALIZE); - glEnable(GL_MAP2_VERTEX_3); - glEnable(GL_MAP2_TEXTURE_COORD_2); - glPushMatrix(); - glRotatef(270.0, 1.0, 0.0, 0.0); - glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); - glTranslatef(0.0, 0.0, -1.5); - for (i = 0; i < 10; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 4; k++) { - for (l = 0; l < 3; l++) { - p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 1) - q[j][k][l] *= -1.0; - if (i < 6) { - r[j][k][l] = - cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 0) - r[j][k][l] *= -1.0; - s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - if (l == 0) - s[j][k][l] *= -1.0; - if (l == 1) - s[j][k][l] *= -1.0; - } - } - } - } - glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, - &tex[0][0][0]); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &p[0][0][0]); - glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &q[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - if (i < 6) { - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &r[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &s[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - } - } - glPopMatrix(); - glPopAttrib(); -} - -/* CENTRY */ -void GLUTAPIENTRY -glutSolidTeapot(GLdouble scale) -{ - teapot(7, scale, GL_FILL); -} - -void GLUTAPIENTRY -glutWireTeapot(GLdouble scale) -{ - teapot(10, scale, GL_LINE); -} - -/* ENDCENTRY */ diff --git a/src/glut/directfb/window.c b/src/glut/directfb/window.c deleted file mode 100644 index 62cf8bb..0000000 --- a/src/glut/directfb/window.c +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "internal.h" - - -/*****************************************************************************/ - -static __GlutWindow *g_stack = NULL; - -/*****************************************************************************/ - - -__GlutWindow* -__glutCreateWindow( GLboolean fullscreen ) -{ - __GlutWindow *new; - DFBResult ret; - static int curid = 1; - - new = calloc( 1, sizeof(__GlutWindow) ); - if (!new) - __glutFatalError( "out of memory" ); - - new->id = curid++; - - if (fullscreen) { - DFBDisplayLayerConfig config; - DFBDisplayLayerConfigFlags fail = 0; - - config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | - DLCONF_BUFFERMODE; - config.width = g_width; - config.height = g_height; - - if (g_display_mode & GLUT_DOUBLE) - config.buffermode = DLBM_BACKVIDEO; - else - config.buffermode = DLBM_FRONTONLY; - - if (g_bpp) { - config.flags |= DLCONF_PIXELFORMAT; - - switch (g_bpp) { - case 8: - config.pixelformat = DSPF_RGB332; - break; - case 12: - config.pixelformat = DSPF_ARGB4444; - break; - case 15: - config.pixelformat = DSPF_ARGB1555; - break; - case 16: - config.pixelformat = DSPF_RGB16; - break; - case 24: - case 32: - config.pixelformat = DSPF_RGB32; - break; - default: - config.flags &= ~DLCONF_PIXELFORMAT; - break; - } - } - - primary->TestConfiguration( primary, &config, &fail ); - config.flags &= ~fail; - primary->SetConfiguration( primary, &config ); - - ret = primary->GetSurface( primary, &new->surface ); - if (ret) { - DirectFBError( "IDirectFBDisplayLayer::GetSurface()", ret ); - free( new ); - return NULL; - } - - ret = new->surface->GetGL( new->surface, &new->gl ); - if (ret) { - DirectFBError( "IDirectFBSurface::GetGL()", ret ); - new->surface->Release( new->surface ); - free( new ); - return NULL; - } - - events->Reset( events ); - if (keyboard) - keyboard->AttachEventBuffer( keyboard, events ); - if (mouse) - mouse->AttachEventBuffer( mouse, events ); - if (joystick) - joystick->AttachEventBuffer( joystick, events ); - - new->visible = GL_TRUE; - } - else { - DFBWindowDescription dsc; - - dsc.flags = DWDESC_CAPS | DWDESC_POSX | DWDESC_POSY | - DWDESC_WIDTH | DWDESC_HEIGHT; - dsc.caps = DWCAPS_NONE; - dsc.posx = g_xpos; - dsc.posy = g_ypos; - dsc.width = g_width; - dsc.height = g_height; - - if (g_display_mode & GLUT_DOUBLE) - dsc.caps |= DWCAPS_DOUBLEBUFFER; - if (g_display_mode & GLUT_ALPHA) - dsc.caps |= DWCAPS_ALPHACHANNEL; - - ret = primary->CreateWindow( primary, &dsc, &new->window ); - if (ret) { - DirectFBError( "IDirectFBDisplayLayer::CreateWindow()", ret ); - free( new ); - return NULL; - } - - new->window->GetID( new->window, &new->wid ); - - ret = new->window->GetSurface( new->window, &new->surface ); - if (ret) { - DirectFBError( "IDirectFBWindow::GetSurface()", ret ); - new->window->Release( new->window ); - free( new ); - return NULL; - } - - ret = new->surface->GetGL( new->surface, &new->gl ); - if (ret) { - DirectFBError( "IDirectFBSurface::GetGl()", ret ); - new->surface->Release( new->surface ); - new->window->Release( new->window ); - free( new ); - return NULL; - } - - new->window->AttachEventBuffer( new->window, events ); - /* enable only handled events */ - new->window->DisableEvents( new->window, DWET_ALL ); - new->window->EnableEvents( new->window, DWET_KEYDOWN | DWET_KEYUP | - DWET_BUTTONDOWN | DWET_BUTTONUP | - DWET_ENTER | DWET_LEAVE | - DWET_MOTION | DWET_SIZE ); - - new->req.flags |= WINDOW_REQUEST_SHOW; - } - - new->mode = g_display_mode; - - new->reshape = GL_TRUE; - new->visibility = GL_TRUE; - new->redisplay = GL_TRUE; - - if (g_stack) { - new->prev = g_stack->prev; - g_stack->prev->next = new; - g_stack->prev = new; - } - else { - new->prev = new; - g_stack = new; - } - - return new; -} - - -__GlutWindow* -__glutFindWindow( DFBWindowID id ) -{ - __GlutWindow *cur; - - for (cur = g_stack; cur; cur = cur->next) { - if (cur->wid == id) - return cur; - } - - __glutFatalError( "Window %d not found", id ); - - return NULL; -} - - -void -__glutSetWindow( __GlutWindow *window ) -{ - if (g_current) { - if (g_current == window) - return; - g_current->gl->Unlock( g_current->gl ); - } - - if (window) - window->gl->Lock( window->gl ); - g_current = window; -} - - -void -__glutHandleWindows( void ) -{ - __GlutWindow *cur = g_stack; - - while (cur) { - __GlutWindow *next = cur->next; - GLboolean displayed = GL_FALSE; - - if (cur->window && cur->req.flags) { - if (cur == g_current) - cur->gl->Unlock( cur->gl ); - - if (cur->req.flags & WINDOW_REQUEST_DESTROY) { - __glutDestroyWindow( cur ); - cur = next; - continue; - } - - if (cur->req.flags & WINDOW_REQUEST_POSITION) { - cur->window->MoveTo( cur->window, - cur->req.x, cur->req.y ); - } - - if (cur->req.flags & WINDOW_REQUEST_RESIZE) { - cur->window->Resize( cur->window, - cur->req.w, cur->req.h ); - cur->reshape = GL_TRUE; - cur->redisplay = GL_TRUE; - } - - if (cur->req.flags & WINDOW_REQUEST_RESTACK) { - while (cur->req.z > 0) { - if (cur->req.z >= +1000) { - cur->window->RaiseToTop( cur->window ); - cur->req.z = 0; - break; - } - - cur->window->Raise( cur->window ); - cur->req.z--; - } - - while (cur->req.z < 0) { - if (cur->req.z <= -1000) { - cur->window->LowerToBottom( cur->window ); - cur->req.z = 0; - break; - } - - cur->window->Lower( cur->window ); - cur->req.z++; - } - } - - if (cur->req.flags & WINDOW_REQUEST_SHOW) { - cur->window->SetOpacity( cur->window, 0xff ); - cur->visible = GL_TRUE; - cur->visibility = GL_TRUE; - } - else if (cur->req.flags & WINDOW_REQUEST_HIDE) { - cur->window->SetOpacity( cur->window, 0x00 ); - cur->visible = GL_FALSE; - cur->visibility = GL_TRUE; - } - - cur->req.flags = 0; - - if (cur == g_current) - cur->gl->Lock( cur->gl ); - } - - if (cur->reshape && reshape_func) { - int w, h; - g_idle = GL_FALSE; - cur->surface->GetSize( cur->surface, &w, &h ); - __glutSetWindow( cur ); - reshape_func( w, h ); - displayed = GL_TRUE; - } - - if (cur->visibility && visibility_func) { - g_idle = GL_FALSE; - __glutSetWindow( cur ); - visibility_func( cur->visible ? GLUT_VISIBLE : GLUT_NOT_VISIBLE ); - displayed = GL_TRUE; - } - - if (cur->redisplay && display_func) { - g_idle = GL_FALSE; - __glutSetWindow( cur ); - display_func(); - displayed = GL_TRUE; - } - - if (displayed && cur->window && cur->visible) { - if (!(cur->mode & GLUT_DOUBLE)) { - cur->gl->Unlock( cur->gl ); - cur->surface->Flip( cur->surface, NULL, 0 ); - cur->gl->Lock( cur->gl ); - } - } - - cur->reshape = GL_FALSE; - cur->visibility = GL_FALSE; - cur->redisplay = GL_FALSE; - - cur = next; - } -} - - -void -__glutDestroyWindow( __GlutWindow *window ) -{ - __GlutWindow *next = window->next; - __GlutWindow *prev = window->prev; - - __glutAssert( window != NULL ); - - if (window == g_current) - g_current = NULL; - if (window == g_game) - g_game = NULL; - - window->gl->Unlock( window->gl ); - window->gl->Release( window->gl ); - window->surface->Release( window->surface ); - - if (window->window) { -#if DIRECTFB_VERSION_CODE >= VERSION_CODE(0,9,26) - window->window->DetachEventBuffer( window->window, events ); -#else - window->window->Destroy( window->window ); -#endif - window->window->Release( window->window ); - } - else { -#if DIRECTFB_VERSION_CODE >= VERSION_CODE(0,9,26) - if (joystick) - joystick->DetachEventBuffer( joystick, events ); - if (mouse) - mouse->DetachEventBuffer( mouse, events ); - if (keyboard) - keyboard->DetachEventBuffer( keyboard, events ); -#endif - events->Reset( events ); - } - - free( window ); - - if (next) - next->prev = prev; - else - g_stack->prev = prev; - - if (window == g_stack) - g_stack = next; - else - prev->next = next; -} - - -void -__glutDestroyWindows( void ) -{ - __GlutWindow *cur = g_stack; - - while (cur) { - __GlutWindow *next = cur->next; - __glutDestroyWindow( cur ); - cur = next; - } -} - - -int GLUTAPIENTRY -glutCreateWindow( const char *title ) -{ - __GlutWindow *window; - - if (getenv( "__GLUT_GAME_MODE" )) - return glutEnterGameMode(); - - glutInit( NULL, NULL ); - - window = __glutCreateWindow( GL_FALSE ); - if (!window) - return 0; - - __glutSetWindow( window ); - glutSetCursor( GLUT_CURSOR_INHERIT ); - - return window->id; -} - - -int GLUTAPIENTRY -glutCreateSubWindow( int win, int x, int y, int width, int height ) -{ - return GL_FALSE; -} - - -void GLUTAPIENTRY -glutDestroyWindow( int win ) -{ - __GlutWindow *cur; - - for (cur = g_stack; cur; cur = cur->next) { - if (cur->id == win) { - if (cur->window) - cur->window->Destroy( cur->window ); - - cur->req.flags |= WINDOW_REQUEST_DESTROY; - break; - } - } -} - - -void GLUTAPIENTRY -glutPostRedisplay( void ) -{ - if (g_current) - g_current->redisplay = GL_TRUE; -} - - -void GLUTAPIENTRY -glutPostWindowRedisplay( int win ) -{ - __GlutWindow *cur; - - for (cur = g_stack; cur; cur = cur->next) { - if (cur->id == win) { - cur->redisplay = GL_TRUE; - break; - } - } -} - - -void GLUTAPIENTRY -glutSwapBuffers( void ) -{ - if (g_current) { - g_current->gl->Unlock( g_current->gl ); - g_current->surface->Flip( g_current->surface, NULL, 0 ); - g_current->gl->Lock( g_current->gl ); - } -} - - -int GLUTAPIENTRY -glutGetWindow( void ) -{ - return (g_current) ? g_current->id : 0; -} - - -void GLUTAPIENTRY -glutSetWindow( int win ) -{ - __GlutWindow *cur; - - if (g_current && g_current->id == win) - return; - - for (cur = g_stack; cur; cur = cur->next) { - if (cur->id == win) { - __glutSetWindow( cur ); - break; - } - } -} - - -void GLUTAPIENTRY -glutSetWindowTitle( const char *title ) -{ -} - - -void GLUTAPIENTRY -glutSetIconTitle( const char *title ) -{ -} - - -void GLUTAPIENTRY -glutFullScreen( void ) -{ - if (g_current && !g_game) { - DFBDisplayLayerConfig config; - - primary->GetConfiguration( primary, &config ); - - g_current->req.flags |= WINDOW_REQUEST_POSITION | - WINDOW_REQUEST_RESIZE | - WINDOW_REQUEST_RESTACK; - g_current->req.x = 0; - g_current->req.y = 0; - g_current->req.w = config.width; - g_current->req.h = config.height; - g_current->req.z = 1000; - } -} - - -void GLUTAPIENTRY -glutPositionWindow( int x, int y ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_POSITION; - g_current->req.x = x; - g_current->req.y = y; - } -} - - -void GLUTAPIENTRY -glutReshapeWindow( int width, int height ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_RESIZE; - g_current->req.w = width; - g_current->req.h = height; - } -} - - -void GLUTAPIENTRY -glutPopWindow( void ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_RESTACK; - g_current->req.z--; - } -} - - -void GLUTAPIENTRY -glutPushWindow( void ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_RESTACK; - g_current->req.z++; - } -} - - -void GLUTAPIENTRY -glutIconifyWindow( void ) -{ -} - - -void GLUTAPIENTRY -glutShowWindow( void ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_SHOW; - g_current->req.flags &= ~WINDOW_REQUEST_HIDE; - } -} - - -void GLUTAPIENTRY -glutHideWindow( void ) -{ - if (g_current && !g_game) { - g_current->req.flags |= WINDOW_REQUEST_HIDE; - g_current->req.flags &= ~WINDOW_REQUEST_SHOW; - } -} - |