diff --git a/src/native/autogen.sh b/src/native/autogen.sh index a606dd28..d4f00d5f 100755 --- a/src/native/autogen.sh +++ b/src/native/autogen.sh @@ -1,4 +1,4 @@ aclocal autoheader -automake --foreign --include-deps --add-missing --copy +automake --foreign --include-deps --add-missing autoconf diff --git a/src/native/common/extal.cpp b/src/native/common/extal.cpp index e04944c7..8a2f28f8 100644 --- a/src/native/common/extal.cpp +++ b/src/native/common/extal.cpp @@ -31,7 +31,6 @@ */ #include -#include #include "extal.h" #ifdef _X11 diff --git a/src/native/common/extal.h b/src/native/common/extal.h index 5d003214..b7ee2cf4 100644 --- a/src/native/common/extal.h +++ b/src/native/common/extal.h @@ -40,10 +40,17 @@ #ifdef _X11 #include #include -#else +#endif +#ifdef _WIN32 #include #include #endif +#ifdef _AGL +#include +#include +#endif + +#include #ifdef __cplusplus extern "C" { diff --git a/src/native/configure.in b/src/native/configure.in index c2afb552..ebfe7f1c 100644 --- a/src/native/configure.in +++ b/src/native/configure.in @@ -26,19 +26,16 @@ else DEBUG_FLAGS= fi -CC="$CXX" -AC_LIBTOOL_DLOPEN -AC_PROG_LIBTOOL +AC_CANONICAL_HOST case "$host_os" in - darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings -I/Library/Frameworks/OpenAL.framework/Headers" - AC_CHECK_HEADER([/Library/Frameworks/OpenAL.framework/Headers/altypes.h],, AC_MSG_ERROR([OpenAL headers required])) - AC_CHECK_HEADER([/Library/Frameworks/OpenAL.framework/Headers/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) + darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings" NATIVE_BUILD_DIR=macosx CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" ;; bsdi* | linux* | solaris*) AC_PATH_XTRA + AC_LIBTOOL_DLOPEN _BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS" AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) NATIVE_BUILD_DIR=linux @@ -49,17 +46,12 @@ case "$host_os" in AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required)) AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required)) AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR(pthread is required)) - ;; *) AC_MSG_ERROR([Unsupported system $host_os]);; esac -AC_SUBST(native_build_dir, [$NATIVE_BUILD_DIR]) - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC +CC="$CXX" +AC_PROG_LIBTOOL AC_JNI_INCLUDE_DIR @@ -68,6 +60,13 @@ do CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR" done +AC_SUBST(native_build_dir, [$NATIVE_BUILD_DIR]) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC + AC_CHECK_HEADER([stddef.h stdlib.h string.h sys/time.h]) # Checks for typedefs, structures, and compiler characteristics. diff --git a/src/native/macosx/Makefile.am b/src/native/macosx/Makefile.am index a220d9eb..753ae240 100644 --- a/src/native/macosx/Makefile.am +++ b/src/native/macosx/Makefile.am @@ -10,7 +10,7 @@ NATIVE = \ # org_lwjgl_input_Keyboard.cpp \ # org_lwjgl_input_Mouse.cpp \ # org_lwjgl_input_Cursor.cpp \ -# org_lwjgl_opengl_Window.cpp \ + org_lwjgl_opengl_Window.cpp # org_lwjgl_opengl_GLCaps.cpp \ # org_lwjgl_opengl_Pbuffer.cpp diff --git a/src/native/macosx/org_lwjgl_opengl_Window.cpp b/src/native/macosx/org_lwjgl_opengl_Window.cpp new file mode 100644 index 00000000..182c41b4 --- /dev/null +++ b/src/native/macosx/org_lwjgl_opengl_Window.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2002 Light Weight Java Game Library Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'Light Weight Java Game Library' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Base OSX functionality for GL. + * + * @author Elias Naur + * @version $Revision$ + */ + +#include +#include + +static WindowRef win_ref; + +/* + * Utility function to throw an Exception + */ +static void throwException(JNIEnv * env, const char * err) +{ + jclass cls = env->FindClass("java/lang/Exception"); + env->ThrowNew(cls, err); + env->DeleteLocalRef(cls); +} + +/* + * Class: org_lwjgl_opengl_Window + * Method: nCreate + * Signature: (Ljava/lang/String;IIIIZIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate(JNIEnv *env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil) { + const Rect rect = {y, x, y + height, x + width}; +/* rect.top = y; + rect.left = x; + rect.bottom = y + height; + rect.right = x + width;*/ + OSStatus status; + + status = CreateNewWindow(kPlainWindowClass, kWindowNoAttributes, &rect, &win_ref); + if (noErr != status) { + throwException(env, "Could not create window"); + return; + } + printf("yir\n"); +} +