*** empty log message ***
This commit is contained in:
parent
2e30eff2a5
commit
13edf0ce99
|
@ -108,6 +108,7 @@ public final class Sys {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name of the native library to load
|
* @return the name of the native library to load
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -149,7 +149,7 @@ public abstract class Window {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimize the game and allow the operating system's default display to become
|
* Minimize the game and allow the operating system's default display to become
|
||||||
* visible. It is NOT the responsibility of LWJGL's native code to restore the display
|
* visible. It is the responsibility of LWJGL's native code to restore the display
|
||||||
* to its normal display settings.
|
* to its normal display settings.
|
||||||
*
|
*
|
||||||
* If the display is already minimized then this is a no-op.
|
* If the display is already minimized then this is a no-op.
|
||||||
|
@ -157,7 +157,7 @@ public abstract class Window {
|
||||||
public final native void minimize();
|
public final native void minimize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the game and hide the operating system away. It is NOT the responsibility of
|
* Restore the game and hide the operating system away. It is the responsibility of
|
||||||
* LWJGL's native code to restore the display to its game display settings.
|
* LWJGL's native code to restore the display to its game display settings.
|
||||||
*
|
*
|
||||||
* If the display is not minimized then this is a no-op/
|
* If the display is not minimized then this is a no-op/
|
||||||
|
|
|
@ -47,87 +47,90 @@ import java.util.StringTokenizer;
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public abstract class BaseAL {
|
public abstract class BaseAL {
|
||||||
/** Have we been created? */
|
/** Have we been created? */
|
||||||
protected static boolean created;
|
protected static boolean created;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override to provide any initialization code after creation.
|
* Override to provide any initialization code after creation.
|
||||||
*/
|
*/
|
||||||
protected void init() throws OpenALException {
|
protected void init() throws OpenALException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static initialization
|
* Static initialization
|
||||||
*/
|
*/
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
||||||
}
|
try {
|
||||||
|
System.loadLibrary("OpenAL32");
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.loadLibrary("openal");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the AL instance
|
* Creates the AL instance
|
||||||
*
|
*
|
||||||
* @throws Exception if a failiure occured in the AL creation process
|
* @throws Exception if a failiure occured in the AL creation process
|
||||||
*/
|
*/
|
||||||
public void create() throws OpenALException {
|
public void create() throws OpenALException {
|
||||||
if (created) {
|
if (created) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to pass path of possible locations of OAL to native side
|
// need to pass path of possible locations of OAL to native side
|
||||||
String libpath = System.getProperty("java.library.path");
|
String libpath = System.getProperty("java.library.path");
|
||||||
String seperator = System.getProperty("path.separator");
|
String seperator = System.getProperty("path.separator");
|
||||||
String libname;
|
String libname;
|
||||||
|
|
||||||
// libname is hardcoded atm - this will change in a near future...
|
// libname is hardcoded atm - this will change in a near future...
|
||||||
libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1)
|
libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) ? "libopenal.so" : "OpenAL32.dll";
|
||||||
? "libopenal.so"
|
|
||||||
: "OpenAL32.dll";
|
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(libpath, seperator);
|
StringTokenizer st = new StringTokenizer(libpath, seperator);
|
||||||
|
|
||||||
//create needed string array
|
//create needed string array
|
||||||
String[] oalPaths = new String[st.countTokens()+1];
|
String[] oalPaths = new String[st.countTokens() + 1];
|
||||||
|
|
||||||
//build paths
|
//build paths
|
||||||
for(int i=0;i<oalPaths.length - 1;i++) {
|
for (int i = 0; i < oalPaths.length - 1; i++) {
|
||||||
oalPaths[i] = st.nextToken() + File.separator + libname;
|
oalPaths[i] = st.nextToken() + File.separator + libname;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add cwd path
|
//add cwd path
|
||||||
oalPaths[oalPaths.length-1] = libname;
|
oalPaths[oalPaths.length - 1] = libname;
|
||||||
if (!nCreate(oalPaths)) {
|
if (!nCreate(oalPaths)) {
|
||||||
throw new OpenALException("AL instance could not be created.");
|
throw new OpenALException("AL instance could not be created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to create AL instance
|
* Native method to create AL instance
|
||||||
*
|
*
|
||||||
* @param oalPaths Array of strings containing paths to search for OpenAL library
|
* @param oalPaths Array of strings containing paths to search for OpenAL library
|
||||||
* @return true if the AL creation process succeeded
|
* @return true if the AL creation process succeeded
|
||||||
*/
|
*/
|
||||||
protected native boolean nCreate(String[] oalPaths);
|
protected native boolean nCreate(String[] oalPaths);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls whatever destruction rutines that are needed
|
* Calls whatever destruction rutines that are needed
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (!created) {
|
if (!created) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
created = false;
|
created = false;
|
||||||
nDestroy();
|
nDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method the destroy the AL
|
* Native method the destroy the AL
|
||||||
*/
|
*/
|
||||||
protected native void nDestroy();
|
protected native void nDestroy();
|
||||||
}
|
}
|
|
@ -174,7 +174,24 @@ void* GetFunctionPointer(const char* function) {
|
||||||
* Loads the OpenAL Library
|
* Loads the OpenAL Library
|
||||||
*/
|
*/
|
||||||
void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
|
void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
|
||||||
jsize pathcount = env->GetArrayLength(oalPaths);
|
|
||||||
|
/*
|
||||||
|
* CAS: Experimental new code for loading OpenAL. We're ignoring the paths
|
||||||
|
* and just trying to load it once.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
handleOAL = LoadLibrary("OpenAL32.dll");
|
||||||
|
#endif
|
||||||
|
#ifdef _X11
|
||||||
|
handleOAL = dlopen("libopenal.so", RTLD_LAZY);
|
||||||
|
#endif
|
||||||
|
#ifdef TARGET_OS_MAC
|
||||||
|
oalInitEntryPoints();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
jsize pathcount = env->GetArrayLength(oalPaths);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Found %d OpenAL paths\n", pathcount);
|
printf("Found %d OpenAL paths\n", pathcount);
|
||||||
#endif
|
#endif
|
||||||
|
@ -201,7 +218,7 @@ void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
env->ReleaseStringUTFChars(path, path_str);
|
env->ReleaseStringUTFChars(path, path_str);
|
||||||
}
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -149,12 +149,18 @@ void closeWindow()
|
||||||
*/
|
*/
|
||||||
void appActivate(bool active)
|
void appActivate(bool active)
|
||||||
{
|
{
|
||||||
|
if (!active) {
|
||||||
|
tempResetDisplayMode();
|
||||||
|
}
|
||||||
if (active) {
|
if (active) {
|
||||||
SetForegroundWindow(hwnd);
|
SetForegroundWindow(hwnd);
|
||||||
ShowWindow(hwnd, SW_RESTORE);
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
} else if (isFullScreen) {
|
} else if (isFullScreen) {
|
||||||
ShowWindow(hwnd, SW_MINIMIZE);
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
}
|
}
|
||||||
|
if (active) {
|
||||||
|
tempRestoreDisplayMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -200,15 +206,11 @@ LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
|
||||||
case WA_CLICKACTIVE:
|
case WA_CLICKACTIVE:
|
||||||
environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE);
|
environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE);
|
||||||
isMinimized = false;
|
isMinimized = false;
|
||||||
// Change to game display settings
|
|
||||||
tempRestoreDisplayMode();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WA_INACTIVE:
|
case WA_INACTIVE:
|
||||||
environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE);
|
environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE);
|
||||||
isMinimized = true;
|
isMinimized = true;
|
||||||
// Restore display settings
|
|
||||||
tempResetDisplayMode();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +415,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_minimize
|
||||||
if (isMinimized)
|
if (isMinimized)
|
||||||
return;
|
return;
|
||||||
ShowWindow(hwnd, SW_MINIMIZE);
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
// tempResetDisplayMode();
|
tempResetDisplayMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -427,6 +429,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_restore
|
||||||
if (!isMinimized)
|
if (!isMinimized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// tempRestoreDisplayMode();
|
tempRestoreDisplayMode();
|
||||||
ShowWindow(hwnd, SW_RESTORE);
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue