diff --git a/trunk/Bin/Debug.log b/trunk/Bin/Debug.log new file mode 100644 index 0000000..7222486 --- /dev/null +++ b/trunk/Bin/Debug.log @@ -0,0 +1,20 @@ +Log Started: Wed Oct 12 18:01:55 2011 + +-----Debug Initialized----- + +OpenGL 3.0 is not supported, falling back to 2.1. + + +-----Engine Initialization Complete----- + + +-----Logic----- +Warning: Can not translate this key + + +-----Cleaning Up----- + +Player Deleted. + +Log Closed: Wed Oct 12 18:01:59 2011 + diff --git a/trunk/Bin/Makefile b/trunk/Bin/Makefile new file mode 100644 index 0000000..cb242fe --- /dev/null +++ b/trunk/Bin/Makefile @@ -0,0 +1,25 @@ +CC = g++ +CFLAGS = -ansi -Wall -g +LDADD = -lGL -lGLU -lglut -lSDL +LDADDSTATIC = -Wl,-Bstatic -lSDL -lSDL_image -lopenal -lalut -L/usr/X11 -Wl,-Bdynamic -lasound -lartsc -lesd -lpulse -lpulse-simple -ldirectfb -lvga -laa -lcaca -ljpeg -ltiff - + +.PHONY: default static all clean + +default: all + +all: + $(MAKE) -C ../src/libUnuk + $(MAKE) -C ../src/Unuk + $(CC) $(CFLAGS) -o Unuk ../src/Unuk/main.cpp ../src/libUnuk/*.o ../src/Unuk/*.o $(LDADD) + +static: + @echo -e "\033[1;31mThis is an experimental build, if it does not work, don't complain...\033[0m" + @sleep 1 + $(MAKE) -C ../src/libUnuk + $(MAKE) -C ../src/Unuk + $(CC) $(CFLAGS) -o build/Unuk-static ../src/Unuk/main.cpp ../src/libUnuk/*.o ../src/Unuk/*.o $(LDADDSTATIC) + +clean: + $(MAKE) -C ../src/libUnuk clean + $(MAKE) -C ../src/Unuk clean + rm -f Unuk ../Data/Debug.log \ No newline at end of file diff --git a/trunk/Data/Media/.svn/all-wcprops b/trunk/Data/Media/.svn/all-wcprops new file mode 100644 index 0000000..863ab18 --- /dev/null +++ b/trunk/Data/Media/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 45 +/saracraft/!svn/ver/119/trunk/Unuk/Data/Media +END +test.bmp +K 25 +svn:wc:ra_dav:version-url +V 54 +/saracraft/!svn/ver/119/trunk/Unuk/Data/Media/test.bmp +END diff --git a/trunk/Data/Media/.svn/entries b/trunk/Data/Media/.svn/entries new file mode 100644 index 0000000..58857de --- /dev/null +++ b/trunk/Data/Media/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +119 +https://svn.origo.ethz.ch/saracraft/trunk/Unuk/Data/Media +https://svn.origo.ethz.ch/saracraft + + + +2011-08-27T10:14:02.081475Z +119 +allanis + + + + + + + + + + + + + + +ed78350d-8895-4595-9ae3-86e2b1f39417 + +test.bmp +file + + + + +2011-08-27T14:28:59.000000Z +547bee8a4cb01050e3391eb8201ae6d5 +2011-08-27T10:14:02.081475Z +119 +allanis +has-props + + + + + + + + + + + + + + + + + + + + +160054 + diff --git a/trunk/Data/Media/.svn/prop-base/test.bmp.svn-base b/trunk/Data/Media/.svn/prop-base/test.bmp.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/trunk/Data/Media/.svn/prop-base/test.bmp.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/trunk/Data/Media/.svn/text-base/test.bmp.svn-base b/trunk/Data/Media/.svn/text-base/test.bmp.svn-base new file mode 100644 index 0000000..cdfd4c9 Binary files /dev/null and b/trunk/Data/Media/.svn/text-base/test.bmp.svn-base differ diff --git a/trunk/Data/Media/test.bmp b/trunk/Data/Media/test.bmp new file mode 100644 index 0000000..6f8bd71 Binary files /dev/null and b/trunk/Data/Media/test.bmp differ diff --git a/trunk/Docs/include/input.h b/trunk/Docs/include/input.h new file mode 100644 index 0000000..907b8ec --- /dev/null +++ b/trunk/Docs/include/input.h @@ -0,0 +1,48 @@ +#ifndef INPUT_H_ +#define INPUT_H_ + +#include + +typedef struct mouse_s +{ + int dx, dy; + int old_x, old_y; + unsigned int buttons; + unsigned int old_buttons; +} mouse_t; + +typedef struct keyboard_s +{ + unsigned char *keys; + unsigned char *old_keys; + int keycount; + int last_char; + unsigned int mods; +} keyboard_t; + +typedef struct input_s +{ + mouse_t mouse; + keyboard_t keyboard; +} input_t; + +bool create_input(); +void update_input(); + +char get_key(); +unsigned int get_x(); +unsigned int get_y(); +unsigned int get_old_x(); +unsigned int get_old_y(); +unsigned int get_mods(); +bool key_down(int index); +bool key_still_down(int index); +bool key_up(int index); +bool key_still_up(int index); +bool mouse_down(int button); +bool mouse_still_down(int button); +bool mouse_up(int button); +bool mouse_still_up(int button); + +void destroy_input(); +#endif // INPUT_H_ diff --git a/trunk/Docs/src/input.cpp b/trunk/Docs/src/input.cpp new file mode 100644 index 0000000..cb0f85a --- /dev/null +++ b/trunk/Docs/src/input.cpp @@ -0,0 +1,142 @@ +#include "input.h" +#include + +static mouse_t mouse; +static keyboard_t keyboard; + +bool _curr_key(int index) +{ + return (keyboard.keys[index] != 0); +} + +bool _old_key(int index) +{ + return (keyboard.old_keys[index] != 0); +}; + +bool _curr_mouse(int button) +{ + return ((mouse.buttons & SDL_BUTTON(button)) != 0); +}; + +bool _old_mouse(int button) +{ + return ((mouse.old_buttons & SDL_BUTTON(button)) != 0); +}; + +bool create_input() +{ + memset(&keyboard, 0, sizeof(keyboard_t)); + memset(&mouse, 0, sizeof(mouse_t)); + SDL_PumpEvents(); + SDL_PumpEvents(); + unsigned char *temp_keys = SDL_GetKeyState(&keyboard.keycount); + keyboard.keys = (unsigned char *)malloc(sizeof(char) * keyboard.keycount); + keyboard.old_keys = (unsigned char *)malloc(sizeof(char) * keyboard.keycount); + + memcpy(keyboard.keys, temp_keys, sizeof(char) * keyboard.keycount); + mouse.buttons = SDL_GetMouseState(&mouse.dx, &mouse.dy); + return true; +}; + +void update_input() +{ + SDL_PumpEvents(); + keyboard.last_char = -1; + mouse.old_x = mouse.dx; + mouse.old_y = mouse.dy; + mouse.old_buttons = mouse.buttons; + mouse.buttons = SDL_GetMouseState(&mouse.dx, &mouse.dy); + + memcpy(keyboard.old_keys, keyboard.keys, sizeof(char) * keyboard.keycount); + + unsigned char *tmp = SDL_GetKeyState(&keyboard.keycount); + memcpy(keyboard.keys, tmp, sizeof(char) * keyboard.keycount); + + keyboard.mods = SDL_GetModState(); + + SDL_Event event; + while(SDL_PollEvent(&event)) + { + if(event.type == SDL_KEYDOWN) + keyboard.last_char = event.key.keysym.sym; + } +}; + +char get_key() +{ + if(keyboard.last_char != -1) + return keyboard.last_char; + return 0; +}; + +unsigned int get_x() +{ + return mouse.dx; +}; + +unsigned int get_y() +{ + return mouse.dy; +}; + +unsigned int get_old_x() +{ + return mouse.old_x; +}; + +unsigned int get_old_y() +{ + return mouse.old_y; +}; + +unsigned int get_mods() +{ + return keyboard.mods; +}; + +bool key_down(int index) +{ + return(_curr_key(index) && !_old_key(index)); +}; + +bool key_still_down(int index) +{ + return(_curr_key(index) && _old_key(index)); +}; + +bool key_up(int index) +{ + return(!_curr_key(index) && _old_key(index)); +}; + +bool key_still_up(int index) +{ + return (!_curr_key(index) && !_old_key(index)); +}; + +bool mouse_down(int button) +{ + return (_curr_mouse(button) && !_old_mouse(button)); +}; + +bool mouse_still_down(int button) +{ + return (_curr_mouse(button) && _old_mouse(button)); +}; + +bool mouse_up(int button) +{ + return (!_curr_mouse(button) && _old_mouse(button)); +}; + +bool mouse_still_up(int button) +{ + return (!_curr_mouse(button) && !_old_mouse(button)); +}; + +void destroy_input() +{ + free(keyboard.keys); + free(keyboard.old_keys); +}; diff --git a/trunk/README b/trunk/README new file mode 100644 index 0000000..2c01732 --- /dev/null +++ b/trunk/README @@ -0,0 +1,5 @@ +Readme plz! +___________ + +I have decided to use Git for SCM of this project. +Please see https://github.com/Allanis/Unuk \ No newline at end of file diff --git a/trunk/Tasks/project_files_GD_Marking_Criteria.pdf b/trunk/Tasks/project_files_GD_Marking_Criteria.pdf new file mode 100644 index 0000000..8d00438 Binary files /dev/null and b/trunk/Tasks/project_files_GD_Marking_Criteria.pdf differ diff --git a/trunk/Tasks/project_files_GD_portfolio_project_02.pdf b/trunk/Tasks/project_files_GD_portfolio_project_02.pdf new file mode 100644 index 0000000..b2a8377 Binary files /dev/null and b/trunk/Tasks/project_files_GD_portfolio_project_02.pdf differ diff --git a/trunk/Unuk-QT/Input.o b/trunk/Unuk-QT/Input.o new file mode 100644 index 0000000..147c433 Binary files /dev/null and b/trunk/Unuk-QT/Input.o differ diff --git a/trunk/Unuk-QT/Makefile b/trunk/Unuk-QT/Makefile new file mode 100644 index 0000000..d112ba3 --- /dev/null +++ b/trunk/Unuk-QT/Makefile @@ -0,0 +1,261 @@ +############################################################################# +# Makefile for building: Unuk-QT +# Generated by qmake (2.01a) (Qt 4.7.3) on: Sun Oct 9 18:24:18 2011 +# Project: Unuk-QT.pro +# Template: app +# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. +LINK = g++ +LFLAGS = +LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread -lSDL -lGL -lGLU +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = ../src/libUnuk/Vec2.cpp \ + ../src/libUnuk/Sprite.cpp \ + ../src/libUnuk/ImageLoader.cpp \ + ../src/libUnuk/GlxWindow.cpp \ + ../src/libUnuk/Debug.cpp \ + ../src/Unuk/Player.cpp \ + ../src/Unuk/main.cpp \ + ../src/Unuk/Game.cpp +OBJECTS = Vec2.o \ + Sprite.o \ + ImageLoader.o \ + GlxWindow.o \ + Debug.o \ + Player.o \ + main.o \ + Game.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/debug.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + Unuk-QT.pro +QMAKE_TARGET = Unuk-QT +DESTDIR = +TARGET = Unuk-QT + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: Unuk-QT.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/debug.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/debug.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/Unuk-QT1.0.0 || $(MKDIR) .tmp/Unuk-QT1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Unuk-QT1.0.0/ && $(COPY_FILE) --parents ../src/libUnuk/Vec2.h ../src/libUnuk/ImageLoader.h ../src/libUnuk/GlxWindow.h ../src/libUnuk/Sprite.h ../src/libUnuk/Debug.h ../src/Libs/wglext.h ../src/Libs/glxext.h ../src/Unuk/Game.h ../src/Unuk/Player.h ../src/libUnuk/KeyboardInterface.h ../src/libUnuk/XKeyboardInterface.h .tmp/Unuk-QT1.0.0/ && $(COPY_FILE) --parents ../src/libUnuk/Vec2.cpp ../src/libUnuk/Sprite.cpp ../src/libUnuk/ImageLoader.cpp ../src/libUnuk/GlxWindow.cpp ../src/libUnuk/Debug.cpp ../src/Unuk/Player.cpp ../src/Unuk/main.cpp ../src/Unuk/Game.cpp .tmp/Unuk-QT1.0.0/ && (cd `dirname .tmp/Unuk-QT1.0.0` && $(TAR) Unuk-QT1.0.0.tar Unuk-QT1.0.0 && $(COMPRESS) Unuk-QT1.0.0.tar) && $(MOVE) `dirname .tmp/Unuk-QT1.0.0`/Unuk-QT1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/Unuk-QT1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: +compiler_moc_header_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: + +####### Compile + +Vec2.o: ../src/libUnuk/Vec2.cpp ../src/libUnuk/Vec2.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Vec2.o ../src/libUnuk/Vec2.cpp + +Sprite.o: ../src/libUnuk/Sprite.cpp ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Sprite.o ../src/libUnuk/Sprite.cpp + +ImageLoader.o: ../src/libUnuk/ImageLoader.cpp ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ImageLoader.o ../src/libUnuk/ImageLoader.cpp + +GlxWindow.o: ../src/libUnuk/GlxWindow.cpp ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/GlxWindow.h \ + ../src/Libs/glxext.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o GlxWindow.o ../src/libUnuk/GlxWindow.cpp + +Debug.o: ../src/libUnuk/Debug.cpp ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Debug.o ../src/libUnuk/Debug.cpp + +Player.o: ../src/Unuk/Player.cpp ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h \ + ../src/Unuk/Player.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Player.o ../src/Unuk/Player.cpp + +main.o: ../src/Unuk/main.cpp ../src/libUnuk/Win32Window.h \ + ../src/libUnuk/GlxWindow.h \ + ../src/Libs/glxext.h \ + ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../src/Unuk/main.cpp + +Game.o: ../src/Unuk/Game.cpp ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Game.o ../src/Unuk/Game.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/trunk/Unuk-QT/Makefile_backup b/trunk/Unuk-QT/Makefile_backup new file mode 100644 index 0000000..c5297d5 --- /dev/null +++ b/trunk/Unuk-QT/Makefile_backup @@ -0,0 +1,261 @@ +############################################################################# +# Makefile for building: Unuk-QT +# Generated by qmake (2.01a) (Qt 4.7.3) on: Wed Oct 5 01:03:25 2011 +# Project: Unuk-QT.pro +# Template: app +# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. +LINK = g++ +LFLAGS = +LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread -lGL -lGLU -lglut -lSDL +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = strip +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = ../src/libUnuk/Vec2.cpp \ + ../src/libUnuk/Sprite.cpp \ + ../src/libUnuk/ImageLoader.cpp \ + ../src/libUnuk/GlxWindow.cpp \ + ../src/libUnuk/Debug.cpp \ + ../src/Unuk/Player.cpp \ + ../src/Unuk/main.cpp \ + ../src/Unuk/Game.cpp +OBJECTS = Vec2.o \ + Sprite.o \ + ImageLoader.o \ + GlxWindow.o \ + Debug.o \ + Player.o \ + main.o \ + Game.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/debug.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + Unuk-QT.pro +QMAKE_TARGET = Unuk-QT +DESTDIR = +TARGET = Unuk-QT + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: Unuk-QT.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/debug.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/debug.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile Unuk-QT.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/Unuk-QT1.0.0 || $(MKDIR) .tmp/Unuk-QT1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Unuk-QT1.0.0/ && $(COPY_FILE) --parents ../src/libUnuk/Vec2.h ../src/libUnuk/ImageLoader.h ../src/libUnuk/GlxWindow.h ../src/libUnuk/Sprite.h ../src/libUnuk/Debug.h ../src/Libs/wglext.h ../src/Libs/glxext.h ../src/Unuk/Game.h ../src/Unuk/Player.h ../src/libUnuk/Input.h .tmp/Unuk-QT1.0.0/ && $(COPY_FILE) --parents ../src/libUnuk/Vec2.cpp ../src/libUnuk/Sprite.cpp ../src/libUnuk/ImageLoader.cpp ../src/libUnuk/GlxWindow.cpp ../src/libUnuk/Debug.cpp ../src/Unuk/Player.cpp ../src/Unuk/main.cpp ../src/Unuk/Game.cpp .tmp/Unuk-QT1.0.0/ && (cd `dirname .tmp/Unuk-QT1.0.0` && $(TAR) Unuk-QT1.0.0.tar Unuk-QT1.0.0 && $(COMPRESS) Unuk-QT1.0.0.tar) && $(MOVE) `dirname .tmp/Unuk-QT1.0.0`/Unuk-QT1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/Unuk-QT1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: +compiler_moc_header_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: + +####### Compile + +Vec2.o: ../src/libUnuk/Vec2.cpp ../src/libUnuk/Vec2.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Vec2.o ../src/libUnuk/Vec2.cpp + +Sprite.o: ../src/libUnuk/Sprite.cpp ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Sprite.o ../src/libUnuk/Sprite.cpp + +ImageLoader.o: ../src/libUnuk/ImageLoader.cpp ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ImageLoader.o ../src/libUnuk/ImageLoader.cpp + +GlxWindow.o: ../src/libUnuk/GlxWindow.cpp ../src/libUnuk/GlxWindow.h \ + ../src/Libs/glxext.h \ + ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o GlxWindow.o ../src/libUnuk/GlxWindow.cpp + +Debug.o: ../src/libUnuk/Debug.cpp ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Debug.o ../src/libUnuk/Debug.cpp + +Player.o: ../src/Unuk/Player.cpp ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h \ + ../src/Unuk/Player.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Player.o ../src/Unuk/Player.cpp + +main.o: ../src/Unuk/main.cpp ../src/libUnuk/Win32Window.h \ + ../src/libUnuk/GlxWindow.h \ + ../src/Libs/glxext.h \ + ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../src/Unuk/main.cpp + +Game.o: ../src/Unuk/Game.cpp ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/Vec2.h \ + ../src/libUnuk/Debug.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o Game.o ../src/Unuk/Game.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/trunk/Unuk-QT/Unuk-QT b/trunk/Unuk-QT/Unuk-QT new file mode 100755 index 0000000..ebae8c3 Binary files /dev/null and b/trunk/Unuk-QT/Unuk-QT differ diff --git a/trunk/Unuk-QT/Unuk-QT.pro b/trunk/Unuk-QT/Unuk-QT.pro new file mode 100644 index 0000000..06ee1c4 --- /dev/null +++ b/trunk/Unuk-QT/Unuk-QT.pro @@ -0,0 +1,25 @@ +RESOURCES += +OTHER_FILES += ../src/libUnuk/Vec2.o \ + ../src/libUnuk/ImageLoader.o \ + ../src/libUnuk/GlxWindow.o \ + ../src/libUnuk/Sprite.o \ + ../src/libUnuk/Debug.o +HEADERS += ../src/libUnuk/Vec2.h \ + ../src/libUnuk/ImageLoader.h \ + ../src/libUnuk/GlxWindow.h \ + ../src/libUnuk/Sprite.h \ + ../src/libUnuk/Debug.h \ + ../src/Libs/wglext.h \ + ../src/Libs/glxext.h \ + ../src/Unuk/Game.h \ + ../src/Unuk/Player.h \ + ../src/libUnuk/KeyboardInterface.h \ + ../src/libUnuk/XKeyboardInterface.h +SOURCES += ../src/libUnuk/Vec2.cpp \ + ../src/libUnuk/Sprite.cpp \ + ../src/libUnuk/ImageLoader.cpp \ + ../src/libUnuk/GlxWindow.cpp \ + ../src/libUnuk/Debug.cpp \ + ../src/Unuk/Player.cpp \ + ../src/Unuk/main.cpp \ + ../src/Unuk/Game.cpp diff --git a/trunk/Unuk-QT/Unuk-QT.pro.user b/trunk/Unuk-QT/Unuk-QT.pro.user new file mode 100644 index 0000000..0d076ea --- /dev/null +++ b/trunk/Unuk-QT/Unuk-QT.pro.user @@ -0,0 +1,321 @@ + + + + RunConfiguration0-BaseEnvironmentBase + 2 + + + RunConfiguration0-CommandLineArguments + + + + RunConfiguration0-ProFile + Unuk-QT.pro + + + RunConfiguration0-RunConfiguration.name + Unuk-QT + + + RunConfiguration0-UseDyldImageSuffix + false + + + RunConfiguration0-UseTerminal + false + + + RunConfiguration0-UserEnvironmentChanges + + + + RunConfiguration0-UserSetName + false + + + RunConfiguration0-UserSetWorkingDirectory + false + + + RunConfiguration0-UserWorkingDirectory + + + + RunConfiguration0-type + Qt4ProjectManager.Qt4RunConfiguration + + + activeRunConfiguration + 0 + + + activebuildconfiguration + Debug + + + buildConfiguration-Debug + + Debug + 0 + 0 + + 2 + + + + buildConfiguration-Release + + Release + 0 + + 0 + + + + buildconfiguration-Debug-buildstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-jZvtFgh4Q8,guid=64951d68d90161d18293293f00000185 + DISPLAY=:0 + HOME=/home/allanis + HUSHLOGIN=FALSE + LANGUAGE= + LD_LIBRARY_PATH=/usr/lib/qtcreator + LOGNAME=allanis + LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: + MAIL=/var/mail/allanis + PATH=/usr/bin:/home/allanis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/sbin:/sbin + PWD=/home/allanis + QTDIR=/usr/share/qt4 + SHELL=/bin/bash + SHLVL=1 + SSH_AGENT_PID=4618 + SSH_AUTH_SOCK=/tmp/ssh-GLBfmvFD4589/agent.4589 + TERM=linux + USER=allanis + WINDOWPATH=7 + XAUTHORITY=/home/allanis/.Xauthority + XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1318168661.569853-1852884431 + _=/usr/bin/startx + + + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT/Unuk-QT.pro + -spec + linux-g++ + -r + CONFIG+=debug + + /usr/bin/qmake-qt4 + false + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT + + + + buildconfiguration-Debug-buildstep1 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-jZvtFgh4Q8,guid=64951d68d90161d18293293f00000185 + DISPLAY=:0 + HOME=/home/allanis + HUSHLOGIN=FALSE + LANGUAGE= + LD_LIBRARY_PATH=/usr/lib/qtcreator + LOGNAME=allanis + LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: + MAIL=/var/mail/allanis + PATH=/usr/bin:/home/allanis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/sbin:/sbin + PWD=/home/allanis + QTDIR=/usr/share/qt4 + SHELL=/bin/bash + SHLVL=1 + SSH_AGENT_PID=4618 + SSH_AUTH_SOCK=/tmp/ssh-GLBfmvFD4589/agent.4589 + TERM=linux + USER=allanis + WINDOWPATH=7 + XAUTHORITY=/home/allanis/.Xauthority + XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1318168661.569853-1852884431 + _=/usr/bin/startx + + false + + -w + + /usr/bin/make + true + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT + + + + buildconfiguration-Debug-cleanstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-jZvtFgh4Q8,guid=64951d68d90161d18293293f00000185 + DISPLAY=:0 + HOME=/home/allanis + HUSHLOGIN=FALSE + LANGUAGE= + LD_LIBRARY_PATH=/usr/lib/qtcreator + LOGNAME=allanis + LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: + MAIL=/var/mail/allanis + PATH=/usr/bin:/home/allanis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/sbin:/sbin + PWD=/home/allanis + QTDIR=/usr/share/qt4 + SHELL=/bin/bash + SHLVL=1 + SSH_AGENT_PID=4618 + SSH_AUTH_SOCK=/tmp/ssh-GLBfmvFD4589/agent.4589 + TERM=linux + USER=allanis + WINDOWPATH=7 + XAUTHORITY=/home/allanis/.Xauthority + XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1318168661.569853-1852884431 + _=/usr/bin/startx + + true + + clean + -w + + /usr/bin/make + true + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT + true + + clean + + + + + buildconfiguration-Release-buildstep0 + + Release + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bASjAF89Ou,guid=3c44d6b9c9f472128b547b8300000047 + DISPLAY=:0 + HOME=/home/allanis + HUSHLOGIN=FALSE + LD_LIBRARY_PATH=/usr/lib/qtcreator + LOGNAME=allanis + LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: + MAIL=/var/mail/allanis + PATH=/usr/bin:/home/allanis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/sbin:/sbin + PWD=/home/allanis + QTDIR=/usr/share/qt4 + SHELL=/bin/bash + SHLVL=1 + SSH_AGENT_PID=3224 + SSH_AUTH_SOCK=/tmp/ssh-zYjDAHRv3201/agent.3201 + TERM=linux + USER=allanis + WINDOWPATH=7 + XAUTHORITY=/home/allanis/.Xauthority + XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1317373306.554178-1370043490 + _=/usr/bin/startx + + + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT/Unuk-QT.pro + -spec + linux-g++ + -r + + /usr/bin/qmake-qt4 + false + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT + + + + buildconfiguration-Release-buildstep1 + + Release + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bASjAF89Ou,guid=3c44d6b9c9f472128b547b8300000047 + DISPLAY=:0 + HOME=/home/allanis + HUSHLOGIN=FALSE + LD_LIBRARY_PATH=/usr/lib/qtcreator + LOGNAME=allanis + LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: + MAIL=/var/mail/allanis + PATH=/usr/bin:/home/allanis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/sbin:/sbin + PWD=/home/allanis + QTDIR=/usr/share/qt4 + SHELL=/bin/bash + SHLVL=1 + SSH_AGENT_PID=3224 + SSH_AUTH_SOCK=/tmp/ssh-zYjDAHRv3201/agent.3201 + TERM=linux + USER=allanis + WINDOWPATH=7 + XAUTHORITY=/home/allanis/.Xauthority + XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1317373306.554178-1370043490 + _=/usr/bin/startx + + false + + -w + + /usr/bin/make + true + /drv/storage/Projects/Portfolio/saracraft/trunk/Unuk/Unuk-QT + + + + buildconfiguration-Release-cleanstep0 + + Release + + + + buildconfigurations + + Debug + Release + + + + buildstep0 + + + + + + + buildstep1 + + + + + + buildsteps + + trolltech.qt4projectmanager.qmake + trolltech.qt4projectmanager.make + + + + cleanstep0 + + + true + + + + cleansteps + + trolltech.qt4projectmanager.make + + + + defaultFileEncoding + ISO-8859-1 + + + project + + + diff --git a/trunk/Unuk-QT/Unuk.qrc b/trunk/Unuk-QT/Unuk.qrc new file mode 100644 index 0000000..2496c87 --- /dev/null +++ b/trunk/Unuk-QT/Unuk.qrc @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/trunk/Unuk-QT/cal.png b/trunk/Unuk-QT/cal.png new file mode 100644 index 0000000..ab52904 Binary files /dev/null and b/trunk/Unuk-QT/cal.png differ diff --git a/trunk/src/Libs/glxext.h b/trunk/src/Libs/glxext.h new file mode 100755 index 0000000..536fb25 --- /dev/null +++ b/trunk/src/Libs/glxext.h @@ -0,0 +1,833 @@ +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glxext.h last updated 2008/10/22 */ +/* Current version at http://www.opengl.org/registry/ */ +#define GLX_GLXEXT_VERSION 21 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +#endif + +#ifndef GLX_ARB_get_proc_address +#endif + +#ifndef GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif + +#ifndef GLX_OML_sync_control +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#endif + +#ifndef GLX_MESA_agp_offset +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT +#define GLX_BACK_EXT GLX_BACK_LEFT_EXT +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB +#endif + +#ifndef GLX_NV_present_video +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef GLX_NV_video_out +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC +#endif + +#ifndef GLX_NV_swap_group +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(void); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GLX_OML_sync_control extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include /* Fallback option */ +#endif +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); +extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); +extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); +extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); +extern void glXDestroyWindow (Display *, GLXWindow); +extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); +extern void glXDestroyPixmap (Display *, GLXPixmap); +extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); +extern void glXDestroyPbuffer (Display *, GLXPbuffer); +extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); +extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); +extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *, GLXContext, int, int *); +extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *); +extern int glXWaitVideoSyncSGI (int, int, unsigned int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef _VL_H +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* _VL_H */ +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); +extern GLXContextID glXGetContextIDEXT (const GLXContext); +extern GLXContext glXImportContextEXT (Display *, GLXContextID); +extern void glXFreeContextEXT (Display *, GLXContext); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); +extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); +extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); +extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *, Window, float); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); +extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); +extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef _DM_BUFFER_H_ +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* _DM_BUFFER_H_ */ +#endif + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#endif + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); +extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); +extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); +extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); +extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int + participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *); +extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *); +extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *); +extern int glXDestroyHyperpipeConfigSGIX (Display *, int); +extern int glXBindHyperpipeSGIX (Display *, int); +extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *); +extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *); +extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int glXGetAGPOffsetMESA (const void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindTexImageEXT (Display *, GLXDrawable, int, const int *); +extern void glXReleaseTexImageEXT (Display *, GLXDrawable, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer); +#endif + +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 +#endif + +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 +#endif + +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/trunk/src/Libs/wglext.h b/trunk/src/Libs/wglext.h new file mode 100755 index 0000000..785bd72 --- /dev/null +++ b/trunk/src/Libs/wglext.h @@ -0,0 +1,707 @@ +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2008/08/10 */ +/* Current version at http://www.opengl.org/registry/ */ +#define WGL_WGLEXT_VERSION 10 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef WGL_NV_video_out +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +#endif + +#ifndef WGL_NV_swap_group +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif +#ifndef WGL_NV_present_video +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#endif +#ifndef WGL_NV_video_out +DECLARE_HANDLE(HPVIDEODEV); +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void WINAPI wglFreeMemoryNV (void *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); +extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); +extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); +extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); +extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +#endif + +#ifndef WGL_NV_video_out +#define WGL_NV_video_out 1 +#endif + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/trunk/src/Unuk/Game.cpp b/trunk/src/Unuk/Game.cpp new file mode 100644 index 0000000..cecb3af --- /dev/null +++ b/trunk/src/Unuk/Game.cpp @@ -0,0 +1,106 @@ +#ifdef WIN32 +#include +#endif + +#include +#include +#include +#include +#include + +#include "SDL/SDL.h" +#include "Game.h" +#include "Player.h" +#include "../libUnuk/Sprite.h" +#include "../libUnuk/Debug.h" + +Game::Game(void) { + m_rotationAngle = 0.0f; +} + +Game::~Game(void) { + +} + +bool Game::Init(void) { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + + return true; +} + +void Game::Prepare(float dt) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glShadeModel(GL_FLAT); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + Sprite::Enable2D(); + + m_player->Prepare(); + + const float SPEED = 15.0f; + m_rotationAngle += SPEED * dt; + if(m_rotationAngle > 360.0f) { + m_rotationAngle -= 360.0f; + } + +} + +void Game::Render(void) { + static GLint T0 = 0; + static GLint frames = 0; + + glClear(GL_COLOR_BUFFER_BIT); + glRasterPos2i(0, 0); + + // Draw the test image. + m_player->Render(); + + glFlush(); + //glutSwapBuffers(); + glDisable(GL_TEXTURE_2D); + + // Get frames per second. + frames++; + { + GLint t = SDL_GetTicks(); + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0f; + GLfloat fps = frames / seconds; + Debug::logger->message("\n%d frames in %g seconds = %g FPS", frames, seconds, fps); + T0 = t; + frames = 0; + } + } +} + +void Game::Shutdown(void) { + Debug::logger->message("\n\n-----Cleaning Up-----"); + m_player->CleanUp(); + Debug::logger->message("\nPlayer Deleted."); + Debug::closeLog(); +} + +void Game::UpdateProjection(void) { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + // Set up the orthographic projection. + glOrtho(-1.0, 1.0, -1.0, 1.0, 1.0, 1000.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void Game::OnResize(int width, int height) { + // Let's see you divide by zero now! + if(height == 0) { height = 1; } + + // Set the viewport to the window size. + glViewport(0, 0, width, height); + + // Set the projection. + UpdateProjection(); +} diff --git a/trunk/src/Unuk/Game.h b/trunk/src/Unuk/Game.h new file mode 100644 index 0000000..f858556 --- /dev/null +++ b/trunk/src/Unuk/Game.h @@ -0,0 +1,23 @@ +#ifndef _GAME_H_ +#define _GAME_H_ +#include "Player.h" + +class Game { +public: + Game(void); + ~Game(void); + + bool Init(void); + void Prepare(float dt); + void Render(void); + void Shutdown(void); + + void UpdateProjection(); + void OnResize(int width, int height); + +private: + float m_rotationAngle; + Player *m_player; +}; + +#endif diff --git a/trunk/src/Unuk/Makefile b/trunk/src/Unuk/Makefile new file mode 100644 index 0000000..11c95fd --- /dev/null +++ b/trunk/src/Unuk/Makefile @@ -0,0 +1,21 @@ +CC = g++ +CFLAGS = -ansi -Wall -g +LDADD = -lGL -lGLU -lSDL -lSDL_image + +objects = Game.o Player.o + + +.PHONY: default all clean + +default: all + +%.cpp: %.h + +%.o: %.cpp + $(CC) $(CFLAGS) -c -o $@ $< + +all: $(objects) + +clean: + rm -f $(objects) + diff --git a/trunk/src/Unuk/Player.cpp b/trunk/src/Unuk/Player.cpp new file mode 100644 index 0000000..49267ec --- /dev/null +++ b/trunk/src/Unuk/Player.cpp @@ -0,0 +1,52 @@ +#include +#include +#include "../libUnuk/Sprite.h" +#include "../libUnuk/Debug.h" +#include "Player.h" + +Player::Player(void) { + m_posx = 0; + m_posy = 0; +} + +Player::~Player(void) { + CleanUp(); +} + +void Player::Prepare(void) { + m_player = new Sprite("../Data/Media/test.bmp"); + // I borked up the image loader, so for now we will + // rotate the image 180 degrees. + m_player->Rotate(180); + // Set our pivot to the top right. + m_player->SetPivot(1.0f, 1.0f); + + if(m_velx && m_vely > 0) { + m_posx += m_velx; + m_posy += m_vely; + } + SetPosition(m_posx, m_posy); +} + +void Player::Render(void) { + // Only render calls should appear here. + m_player->Render(); +} + +void Player::SetPosition(GLdouble posx, GLdouble posy) { + // -- Set the position of the player sprite. + m_posx = posx; + m_posy = posy; + + m_player->SetX(m_posx); + m_player->SetY(m_posy); +} + +void Player::SetVelocity(GLdouble velx, GLdouble vely) { + m_velx = velx; + m_vely = vely; +} + +void Player::CleanUp(void) { + delete m_player; +} diff --git a/trunk/src/Unuk/Player.h b/trunk/src/Unuk/Player.h new file mode 100644 index 0000000..ddfb93d --- /dev/null +++ b/trunk/src/Unuk/Player.h @@ -0,0 +1,35 @@ +#ifndef _PLAYER_H_ +#define _PLAYER_H_ +#include +#include "../libUnuk/Sprite.h" + +class Player { +public: + Player(void); + ~Player(void); + + void Prepare(void); + void Render(void); + + void SetPosition(GLdouble posx, GLdouble posy); + void SetVelocity(GLdouble velx, GLdouble vely); + + void CleanUp(void); + +private: + Sprite *m_player; + + // Position variables. + GLdouble m_tempx; + GLdouble m_tempy; + GLdouble m_posx; + GLdouble m_posy; + + // Velocity variables. + int m_tempvelx; + int m_tempvely; + int m_velx; + int m_vely; +}; + +#endif diff --git a/trunk/src/Unuk/main.cpp b/trunk/src/Unuk/main.cpp new file mode 100644 index 0000000..6132bb8 --- /dev/null +++ b/trunk/src/Unuk/main.cpp @@ -0,0 +1,92 @@ +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#define GLX_GLXEXT_LEGACY // Defined so we use our own glxext.h, rather than the system one. + +#ifdef WIN32 +#include +#include "../libUnuk/Win32Window.h" +#else +#include "../libUnuk/GlxWindow.h" +#endif + +#include +#include "Game.h" +#include "../libUnuk/Debug.h" + +#ifdef WIN32 +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int cmdShow) { +#else +int main(/*int argc, char** argv*/) { +#endif + // Initialize our Debug log. + Debug::openLog(true); + Debug::logger->message("-----Debug Initialized-----"); + // Set our window settings. + const int windowWidth = 800; + const int windowHeight = 600; + const int windowBPP = 16; + const int windowFullscreen = false; + +#ifdef WIN32 + // This is our window. + Win32Window programWindow(hInstance); +#else + GlxWindow programWindow; +#endif + + // Set SDL up so we can use it for input and crap. + SDL_Init(SDL_INIT_EVERYTHING); + + // The Game code. + Game game; + + // Attach the game to our window. + programWindow.AttachGame(&game); + + // Attempt to create the window. + if(!programWindow.Create(windowWidth, windowHeight, windowBPP, windowFullscreen)) { + // If it fails to be created... +#ifdef WIN32 + MessageBox(NULL, "Unable to create the OpenGL window.", "Error", MB_ICONERROR | MB_OK); +#endif + // Reset the display and exit. + programWindow.Destroy(); + return 1; + } + + // Make sure our game is initialized. + if(!game.Init()) { +#ifdef WIN32 + MessageBox(Null, "Could not initialize the application", "Error", MB_ICONERROR | MB_OK); +#endif + // Reset the display and exit. + programWindow.Destroy(); + return 1; + } + + Debug::logger->message("\n\n-----Engine Initialization Complete-----"); + Debug::logger->message("\n\n-----Logic-----"); + // Main loop: We render frames untill IsRunning returns false. + while(programWindow.IsRunning()) { + // Process the window events. + programWindow.ProcessEvents(); + + // Get the time that passed since the last frame. + float elapsedTime = programWindow.GetElapsedSeconds(); + + //Perform any logic before rendering. + game.Prepare(elapsedTime); + // Let us now render the scene. + game.Render(); + + programWindow.SwapBuffers(); + } + + // Free any recources used. + game.Shutdown(); + // Destroy the window. + programWindow.Destroy(); + + // Sucess!!!11one!one1! + return 0; +} diff --git a/trunk/src/libUnuk/AStar.cpp b/trunk/src/libUnuk/AStar.cpp new file mode 100644 index 0000000..4e00042 --- /dev/null +++ b/trunk/src/libUnuk/AStar.cpp @@ -0,0 +1,289 @@ +#include +#include "AStar.h" +#include "Node.h" + +AStar::AStar(void) { + m_open = NULL; + m_stack = NULL; + m_best = NULL; + + udCost = NULL; + udValid = NULL; + udNotifyChild = NULL; + udNotifyList = NULL; +} + +AStar::~AStar(void) { + ClearNodes(); +} + +bool AStar::GeneratePath(int startx, int starty, int destx, int desty) { + // Grab the next node from the f position. + InitStep(startx, starty, destx, desty); + + int retval = 0; + while(retval == 0) { + // Go find the next node. + retval = Step(); + } + + if(retval == 0 || !m_best) { + // Set m_best to NULL so we can go and check for the next best node. + m_best = NULL; + return false; + } + return true; +} + +int AStar::Step(void) { + // If we don't get the most efficent route, then go back + // and check some more nodes plox! + if(!(m_best == GetBest())) { return -1; } + // Ok, we found the best route. + if(m_best->id == m_ID) { return 1; } + + // Please set the best route as a child node. + CreateChildren(m_best); + + return 0; +} + +int AStar::InitStep(int startx, int starty, int destx, int desty) { + // Prepare for the next pass by clearing our previous nodes. + ClearNodes(); + + // Initialize our variables. + m_startx = startx; + m_starty = starty; + m_destx = destx; + m_desty = desty; + m_ID = Coord2Id(destx, desty); + + // Set the node for our start location. + Node *temp = new Node(startx, starty); + temp->g = 0; + temp->h = abs(destx - startx) + abs(desty - starty); + temp->f = temp->g + temp->h; + temp->id = Coord2Id(startx, starty); + m_open = temp; + + return 0; +} + +void AStar::AddToOpen(Node *addnode) { + Node *node = m_open; + Node *prev = NULL; + + if(!m_open) { + // Add a a new node to the open list. + m_open = addnode; + + m_open->next = NULL; + + // Start a new open list with our new node. + //Func(udNotifyList, NULL, addnode, NL_STARTOPEN, NCData); + + return; + } + + while(node) { + // If our addnode's f is greater than the currently open node + // then add the open node to the to previous to make room for + // add node to be on the open list. + if(addnode->f > node->f) { + prev = node; + // Now we have our new node go to next. + node = node->next; + } else { + // go to the next node, and set it on our open list to check it's + // f value. + if(prev) { + prev->next = addnode; + addnode->next = node; + Func(udNotifyList, prev, addnode, NL_ADDOPEN, NCData); + } else { + // We will only ever run through this once per instance. We have no nodes currently + // so we set an open list with this node. + Node *temp = m_open; + + m_open = addnode; + m_open->next = temp; + //Func(udNotifyList, temp, addnode, NL_STARTOPEN, NCData); + } + return; + } + } + // Get the next node and add it to the open list. + prev->next = addnode; + //Func(udNotifyList, prev, addnode, NL_ADDOPEN, NCData); +} + +void AStar::ClearNodes(void) { + Node *temp = NULL; + Node *temp2 = NULL; + + if(m_open) { + while(m_open) { + temp = m_open->next; + delete m_open; + m_open = temp; + } + } + if(m_closed) { + while(m_closed) { + temp = m_closed->next; + delete m_closed; + m_closed = temp; + } + } +} + +void AStar::CreateChildren(Node *node) { + Node temp; + int x = node->x; + int y = node->y; + + // Loop through the grid and add the children to the list. + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + temp.x = x+i; + temp.y = y+j; + if((i == 0) && (j == 0) || !Func(udValid, node, &temp, NC_INITIALADD, CBData)) continue; + + LinkChild(node, &temp); + } + } +} + +void AStar::LinkChild(Node *node, Node *temp) { + // Initialize variables for our temp node. + int x = temp->x; + int y = temp->y; + int g = temp->g + Func(udCost, node, temp, 0, CBData); + // Grabbing a unique ID before adding the node to the open list. + int id = Coord2Id(x, y); + + Node *check = NULL; + + if(check = CheckList(m_open, id)) { + node->children[node->numChildren++] = check; + + // We have found an awesome route, update the node and variables. + if(g < check->g) { + check->parent = node; + check->g = g; + check->f = g+check->h; + //Func(udNotifyChild, node, check, NC_OPENADD_UP, NCData); + } else { + //Func(udNotifyChild, node, check, 2, NCData); + } + } else if(check = CheckList(m_closed, id)) { + node->children[node->numChildren++] = check; + + if(g < check->g) { + check->parent = node; + check->g = g; + check->f = g+check->h; + //Func(udNotifyChild, node, check, 3, NCData); + + // Update the parents. + UpdateParents(check); + } else { + //Func(udNotifyChild, node, check, 4, NCData); + } + } else { + Node *newnode = new Node(x, y); + newnode->parent = node; + newnode->g = g; + newnode->h = abs(x - m_destx) + abs(y - m_desty); + newnode->f = newnode->g + newnode->h; + newnode->id = Coord2Id(x, y); + + AddToOpen(newnode); + node->children[node->numChildren++] = newnode; + + //Func(udNotifyChild, node, newnode, 5, NCData); + } +} + + +void AStar::UpdateParent(Node *node) { + int g = node->g; + int c = node->numChildren; + + Node *child = NULL; + for(int i = 0; i < c; i++) { + child = node->children[i]; + if(g + 1 < child->g) { + child->g = g + 1; + child->f = child->g + child->h; + child->parent = node; + Push(child); + } + } + Node *parent; + + while(m_stack) { + parent = Pop(); + c = parent->numC22hildren; + for(int i = 0; i < c; i++) { + child = parent->children[i]; + + if(parent->g + 1 < child->g) { + child->g = parent->g + Func(udCost, parent, child, NC_INITIALADD, CBData); + child->f = child->g + child->h; + child->parent = parent; + Push(child); + } + } + } +} + +void AStar::Push(Node *node) { + if(!m_stack) { + m_stack = new Stack; + m_stack->data = node; + m_stack->next = NULL; + } else { + Stack *temp = new Stack; + temp->data = node; + temp->next = m_stack; + m_stack = temp; + } +} + +Node AStar::*Pop(void) { + Node *data = m_stack->data; + Stack *temp = m_stack; + + m_stack = temp->next; + delete temp; + + return data; +} + +Node AStar::*CheckList(Node *node, int id) { + while(node) { + if(node->id == id) return node; + + node = node->next; + } + return NULL; +} + +// Get the best node in the open list to enable us to find +// the best route to take. +Node AStar::*GetBest(void) { + if(!m_open) { return NULL; } + + Node *temp = m_open; + Node *temp2 = m_closed; + m_open = temp->next; + + //Func(udNotifyList, NULL, temp, NL_DELETEOPEN, NCData); + m_closed = temp; + m_closed->next = temp2; + //Func(udNotifyList, NULL, m_closed, NL_ADDCLOSED, NCData); + + return temp; +} diff --git a/trunk/src/libUnuk/AStar.h b/trunk/src/libUnuk/AStar.h new file mode 100644 index 0000000..12e9d08 --- /dev/null +++ b/trunk/src/libUnuk/AStar.h @@ -0,0 +1,59 @@ +#ifndef _ASTAR_H_ +#define _ASTAR_H_ +#include "Node.h" + +class AStar { +public: + AStar(void); + ~AStar(void); + + Func udCost; // Called when the cost is needed. + Func udValid; // Check the validity of the coordanate. + Func udNotifyChild; // Child is called/checked (LinkChild). + Func udNotifyList; // node is added to the open/closed list. + + void *CBData; // Data passed back to the callback function. + void *NCData; // Data paseed back to to notify child. + + bool GeneratePath(int startx, int starty, int destx, int desty); + int Step(void); + int InitStep(int startx, int starty, int destx, int desty); + void SetRows(int r) { m_rows = r; } + void Reset(void) { m_best = NULL; } + + Node *GetBestNode(void) { return m_best; } + +private: + int m_rows; // Used to calculate unique ID for node->number. + int m_startx; + int m_starty; + int m_destx; + int m_desty; + + int m_ID; + + + // Node list. + Node *m_open; + Node *m_closed; + Node *m_best; + + Stack *m_stack; + + // Private methods. + void AddToOpen(Node *node); + void ClearNodes(void); + void CreateChildren(Node *node); + void LinkChild(Node *, Node *); + void UpdateParent(Node *node); + + // Stack functions. + void Push(Node *node); + Node *Pop(void); + Node *CheckList(Node *node, int number); + Node *GetBest(void); + + inline int Coord2Id(int x, int y) { return x * m_rows + y; } +}; + +#endif diff --git a/trunk/src/libUnuk/Debug.cpp b/trunk/src/libUnuk/Debug.cpp new file mode 100644 index 0000000..438dc3f --- /dev/null +++ b/trunk/src/libUnuk/Debug.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include "Debug.h" +#include "string" + + +using namespace std; + +// =================================================================== +// The Debug log allows us to display ever piece of data that +// populates our class components, anything that is loaded, serialized, +// de-serialized etc will be printed out to a text file. +// (Running our program in a terminal, this debug log will print to it.) +// =================================================================== + +Debug *Debug::logger = NULL; + +Debug::Debug(bool logToFile) { + time_t timestamp; + if(logToFile) { + logFile.open("../Bin/Debug.log", ios::out); + if(!logToFile) { + // We can not open our log. + cerr << "Warning: Can not open Debug.log to write, continueing without logging\n"; + } else { + // Log File is open, let us give it a nice time stamp. + timestamp = time(NULL); + logFile << "Log Started: " << ctime(×tamp) << endl; + } + } +} + +Debug::~Debug(void) { + time_t timestamp; + + // We only need to close the log if it is open. + if(logFile) { + // Give it a closing timestamp. + timestamp = time(NULL); + logFile << endl << "Log Closed: " << ctime(×tamp) << endl; + + // Close the log file. + logFile.close(); + } +} + +void Debug::message(std::string msg) { + if(logFile) { + logFile << msg << endl; + } + cerr << msg << endl << endl; +} + +void Debug::message(const char *msg, ...) { + va_list vargList; // This is to handlle the variable arguments + + char outBuf[1024]; + unsigned short outLen; + + // This takes the arguments and puts them into the character array. + va_start(vargList, msg); + +#if defined WIN32 + outLen = _vsnprintf(outBuf, sizeof(outBuf), msg, vargList); +#else + outLen = vsnprintf(outBuf, sizeof(outBuf), msg, vargList); +#endif + + va_end(vargList); + + if(outLen >= sizeof(outBuf)) { + outLen = sizeof(outBuf); + } + + if(logFile) { + logFile << outBuf << endl; + } + + cerr << outBuf << endl; +} + +bool Debug::openLog(bool logToFile) { + // Make sure the logger has not already been initialized. + if(logger != NULL) { + logger->message("Warning: Multiple calls to openLog()."); + return false; + } + logger = new Debug(logToFile); + return true; +} + +void Debug::closeLog(void) { + if(logger == NULL) { + cerr << "Warning: Call to closeLog() with NULL logger pointer." << endl; + return; + } + delete logger; + logger = NULL; +} diff --git a/trunk/src/libUnuk/Debug.h b/trunk/src/libUnuk/Debug.h new file mode 100644 index 0000000..fb805d1 --- /dev/null +++ b/trunk/src/libUnuk/Debug.h @@ -0,0 +1,23 @@ +#ifndef _DEBUG_H_ +#define _DEBUG_H_ +#include +#include "string" + +class Debug { +public: + Debug(bool logToFile); + ~Debug(void); + + // Log an error message. + void message(std::string msg); + void message(const char *msg, ...); + static bool openLog(bool logToFile); + static void closeLog(void); + + static Debug *logger; + +private: + std::ofstream logFile; +}; + +#endif // _DEBUG_H_ diff --git a/trunk/src/libUnuk/GlxWindow.cpp b/trunk/src/libUnuk/GlxWindow.cpp new file mode 100644 index 0000000..a981d3f --- /dev/null +++ b/trunk/src/libUnuk/GlxWindow.cpp @@ -0,0 +1,257 @@ +#include +#include + +#ifdef __unix__ +#include +#endif + +#include "../Unuk/Game.h" +#include "../Unuk/Player.h" +#include "GlxWindow.h" +#include "XKeyboardInterface.h" +#include "Debug.h" + +using namespace std; + +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); + +unsigned int GetTickCount() { + struct timeval t; + gettimeofday(&t, NULL); + + unsigned long secs = t.tv_sec * 1000; + secs += (t.tv_usec / 1000); + return secs; +} + +GlxWindow::GlxWindow(void) : + m_game(NULL), + m_isRunning(true), + m_lastTime(0), + m_display(NULL), + m_XWindow(0), + m_glContext(0), + m_screenID(0), + m_isFullscreen(false), + m_width(0), + m_height(0), + m_bpp(0), + m_GL3Supported(false), + m_keyboard(NULL) { + m_keyboard = new XKeyboardInterface(); + } + +GlxWindow::~GlxWindow(void) { + delete m_keyboard; +} + +bool GlxWindow::Create(int width, int height, int bpp, bool fullscreen) { + // Open up the default display. + m_display = XOpenDisplay(0); + if(m_display == NULL) { + Debug::logger->message("\nCould not open the display."); + return false; + } + + // Get the ID of the default screen. + m_screenID = DefaultScreen(m_display); + + int n = 0; + int modeNum = 0; + + // Get the framebuffer config using the default attributes. + GLXFBConfig framebufferConfig = (*glXChooseFBConfig(m_display, DefaultScreen(m_display), 0, &n)); + + XF86VidModeModeInfo **modes; + if(!XF86VidModeGetAllModeLines(m_display, m_screenID, &modeNum, &modes)) { + Debug::logger->message("\nCould not query the video modes."); + return false; + } + + m_XF86DeskMode = *modes[0]; + + int bestMode = - 1; + for(int i = 0; i < modeNum; i++) { + if((modes[i]->hdisplay == width) && (modes[i]->vdisplay == height)) { + bestMode = i; + } + } + + if(bestMode == -1) { + Debug::logger->message("\nCould not find a suitable graphics mode."); + return false; + } + + int doubleBufferedAttribList[] = { + GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_RED_SIZE, 4, + GLX_GREEN_SIZE, 4, + GLX_BLUE_SIZE, 4, + GLX_DEPTH_SIZE, 16, + None + }; + + XVisualInfo* vi = NULL; + // Try to create a double buffered mode. + vi = glXChooseVisual(m_display, m_screenID, doubleBufferedAttribList); + + if(vi == NULL) { + Debug::logger->message("\nCould not create a double buffered window."); + return false; + } + + // Create a GL 2.1 context. + GLXContext gl2Context = glXCreateContext(m_display, vi, 0, GL_TRUE); + + if(gl2Context == NULL) { + Debug::logger->message("\nCould not create a GL 2.1 context, please check your graphics drivers."); + return false; + } + + // Get a pointer to the GL 3.0 context creation. + PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB"); + + if(glXCreateContextAttribs == NULL) { + Debug::logger->message("\nOpenGL 3.0 is not supported, falling back to 2.1."); + m_glContext = gl2Context; + m_GL3Supported = false; + } else { + // Create a GL 3.0 context. + int attribs[] = { + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + GLX_CONTEXT_MINOR_VERSION_ARB, 0, + 0 + }; + + m_glContext = glXCreateContextAttribs(m_display, framebufferConfig, 0, true, &attribs[0]); + // We can destroy the GL 2.0 context once the 3.0 one has been created. + glXDestroyContext(m_display, gl2Context); + m_GL3Supported = true; + } + + Colormap cmap = XCreateColormap(m_display, RootWindow(m_display, vi->screen), vi->visual, AllocNone); + m_XSetAttr.colormap = cmap; + m_XSetAttr.border_pixel = 0; + m_XSetAttr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | + StructureNotifyMask; + + m_XSetAttr.override_redirect = False; + + //unsigned long windowAttributes = CWBorderPixel | CWColormap | CWEventMask; + + if(fullscreen) { + //windowAttributes = CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect; + + XF86VidModeSwitchToMode(m_display, m_screenID, modes[bestMode]); + XF86VidModeSetViewPort(m_display, m_screenID, 0, 0); + m_XSetAttr.override_redirect = true; + } + + m_XWindow = XCreateWindow(m_display, RootWindow(m_display, vi->screen), 0, 0, + width, height, 0, vi->depth, InputOutput, vi->visual, + CWBorderPixel | CWColormap | CWEventMask, &m_XSetAttr); + + string title = "Unuk"; + + if(fullscreen) { + XWarpPointer(m_display, None, m_XWindow, 0, 0, 0, 0, 0, 0); + XMapRaised(m_display, m_XWindow); + XGrabKeyboard(m_display, m_XWindow, true, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer(m_display, m_XWindow, true, ButtonPressMask, GrabModeAsync, + GrabModeAsync, m_XWindow, None, CurrentTime); + + m_isFullscreen = true; + } else { + Atom wmDelete = XInternAtom(m_display, "WM_DELETE_WINDOW", true); + XSetWMProtocols(m_display, m_XWindow, &wmDelete, 1); + XSetStandardProperties(m_display, m_XWindow, title.c_str(), None, 16, NULL, 0, NULL); + XMapRaised(m_display, m_XWindow); + } + + XFree(modes); + + // Let's make the new context current. + glXMakeCurrent(m_display, m_XWindow, m_glContext); + + int posx = 0; + int posy = 0; + Window winDummy; + unsigned int borderDummy; + + m_width = (unsigned) width; + m_height = (unsigned) height; + m_bpp = (unsigned) bpp; + + XGetGeometry(m_display, m_XWindow, &winDummy, + &posx, &posy, &m_width, &m_height, + &borderDummy, &m_bpp); + + // Initialize the time. + m_lastTime = GetTickCount(); + return true; +} + +void GlxWindow::Destroy() { + if(m_glContext) { + glXMakeCurrent(m_display, None, NULL); + glXDestroyContext(m_display, m_glContext); + m_glContext = NULL; + } + + if(m_isFullscreen) { + XF86VidModeSwitchToMode(m_display, m_screenID, &m_XF86DeskMode); + XF86VidModeSetViewPort(m_display, m_screenID, 0, 0); + } + + XCloseDisplay(m_display); +} + +void GlxWindow::ProcessEvents(void) { + GetKeyboard()->Update(); + + XEvent event; + while(XPending(m_display) > 0) { + XNextEvent(m_display, &event); + switch(event.type) { + case Expose: + if(event.xexpose.count != 0) break; + break; + case ConfigureNotify: { + int width = event.xconfigure.width; + int height = event.xconfigure.height; + GetAttachedGame()->OnResize(width, height); + } + break; + case KeyPress: { + if(XLookupKeysym(&event.xkey, 0) == XK_Escape) { + m_isRunning = false; + } + // Register the key press with the keyboard interface. + m_keyboard->HandleKeyDown(m_keyboard->TranslateKey(XLookupKeysym(&event.xkey,0))); + + // -- Big Hack! I will process all events from here. + if(m_keyboard->IsKeyHeldDown(U_w)) { m_player->SetVelocity(1,1); } + } + break; + case KeyRelease: { + UnukKeyCode code = m_keyboard->TranslateKey(XLookupKeysym(&event.xkey,0)); + m_keyboard->HandleKeyUp(code); + } + break; + case ClientMessage: + if(string(XGetAtomName(m_display, event.xclient.message_type)) == string("WM_PROTOCOLS")) { + m_isRunning = false; + } + break; + default: + break; + } + } +} + +float GlxWindow::GetElapsedSeconds(void) { + unsigned int currentTime = GetTickCount(); + unsigned int diff = currentTime - m_lastTime; + m_lastTime = currentTime; + return float(diff) / 1000.0f; +} diff --git a/trunk/src/libUnuk/GlxWindow.h b/trunk/src/libUnuk/GlxWindow.h new file mode 100644 index 0000000..d44fed5 --- /dev/null +++ b/trunk/src/libUnuk/GlxWindow.h @@ -0,0 +1,60 @@ +#ifndef _GLXWINDOW_H_ +#define _GLXWINDOW_H_ +#define GLX_GLXEXT_LEGACY // This must be declared so the local glxext.h is used instead of the system one. +#include +#include +#include +#include +#include +#include +#include "../Libs/glxext.h" + +// Declare some classes. +class Game; +class Player; +class KeyboardInterface; + +class GlxWindow { +public: + GlxWindow(void); + virtual ~GlxWindow(void); + + bool Create(int width, int height, int bpp, bool fullscreen); + void Destroy(void); + void ProcessEvents(void); + void AttachGame(Game* game) { m_game = game; } + + bool IsRunning(void) { return m_isRunning; } + + void SwapBuffers(void) { glXSwapBuffers(m_display, m_XWindow); } + + float GetElapsedSeconds(void); + + KeyboardInterface* GetKeyboard(void) const { return m_keyboard; } + +private: + Game* m_game; + Player* m_player; + bool m_isRunning; + + Game* GetAttachedGame(void) { return m_game; } + + unsigned int m_lastTime; + + Display* m_display; + Window m_XWindow; + GLXContext m_glContext; + XF86VidModeModeInfo m_XF86DeskMode; + XSetWindowAttributes m_XSetAttr; + int m_screenID; + + bool m_isFullscreen; + unsigned int m_width; + unsigned int m_height; + unsigned int m_bpp; + + bool m_GL3Supported; + KeyboardInterface* m_keyboard; +}; + +#endif // _GLXWINDOW_H_ diff --git a/trunk/src/libUnuk/ImageLoader.cpp b/trunk/src/libUnuk/ImageLoader.cpp new file mode 100644 index 0000000..5541acf --- /dev/null +++ b/trunk/src/libUnuk/ImageLoader.cpp @@ -0,0 +1,178 @@ +#include +#include +#include +#include "ImageLoader.h" +#include "Debug.h" +#define BITMAP_TYPE 19778 + +// Initialize an empty image. +ImageLoader::ImageLoader(void) { + Reset(); +} + +// Initializes an image with an image from the disk. +ImageLoader::ImageLoader(const char *filename) { + Reset(); + LoadBMP(filename); +} + +ImageLoader::~ImageLoader(void) { + if(colors != NULL) { + delete [] colors; + } + + if(pixelData != NULL) { + delete [] pixelData; + } +} + +bool ImageLoader::LoadBMP(const char* filename) { + FILE *in = NULL; + bool result = false; + + // Open the file for reading in binary mode. + in = fopen(filename, "rb"); + if(in == NULL) { + perror("Error"); + Debug::logger->message("\nError Number: %d", errno); + return false; + } + + fread(&bmfh, sizeof(BITMAPFILEHEADER), 1, in); + + // Check if this is even the right type of file. + if(bmfh.bfType != BITMAP_TYPE) { + perror("Error"); + Debug::logger->message("\nError Number: %d", errno); + return false; + } + + fread(&bmih, sizeof(BITMAPINFOHEADER), 1, in); + width = bmih.biWidth; + height = bmih.biHeight; + bpp = bmih.biBitCount; + + // TODO: Get this running on 24-bit images too, right now it will seg fault if it is 24-bit. + // Set the number of colors. + LONG numColors = 1 << bmih.biBitCount; + + // The bitmap is not yet loaded. + loaded = false; + // Make sure memory is not lost. + if(colors != NULL) { + delete [] colors; + } + + if(pixelData != NULL) { + delete [] pixelData; + } + + // Load the palette for 8 bits per pixel. + if(bmih.biBitCount < 24) { + colors = new RGBQUAD[numColors]; + fread(colors, sizeof(RGBQUAD), numColors, in); + } + + DWORD size = bmfh.bfSize - bmfh.bfOffBits; + + BYTE *tempPixelData = NULL; + tempPixelData = new BYTE[size]; + + if(tempPixelData == NULL) { + Debug::logger->message("\nError: Out of memory. Cannot find space to load image into memory."); + fclose(in); + return false; + } + + fread(tempPixelData, sizeof(BYTE), size, in); + + result = FixPadding(tempPixelData, size); + loaded = result; + + delete [] tempPixelData; + fclose(in); + + return result; +} + +bool ImageLoader::FixPadding(BYTE const * const tempPixelData, DWORD size) { + // byteWidth is the width of the actual image in bytes. padWidth is + // the width of the image plus the extrapadding. + LONG byteWidth, padWidth; + + // Set both to the width of the image. + byteWidth = padWidth = (LONG)((float)width * (float)bpp / 8.0); + + // Add any extra space to bring each line to a DWORD boundary. + short padding = padWidth % 4 != 0; + padWidth += padding; + + DWORD diff; + int offset; + + height = bmih.biHeight; + // Set the diff to the actual image size (without any padding). + diff = height * byteWidth; + // allocate memory for the image. + pixelData = new BYTE[diff]; + + if(pixelData == NULL) { + return false; + } + + // =================================================================== + // Bitmap is inverted, so the paddind needs to be removed and the + // image reversed. Here you can start from the back of the file or + // the front, after the header. The only problem is that some programs + // will pad not only the data, but also the file size to be divisiaible + // by 4 bytes. + // =================================================================== + if(height > 0) { + offset = padWidth - byteWidth; + for(unsigned int i = 0; i < size - 2; i += 4) { + if((i + 1) % padWidth == 0) { + i += offset; + } + // Now we need to swap the data for it to have the right order. + *(pixelData + i) = *(tempPixelData + i + 2); // R + *(pixelData + i + 1) = *(tempPixelData + i + 1); // G + *(pixelData + i + 2) = *(tempPixelData + i); // B + *(pixelData + i + 3) = *(tempPixelData + i + 3); // A + } + } else { + // The image is not reserved. Only the padding needs to be removed. + height = height * -1; + offset = 0; + while(offset < height) { + memcpy((pixelData + (offset * byteWidth)), (tempPixelData + (offset * padWidth)), byteWidth); + offset++; + } + } + return true; +} + +void ImageLoader::Reset(void) { + width = 0; + height = 0; + pixelData = NULL; + colors = NULL; + loaded = false; +} + +// Get the alpha channel as an array of bytes. +// The size of the array will return -1 on failure. +BYTE *ImageLoader::GetAlpha() const { + LONG arraySize = width * height; + BYTE *array = new BYTE[arraySize]; + + if(array == NULL) { + delete [] array; + return NULL; + } + + for(long i = 0; i < arraySize; i++) { + // Jump to the alpha and extract it everytime. + array[i] = pixelData[i * 4 + 3]; + } + return array; +} diff --git a/trunk/src/libUnuk/ImageLoader.h b/trunk/src/libUnuk/ImageLoader.h new file mode 100644 index 0000000..ced4325 --- /dev/null +++ b/trunk/src/libUnuk/ImageLoader.h @@ -0,0 +1,76 @@ +// =================================================================== +// This image loader will read in a 32-bit bitmap. +// =================================================================== + +#ifndef _IMAGELOADER_H_ +#define _IMAGELOADER_H_ + +typedef unsigned char BYTE; +typedef int LONG; +typedef unsigned int DWORD; +typedef unsigned short WORD; + +// Provides general information about the file. +typedef struct __attribute__ ((__packed__)) tagBITMAPFILEHEADER { + WORD bfType; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; +} BITMAPFILEHEADER, *PBITMAPFILEHEADER; + +// The information header provides information specific to the image data. +typedef struct __attribute__ ((__packed__)) tagBITMAPINFOHEADER { + DWORD biSize; + LONG biWidth; + LONG biHeight; + WORD biPlanes; + WORD biBitCount; + DWORD biCompression; + DWORD biSizeImage; + DWORD biXPelsPerMeter; + DWORD biYPelsPerMeter; + DWORD biCLRUsed; + DWORD biCLRImportant; +} BITMAPINFOHEADER, *PBITAPINFOHEADER; + +// Color palette. +typedef struct __attribute__ ((__packed__)) tagRGBQUAD { + BYTE rbgBlue; + BYTE rgbGreen; + BYTE rgbRed; + BYTE rgbReserved; +} RGBQUAD; + +class ImageLoader { +public: + ImageLoader(void); + ImageLoader(const char *filename); + + virtual ~ImageLoader(void); + + bool LoadBMP(const char *filename); + BYTE *GetAlpha(void) const; + + LONG GetHeight(void) const { return height; } + RGBQUAD *GetColors(void) const { return colors; } + bool GetLoaded(void) const { return loaded; } + BYTE *GetPixelData(void) const { return pixelData; } + LONG GetWidth(void) const { return width; } + +private: + BITMAPFILEHEADER bmfh; + BITMAPINFOHEADER bmih; + RGBQUAD *colors; + BYTE *pixelData; + bool loaded; + LONG width; + LONG height; + WORD bpp; + + // Private methods. + void Reset(void); + bool FixPadding(BYTE const * const tempPixelData, DWORD size); +}; + +#endif diff --git a/trunk/src/libUnuk/KeyboardInterface.h b/trunk/src/libUnuk/KeyboardInterface.h new file mode 100644 index 0000000..1fdc6eb --- /dev/null +++ b/trunk/src/libUnuk/KeyboardInterface.h @@ -0,0 +1,31 @@ +#ifndef _KEYBOARDINTERFACE_H_ +#define _KEYBOARDINTERFACE_H_ + +enum UnukKeyCode { + U_INVALID, + U_UP, + U_DOWN, + U_LEFT, + U_RIGHT, + U_SPACE, + U_w, + U_a, + U_s, + U_d, + U_MAX_KEYS +}; + +class KeyboardInterface { +public: + virtual ~KeyboardInterface(void) {} + virtual bool IsKeyPressed(UnukKeyCode code) = 0; + virtual bool IsKeyHeldDown(UnukKeyCode code) = 0; + + virtual void HandleKeyDown(UnukKeyCode code) = 0; + virtual void HandleKeyUp(UnukKeyCode code) = 0; + // Translate The operating systems key, to a keycode. + virtual UnukKeyCode TranslateKey(unsigned int code) = 0; + virtual void Update(void) = 0; +}; + +#endif diff --git a/trunk/src/libUnuk/Makefile b/trunk/src/libUnuk/Makefile new file mode 100644 index 0000000..f4ae796 --- /dev/null +++ b/trunk/src/libUnuk/Makefile @@ -0,0 +1,18 @@ +CC = g++ +CFLAGS = -ansi -Wall -g +LDADD = -lGL -lGLU -lSDL +objects = Debug.o GlxWindow.o ImageLoader.o Sprite.o Vec2.o Input.o\ + +.PHONY: default all clean + +default: all + +%.cpp: %.h + +%.o: %.cpp + $(CC) $(CFLAGS) -c -o $@ $< + +all: $(objects) + +clean: + rm -f $(objects) diff --git a/trunk/src/libUnuk/Node.h b/trunk/src/libUnuk/Node.h new file mode 100644 index 0000000..806f8d7 --- /dev/null +++ b/trunk/src/libUnuk/Node.h @@ -0,0 +1,48 @@ +#ifndef _NODE_H_ +#define _NODE_H_ +#include + +#ifndef NULL +#define NULL 0 +#endif + +#define NL_ADDOPEN 0 +#define NL_STARTOPEN 1 +#define NL_DELETEOPEN 2 +#define NL_ADDCLOSED 3 + +#define NC_INITIALADD 0 +#define NC_OPENADD_UP 1 +#define NC_OPENADD 2 +#define NC_CLOSEDADD_UP 3 +#define NC_CLOSEADD 4 +#define NC_NEWADD 5 + +class Node { +public: + Node(int posx = -1, int posy = -1) : x(posx), y(posy), id(0), numChildren(0) { + parent = next = NULL; + memset(children, 0, sizeof(children)); + } + + // Fitness, goal, heuristic. + int f, g, h; + // Position x and y. + int x, y; + int numChildren; // x*m_rows+y + int id; + + Node *parent; + Node *next; + // Square tiles. + Node *children[8]; +}; + +struct Stack { + Node *data; + Stack *next; +}; + +typedef int(*Func) (Node *, Node *, int, void *); + +#endif diff --git a/trunk/src/libUnuk/Sprite.cpp b/trunk/src/libUnuk/Sprite.cpp new file mode 100644 index 0000000..ba86936 --- /dev/null +++ b/trunk/src/libUnuk/Sprite.cpp @@ -0,0 +1,249 @@ +#include +#include +#include +#include "Sprite.h" +#include "ImageLoader.h" +#include "Debug.h" + +Sprite::Sprite(string filename) { + image = new ImageLoader(filename.c_str()); + angle = 0; + x = 0.0f; + y = 0.0f; + SetPivot(0.0f, 0.0f); + SetScale(1.0f, 1.0f); +} + +Sprite::~Sprite(void) { + delete image; +} + +// Enable 2D drawing mode to draw our sprites. This function MUST be +// called before any sprite is drawn on screen using the Draw method. +void Sprite::Enable2D(void) { + GLint iViewport[4]; + + // Get a copy of the viewport. + glGetIntegerv(GL_VIEWPORT, iViewport); + glPushMatrix(); + glLoadIdentity(); + + // Save a copy of the projection atrix so that we can restore + // it when it's time to do 3D rendering again. + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + // Set upt the orthographic projection. + glOrtho( iViewport[0], iViewport[0] + iViewport[2], + iViewport[1] + iViewport[3], iViewport[1], -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + // Make sure depth testing and lighting are disabled for 2D rendering + //until we are finished rendering in 2D. + glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); +} + +// Disables the 2D drawing. This can be called before you are done +// drawing all 2D sprites on screen using the Draw method. +void Sprite::Disable2D(void) { + glPopAttrib(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + +// Initializes extensions, textures, render states, etc. before rendering. +void Sprite::InitScene(void) { + // Disable lighting. + glDisable(GL_LIGHTING); + // Disable dithering. + glDisable(GL_DITHER); + // Disable blending (for now). + glDisable(GL_BLEND); + // Disable depth testing. + glDisable(GL_DEPTH_TEST); + + // Is the extension supported on this driver/card? + if(!IsExtensionSupported("GL_ARB_texture_rectangle")) { + Debug::logger->message("\nERROR: Texture rectangles not supported on this video card!"); + exit(-1); + } + + // TODO: + // If your machine does not support GL_NV_texture_rectangle, you can try + // using GL_EXT_texture_rectangle. Maybe I will run a test so I can support both. + + // Enable the texture rectangle extension. + glEnable(GL_TEXTURE_RECTANGLE_ARB); + + // Generate one texture ID. + glGenTextures(1, &textureID); + // Bind the texture using GL_TEXTURE_RECTANGLE_NV + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureID); + // Enable bilinear filtering on this texture. + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + // Write the 32-bit RGBA texture buffer to video memory. + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, image->GetWidth(), image->GetHeight(), + 0, GL_RGBA, GL_UNSIGNED_BYTE, image->GetPixelData()); +} + +// ================================================================= +// Set the pivot point in relation to the sprite itself, that is +// using the object coordinates system. In this coordinate system +// the bottom left point of the object is at (0,0) and the top +// right is at (1,1). +// +// Example: To set the pivot to be in the middle of the sprite use +// (0.5, 0.5) default values are (1,1). +// pivotX can be any value, but when x is in the range [0,1] the +// pivot is inside the sprite where 0 is the left edge of the sprite +// and 1 is the right edge of the sprite. +// pivotY is the same as pivotX but when y is in the range of [0,1] +// the pivot is inside the sprite where 0 is the bottom edge of the +// sprite and 1 is the top edge of the sprite. +// ================================================================= +void Sprite::SetPivot(GLfloat pivotX, GLfloat pivotY) { + GLfloat deltaPivotX = pivotX - GetPivotX(); + GLfloat deltaPivotY = pivotY - GetPivotY(); + + this->pivotX = pivotX; + this->pivotY = pivotY; + + x += deltaPivotX * image->GetWidth(); + y += deltaPivotY * image->GetHeight(); +} + +// ================================================================= +// Sets the pivot to be at the point where object's pivot is set. +// obj is the reference object to whose pivot we will set this pivot +// to be. +// Note: If the obj pivot changes or the obj moves after the SetPivot +// call has been issued, the pivot of this object will not reflect these +// changes. You must call SetPivot again with that object to update the +// pivot information. +// ================================================================= +void Sprite::SetPivot(const Sprite &obj) { + // This x location if the pivot was at SetPivot(0, 0); + GLint worldX; + // This y location it the pivot was at SetPivot(0, 0); + GLint worldY; + GLfloat newPivotX; + GLfloat newPivotY; + + worldX = x - GetPivotX() * image->GetWidth(); + worldY = y - GetPivotY() * image->GetHeight(); + + newPivotX = (float)(obj.x - worldX) / image->GetWidth(); + newPivotY = (float)(obj.y - worldY) / image->GetHeight(); + + SetPivot(newPivotX, newPivotY); +} + +// Help determine if an OpenGL extension is supported on the target machine +// at runtime. +bool Sprite::IsExtensionSupported(const char *extension) const { + const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + // Extension names should not have spaces. + where = (GLubyte *) strchr(extension, ' '); + + if (where || *extension == '\0') { + return false; + } + + extensions = glGetString(GL_EXTENSIONS); + + // It takes a bit of care to be fool-proof about parsing the + // OpenGL extensions string. Don't be fooled by sub-strings, etc. + start = extensions; + + for (;;) { + where = (GLubyte *) strstr((const char *) start, extension); + + if (!where) { + break; + } + + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return true; + } + } + + start = terminator; + } + + return false; +} + +void Sprite::Render(void) { + InitScene(); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_TEXTURE_2D); + + // Set the primitive color to white + glColor3f(1.0f, 1.0f, 1.0f); + // Bind the texture to the polygons + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureID); + + glPushMatrix(); + + GLfloat transX = 1; + GLfloat transY = 1; + + if(x != 0.0) { + transX = x; + } + + if(y != 0.0) { + transY = y; + } + + glLoadIdentity(); + glTranslatef(transX, transY, 0); + glScalef(scaleX, scaleY, 1.0); + glRotatef(angle, 0.0, 0.0, 1.0); + + // ================================================================= + // Render a quad + // Instead of the using (s,t) coordinates, with the GL_NV_texture_rectangle + // extension, you need to use the actual dimensions of the texture. + // This makes using 2D sprites for games and emulators much easier now + // that you won't have to convert :) + // + // convert the coordinates so that the bottom left corner changes to + // (0, 0) -> (1, 1) and the top right corner changes from (1, 1) -> (0, 0) + // we will use this new coordinate system to calculate the location of the sprite + // in the world coordinates to do the rotation and scaling. This mapping is done in + // order to make implementation simpler in this class and let the caller keep using + // the standard OpenGL coordinates system (bottom left corner at (0, 0)) + // ================================================================= + glBegin(GL_QUADS); + glTexCoord2i(0, 0); + glVertex2i(-pivotX * image->GetWidth(), -pivotY * image->GetHeight()); + + glTexCoord2i(0, image->GetHeight()); + glVertex2i(-pivotX * image->GetWidth(), (1 - pivotY) * image->GetHeight()); + + glTexCoord2i(image->GetWidth(), image->GetHeight()); + glVertex2i( (1 - pivotX) * image->GetWidth(), (1 - pivotY) * image->GetHeight()); + + glTexCoord2i(image->GetWidth(), 0); + glVertex2i( (1 - pivotX) * image->GetWidth(), -pivotY * image->GetHeight()); + glEnd(); + + glPopMatrix(); +} diff --git a/trunk/src/libUnuk/Sprite.h b/trunk/src/libUnuk/Sprite.h new file mode 100644 index 0000000..e9dfcb4 --- /dev/null +++ b/trunk/src/libUnuk/Sprite.h @@ -0,0 +1,64 @@ +#ifndef _SPRITE_H_ +#define _SPRITE_H_ +#include +#include +#include "ImageLoader.h" + +using namespace std; + +class ImageLoader; + +class Sprite { +public: + static void Enable2D(void); + + static void Disable2D(void); + + Sprite(string filename); + virtual ~Sprite(void); + + virtual void Render(void); + virtual void Rotate(GLint degrees) { angle += degrees; } + + // Mutators. + GLint GetAngle(void) const { return angle; } + void SetAngle(GLint angle) { this->angle = angle; } + void SetX(GLdouble x) { this->x = x; } + void SetY(GLdouble y) { this->y = y; } + GLint GetHeight(void) const { return image->GetHeight() * scaleY; } + GLint GetWidth(void) const { return image->GetWidth() * scaleX; } + + void SetPivot(GLfloat pivotX, GLfloat pivotY); + GLfloat GetPivotX(void) const { return pivotX; } + GLfloat GetPivotY(void) const { return pivotY; } + + GLdouble GetX(void) const { return x; } + GLdouble GetY(void) const { return y; } + + void SetPivot(const Sprite &obj); + + + // ================================================================= + // Set the scale of the object. A scale of (1.0,1.0) means the sprite + // maintains its original size. Values larger than 1 scales the sprite + // up while values less than 1 shrink it down. + // ================================================================= + void SetScale(GLfloat x, GLfloat y) { scaleX = x, scaleY = y; } + +private: + ImageLoader *image; + GLuint textureID; + GLint angle; + GLdouble x; + GLdouble y; + GLfloat pivotX; + GLfloat pivotY; + GLfloat scaleX; + GLfloat scaleY; + + void InitScene(void); + + bool IsExtensionSupported(const char *extension) const; +}; + +#endif diff --git a/trunk/src/libUnuk/Vec2.cpp b/trunk/src/libUnuk/Vec2.cpp new file mode 100644 index 0000000..d3a3fce --- /dev/null +++ b/trunk/src/libUnuk/Vec2.cpp @@ -0,0 +1,55 @@ +#include "Vec2.h" + +/// Get a 0.0 vector. +Vec2 Vec2::Zero() { return Vec2(0.0f, 0.0f); } + +Vec2::Vec2(void) { + x = 0; + y = 0; +} + +Vec2::Vec2(float xValue, float yValue) { + x = xValue; + y = yValue; +} + +Vec2::Vec2(const Vec2 &v) { + x = v.x; + y = v.y; +} + +Vec2::~Vec2(void) { + x = 0; + y = 0; +} + +Vec2& Vec2::operator =(const Vec2 &v) { + x = v.x; + y = v.y; + return *this; +} + +Vec2& Vec2::operator+=(const Vec2 &v) { + x += v.x; + y += v.y; + return *this; +} + +Vec2& Vec2::operator-=(const Vec2 &v) { + x -= v.x; + y -= v.y; + return *this; +} + +Vec2& Vec2::operator*=(float c) { + x *= c; + y *= c; + return *this; +} + +/// Multiply by a vector2. +Vec2& Vec2::operator*=(const Vec2 &v) { + x *= v.x; + y *= v.y; + return *this; +} diff --git a/trunk/src/libUnuk/Vec2.h b/trunk/src/libUnuk/Vec2.h new file mode 100644 index 0000000..fbade18 --- /dev/null +++ b/trunk/src/libUnuk/Vec2.h @@ -0,0 +1,33 @@ +#ifndef _VEC2_H_ +#define _VEC2_H_ + +class Vec2 +{ +public: + static Vec2 Zero(); + Vec2(void); + Vec2(float xValue, float yValue); + Vec2(const Vec2 &v); + ~Vec2(void); + + // the operators are required to allow the system to understand how to compute mathematical problems + // Copy operator + Vec2& operator=(const Vec2 &v); + + // Addition operator + Vec2& operator+=(const Vec2 &v); + + // Subtraction operator + Vec2& operator-=(const Vec2 &v); + + // Multiply by a scalar + Vec2& operator*=(float c); + + // Multiply by a vector2. + Vec2& operator*=(const Vec2 &v); + + float x; + float y; +}; + +#endif diff --git a/trunk/src/libUnuk/Win32Window.cpp b/trunk/src/libUnuk/Win32Window.cpp new file mode 100644 index 0000000..7bb4714 --- /dev/null +++ b/trunk/src/libUnuk/Win32Window.cpp @@ -0,0 +1,250 @@ +#include +#include +#include +#include +#include "../Libs/wglext.h" +#include "Win32Window.h" +#include "../Unuk/Game.h" + +typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC, HGLRC, const int*); +PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; + +Win32Window::Win32Window(HINSTANCE hInstance) { + m_isRunning = false; + m_game = NULL; + m_hinstance = hInstance; + m_lastTime = 0; +} + +Win32Window::~Win32Window(void) { + +} + +bool Win32Window::Create(int width, int height, int bpp, bool fullscreen) { + DWORD dwExStyle; + DWORD dwStyle; + + m_isFullscreen = fullscreen; + + // Set up the window values. + m_windowRect.left = (long) 0; + m_windowRect.right = (long) width; + m_windowRect.top = (long) 0; + m_windowRect.bottom = (long) height; + + // Set up the window class structure. + m_windowClass.cbSize = sizeof(WNDCLASSEX); + m_windowClass.style = CS_HREDRAW | CS_VREDRAW; + m_windowClass.lpfnWndProc = Win32Window::StaticWndProc; // Our static method is the event handler. + m_windowClass.cbClsExtra = 0; + m_windowClass.cbWndExtra = 0; + m_windowClass.hInstance = m_hinstance; + m_windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); + m_windowClass.hCurser = LoadCursor(NULL, IDC_ARROW); + m_windowClass.hbrBackground = NULL; + m_windowClass.lpszMenuName = NULL; + m_windowClass.lpszClassName = "Unuk"; + m_windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO); + + // Register the window class. + if(!RegisterClassEx(&m_windowClass)) { + return false; + } + + // We need to change the display mode if we are running fullscreen. + if(m_isFullsceen) { + // This is the device mode. + DEVMODE dmScreenSettings; + memset(&dmScreenSettings, 0, sizeof(smScreenSettings)); + dmScreenSettings.dmSize = sizeof(dmScreenSettings); + + // Set the screen width/height/bpp. + dmScreenSettings.dmPelsWidth = width; + dmScreenSettings.dmPelsHeight = height; + dmScreenSettings.dmBitsPerPel = bpp; + dmScreenSettings.dwFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + + if(ChangeDisplaySettings(&dScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { + // Setting display mode failed, we will switch to windowed mode. + MessageBox(NULL, "Display mode failed", NULL, MB_OK); + m_isFullscreen = false; + } + } + + // Check to see if we are still in fullscreen mode. + if(m_fullscreen) { + dwExStyle = WS_EX_APPWINDOW; + dwStyle = WS_POPUP; + ShowCursor(false); + } else { + // fullscreen mode must have failed. + dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; + dwStyle = WS_OVERLAPPEDWINDOW + } + + // Adjusted the window to the requested size. + AdjustWindowRectEx(&m_windowRect, swStyle, false, dwExStyle); + + // Now the class is regestered we can finaly create the window. + m_hWnd = CreateWindowEx(NULL, "Unuk", dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, + m_windowRect.right - m_windowRect.left, m_windowRect.bottom - m_windowRect.top, + NULL, NULL, m_hinstance, this); + + // Let's make sure the window creation went as planned. + if(!m_hWnd) return 0; + + m_hdc = GetDC(m_hWnd); + + // We know everything is ok, display and update the window now. + ShowWindow(m_hWnd, SW_SHOW); + UpdateWindow(m_hWnd); + + m_lastTime = GetTickCount() / 1000.0f; + return true; +} + +void Win32Window::Destroy(void) { + // If we are in fullscreen we want to switch back to desktop, and show the mouse cursor. + if(m_isFullscreen) { + ChangeDisplaySettings(NULL, 0); + ShowCursor(true); + } +} + +void Win32Window::AttachGame(Game* game) { + m_game = game; +} + +bool Win32Window::IsRunning(void) { + return m_isRunning; +} + +void Win32Window::ProccessEvents(void) { + MSG msg; + + // While there are messages in the queue, store them in msg. + while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + // Process the messages one at a time. + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + +void Win32Window::SetupPixelFormat(void) { + int pixelFormat; + + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // Size. + 1, // Version. + PFD_SUPPORT_OPENGL | // OpenGL window. + PFD_DRAW_TO_WINDOW | // Render to window. + PFD_DOUBLEBUFFER, // Double buffer. + PFD_TYPE_RGBA, // Color type. + 32, // Color Depth. + 0, 0, 0, 0, 0, 0, // Color bits (ignored). + 0, // No alpha buffer. + 0, // Alpha bits (ignored). + 0, // No accumulation buffer. + 0, 0, 0, 0, // Accumulation bits (ignored). + 16, // Depth buffer. + 0, // No stencil buffer. + 0, // No auxiliary buffers. + PFD_MAIN_PLANE, // Main layer. + 0, // Reserved. + 0, 0, 0, // No layer, visible, damage masks. + }; + + pixelFormat = ChoosePixelFormat(m_hdc, &pfd); + SetPixelFormat(m_hdc, pixelFormat, &pfd); +} + +LRESULT Win32Window::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + switch(uMsg) { + // Create the window. + case WM_CREATE: + m_hdc = GetDC(hWnd); + SetupPixelFormat(); + + // Setup the OpenGL version. We want to use 3.0. + int attribs[] = { + WGL_CONTEXT_MAJOR_VERSION_ARB, 3, + WGL_CONTEXT_MINOR_VERSION_ARB, 0, + 0 + }; + + // Create a temporary context so we can get a pointer to the function. + HGLRC tmpContext = wglCreateContext(m_hdc); + // Make it the current. + wglMakeCurrent(m_hdc, tmpContext); + + // Get the function pointer. + wglCreateContextAttribsARB = (PFNWGLCCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB"); + + // If it is NULL, then GL 3.0 is not supported. + if(!wglCreateContextAttribsARB) { + Debug::logger->message("\nOpenGL 3.0 is not supported, falling back to GL 2.1"); + m_hglrc = tmpContext; + } else { + // Create an OpenGL 3.0 context using the new function. + m_hglrc = wglCreateContextAttribsARB(m_hdc, 0, attribs); + // Delete then temp context. + wglDeleteContext(tmpContext); + } + + // Make the GL3 context current. + wglMakeCurrent(m_hdc, m_hglrc); + // Our window is now running. + m_isRunning = true; + break; + case WM_DESTROY: + case WM_CLOSE: + wglMakeCurrent(m_hdc, NULL); + wglDeleteContext(m_hglrc); + m_isRunning = false; + PostQuitMessage(0); + return 0; + break; + case WM_SIZE: + // Get the width and height. + int height = HIWORD(lParam); + int width = LOWORD(lParam); + getAttachedExample()->onResize(width, height); + break; + case WM_KEYDOWN: + // If we detect the escape key, then please close the window. + if(wParam == VK_ESCAPE) { + DestroyWindow(m_hwnd); + } + break; + default: + break; + } + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} + +LRESULT CALLBACK Win32Window::StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + Win32Window* window = NULL; + + // If we see the create message. + if(uMsg == WM_CREATE) { + // Then get the pointer we stored during create. + window = (Win32Window)(LPCREATESTRUCT)lParam)->lpCreateParams; + // Associate the window pointer with the hWnd for the other events to access. + SetWindowLongPtr(hWnd, GWL_USERDAA, (LONG_PTR)window); + } else { + // If this aint a creation event, then we should have stored a pointer to the window. + window = (Win32Window)GetWindowLongPtr(hWnd, GWL_USERDATA); + if(!window) { + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + } + // Call our window's member WndProc (allows us to access member variables). + return window->WndProc(hWnd, uMsg, wParam, lParam) +} + +float Win32Window::getElapsedSeconds() { + float currentTime = float(GetTickCount()) / 1000.0f; + float seconds = float(currentTime - m_lastTime); + m_lastTime = currentTime; + return seconds; +} diff --git a/trunk/src/libUnuk/Win32Window.h b/trunk/src/libUnuk/Win32Window.h new file mode 100644 index 0000000..cefcd36 --- /dev/null +++ b/trunk/src/libUnuk/Win32Window.h @@ -0,0 +1,54 @@ +#ifndef _WIN32WINDOW_H_ +#define _WIN32WINDOW_H_ +#include +#include + +class Game; // Declaration of our Game class. + +class Win32Window { +public: + // Default constructor/deconstructor. + Win32Window(HINSTANCE hInstance); + ~Win32Window(void); + + bool Create(int width, int height, int bpp, bool fullscreen); + void Destroy(); + void ProcessEvents(); + void AttachGame(Game* game); + + // Is the window running? + bool IsRunning(); + + void SwapBuffers() { SwapBuffers(m_hdc); } + + static LRESULT CALLBACK StaticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + + float GetElapsedSeconds(); + +private: + // Pointer to the game class. + Game* m_game; + // Is the window still running? + bool m_isRunning; + bool m_fullscreen; + + // Window handle. + HWND m_hWnd; + // This is our rendering context. + HGLRC m_hglrc; + // The device context. + HDC m_hdc; + // Window bounds. + RECT m_windowRect; + // Application instance. + HINSTANCE m_hinstance; + WNDCLASSEX m_windowClass; + + void SetupPixelFormat(void); + Game* GetAttachedGame() { return m_game; } + + float m_lastTime; +}; + +#endif // _WIN32WINDOW_H_ diff --git a/trunk/src/libUnuk/XKeyboardInterface.h b/trunk/src/libUnuk/XKeyboardInterface.h new file mode 100644 index 0000000..dbb1ffb --- /dev/null +++ b/trunk/src/libUnuk/XKeyboardInterface.h @@ -0,0 +1,81 @@ +#ifndef XKEYBOARDINTERFACE_H +#define XKEYBOARDINTERFACE_H +#ifdef __unix__ +#include +#include "KeyboardInterface.h" +#include "Debug.h" + +class XKeyboardInterface : public KeyboardInterface { +public: + XKeyboardInterface(void) { + for(int i = 0; i < U_MAX_KEYS; ++i) { + m_keyState[i] = 0; + m_lastKeyState[i] = 0; + } + } + + virtual bool IsKeyPressed(UnukKeyCode code) { + return(m_lastKeyState[code] && m_keyState[code] == 1); + } + + virtual bool IsKeyHeldDown(UnukKeyCode code) { + return(m_lastKeyState[code] && m_keyState[code]); + } + + virtual void HandleKeyDown(UnukKeyCode code) { + m_keyState[code] = 1; + } + + virtual void HandleKeyUp(UnukKeyCode code) { + m_keyState[code] =0; + } + + UnukKeyCode TranslateKey(unsigned int code) { + switch(code) { + case XK_Up: + return U_UP; + break; + case XK_Down: + return U_DOWN; + break; + case XK_Left: + return U_LEFT; + break; + case XK_Right: + return U_RIGHT; + break; + case XK_space: + return U_SPACE; + break; + case XK_w: + return U_w; + break; + case XK_a: + return U_a; + break; + case XK_s: + return U_s; + break; + case XK_d: + return U_d; + break; + default: + Debug::logger->message("Warning: Can not translate this key"); + return U_INVALID; + } + } + + void Update(void) { + // Copy the current key to the last key state. + memcpy(m_lastKeyState, m_keyState, sizeof(short) * U_MAX_KEYS); + } + +private: + short m_keyState[U_MAX_KEYS]; + short m_lastKeyState[U_MAX_KEYS]; +}; + +// __unix__ +#endif +// XKEYBOARDINTERFACE_H +#endif