removing direct x, can be picked up in the lwjgl-directx tag

This commit is contained in:
Brian Matzon 2007-10-20 19:02:48 +00:00
parent 5a659ac1d9
commit 8ee25e22cd
127 changed files with 1 additions and 14970 deletions

View File

@ -539,7 +539,6 @@
<src path="${lwjgl.src}/generated/"/>
<include name="org/lwjgl/*.java"/>
<include name="org/lwjgl/input/**"/>
<include name="org/lwjgl/d3d/**"/>
<include name="org/lwjgl/opengl/**"/>
<include name="org/lwjgl/openal/**"/>
<include name="org/lwjgl/util/**"/>
@ -584,38 +583,6 @@
<class name="org.lwjgl.opengl.WindowsPeerInfo" />
<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" />
<class name="org.lwjgl.opengl.WindowsContextImplementation" />
<!-- Direct 3D -->
<class name="org.lwjgl.d3d.D3DUtil" />
<class name="org.lwjgl.d3d.IDirect3D9" />
<class name="org.lwjgl.d3d.IDirect3D9Ex" />
<class name="org.lwjgl.d3d.IDirect3DBaseTexture9" />
<class name="org.lwjgl.d3d.IDirect3DCubeTexture9" />
<class name="org.lwjgl.d3d.IDirect3DDevice9" />
<class name="org.lwjgl.d3d.IDirect3DDevice9Ex" />
<class name="org.lwjgl.d3d.IDirect3DIndexBuffer9" />
<class name="org.lwjgl.d3d.IDirect3DPixelShader9" />
<class name="org.lwjgl.d3d.IDirect3DQuery9" />
<class name="org.lwjgl.d3d.IDirect3DResource9" />
<class name="org.lwjgl.d3d.IDirect3DStateBlock9" />
<class name="org.lwjgl.d3d.IDirect3DSurface9" />
<class name="org.lwjgl.d3d.IDirect3DSwapChain9" />
<class name="org.lwjgl.d3d.IDirect3DSwapChain9Ex" />
<class name="org.lwjgl.d3d.IDirect3DTexture9" />
<class name="org.lwjgl.d3d.IDirect3DVertexBuffer9" />
<class name="org.lwjgl.d3d.IDirect3DVertexDeclaration9" />
<class name="org.lwjgl.d3d.IDirect3DVertexShader9" />
<class name="org.lwjgl.d3d.IDirect3DVolume9" />
<class name="org.lwjgl.d3d.IDirect3DVolumeTexture9" />
<class name="org.lwjgl.d3d.WindowsDisplay" />
<class name="org.lwjgl.d3d.WindowsContextImplementation" />
<class name="org.lwjgl.d3d.WindowsDirectInput3" />
<class name="org.lwjgl.d3d.WindowsDirectInputDevice3" />
<class name="org.lwjgl.d3d.WindowsDirectInput8" />
<class name="org.lwjgl.d3d.WindowsDirectInputDevice8" />
<class name="org.lwjgl.d3d.WindowsPeerInfo" />
<class name="org.lwjgl.d3d.WindowsDisplayPeerInfo" />
<class name="org.lwjgl.d3d.WindowsRegistry" />
<class name="org.lwjgl.d3d.WindowsKeyboard" />
</javah>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">

View File

@ -53,7 +53,7 @@
</target>
<target name="compile">
<property name="libs" value="Kernel32.lib ole32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib d3dx9.lib d3d9.lib"/>
<property name="libs" value="Kernel32.lib ole32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib"/>
<antcall target="compile_dir"/>
<antcall target="link"/>
</target>

View File

@ -1,253 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
/**
* <p/>
* Context encapsulates an OpenGL context.
* <p/>
*
* This class is thread-safe.
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2730 $
* $Id: Context.java 2730 2007-01-17 12:58:38Z elias_naur $
*/
final class Context {
/**
* The platform specific implementation of context methods
*/
private final static ContextImplementation implementation;
/** The current Context */
private final static ThreadLocal current_context_local = new ThreadLocal();
/**
* Handle to the native GL rendering context
*/
private final ByteBuffer handle;
private final PeerInfo peer_info;
/** Whether the context has been destroyed */
private boolean destroyed;
private boolean destroy_requested;
/** The thread that has this context current, or null. */
private Thread thread;
static {
Sys.initialize();
implementation = createImplementation();
}
private static ContextImplementation createImplementation() {
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
return new WindowsContextImplementation();
default:
throw new IllegalStateException("Unsupported platform");
}
}
PeerInfo getPeerInfo() {
return peer_info;
}
static Context getCurrentContext() {
return (Context)current_context_local.get();
}
/**
* Create a context with the specified peer info and shared context
*/
public Context(PeerInfo peer_info, Context shared_context) throws LWJGLException {
Context context_lock = shared_context != null ? shared_context : this;
// If shared_context is not null, synchronize on it to make sure it is not deleted
// while this context is created. Otherwise, simply synchronize on ourself to avoid NPE
synchronized (context_lock) {
if (shared_context != null && shared_context.destroyed)
throw new IllegalArgumentException("Shared context is destroyed");
// GLContext.loadOpenGLLibrary();
try {
this.peer_info = peer_info;
this.handle = implementation.create(peer_info, shared_context != null ? shared_context.handle : null);
} catch (LWJGLException e) {
// GLContext.unloadOpenGLLibrary();
throw e;
}
}
}
/**
* Release the current context (if any). After this call, no context is current.
*/
public static void releaseCurrentContext() throws LWJGLException {
Context current_context = getCurrentContext();
if (current_context != null) {
implementation.releaseCurrentContext();
// GLContext.useContext(null);
current_context_local.set(null);
synchronized (current_context) {
current_context.thread = null;
current_context.checkDestroy();
}
}
}
/**
* Release the context from its drawable. This is necessary on some platforms,
* like Mac OS X, where binding the context to a drawable and binding the context
* for rendering are two distinct actions and where calling releaseDrawable
* on every releaseCurrentContext results in artifacts.
*/
public synchronized void releaseDrawable() throws LWJGLException {
if (destroyed)
throw new IllegalStateException("Context is destroyed");
implementation.releaseDrawable(getHandle());
}
/**
* Update the context. Should be called whenever it's drawable is moved or resized
*/
public synchronized void update() {
if (destroyed)
throw new IllegalStateException("Context is destroyed");
implementation.update(getHandle());
}
/**
* Swap the buffers on the current context. Only valid for double-buffered contexts
*/
public static void swapBuffers(PeerInfo peerInfo) throws LWJGLException {
implementation.swapBuffers(peerInfo);
}
private boolean canAccess() {
return thread == null || Thread.currentThread() == thread;
}
private void checkAccess() {
if (!canAccess())
throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current");
}
/**
* Make the context current
*/
public synchronized void makeCurrent() throws LWJGLException {
checkAccess();
if (destroyed)
throw new IllegalStateException("Context is destroyed");
thread = Thread.currentThread();
current_context_local.set(this);
implementation.makeCurrent(peer_info, handle);
// GLContext.useContext(this);
}
ByteBuffer getHandle() {
return handle;
}
/**
* Query whether the context is current
*/
public synchronized boolean isCurrent() throws LWJGLException {
if (destroyed)
throw new IllegalStateException("Context is destroyed");
return implementation.isCurrent(handle);
}
private void checkDestroy() {
if (!destroyed && destroy_requested) {
try {
releaseDrawable();
implementation.destroy(peer_info, handle);
destroyed = true;
thread = null;
// GLContext.unloadOpenGLLibrary();
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while destroying context: " + e);
}
}
}
/**
* Set the buffer swap interval. This call is a best-attempt at changing
* the monitor swap interval, which is the minimum periodicity of color buffer swaps,
* measured in video frame periods, and is not guaranteed to be successful.
*
* A video frame period is the time required to display a full frame of video data.
*
* @param sync true to synchronize; false to ignore synchronization
*/
public static void setSwapInterval(int value) {
implementation.setSwapInterval(value);
}
/**
* Destroy the context. This method behaves the same as destroy() with the extra
* requirement that the context must be either current to the current thread or not
* current at all.
*/
public synchronized void forceDestroy() throws LWJGLException {
checkAccess();
destroy();
}
/**
* Request destruction of the Context. If the context is current, no context will be current after this call.
* The context is destroyed when no thread has it current.
*/
public synchronized void destroy() throws LWJGLException {
if (destroyed)
return;
destroy_requested = true;
boolean was_current = isCurrent();
// int error = GL11.GL_NO_ERROR;
if (was_current) {
// if (GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11)
// error = GL11.glGetError();
releaseCurrentContext();
}
checkDestroy();
// if (was_current && error != GL11.GL_NO_ERROR)
// throw new OpenGLException(error);
}
}

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
/**
* <p/>
* Context implementation interface.
* <p/>
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2356 $
* $Id: ContextImplementation.java 2356 2006-06-07 06:35:52Z elias_naur $
*/
interface ContextImplementation {
/**
* Create a context.
*/
public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException;
/**
* Swap the buffers of the current context. Only valid for double-buffered contexts.
*/
public void swapBuffers(PeerInfo peerInfo) throws LWJGLException;
/**
* Release the context from its drawable, if any.
*/
public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException;
/**
* Release the current context (if any). After this call, no context is current.
*/
public void releaseCurrentContext() throws LWJGLException;
/**
* Update the context. Should be called whenever it's drawable is moved or resized
*/
public void update(ByteBuffer context_handle);
/**
* Query whether the context is current
*/
public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException;
/**
* Query whether the context is current
*/
public boolean isCurrent(ByteBuffer handle) throws LWJGLException;
public void setSwapInterval(int value);
/**
* Destroys the Context.
*/
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException;
}

View File

@ -1,81 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DAdapterIdentifier9 {
public byte Driver[] = new byte[Direct3DConstants.MAX_DEVICE_IDENTIFIER_STRING];//512 char [MAX_DEVICE_IDENTIFIER_STRING]
public byte Description[] = new byte[Direct3DConstants.MAX_DEVICE_IDENTIFIER_STRING];//512 char [MAX_DEVICE_IDENTIFIER_STRING]
public byte DeviceName[] = new byte[32]; //32 char [32]
public long DriverVersion; //8 LARGE_INTEGER
public long VendorId; //4 DWORD
public long DeviceId; //4 DWORD
public long SubSysId; //4 DWORD
public long Revision; //4 DWORD
public GUID DeviceIdentifier = new GUID(); //16 GUID
public long WHQLLevel; //4 DWORD
private static final int D3D_ADAPTER_IDENTIFIER_BYTE_SIZE = 1100;
private ByteBuffer buffer;
public D3DAdapterIdentifier9() {
buffer = ByteBuffer.allocateDirect(D3D_ADAPTER_IDENTIFIER_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.put(Driver);
buffer.put(Description);
buffer.put(DeviceName);
buffer.putLong(DriverVersion);
buffer.putInt((int)VendorId);
buffer.putInt((int)DeviceId);
buffer.putInt((int)SubSysId);
buffer.putInt((int)Revision);
buffer.putInt((int)DeviceIdentifier.Data1);
buffer.putShort(DeviceIdentifier.Data2);
buffer.putShort(DeviceIdentifier.Data3);
buffer.put(DeviceIdentifier.Data4);
buffer.putInt((int)WHQLLevel);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
buffer.get(Driver);
buffer.get(Description);
buffer.get(DeviceName);
DriverVersion = buffer.getLong();
VendorId = buffer.getInt();
DeviceId = buffer.getInt();
SubSysId = buffer.getInt();
Revision = buffer.getInt();
DeviceIdentifier.Data1 = buffer.getInt();
DeviceIdentifier.Data2 = buffer.getShort();
DeviceIdentifier.Data3 = buffer.getShort();
buffer.get(DeviceIdentifier.Data4);
WHQLLevel = buffer.getInt();
}
public String toString() {
return
"\n Driver = " + new String(Driver) +
"\n Description = " + new String(Description) +
"\n DeviceName = " + new String(DeviceName) +
"\nDriverVersion = " + DriverVersion +
"\n VendorId = " + VendorId +
"\n DeviceId = " + DeviceId +
"\n SubSysId = " + SubSysId +
"\n Revision = " + Revision +
"\n WHQLLevel = " + WHQLLevel +
DeviceIdentifier;
}
}

View File

@ -1,10 +0,0 @@
package org.lwjgl.d3d;
public class D3DBox {
public int Left; //UINT
public int Top; //UINT
public int Right; //UINT
public int Bottom; //UINT
public int Front; //UINT
public int Back; //UINT
}

View File

@ -1,327 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DCaps9 {
public int DeviceType; //4 D3DDEVTYPE
public int AdapterOrdinal; //4 UINT
public long Caps; //4 DWORD
public long Caps2; //4 DWORD
public long Caps3; //4 DWORD
public long PresentationIntervals; //4 DWORD
public long CursorCaps; //4 DWORD
public long DevCaps; //4 DWORD
public long PrimitiveMiscCaps; //4 DWORD
public long RasterCaps; //4 DWORD
public long ZCmpCaps; //4 DWORD
public long SrcBlendCaps; //4 DWORD
public long DestBlendCaps; //4 DWORD
public long AlphaCmpCaps; //4 DWORD
public long ShadeCaps; //4 DWORD
public long TextureCaps; //4 DWORD
public long TextureFilterCaps; //4 DWORD
public long CubeTextureFilterCaps; //4 DWORD
public long VolumeTextureFilterCaps; //4 DWORD
public long TextureAddressCaps; //4 DWORD
public long VolumeTextureAddressCaps; //4 DWORD
public long LineCaps; //4 DWORD
public long MaxTextureWidth; //4 DWORD
public long MaxTextureHeight; //4 DWORD
public long MaxVolumeExtent; //4 DWORD
public long MaxTextureRepeat; //4 DWORD
public long MaxTextureAspectRatio; //4 DWORD
public long MaxAnisotropy; //4 DWORD
public float MaxVertexW; //4
public float GuardBandLeft; //4
public float GuardBandTop; //4
public float GuardBandRight; //4
public float GuardBandBottom; //4
public float ExtentsAdjust; //4
public long StencilCaps; //4 DWORD
public long FVFCaps; //4 DWORD
public long TextureOpCaps; //4 DWORD
public long MaxTextureBlendStages; //4 DWORD
public long MaxSimultaneousTextures; //4 DWORD
public long VertexProcessingCaps; //4 DWORD
public long MaxActiveLights; //4 DWORD
public long MaxUserClipPlanes; //4 DWORD
public long MaxVertexBlendMatrices; //4 DWORD
public long MaxVertexBlendMatrixIndex; //4 DWORD
public float MaxPointSize; //4
public long MaxPrimitiveCount; //4 DWORD
public long MaxVertexIndex; //4 DWORD
public long MaxStreams; //4 DWORD
public long MaxStreamStride; //4 DWORD
public long VertexShaderVersion; //4 DWORD
public long MaxVertexShaderConst; //4 DWORD
public long PixelShaderVersion; //4 DWORD
public float PixelShader1xMaxValue; //4
public long DevCaps2; //4 DWORD
public float MaxNpatchTessellationLevel; //4
public long Reserved5; //4 DWORD
public int MasterAdapterOrdinal; //4 UINT
public int AdapterOrdinalInGroup; //4 UINT
public int NumberOfAdaptersInGroup; //4 UINT
public long DeclTypes; //4 DWORD
public long NumSimultaneousRTs; //4 DWORD
public long StretchRectFilterCaps; //4 DWORD
public D3DVShaderCaps2_0 VS20Caps = new D3DVShaderCaps2_0(); //16 D3DVSHADERCAPS2_0
public D3DPShaderCaps2_0 D3DPSHADERCAPS2_0 = new D3DPShaderCaps2_0(); //20 D3DPSHADERCAPS2_0
public long VertexTextureFilterCaps; //4 DWORD
public long MaxVShaderInstructionsExecuted; //4 DWORD
public long MaxPShaderInstructionsExecuted; //4 DWORD
public long MaxVertexShader30InstructionSlots; //4 DWORD
public long MaxPixelShader30InstructionSlots; //4 DWORD
private static final int D3D_CAPS_BYTE_SIZE = 304;
private ByteBuffer buffer;
public D3DCaps9() {
buffer = ByteBuffer.allocateDirect(D3D_CAPS_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(DeviceType);
buffer.putInt(AdapterOrdinal);
buffer.putInt((int)Caps);
buffer.putInt((int)Caps2);
buffer.putInt((int)Caps3);
buffer.putInt((int)PresentationIntervals);
buffer.putInt((int)CursorCaps);
buffer.putInt((int)DevCaps);
buffer.putInt((int)PrimitiveMiscCaps);
buffer.putInt((int)RasterCaps);
buffer.putInt((int)ZCmpCaps);
buffer.putInt((int)SrcBlendCaps);
buffer.putInt((int)DestBlendCaps);
buffer.putInt((int)AlphaCmpCaps);
buffer.putInt((int)ShadeCaps);
buffer.putInt((int)TextureCaps);
buffer.putInt((int)TextureFilterCaps);
buffer.putInt((int)CubeTextureFilterCaps);
buffer.putInt((int)VolumeTextureFilterCaps);
buffer.putInt((int)TextureAddressCaps);
buffer.putInt((int)VolumeTextureAddressCaps);
buffer.putInt((int)LineCaps);
buffer.putInt((int)MaxTextureWidth);
buffer.putInt((int)MaxTextureHeight);
buffer.putInt((int)MaxVolumeExtent);
buffer.putInt((int)MaxTextureRepeat);
buffer.putInt((int)MaxTextureAspectRatio);
buffer.putInt((int)MaxAnisotropy);
buffer.putFloat(MaxVertexW);
buffer.putFloat(GuardBandLeft);
buffer.putFloat(GuardBandTop);
buffer.putFloat(GuardBandRight);
buffer.putFloat(GuardBandBottom);
buffer.putFloat(ExtentsAdjust);
buffer.putInt((int)StencilCaps);
buffer.putInt((int)FVFCaps);
buffer.putInt((int)TextureOpCaps);
buffer.putInt((int)MaxTextureBlendStages);
buffer.putInt((int)MaxSimultaneousTextures);
buffer.putInt((int)VertexProcessingCaps);
buffer.putInt((int)MaxActiveLights);
buffer.putInt((int)MaxUserClipPlanes);
buffer.putInt((int)MaxVertexBlendMatrices);
buffer.putInt((int)MaxVertexBlendMatrixIndex);
buffer.putFloat(MaxPointSize);
buffer.putInt((int)MaxPrimitiveCount);
buffer.putInt((int)MaxVertexIndex);
buffer.putInt((int)MaxStreams);
buffer.putInt((int)MaxStreamStride);
buffer.putInt((int)VertexShaderVersion);
buffer.putInt((int)MaxVertexShaderConst);
buffer.putInt((int)PixelShaderVersion);
buffer.putFloat(PixelShader1xMaxValue);
buffer.putInt((int)DevCaps2);
buffer.putFloat(MaxNpatchTessellationLevel);
buffer.putInt((int)Reserved5);
buffer.putInt(MasterAdapterOrdinal);
buffer.putInt(AdapterOrdinalInGroup);
buffer.putInt(NumberOfAdaptersInGroup);
buffer.putInt((int)DeclTypes);
buffer.putInt((int)NumSimultaneousRTs);
buffer.putInt((int)StretchRectFilterCaps);
buffer.putInt((int)VS20Caps.Caps);
buffer.putInt(VS20Caps.DynamicFlowControlDepth);
buffer.putInt(VS20Caps.NumTemps);
buffer.putInt(VS20Caps.StaticFlowControlDepth);
buffer.putInt((int)D3DPSHADERCAPS2_0.Caps);
buffer.putInt(D3DPSHADERCAPS2_0.DynamicFlowControlDepth);
buffer.putInt(D3DPSHADERCAPS2_0.NumTemps);
buffer.putInt(D3DPSHADERCAPS2_0.StaticFlowControlDepth);
buffer.putInt(D3DPSHADERCAPS2_0.NumInstructionSlots);
buffer.putInt((int)VertexTextureFilterCaps);
buffer.putInt((int)MaxVShaderInstructionsExecuted);
buffer.putInt((int)MaxPShaderInstructionsExecuted);
buffer.putInt((int)MaxVertexShader30InstructionSlots);
buffer.putInt((int)MaxPixelShader30InstructionSlots);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
DeviceType = buffer.getInt();
AdapterOrdinal = buffer.getInt();
Caps = buffer.getInt();
Caps2 = buffer.getInt();
Caps3 = buffer.getInt();
PresentationIntervals = buffer.getInt();
CursorCaps = buffer.getInt();
DevCaps = buffer.getInt();
PrimitiveMiscCaps = buffer.getInt();
RasterCaps = buffer.getInt();
ZCmpCaps = buffer.getInt();
SrcBlendCaps = buffer.getInt();
DestBlendCaps = buffer.getInt();
AlphaCmpCaps = buffer.getInt();
ShadeCaps = buffer.getInt();
TextureCaps = buffer.getInt();
TextureFilterCaps = buffer.getInt();
CubeTextureFilterCaps = buffer.getInt();
VolumeTextureFilterCaps = buffer.getInt();
TextureAddressCaps = buffer.getInt();
VolumeTextureAddressCaps = buffer.getInt();
LineCaps = buffer.getInt();
MaxTextureWidth = buffer.getInt();
MaxTextureHeight = buffer.getInt();
MaxVolumeExtent = buffer.getInt();
MaxTextureRepeat = buffer.getInt();
MaxTextureAspectRatio = buffer.getInt();
MaxAnisotropy = buffer.getInt();
MaxVertexW = buffer.getFloat();
GuardBandLeft = buffer.getFloat();
GuardBandTop = buffer.getFloat();
GuardBandRight = buffer.getFloat();
GuardBandBottom = buffer.getFloat();
ExtentsAdjust = buffer.getFloat();
StencilCaps = buffer.getInt();
FVFCaps = buffer.getInt();
TextureOpCaps = buffer.getInt();
MaxTextureBlendStages = buffer.getInt();
MaxSimultaneousTextures = buffer.getInt();
VertexProcessingCaps = buffer.getInt();
MaxActiveLights = buffer.getInt();
MaxUserClipPlanes = buffer.getInt();
MaxVertexBlendMatrices = buffer.getInt();
MaxVertexBlendMatrixIndex = buffer.getInt();
MaxPointSize = buffer.getFloat();
MaxPrimitiveCount = buffer.getInt();
MaxVertexIndex = buffer.getInt();
MaxStreams = buffer.getInt();
MaxStreamStride = buffer.getInt();
VertexShaderVersion = buffer.getInt();
MaxVertexShaderConst = buffer.getInt();
PixelShaderVersion = buffer.getInt();
PixelShader1xMaxValue = buffer.getFloat();
DevCaps2 = buffer.getInt();
MaxNpatchTessellationLevel = buffer.getFloat();
Reserved5 = buffer.getInt();
MasterAdapterOrdinal = buffer.getInt();
AdapterOrdinalInGroup = buffer.getInt();
NumberOfAdaptersInGroup = buffer.getInt();
DeclTypes = buffer.getInt();
NumSimultaneousRTs = buffer.getInt();
StretchRectFilterCaps = buffer.getInt();
VS20Caps.Caps = buffer.getInt();
VS20Caps.DynamicFlowControlDepth = buffer.getInt();
VS20Caps.NumTemps = buffer.getInt();
VS20Caps.StaticFlowControlDepth = buffer.getInt();
D3DPSHADERCAPS2_0.Caps = buffer.getInt();
D3DPSHADERCAPS2_0.DynamicFlowControlDepth = buffer.getInt();
D3DPSHADERCAPS2_0.NumTemps = buffer.getInt();
D3DPSHADERCAPS2_0.StaticFlowControlDepth = buffer.getInt();
D3DPSHADERCAPS2_0.NumInstructionSlots = buffer.getInt();
VertexTextureFilterCaps = buffer.getInt();
MaxVShaderInstructionsExecuted = buffer.getInt();
MaxPShaderInstructionsExecuted = buffer.getInt();
MaxVertexShader30InstructionSlots = buffer.getInt() & 0x00000000ffffffffL;
MaxPixelShader30InstructionSlots = buffer.getInt();
}
public String toString() {
return
"\n DeviceType = " + DeviceType +
"\n AdapterOrdinal = " + AdapterOrdinal +
"\n Caps = " + Caps +
"\n Caps2 = " + Caps2 +
"\n Caps3 = " + Caps3 +
"\n PresentationIntervals = " + PresentationIntervals +
"\n CursorCaps = " + CursorCaps +
"\n DevCaps = " + DevCaps +
"\n PrimitiveMiscCaps = " + PrimitiveMiscCaps +
"\n RasterCaps = " + RasterCaps +
"\n ZCmpCaps = " + ZCmpCaps +
"\n SrcBlendCaps = " + SrcBlendCaps +
"\n DestBlendCaps = " + DestBlendCaps +
"\n AlphaCmpCaps = " + AlphaCmpCaps +
"\n ShadeCaps = " + ShadeCaps +
"\n TextureCaps = " + TextureCaps +
"\n TextureFilterCaps = " + TextureFilterCaps +
"\n CubeTextureFilterCaps = " + CubeTextureFilterCaps +
"\n VolumeTextureFilterCaps = " + VolumeTextureFilterCaps +
"\n TextureAddressCaps = " + TextureAddressCaps +
"\n VolumeTextureAddressCaps = " + VolumeTextureAddressCaps +
"\n LineCaps = " + LineCaps +
"\n MaxTextureWidth = " + MaxTextureWidth +
"\n MaxTextureHeight = " + MaxTextureHeight +
"\n MaxVolumeExtent = " + MaxVolumeExtent +
"\n MaxTextureRepeat = " + MaxTextureRepeat +
"\n MaxTextureAspectRatio = " + MaxTextureAspectRatio +
"\n MaxAnisotropy = " + MaxAnisotropy +
"\n MaxVertexW = " + MaxVertexW +
"\n GuardBandLeft = " + GuardBandLeft +
"\n GuardBandTop = " + GuardBandTop +
"\n GuardBandRight = " + GuardBandRight +
"\n GuardBandBottom = " + GuardBandBottom +
"\n ExtentsAdjust = " + ExtentsAdjust +
"\n StencilCaps = " + StencilCaps +
"\n FVFCaps = " + FVFCaps +
"\n TextureOpCaps = " + TextureOpCaps +
"\n MaxTextureBlendStages = " + MaxTextureBlendStages +
"\n MaxSimultaneousTextures = " + MaxSimultaneousTextures +
"\n VertexProcessingCaps = " + VertexProcessingCaps +
"\n MaxActiveLights = " + MaxActiveLights +
"\n MaxUserClipPlanes = " + MaxUserClipPlanes +
"\n MaxVertexBlendMatrices = " + MaxVertexBlendMatrices +
"\n MaxVertexBlendMatrixIndex = " + MaxVertexBlendMatrixIndex +
"\n MaxPointSize = " + MaxPointSize +
"\n MaxPrimitiveCount = " + MaxPrimitiveCount +
"\n MaxVertexIndex = " + MaxVertexIndex +
"\n MaxStreams = " + MaxStreams +
"\n MaxStreamStride = " + MaxStreamStride +
"\n VertexShaderVersion = " + VertexShaderVersion +
"\n MaxVertexShaderConst = " + MaxVertexShaderConst +
"\n PixelShaderVersion = " + PixelShaderVersion +
"\n PixelShader1xMaxValue = " + PixelShader1xMaxValue +
"\n DevCaps2 = " + DevCaps2 +
"\n MaxNpatchTessellationLevel = " + MaxNpatchTessellationLevel +
"\n Reserved5 = " + Reserved5 +
"\n MasterAdapterOrdinal = " + MasterAdapterOrdinal +
"\n AdapterOrdinalInGroup = " + AdapterOrdinalInGroup +
"\n NumberOfAdaptersInGroup = " + NumberOfAdaptersInGroup +
"\n DeclTypes = " + DeclTypes +
"\n NumSimultaneousRTs = " + NumSimultaneousRTs +
"\n StretchRectFilterCaps = " + StretchRectFilterCaps +
VS20Caps.toString() +
D3DPSHADERCAPS2_0.toString() +
"\n VertexTextureFilterCaps = " + VertexTextureFilterCaps +
"\n MaxVShaderInstructionsExecuted = " + MaxVShaderInstructionsExecuted +
"\n MaxPShaderInstructionsExecuted = " + MaxPShaderInstructionsExecuted +
"\nMaxVertexShader30InstructionSlots = " + MaxVertexShader30InstructionSlots +
"\n MaxPixelShader30InstructionSlots = " + MaxPixelShader30InstructionSlots;
}
}

View File

@ -1,42 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DClipStatus9 {
public long ClipUnion; //4 DWORD
public long ClipIntersection; //4 DWORD
private static final int D3D_CLIP_STATUS_BYTE_SIZE = 8;
private ByteBuffer buffer;
public D3DClipStatus9() {
buffer = ByteBuffer.allocateDirect(D3D_CLIP_STATUS_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)ClipUnion);
buffer.putInt((int)ClipIntersection);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
ClipUnion = buffer.getInt();
ClipIntersection = buffer.getInt();
}
public String toString() {
return
"\n ClipUnion = " + ClipUnion +
"\nClipIntersection = " + ClipIntersection;
}
}

View File

@ -1,44 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DColorValue {
public float r;
public float g;
public float b;
public float a;
private static final int D3D_COLOR_VALUE_BYTE_SIZE = 16;
private ByteBuffer buffer;
public D3DColorValue() {
buffer = ByteBuffer.allocateDirect(D3D_COLOR_VALUE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putFloat(r);
buffer.putFloat(g);
buffer.putFloat(b);
buffer.putFloat(a);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
r = buffer.getFloat();
g = buffer.getFloat();
b = buffer.getFloat();
a = buffer.getFloat();
}
}

View File

@ -1,50 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DDeviceCreationParameters {
public int AdapterOrdinal; //4 UINT
public int DeviceType; //4 D3DDEVTYPE
public long hFocusWindow; //4 HWND
public long BehaviorFlags; //4 DWORD
private static final int D3D_CREATION_PARAMETERS_STATUS_BYTE_SIZE = 16;
private ByteBuffer buffer;
public D3DDeviceCreationParameters() {
buffer = ByteBuffer.allocateDirect(D3D_CREATION_PARAMETERS_STATUS_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(AdapterOrdinal);
buffer.putInt(DeviceType);
buffer.putInt((int)hFocusWindow);
buffer.putInt((int)BehaviorFlags);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
AdapterOrdinal = buffer.getInt();
DeviceType = buffer.getInt();
hFocusWindow = buffer.getInt();
BehaviorFlags = buffer.getInt();
}
public String toString() {
return
"\nAdapterOrdinal = " + AdapterOrdinal +
"\n DeviceType = " + DeviceType +
"\n hFocusWindow = " + hFocusWindow +
"\n BehaviorFlags = " + BehaviorFlags;
}
}

View File

@ -1,51 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DDisplaymode {
public int Width; //4 UINT
public int Height; //4 UINT
public int RefreshRate; //4 UINT
public int Format; //4 D3DFORMAT
private static final int D3D_DISPLAYMODE_BYTE_SIZE = 16;
private ByteBuffer buffer;
public D3DDisplaymode() {
buffer = ByteBuffer.allocateDirect(D3D_DISPLAYMODE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(Width);
buffer.putInt(Height);
buffer.putInt(RefreshRate);
buffer.putInt(Format);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
Width = buffer.getInt();
Height = buffer.getInt();
RefreshRate = buffer.getInt();
Format = buffer.getInt();
}
public String toString() {
return
"\n width = " + Width +
"\n height = " + Height +
"\nrefreshRate = " + RefreshRate +
"\n format = " + Format;
}
}

View File

@ -1,11 +0,0 @@
package org.lwjgl.d3d;
public class D3DDisplaymodeEx {
public int Size; //UINT
public int Width; //UINT
public int Height; //UINT
public int RefreshRate; //UINT
public int Format; //D3DFORMAT
public int ScanLineOrdering; //D3DSCANLINEORDERING
}

View File

@ -1,8 +0,0 @@
package org.lwjgl.d3d;
public class D3DDisplaymodeFilter {
public int Size; //UINT
public int Format; //D3DFORMAT
public int ScanLineOrdering; //D3DSCANLINEORDERING
}

View File

@ -1,51 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
public class D3DGammaRamp {
private ByteBuffer redForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
private ByteBuffer greenForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
private ByteBuffer blueForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
public ShortBuffer red = redForNative.asShortBuffer();
public ShortBuffer green = greenForNative.asShortBuffer();
public ShortBuffer blue = blueForNative.asShortBuffer();
private static final int D3D_GAMMA_RAMP_BYTE_SIZE = 1536;
private ByteBuffer buffer;
public D3DGammaRamp() {
buffer = ByteBuffer.allocateDirect(D3D_GAMMA_RAMP_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
redForNative.rewind();
buffer.put(redForNative);
greenForNative.rewind();
buffer.put(greenForNative);
blueForNative.rewind();
buffer.put(blueForNative);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
byte temp[] = new byte[512];
buffer.get(temp);
redForNative.put(temp);
buffer.get(temp);
greenForNative.put(temp);
buffer.get(temp);
blueForNative.put(temp);
}
}

View File

@ -1,9 +0,0 @@
package org.lwjgl.d3d;
public class D3DIndexBufferDesc {
public int Format; //D3DFORMAT
public int Type; //D3DRESOURCETYPE
public long Usage; //DWORD
public int Pool; //D3DPOOL
public int Size; //UINT
}

View File

@ -1,78 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DLight9 {
public int Type; //2 D3DLIGHTTYPE
public D3DColorValue Diffuse; //16 D3DCOLORVALUE
public D3DColorValue Specular; //16 D3DCOLORVALUE
public D3DColorValue Ambient; //16 D3DCOLORVALUE
public D3DVector Position; //12 D3DVECTOR
public D3DVector Direction; //12 D3DVECTOR
public float Range; //4
public float Falloff; //4
public float Attenuation0; //4
public float Attenuation1; //4
public float Attenuation2; //4
public float Theta; //4
public float Phi; //4
private static final int D3D_LIGHT_BYTE_SIZE = 102;
private ByteBuffer buffer;
public D3DLight9() {
buffer = ByteBuffer.allocateDirect(D3D_LIGHT_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putShort((short)Type);
buffer.put(Diffuse.getBuffer());
buffer.put(Specular.getBuffer());
buffer.put(Ambient.getBuffer());
buffer.put(Position.getBuffer());
buffer.put(Direction.getBuffer());
buffer.putFloat(Range);
buffer.putFloat(Falloff);
buffer.putFloat(Attenuation1);
buffer.putFloat(Attenuation1);
buffer.putFloat(Attenuation2);
buffer.putFloat(Theta);
buffer.putFloat(Phi);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
Type = buffer.getShort();
byte temp[] = new byte[16];
buffer.get(temp);
Diffuse.setBuffer(Diffuse.getEmptyBuffer().put(temp));
buffer.get(temp);
Specular.setBuffer(Specular.getEmptyBuffer().put(temp));
buffer.get(temp);
Ambient.setBuffer(Ambient.getEmptyBuffer().put(temp));
temp = new byte[12];
buffer.get(temp);
Position.setBuffer(Position.getEmptyBuffer().put(temp));
buffer.get(temp);
Direction.setBuffer(Direction.getEmptyBuffer().put(temp));
Range = buffer.getFloat();
Falloff = buffer.getFloat();
Attenuation1 = buffer.getFloat();
Attenuation1 = buffer.getFloat();
Attenuation2 = buffer.getFloat();
Theta = buffer.getFloat();
Phi = buffer.getFloat();
}
}

View File

@ -1,9 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class D3DLockedBox {
public int RowPitch;
public int SlicePitch;
public ByteBuffer pBits;
}

View File

@ -1,9 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class D3DLockedRect {
int Pitch;
public ByteBuffer pBits; //void *
}

View File

@ -1,51 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DMaterial9 {
public D3DColorValue Diffuse; //16
public D3DColorValue Ambient; //16
public D3DColorValue Specular; //16
public D3DColorValue Emissive; //16
public float Power; //4
private static final int D3D_MATERIAL_BYTE_SIZE = 68;
private ByteBuffer buffer;
public D3DMaterial9() {
buffer = ByteBuffer.allocateDirect(D3D_MATERIAL_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.put(Diffuse.getBuffer());
buffer.put(Ambient.getBuffer());
buffer.put(Specular.getBuffer());
buffer.put(Emissive.getBuffer());
buffer.putFloat(Power);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
byte temp[] = new byte[16];
buffer.get(temp);
Diffuse.setBuffer(Diffuse.getEmptyBuffer().put(temp));
buffer.get(temp);
Ambient.setBuffer(Ambient.getEmptyBuffer().put(temp));
buffer.get(temp);
Specular.setBuffer(Specular.getEmptyBuffer().put(temp));
buffer.get(temp);
Emissive.setBuffer(Emissive.getEmptyBuffer().put(temp));
Power = buffer.getFloat();
}
}

View File

@ -1,42 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
public class D3DMatrix {
public float m[][] = new float[4][4];
private static final int D3D_MATRIX_BYTE_SIZE = 64;
private ByteBuffer buffer;
public D3DMatrix() {
buffer = ByteBuffer.allocateDirect(D3D_MATRIX_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
FloatBuffer temp = buffer.asFloatBuffer();
for(int i=0;i<4;i++) {
temp.put(m[i]);
}
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
FloatBuffer temp = buffer.asFloatBuffer();
for(int i=0;i<4;i++) {
temp.get(m[i]);
}
}
}

View File

@ -1,18 +0,0 @@
package org.lwjgl.d3d;
public class D3DPShaderCaps2_0 {
public long Caps; //4 DWORD
public int DynamicFlowControlDepth; //4 INT
public int NumTemps; //4 INT
public int StaticFlowControlDepth; //4 INT
public int NumInstructionSlots; //4 INT
public String toString() {
return
"\n Caps = " + Caps +
"\nDynamicFlowControlDepth = " + DynamicFlowControlDepth +
"\n NumTemps = " + NumTemps +
"\n StaticFlowControlDepth = " + StaticFlowControlDepth +
"\n NumInstructionSlots = " + NumInstructionSlots;
}
}

View File

@ -1,88 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DPresentParameters {
public int BackBufferWidth; //4 UINT
public int BackBufferHeight; //4 UINT
public int BackBufferFormat; //4 D3DFORMAT
public int BackBufferCount; //4 UINT
public int MultiSampleType; //4 D3DMULTISAMPLE_TYPE
public int MultiSampleQuality; //4 DWORD
public int SwapEffect; //4 D3DSWAPEFFECT
public long hDeviceWindow; //4 HWND
public boolean Windowed; //4
public boolean EnableAutoDepthStencil; //4
public int AutoDepthStencilFormat; //4 D3DFORMAT
public long Flags; //4 DWORD
public int FullScreen_RefreshRateInHz; //4 UINT
public int PresentationInterval; //4 UINT
private ByteBuffer buffer;
private static final int D3D_PRESENT_PARAMETERS_BYTE_SIZE = 56;
public D3DPresentParameters() {
buffer = ByteBuffer.allocateDirect(D3D_PRESENT_PARAMETERS_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(BackBufferWidth);
buffer.putInt(BackBufferHeight);
buffer.putInt(BackBufferFormat);
buffer.putInt(BackBufferCount);
buffer.putInt(MultiSampleType);
buffer.putInt(MultiSampleQuality);
buffer.putInt(SwapEffect);
buffer.putInt((int)hDeviceWindow);
buffer.putInt(Windowed ? 1 : 0);
buffer.putInt(EnableAutoDepthStencil ? 1 : 0);
buffer.putInt(AutoDepthStencilFormat);
buffer.putInt((int)Flags);
buffer.putInt(FullScreen_RefreshRateInHz);
buffer.putInt(PresentationInterval);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
BackBufferWidth = buffer.getInt();
BackBufferHeight = buffer.getInt();
BackBufferFormat = buffer.getInt();
BackBufferCount = buffer.getInt();
MultiSampleType = buffer.getInt();
MultiSampleQuality = buffer.getInt();
SwapEffect = buffer.getInt();
hDeviceWindow = buffer.getInt();
Windowed = buffer.getInt() == 1;
EnableAutoDepthStencil = buffer.getInt() == 1;
AutoDepthStencilFormat = buffer.getInt();
Flags = buffer.getInt();
FullScreen_RefreshRateInHz = buffer.getInt();
PresentationInterval = buffer.getInt();
}
public String toString() {
return
"\n BackBufferWidth = " + BackBufferWidth +
"\n BackBufferHeight = " + BackBufferHeight +
"\n BackBufferFormat = " + BackBufferFormat +
"\n BackBufferCount = " + BackBufferCount +
"\n MultiSampleType = " + MultiSampleType +
"\n MultiSampleQuality = " + MultiSampleQuality +
"\n SwapEffect = " + SwapEffect +
"\n hDeviceWindow = " + hDeviceWindow +
"\n Windowed = " + Windowed +
"\n EnableAutoDepthStencil = " + EnableAutoDepthStencil +
"\n AutoDepthStencilFormat = " + AutoDepthStencilFormat +
"\n Flags = " + Flags +
"\nFullScreen_RefreshRateInHz = " + FullScreen_RefreshRateInHz +
"\n PresentationInterval = " + PresentationInterval;
}
}

View File

@ -1,11 +0,0 @@
package org.lwjgl.d3d;
import java.math.BigInteger;
public class D3DPresentStats {
public int PresentCount; //UINT
public int PresentRefreshCount; //UINT
public int SyncRefreshCount; //UINT
public BigInteger SyncQPCTime; //LARGE_INTEGER
public BigInteger SyncGPUTime; //LARGE_INTEGER
}

View File

@ -1,38 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DRasterStatus {
public boolean InVBlank;
public int ScanLine;
private static final int D3D_RASTER_STATUS_BYTE_SIZE = 3;
private ByteBuffer buffer;
public D3DRasterStatus() {
buffer = ByteBuffer.allocateDirect(D3D_RASTER_STATUS_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.put((byte)(InVBlank ? 1 : 0));
buffer.putShort((short)ScanLine);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
InVBlank = buffer.get() == 1;
ScanLine = buffer.getShort();
}
}

View File

@ -1,63 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DRectPatchInfo {
public int StartVertexOffsetWidth; //4 UINT
public int StartVertexOffsetHeight; //4 UINT
public int Width; //4 UINT
public int Height; //4 UINT
public int Stride; //4 UINT
public int Basis; //4 D3DBASISTYPE
public int Degree; //4 D3DDEGREETYPE
private static final int D3D_RECT_PATCH_INFO_BYTE_SIZE = 28;
private ByteBuffer buffer;
public D3DRectPatchInfo() {
buffer = ByteBuffer.allocateDirect(D3D_RECT_PATCH_INFO_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(StartVertexOffsetWidth);
buffer.putInt(StartVertexOffsetHeight);
buffer.putInt(Width);
buffer.putInt(Height);
buffer.putInt(Stride);
buffer.putInt(Basis);
buffer.putInt(Degree);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
StartVertexOffsetWidth = buffer.getInt();
StartVertexOffsetHeight = buffer.getInt();
Width = buffer.getInt();
Height = buffer.getInt();
Stride = buffer.getInt();
Basis = buffer.getInt();
Degree = buffer.getInt();
}
public String toString() {
return
"\n StartVertexOffsetWidth = " + StartVertexOffsetWidth +
"\nStartVertexOffsetHeight = " + StartVertexOffsetHeight +
"\n Width = " + Width +
"\n Height = " + Height +
"\n Stride = " + Stride +
"\n Basis = " + Basis +
"\n Degree = " + Degree;
}
}

View File

@ -1,37 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
//From RGNDATA
public class D3DRegionData {
D3DRegionDataHeader regionHeaderData;
byte Buffer[] = new byte[1];
private static final int RECTANGLE_BYTE_SIZE = 33;
private ByteBuffer buffer;
public D3DRegionData() {
buffer = ByteBuffer.allocateDirect(RECTANGLE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
buffer.clear();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.put(Buffer);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
regionHeaderData.setBuffer(buffer);
buffer.get(Buffer);
}
}

View File

@ -1,47 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
//From RGNDATAHEADER
public class D3DRegionDataHeader {
public long dwSize; //4 DWORD
public long iType; //4 DWORD
public long nCount; //4 DWORD
public long nRgnSize; //4 DWORD
Rectangle rcBound; //16 RECT
private static final int RECTANGLE_BYTE_SIZE = 32;
private ByteBuffer buffer;
public D3DRegionDataHeader() {
buffer = ByteBuffer.allocateDirect(RECTANGLE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
buffer.clear();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)dwSize);
buffer.putInt((int)iType);
buffer.putInt((int)nCount);
buffer.putInt((int)nRgnSize);
buffer.put(rcBound.getBuffer());
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
dwSize = buffer.getInt();
iType = buffer.getInt();
nCount = buffer.getInt();
nRgnSize = buffer.getInt();
rcBound.setBuffer(buffer.slice());
}
}

View File

@ -1,12 +0,0 @@
package org.lwjgl.d3d;
public class D3DSsurfaceDesc {
public int Format; //D3DFORMAT
public int Type; //D3DRESOURCETYPE
public long Usage; //DWORD
public int Pool; //D3DPOOL
public int MultiSampleType; //D3DMULTISAMPLE_TYPE
public long MultiSampleQuality; //DWORD
public int Width; //UINT
public int Height; //UINT
}

View File

@ -1,12 +0,0 @@
package org.lwjgl.d3d;
public class D3DSurfaceDesc {
public int Format; //D3DFORMAT
public int Type; //D3DRESOURCETYPE
public long Usage; //DWORD
public int Pool; //D3DPOOL
public int MultiSampleType; //D3DMULTISAMPLE_TYPE
public long MultiSampleQuality; //DWORD
public int Width; //UINT
public int Height; //UINT
}

View File

@ -1,50 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DTriPatchInfo {
public int StartVertexOffset; //4 UINT
public int NumVertices; //4 UINT
public int Basis; //4 D3DBASISTYPE
public int Degree; //4 D3DDEGREETYPE
private static final int D3D_TRI_PATCH_INFO_BYTE_SIZE = 16;
private ByteBuffer buffer;
public D3DTriPatchInfo() {
buffer = ByteBuffer.allocateDirect(D3D_TRI_PATCH_INFO_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(StartVertexOffset);
buffer.putInt(NumVertices);
buffer.putInt(Basis);
buffer.putInt(Degree);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
StartVertexOffset = buffer.getInt();
NumVertices = buffer.getInt();
Basis = buffer.getInt();
Degree = buffer.getInt();
}
public String toString() {
return
"\nStartVertexOffset = " + StartVertexOffset +
"\n NumVertices = " + NumVertices +
"\n Basis = " + Basis +
"\n Degree = " + Degree;
}
}

View File

@ -1,71 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DUtil {
public final static void D3DXMatrixLookAtLH(D3DMatrix out, D3DVector eye, D3DVector at, D3DVector up) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixLookAtLH(buffer, eye.getBuffer(), at.getBuffer(), up.getBuffer());
out.setBuffer(buffer);
}
public final static void D3DXMatrixPerspectiveFovLH(D3DMatrix out, float fovy, float aspect, float zn, float zf) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixPerspectiveFovLH(buffer, fovy, aspect, zn, zf);
out.setBuffer(buffer);
}
public final static void D3DXMatrixIdentity(D3DMatrix out) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixIdentity(buffer);
out.setBuffer(buffer);
}
public final static void D3DXMatrixScaling(D3DMatrix out, float sx, float sy, float sz) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixScaling(buffer, sx, sy, sz);
out.setBuffer(buffer);
}
public final static void D3DXMatrixTranslation(D3DMatrix out, float x, float y ,float z) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixTranslation(buffer, x, y, z);
out.setBuffer(buffer);
}
public final static void D3DXMatrixRotationX(D3DMatrix out, float angle) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixRotationX(buffer, angle);
out.setBuffer(buffer);
}
public final static void D3DXMatrixRotationY(D3DMatrix out, float angle) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixRotationY(buffer, angle);
out.setBuffer(buffer);
}
public final static void D3DXMatrixRotationZ(D3DMatrix out, float angle) {
ByteBuffer buffer = out.getBuffer();
nD3DXMatrixRotationZ(buffer, angle);
out.setBuffer(buffer);
}
public final static D3DMatrix D3DXMatrixMultiply(D3DMatrix out, D3DMatrix m1, D3DMatrix m2) {
D3DMatrix result = new D3DMatrix();
ByteBuffer buffer = out.getBuffer();
ByteBuffer resultBuffer = nD3DXMatrixMultiply(buffer, m1.getBuffer(), m2.getBuffer());
resultBuffer.order(ByteOrder.nativeOrder());
out.setBuffer(buffer);
result.setBuffer(resultBuffer);
return result;
}
//natives
private final static native void nD3DXMatrixLookAtLH(ByteBuffer out, ByteBuffer eye, ByteBuffer at, ByteBuffer up);
private final static native void nD3DXMatrixPerspectiveFovLH(ByteBuffer out, float fovy, float aspect, float zn, float zf);
private final static native void nD3DXMatrixIdentity(ByteBuffer out);
private final static native void nD3DXMatrixScaling(ByteBuffer out, float sx, float sy, float sz);
private final static native void nD3DXMatrixTranslation(ByteBuffer out, float x, float y ,float z);
private final static native void nD3DXMatrixRotationX(ByteBuffer out, float angle);
private final static native void nD3DXMatrixRotationY(ByteBuffer out, float angle);
private final static native void nD3DXMatrixRotationZ(ByteBuffer out, float angle);
private final static native ByteBuffer nD3DXMatrixMultiply(ByteBuffer out, ByteBuffer m1, ByteBuffer m2);
}

View File

@ -1,16 +0,0 @@
package org.lwjgl.d3d;
public class D3DVShaderCaps2_0 {
public long Caps; //4 DWORD
public int DynamicFlowControlDepth; //4 INT
public int NumTemps; //4 INT
public int StaticFlowControlDepth; //4 INT
public String toString() {
return
"\n Caps = " + Caps +
"\nDynamicFlowControlDepth = " + DynamicFlowControlDepth +
"\n NumTemps = " + NumTemps +
"\n StaticFlowControlDepth = " + StaticFlowControlDepth;
}
}

View File

@ -1,40 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DVector {
public float x;
public float y;
public float z;
private static final int D3D_VECTOR_BYTE_SIZE = 12;
private ByteBuffer buffer;
public D3DVector() {
buffer = ByteBuffer.allocateDirect(D3D_VECTOR_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putFloat(x);
buffer.putFloat(y);
buffer.putFloat(z);
buffer.rewind();
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
x = buffer.getFloat();
y = buffer.getFloat();
z = buffer.getFloat();
}
}

View File

@ -1,49 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DVertexBufferDesc {
public int Format; //4 D3DFORMAT
public int Type; //4 D3DRESOURCETYPE
public long Usage; //4 DWORD
public int Pool; //4 D3DPOOL
public int Size; //4 UINT
public long FVF; //4 DWORD
private static final int D3D_VERTEX_BUFFER_DESC_BYTE_SIZE = 24;
private ByteBuffer buffer;
public D3DVertexBufferDesc() {
buffer = ByteBuffer.allocateDirect(D3D_VERTEX_BUFFER_DESC_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt(Format);
buffer.putInt(Type);
buffer.putInt((int)Usage);
buffer.putInt(Pool);
buffer.putInt(Size);
buffer.putInt((int)FVF);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
Format = buffer.getInt();
Type = buffer.getInt();
Usage = buffer.getInt();
Pool = buffer.getInt();
Size = buffer.getInt();
FVF = buffer.getInt();
}
}

View File

@ -1,60 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class D3DVertexElement9 {
public long Stream; //WORD
public long Offset; //WORD
public byte Type; //BYTE
public byte Method; //BYTE
public byte Usage; //BYTE
public byte UsageIndex; //BYTE
private static final int D3D_VERTEX_ELEMENT_BYTE_SIZE = 12;
private ByteBuffer buffer;
public D3DVertexElement9() {
buffer = ByteBuffer.allocateDirect(D3D_VERTEX_ELEMENT_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)Stream);
buffer.putInt((int)Offset);
buffer.put(Type);
buffer.put(Method);
buffer.put(Usage);
buffer.put(UsageIndex);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
Stream = buffer.getInt();
Offset = buffer.getInt();
Type = buffer.get();
Method = buffer.get();
Usage = buffer.get();
UsageIndex = buffer.get();
}
public String toString() {
return
"\n Stream = " + Stream +
"\n Offset = " + Offset +
"\n Type = " + Type +
"\n Method = " + Method +
"\n Usage = " + Usage +
"\nUsageIndex = " + UsageIndex;
}
}

View File

@ -1,51 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
public class D3DViewport9 {
public long X; //4 DWORD
public long Y; //4 DWORD
public long Width; //4 DWORD
public long Height; //4 DWORD
public float MinZ; //4
public float MaxZ; //4
private static final int D3D_VIEWPORT_BYTE_SIZE = 24;
private ByteBuffer buffer;
public D3DViewport9() {
buffer = ByteBuffer.allocateDirect(D3D_VIEWPORT_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)X);
buffer.putInt((int)Y);
buffer.putInt((int)Width);
buffer.putInt((int)Height);
buffer.putFloat(MinZ);
buffer.putFloat(MaxZ);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
X = buffer.getInt();
Y = buffer.getInt();
Width = buffer.getInt();
Height = buffer.getInt();
MinZ = buffer.getFloat();
MaxZ = buffer.getFloat();
}
}

View File

@ -1,11 +0,0 @@
package org.lwjgl.d3d;
public class D3DVolumeDesc {
public int Format; //D3DFORMAT
public int Type; //D3DRESOURCETYPE
public long Usage; //DWORD
public int Pool; //D3DPOOL
public int Width; //UINT
public int Height; //UINT
public int Depth; //UINT
}

View File

@ -1,446 +0,0 @@
package org.lwjgl.d3d;
public class Direct3DConstants {
public static final int D3DADAPTER_DEFAULT = 0;
public static final int D3DPRESENT_BACK_BUFFERS_MAX = 3;
public static final int D3DENUM_WHQL_LEVEL = 0x00000002;
public static final int MAX_DEVICE_IDENTIFIER_STRING = 512;
//D3DDEVTYPE
public static final int D3DDEVTYPE_HAL = 1;
public static final int D3DDEVTYPE_NULLREF = 4;
public static final int D3DDEVTYPE_REF = 2;
public static final int D3DDEVTYPE_SW = 3;
public static final int D3DDEVTYPE_FORCE_DWORD = 0xffffffff;
//D3DFORMAT
public static final int D3DFMT_UNKNOWN = 0;
public static final int D3DFMT_R8G8B8 = 20;
public static final int D3DFMT_A8R8G8B8 = 21;
public static final int D3DFMT_X8R8G8B8 = 22;
public static final int D3DFMT_R5G6B5 = 23;
public static final int D3DFMT_X1R5G5B5 = 24;
public static final int D3DFMT_A1R5G5B5 = 25;
public static final int D3DFMT_A4R4G4B4 = 26;
public static final int D3DFMT_R3G3B2 = 27;
public static final int D3DFMT_A8 = 28;
public static final int D3DFMT_A8R3G3B2 = 29;
public static final int D3DFMT_X4R4G4B4 = 30;
public static final int D3DFMT_A2B10G10R10 = 31;
public static final int D3DFMT_G16R16 = 34;
public static final int D3DFMT_A8P8 = 40;
public static final int D3DFMT_P8 = 41;
public static final int D3DFMT_L8 = 50;
public static final int D3DFMT_A8L8 = 51;
public static final int D3DFMT_A4L4 = 52;
public static final int D3DFMT_V8U8 = 60;
public static final int D3DFMT_L6V5U5 = 61;
public static final int D3DFMT_X8L8V8U8 = 62;
public static final int D3DFMT_Q8W8V8U8 = 63;
public static final int D3DFMT_V16U16 = 64;
public static final int D3DFMT_W11V11U10 = 65;
public static final int D3DFMT_A2W10V10U10 = 67;
public static final int D3DFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y');
public static final int D3DFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2');
public static final int D3DFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
public static final int D3DFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2');
public static final int D3DFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3');
public static final int D3DFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4');
public static final int D3DFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');
public static final int D3DFMT_D16_LOCKABLE = 70;
public static final int D3DFMT_D32 = 71;
public static final int D3DFMT_D15S1 = 73;
public static final int D3DFMT_D24S8 = 75;
public static final int D3DFMT_D16 = 80;
public static final int D3DFMT_D24X8 = 77;
public static final int D3DFMT_D24X4S4 = 79;
public static final int D3DFMT_VERTEXDATA =100;
public static final int D3DFMT_INDEX16 =101;
public static final int D3DFMT_INDEX32 =102;
public static final int D3DFMT_FORCE_DWORD =0x7fffffff;
//D3DRESOURCETYPE
public static final int D3DRTYPE_SURFACE = 1;
public static final int D3DRTYPE_VOLUME = 2;
public static final int D3DRTYPE_TEXTURE = 3;
public static final int D3DRTYPE_VOLUMETEXTURE = 4;
public static final int D3DRTYPE_CubeTexture = 5;
public static final int D3DRTYPE_VERTEXBUFFER = 6;
public static final int D3DRTYPE_INDEXBUFFER = 7;
public static final int D3DRTYPE_FORCE_DWORD = 0x7fffffff;
//D3DUSAGE
public static final int D3DUSAGE_RENDERTARGET = 0x00000001;
public static final int D3DUSAGE_DEPTHSTENCIL = 0x00000002;
public static final int D3DUSAGE_AUTOGENMIPMAP = 0x00000400;
public static final int D3DUSAGE_DMAP = 0x00004000;
//The following usages are valid only for querying CheckDeviceFormat
public static final int D3DUSAGE_QUERY_LEGACYBUMPMAP = 0x00008000;
public static final int D3DUSAGE_QUERY_SRGBREAD = 0x00010000;
public static final int D3DUSAGE_QUERY_FILTER = 0x00020000;
public static final int D3DUSAGE_QUERY_SRGBWRITE = 0x00040000;
public static final int D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING = 0x00080000;
public static final int D3DUSAGE_QUERY_VERTEXTEXTURE = 0x00100000;
public static final int D3DUSAGE_QUERY_WRAPANDMIP = 0x00200000;
/* Usages for Vertex/Index buffers */
public static final int D3DUSAGE_WRITEONLY = 0x00000008;
public static final int D3DUSAGE_SOFTWAREPROCESSING = 0x00000010;
public static final int D3DUSAGE_DONOTCLIP = 0x00000020;
public static final int D3DUSAGE_POINTS = 0x00000040;
public static final int D3DUSAGE_RTPATCHES = 0x00000080;
public static final int D3DUSAGE_NPATCHES = 0x00000100;
//D3DMULTISAMPLE_TYPE
public static final int D3DMULTISAMPLE_NONE = 0;
public static final int D3DMULTISAMPLE_NONMASKABLE = 1;
public static final int D3DMULTISAMPLE_2_SAMPLES = 2;
public static final int D3DMULTISAMPLE_3_SAMPLES = 3;
public static final int D3DMULTISAMPLE_4_SAMPLES = 4;
public static final int D3DMULTISAMPLE_5_SAMPLES = 5;
public static final int D3DMULTISAMPLE_6_SAMPLES = 6;
public static final int D3DMULTISAMPLE_7_SAMPLES = 7;
public static final int D3DMULTISAMPLE_8_SAMPLES = 8;
public static final int D3DMULTISAMPLE_9__SAMPLES = 9;
public static final int D3DMULTISAMPLE_10_SAMPLES = 10;
public static final int D3DMULTISAMPLE_11_SAMPLES = 11;
public static final int D3DMULTISAMPLE_12_SAMPLES = 12;
public static final int D3DMULTISAMPLE_13_SAMPLES = 13;
public static final int D3DMULTISAMPLE_14_SAMPLES = 14;
public static final int D3DMULTISAMPLE_15_SAMPLES = 15;
public static final int D3DMULTISAMPLE_16_SAMPLES = 16;
public static final int D3DMULTISAMPLE_FORCE_DWORD = 0xffffffff;
//D3DSWAPEFFECT
public static final int D3DSWAPEFFECT_DISCARD = 1;
public static final int D3DSWAPEFFECT_FLIP = 2;
public static final int D3DSWAPEFFECT_COPY = 3;
public static final int D3DSWAPEFFECT_FORCE_DWORD = 0xFFFFFFFF;
//D3DPOOL
public static final int D3DPOOL_DEFAULT = 0;
public static final int D3DPOOL_MANAGED = 1;
public static final int D3DPOOL_SYSTEMMEM = 2;
public static final int D3DPOOL_SCRATCH = 3;
public static final int D3DPOOL_FORCE_DWORD = 0x7fffffff;
//D3DQUERYTYPE
public static final int D3DQUERYTYPE_VCACHE = 4;
public static final int D3DQUERYTYPE_ResourceManager = 5;
public static final int D3DQUERYTYPE_VERTEXSTATS = 6;
public static final int D3DQUERYTYPE_EVENT = 8;
public static final int D3DQUERYTYPE_OCCLUSION = 9;
public static final int D3DQUERYTYPE_TIMESTAMP = 10;
public static final int D3DQUERYTYPE_TIMESTAMPDISJOINT = 11;
public static final int D3DQUERYTYPE_TIMESTAMPFREQ = 12;
public static final int D3DQUERYTYPE_PIPELINETIMINGS = 13;
public static final int D3DQUERYTYPE_INTERFACETIMINGS = 14;
public static final int D3DQUERYTYPE_VERTEXTIMINGS = 15;
public static final int D3DQUERYTYPE_PIXELTIMINGS = 16;
public static final int D3DQUERYTYPE_BANDWIDTHTIMINGS = 17;
public static final int D3DQUERYTYPE_CACHEUTILIZATION = 18;
//D3DSTATEBLOCKTYPE
public static final int D3DSBT_ALL = 1;
public static final int D3DSBT_PIXELSTATE = 2;
public static final int D3DSBT_VERTEXSTATE = 2;
public static final int D3DSBT_FORCE_DWORD = 0xffffffff;
//D3DPRIMITIVETYPE
public static final int D3DPT_POINTLIST = 1;
public static final int D3DPT_LINELIST = 2;
public static final int D3DPT_LINESTRIP = 3;
public static final int D3DPT_TRIANGLELIST = 4;
public static final int D3DPT_TRIANGLESTRIP = 5;
public static final int D3DPT_TRIANGLEFAN = 6;
public static final int D3DPT_FORCE_DWORD = 0x7fffffff;
//D3DBASISTYPE
public static final int D3DBASIS_BEZIER = 0;
public static final int D3DBASIS_BSPLINE = 1;
public static final int D3DBASIS_CATMULL_ROM = 2;
public static final int D3DBASIS_FORCE_DWORD = 0x7fffffff;
//D3DDEGREETYPE
public static final int D3DDEGREE_LINEAR = 1;
public static final int D3DDEGREE_QUADRATIC = 2;
public static final int D3DDEGREE_CUBIC = 3;
public static final int D3DDEGREE_QUINTIC = 5;
public static final int D3DDEGREE_FORCE_DWORD = 0x7fffffff;
//D3DBACKBUFFER_TYPE
public static final int D3DBACKBUFFER_TYPE_MONO = 0;
public static final int D3DBACKBUFFER_TYPE_FORCE_DWORD = 0x7fffffff;
//D3DLIGHTTYPE
public static final int D3DLIGHT_POINT = 1;
public static final int D3DLIGHT_SPOT = 2;
public static final int D3DLIGHT_DIRECTIONAL = 3;
public static final int D3DLIGHT_FORCE_DWORD = 0x7fffffff;
//D3DRENDERSTATETYPE
public static final int D3DRS_ZENABLE = 7;
public static final int D3DRS_FILLMODE = 8;
public static final int D3DRS_SHADEMODE = 9;
public static final int D3DRS_ZWRITEENABLE = 14;
public static final int D3DRS_ALPHATESTENABLE = 15;
public static final int D3DRS_LASTPIXEL = 16;
public static final int D3DRS_SRCBLEND = 19;
public static final int D3DRS_DESTBLEND = 20;
public static final int D3DRS_CULLMODE = 22;
public static final int D3DRS_ZFUNC = 23;
public static final int D3DRS_ALPHAREF = 24;
public static final int D3DRS_ALPHAFUNC = 25;
public static final int D3DRS_DITHERENABLE = 26;
public static final int D3DRS_ALPHABLENDENABLE = 27;
public static final int D3DRS_FOGENABLE = 28;
public static final int D3DRS_SPECULARENABLE = 29;
public static final int D3DRS_FOGCOLOR = 34;
public static final int D3DRS_FOGTABLEMODE = 35;
public static final int D3DRS_FOGSTART = 36;
public static final int D3DRS_FOGEND = 37;
public static final int D3DRS_FOGDENSITY = 38;
public static final int D3DRS_RANGEFOGENABLE = 48;
public static final int D3DRS_STENCILENABLE = 52;
public static final int D3DRS_STENCILFAIL = 53;
public static final int D3DRS_STENCILZFAIL = 54;
public static final int D3DRS_STENCILPASS = 55;
public static final int D3DRS_STENCILFUNC = 56;
public static final int D3DRS_STENCILREF = 57;
public static final int D3DRS_STENCILMASK = 58;
public static final int D3DRS_STENCILWRITEMASK = 59;
public static final int D3DRS_TEXTUREFACTOR = 60;
public static final int D3DRS_WRAP0 = 128;
public static final int D3DRS_WRAP1 = 129;
public static final int D3DRS_WRAP2 = 130;
public static final int D3DRS_WRAP3 = 131;
public static final int D3DRS_WRAP4 = 132;
public static final int D3DRS_WRAP5 = 133;
public static final int D3DRS_WRAP6 = 134;
public static final int D3DRS_WRAP7 = 135;
public static final int D3DRS_CLIPPING = 136;
public static final int D3DRS_LIGHTING = 137;
public static final int D3DRS_AMBIENT = 139;
public static final int D3DRS_FOGVERTEXMODE = 140;
public static final int D3DRS_COLORVERTEX = 141;
public static final int D3DRS_LOCALVIEWER = 142;
public static final int D3DRS_NORMALIZENORMALS = 143;
public static final int D3DRS_DIFFUSEMATERIALSOURCE = 145;
public static final int D3DRS_SPECULARMATERIALSOURCE = 146;
public static final int D3DRS_AMBIENTMATERIALSOURCE = 147;
public static final int D3DRS_EMISSIVEMATERIALSOURCE = 148;
public static final int D3DRS_VERTEXBLEND = 151;
public static final int D3DRS_CLIPPLANEENABLE = 152;
public static final int D3DRS_POINTSIZE = 154;
public static final int D3DRS_POINTSIZE_MIN = 155;
public static final int D3DRS_POINTSPRITEENABLE = 156;
public static final int D3DRS_POINTSCALEENABLE = 157;
public static final int D3DRS_POINTSCALE_A = 158;
public static final int D3DRS_POINTSCALE_B = 159;
public static final int D3DRS_POINTSCALE_C = 160;
public static final int D3DRS_MULTISAMPLEANTIALIAS = 161;
public static final int D3DRS_MULTISAMPLEMASK = 162;
public static final int D3DRS_PATCHEDGESTYLE = 163;
public static final int D3DRS_DEBUGMONITORTOKEN = 165;
public static final int D3DRS_POINTSIZE_MAX = 166;
public static final int D3DRS_INDEXEDVERTEXBLENDENABLE = 167;
public static final int D3DRS_COLORWRITEENABLE = 168;
public static final int D3DRS_TWEENFACTOR = 170;
public static final int D3DRS_BLENDOP = 171;
public static final int D3DRS_POSITIONDEGREE = 172;
public static final int D3DRS_NORMALDEGREE = 173;
public static final int D3DRS_SCISSORTESTENABLE = 174;
public static final int D3DRS_SLOPESCALEDEPTHBIAS = 175;
public static final int D3DRS_ANTIALIASEDLINEENABLE = 176;
public static final int D3DRS_MINTESSELLATIONLEVEL = 178;
public static final int D3DRS_MAXTESSELLATIONLEVEL = 179;
public static final int D3DRS_ADAPTIVETESS_X = 180;
public static final int D3DRS_ADAPTIVETESS_Y = 181;
public static final int D3DRS_ADAPTIVETESS_Z = 182;
public static final int D3DRS_ADAPTIVETESS_W = 183;
public static final int D3DRS_ENABLEADAPTIVETESSELLATION = 184;
public static final int D3DRS_TWOSIDEDSTENCILMODE = 185;
public static final int D3DRS_CCW_STENCILFAIL = 186;
public static final int D3DRS_CCW_STENCILZFAIL = 187;
public static final int D3DRS_CCW_STENCILPASS = 188;
public static final int D3DRS_CCW_STENCILFUNC = 189;
public static final int D3DRS_COLORWRITEENABLE1 = 190;
public static final int D3DRS_COLORWRITEENABLE2 = 191;
public static final int D3DRS_COLORWRITEENABLE3 = 192;
public static final int D3DRS_BLENDFACTOR = 193;
public static final int D3DRS_SRGBWRITEENABLE = 194;
public static final int D3DRS_DEPTHBIAS = 195;
public static final int D3DRS_WRAP8 = 198;
public static final int D3DRS_WRAP9 = 199;
public static final int D3DRS_WRAP10 = 200;
public static final int D3DRS_WRAP11 = 201;
public static final int D3DRS_WRAP12 = 202;
public static final int D3DRS_WRAP13 = 203;
public static final int D3DRS_WRAP14 = 204;
public static final int D3DRS_WRAP15 = 205;
public static final int D3DRS_SEPARATEALPHABLENDENABLE = 206;
public static final int D3DRS_SRCBLENDALPHA = 207;
public static final int D3DRS_DESTBLENDALPHA = 208;
public static final int D3DRS_BLENDOPALPHA = 209;
public static final int D3DRS_FORCE_DWORD = 0x7fffffff;
//D3DSAMPLERSTATETYPE
public static final int D3DSAMP_ADDRESSU = 1;
public static final int D3DSAMP_ADDRESSV = 2;
public static final int D3DSAMP_ADDRESSW = 3;
public static final int D3DSAMP_BORDERCOLOR = 4;
public static final int D3DSAMP_MAGFILTER = 5;
public static final int D3DSAMP_MINFILTER = 6;
public static final int D3DSAMP_MIPFILTER = 7;
public static final int D3DSAMP_MIPMAPLODBIAS = 8;
public static final int D3DSAMP_MAXMIPLEVEL = 9;
public static final int D3DSAMP_MAXANISOTROPY = 10;
public static final int D3DSAMP_SRGBTEXTURE = 11;
public static final int D3DSAMP_ELEMENTINDEX = 12;
public static final int D3DSAMP_DMAPOFFSET = 13;
public static final int D3DSAMP_FORCE_DWORD = 0x7fffffff;
//D3DTEXTURESTAGESTATETYPE
public static final int D3DTSS_COLOROP = 1;
public static final int D3DTSS_COLORARG1 = 2;
public static final int D3DTSS_COLORARG2 = 3;
public static final int D3DTSS_ALPHAOP = 4;
public static final int D3DTSS_ALPHAARG1 = 5;
public static final int D3DTSS_ALPHAARG2 = 6;
public static final int D3DTSS_BUMPENVMAT00 = 7;
public static final int D3DTSS_BUMPENVMAT01 = 8;
public static final int D3DTSS_BUMPENVMAT10 = 9;
public static final int D3DTSS_BUMPENVMAT11 = 10;
public static final int D3DTSS_TEXCOORDINDEX = 11;
public static final int D3DTSS_BUMPENVLSCALE = 22;
public static final int D3DTSS_BUMPENVLOFFSET = 23;
public static final int D3DTSS_TEXTURETRANSFORMFLAGS = 24;
public static final int D3DTSS_COLORARG0 = 26;
public static final int D3DTSS_ALPHAARG0 = 27;
public static final int D3DTSS_RESULTARG = 28;
public static final int D3DTSS_CONSTANT = 32;
public static final int D3DTSS_FORCE_DWORD = 0x7fffffff;
public static final int D3DTS_WORLD = 256;
//D3DTRANSFORMSTATETYPE
public static final int D3DTS_VIEW = 2;
public static final int D3DTS_PROJECTION = 3;
public static final int D3DTS_TEXTURE0 = 16;
public static final int D3DTS_TEXTURE1 = 17;
public static final int D3DTS_TEXTURE2 = 18;
public static final int D3DTS_TEXTURE3 = 19;
public static final int D3DTS_TEXTURE4 = 20;
public static final int D3DTS_TEXTURE5 = 21;
public static final int D3DTS_TEXTURE6 = 22;
public static final int D3DTS_TEXTURE7 = 23;
public static final int D3DTS_FORCE_DWORD = 0x7fffffff;
//D3DTEXTUREFILTERTYPE
public static final int D3DTEXF_NONE = 0;
public static final int D3DTEXF_POINT = 1;
public static final int D3DTEXF_LINEAR = 2;
public static final int D3DTEXF_ANISOTROPIC = 3;
public static final int D3DTEXF_PYRAMIDALQUAD = 6;
public static final int D3DTEXF_GAUSSIANQUAD = 7;
public static final int D3DTEXF_CONVOLUTIONMONO = 8;
public static final int D3DTEXF_FORCE_DWORD = 0x7fffffff;
//D3DSCANLINEORDERING
public static final int D3DSCANLINEORDERING_PROGRESSIVE = 1;
public static final int D3DSCANLINEORDERING_INTERLACED = 2;
//D3DDISPLAYROTATION
public static final int D3DDISPLAYROTATION_IDENTITY = 1;
public static final int D3DDISPLAYROTATION_90 = 2;
public static final int D3DDISPLAYROTATION_180 = 2;
public static final int D3DDISPLAYROTATION_270 = 2;
//D3DCUBEMAP_FACES
public static final int D3DCUBEMAP_FACE_POSITIVE_X = 0;
public static final int D3DCUBEMAP_FACE_NEGATIVE_X = 1;
public static final int D3DCUBEMAP_FACE_POSITIVE_Y = 2;
public static final int D3DCUBEMAP_FACE_NEGATIVE_Y = 3;
public static final int D3DCUBEMAP_FACE_POSITIVE_Z = 4;
public static final int D3DCUBEMAP_FACE_NEGATIVE_Z = 5;
public static final int D3DCUBEMAP_FACE_FORCE_DWORD = 0xffffffff;
//D3DCOMPOSERECTSOP
public static final int D3DCOMPOSERECTS_COPY = 1;
public static final int D3DCOMPOSERECTS_OR = 2;
public static final int D3DCOMPOSERECTS_AND = 3;
public static final int D3DCOMPOSERECTS_NEG = 4;
public static final int D3DCOMPOSERECTS_FORCE_DWORD = 0x7fffffff;
//D3DCREATE
public static final int D3DCREATE_FPU_PRESERVE = 0x00000002;
public static final int D3DCREATE_MULTITHREADED = 0x00000004;
public static final int D3DCREATE_PUREDEVICE = 0x00000010;
public static final int D3DCREATE_SOFTWARE_VERTEXPROCESSING = 0x00000020;
public static final int D3DCREATE_HARDWARE_VERTEXPROCESSING = 0x00000040;
public static final int D3DCREATE_MIXED_VERTEXPROCESSING = 0x00000080;
public static final int D3DCREATE_DISABLE_DRIVER_MANAGEMENT = 0x00000100;
public static final int D3DCREATE_ADAPTERGROUP_DEVICE = 0x00000200;
public static final int D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX = 0x00000400;
public static final int D3DCREATE_NOWINDOWCHANGES = 0x00000800;
public static final int D3DCREATE_DISABLE_PSGP_THREADING = 0x00002000;
public static final int D3DCREATE_ENABLE_PRESENTSTATS = 0x00004000;
public static final int D3DCREATE_DISABLE_PRINTSCREEN = 0x00008000;
public static final int D3DCREATE_SCREENSAVER = 0x10000000;
//D3DERR
public static final int D3D_OK = 0;
public static final int D3DERR_WRONGTEXTUREFORMAT = MAKE_D3DHRESULT(2072);
public static final int D3DERR_UNSUPPORTEDCOLOROPERATION = MAKE_D3DHRESULT(2073);
public static final int D3DERR_UNSUPPORTEDCOLORARG = MAKE_D3DHRESULT(2074);
public static final int D3DERR_UNSUPPORTEDALPHAOPERATION = MAKE_D3DHRESULT(2075);
public static final int D3DERR_UNSUPPORTEDALPHAARG = MAKE_D3DHRESULT(2076);
public static final int D3DERR_TOOMANYOPERATIONS = MAKE_D3DHRESULT(2077);
public static final int D3DERR_CONFLICTINGTEXTUREFILTER = MAKE_D3DHRESULT(2078);
public static final int D3DERR_UNSUPPORTEDFACTORVALUE = MAKE_D3DHRESULT(2079);
public static final int D3DERR_CONFLICTINGRENDERSTATE = MAKE_D3DHRESULT(2081);
public static final int D3DERR_UNSUPPORTEDTEXTUREFILTER = MAKE_D3DHRESULT(2082);
public static final int D3DERR_CONFLICTINGTEXTUREPALETTE = MAKE_D3DHRESULT(2086);
public static final int D3DERR_DRIVERINTERNALERROR = MAKE_D3DHRESULT(2087);
public static final int D3DERR_NOTFOUND = MAKE_D3DHRESULT(2150);
public static final int D3DERR_MOREDATA = MAKE_D3DHRESULT(2151);
public static final int D3DERR_DEVICELOST = MAKE_D3DHRESULT(2152);
public static final int D3DERR_DEVICENOTRESET = MAKE_D3DHRESULT(2153);
public static final int D3DERR_NOTAVAILABLE = MAKE_D3DHRESULT(2154);
public static final int D3DERR_OUTOFVIDEOMEMORY = MAKE_D3DHRESULT(380);
public static final int D3DERR_INVALIDDEVICE = MAKE_D3DHRESULT(2155);
public static final int D3DERR_INVALIDCALL = MAKE_D3DHRESULT(2156);
public static final int D3DERR_DRIVERINVALIDCALL = MAKE_D3DHRESULT(2157);
public static final int D3DERR_WASSTILLDRAWING = MAKE_D3DHRESULT(540);
public static final int D3DOK_NOAUTOGEN = MAKE_D3DSTATUS(2159);
//D3DFVF
public static final int D3DFVF_RESERVED0 = 0x001;
public static final int D3DFVF_POSITION_MASK = 0x400E;
public static final int D3DFVF_XYZ = 0x002;
public static final int D3DFVF_XYZRHW = 0x004;
public static final int D3DFVF_XYZB1 = 0x006;
public static final int D3DFVF_XYZB2 = 0x008;
public static final int D3DFVF_XYZB3 = 0x00a;
public static final int D3DFVF_XYZB4 = 0x00c;
public static final int D3DFVF_XYZB5 = 0x00e;
public static final int D3DFVF_XYZW = 0x4002;
public static final int D3DFVF_NORMAL = 0x010;
public static final int D3DFVF_PSIZE = 0x020;
public static final int D3DFVF_DIFFUSE = 0x040;
public static final int D3DFVF_SPECULAR = 0x080;
public static final int D3DFVF_TEXCOUNT_MASK = 0xf00;
public static final int D3DFVF_TEXCOUNT_SHIFT = 8;
public static final int D3DFVF_TEX0 = 0x000;
public static final int D3DFVF_TEX1 = 0x100;
public static final int D3DFVF_TEX2 = 0x200;
public static final int D3DFVF_TEX3 = 0x300;
public static final int D3DFVF_TEX4 = 0x400;
public static final int D3DFVF_TEX5 = 0x500;
public static final int D3DFVF_TEX6 = 0x600;
public static final int D3DFVF_TEX7 = 0x700;
public static final int D3DFVF_TEX8 = 0x800;
public static final int D3DFVF_LASTBETA_UBYTE4 = 0x1000;
public static final int D3DFVF_LASTBETA_D3DCOLOR = 0x8000;
public static final int D3DFVF_RESERVED2 = 0x6000;
//D3DCLEAR
public static final int D3DCLEAR_TARGET = 0x00000001;
public static final int D3DCLEAR_ZBUFFER = 0x00000002;
public static final int D3DCLEAR_STENCIL = 0x00000004;
//D3DCULL
public static final int D3DCULL_NONE = 1;
public static final int D3DCULL_CW = 2;
public static final int D3DCULL_CCW = 3;
public static final int D3DCULL_FORCE_DWORD = 0x7fffffff; /* force 32-bit size enum */
//D3DX
public static final double D3DX_PI = 3.141592654;
public static final double D3DX_1BYPI = 0.318309886;
private static int MAKEFOURCC(char ch0, char ch1, char ch2, char ch3) {
return ((((int)ch0)) | (((int)ch1) << 8) | (((int)ch2) << 16) | (((int)ch3) << 24 ));
}
private static int MAKE_D3DHRESULT(int code) {
return MAKE_HRESULT( 1, 0x876, code );
}
private static int MAKE_D3DSTATUS(int code) {
return MAKE_HRESULT( 0, 0x876, code );
}
private static int MAKE_HRESULT(int sev, int fac, int code) {
return (int)(((long)(sev)<<31) | ((long)(fac)<<16) | ((long)(code)));
}
}

View File

@ -1,992 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the abstract class for a Display in LWJGL. LWJGL displays have some
* peculiar characteristics:
*
* - the display may be closeable by the user or operating system, and may be minimized
* by the user or operating system
* - only one display may ever be open at once
* - the operating system may or may not be able to do fullscreen or windowed displays.
*
* @author foo
*/
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.HashSet;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
import org.lwjgl.input.Controllers;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public final class Display {
private static final Thread shutdown_hook = new Thread() {
public void run() {
reset();
}
};
/** The display implementor */
private static final WindowsDisplay display_impl;
/** The initial display mode */
private static final DisplayMode initial_mode;
/** The current display mode, if created */
private static DisplayMode current_mode;
/** Timer for sync() */
private static long timeNow, timeThen;
/** X coordinate of the window */
private static int x = -1;
/** Cached window icons, for when Display is recreated */
private static ByteBuffer[] cached_icons;
/**
* Y coordinate of the window. Y in window coordinates is from the top of the display down,
* unlike GL, where it is typically at the bottom of the display.
*/
private static int y = -1;
/** Title of the window (never null) */
private static String title = "Game";
/** Fullscreen */
private static boolean fullscreen;
/** Swap interval */
private static int swap_interval;
/** A unique context object, so we can track different contexts between creates() and destroys() */
private static PeerInfo peer_info;
private static Context context;
/** The Drawable instance that tracks the current Display context */
private final static Drawable drawable;
private static boolean window_created = false;
static {
Sys.initialize();
if(LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS) {
throw new IllegalStateException("Unsupported platform");
}
display_impl = new WindowsDisplay();
try {
current_mode = initial_mode = display_impl.init();
LWJGLUtil.log("Initial mode: " + initial_mode);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
drawable = new Drawable() {
public Context getContext() {
synchronized (GlobalLock.lock) {
return isCreated() ? context : null;
}
}
};
}
/**
* Fetch the Drawable from the Display.
*
* @return the Drawable corresponding to the Display context
*/
public static Drawable getDrawable() {
return drawable;
}
/**
* Only constructed by ourselves
*/
private Display() {
}
/**
* Returns the entire list of possible fullscreen display modes as an array, in no
* particular order. Although best attempts to filter out invalid modes are done, any
* given mode is not guaranteed to be available nor is it guaranteed to be within the
* current monitor specs (this is especially a problem with the frequency parameter).
* Furthermore, it is not guaranteed that create() will detect an illegal display mode.
*
* The only certain way to check
* is to call create() and make sure it works.
* Only non-palette-indexed modes are returned (ie. bpp will be 16, 24, or 32).
* Only DisplayModes from this call can be used when the Display is in fullscreen
* mode.
*
* @return an array of all display modes the system reckons it can handle.
*/
public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
synchronized (GlobalLock.lock) {
DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes();
if (unfilteredModes == null) {
return new DisplayMode[0];
}
// We'll use a HashSet to filter out the duplicated modes
HashSet modes = new HashSet(unfilteredModes.length);
modes.addAll(Arrays.asList(unfilteredModes));
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
LWJGLUtil.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes");
return filteredModes;
}
}
/**
* Return the current display mode, as set by setDisplayMode().
* @return The current display mode
*/
public static DisplayMode getDisplayMode() {
synchronized (GlobalLock.lock) {
return current_mode;
}
}
/**
* Set the current display mode. If no OpenGL context has been created, the given mode will apply to
* the context when create() is called, and no immediate mode switching will happen. If there is a
* context already, it will be resized according to the given mode. If the context is also a
* fullscreen context, the mode will also be switched immediately. The native cursor position
* is also reset.
*
* @param mode The new display mode to set
* @throws LWJGLException if the display mode could not be set
*/
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
synchronized (GlobalLock.lock) {
if (mode == null)
throw new NullPointerException("mode must be non-null");
current_mode = mode;
if (isCreated()) {
destroyWindow();
// If mode is not fullscreen capable, make sure we are in windowed mode
if (!mode.isFullscreen())
resetFullscreen();
try {
if (fullscreen)
switchDisplayMode();
createWindow();
// makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
destroyContext();
destroyPeerInfo();
display_impl.resetDisplayMode();
throw e;
}
}
}
}
/**
* Create the native window peer from the given mode and fullscreen flag.
* A native context must exist, and it will be attached to the window.
*/
private static void createWindow() throws LWJGLException {
if (window_created) {
return;
}
int window_x;
int window_y;
if (!fullscreen) {
// if no display location set, center window
if (x == -1 && y == -1) {
window_x = Math.max(0, (initial_mode.getWidth() - current_mode.getWidth()) / 2);
window_y = Math.max(0, (initial_mode.getHeight() - current_mode.getHeight()) / 2);
} else {
window_x = x;
window_y = y;
}
} else {
window_x = 0;
window_y = 0;
}
display_impl.createWindow(current_mode, fullscreen, window_x, window_y);
window_created = true;
setTitle(title);
initControls();
// set cached window icon if exists
if(cached_icons != null) {
setIcon(cached_icons);
} else {
setIcon(new ByteBuffer[] { LWJGLUtil.LWJGLIcon32x32, LWJGLUtil.LWJGLIcon16x16 });
}
}
private static void destroyWindow() {
if (!window_created) {
return;
}
// try {
// if (context != null && context.isCurrent()) {
// context.releaseDrawable();
// Context.releaseCurrentContext();
// }
// } catch (LWJGLException e) {
// LWJGLUtil.log("Exception occurred while trying to release context: " + e);
// }
// Automatically destroy keyboard & mouse
if (Mouse.isCreated()) {
Mouse.destroy();
}
if (Keyboard.isCreated()) {
Keyboard.destroy();
}
display_impl.destroyWindow();
window_created = false;
}
private static void switchDisplayMode() throws LWJGLException {
if (!current_mode.isFullscreen()) {
LWJGLUtil.log("Switching to "+initial_mode);
setDisplayMode(initial_mode);
}
display_impl.switchDisplayMode(current_mode);
}
/**
* Set the display configuration to the specified gamma, brightness and contrast.
* The configuration changes will be reset when destroy() is called.
*
* @param gamma The gamma value
* @param brightness The brightness value between -1.0 and 1.0, inclusive
* @param contrast The contrast, larger than 0.0.
*/
public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException {
synchronized (GlobalLock.lock) {
if (!isCreated()) {
throw new LWJGLException("Display not yet created.");
}
if (brightness < -1.0f || brightness > 1.0f)
throw new IllegalArgumentException("Invalid brightness value");
if (contrast < 0.0f)
throw new IllegalArgumentException("Invalid contrast value");
int rampSize = display_impl.getGammaRampLength();
if (rampSize == 0) {
throw new LWJGLException("Display configuration not supported");
}
FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize);
for (int i = 0; i < rampSize; i++) {
float intensity = (float)i/(rampSize - 1);
// apply gamma
float rampEntry = (float)java.lang.Math.pow(intensity, gamma);
// apply brightness
rampEntry += brightness;
// apply contrast
rampEntry = (rampEntry - 0.5f)*contrast + 0.5f;
// Clamp entry to [0, 1]
if (rampEntry > 1.0f)
rampEntry = 1.0f;
else if (rampEntry < 0.0f)
rampEntry = 0.0f;
gammaRamp.put(i, rampEntry);
}
display_impl.setGammaRamp(gammaRamp);
LWJGLUtil.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast);
}
}
/**
* Synchronize the display to a capped frame rate. Note that we are being "smart" about the
* desired results in our implementation; we automatically subtract 1 from the desired framerate
* to prevent just missing the frame time if vsync is set.
* @param fps The desired frame rate, in frames per second
*/
public static void sync3(int fps) {
synchronized (GlobalLock.lock) {
float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
timeNow = Sys.getTime();
while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameTime) {
// This is a system-friendly way of allowing other stuff to use CPU if it wants to
Thread.yield();
timeNow = Sys.getTime();
}
timeThen = timeNow;
}
}
private static long timeLate;
/**
* Alternative sync method which works better on triple-buffered GL displays.
*
* @param fps The desired frame rate, in frames per second
*/
public static void sync2(int fps) {
synchronized (GlobalLock.lock) {
long gapTo = Sys.getTimerResolution() / fps + timeThen;
timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) {
Thread.yield();
timeNow = Sys.getTime();
}
if (gapTo < timeNow)
timeLate = timeNow - gapTo;
else
timeLate = 0;
timeThen = timeNow;
}
}
/**
* Best sync method that works reliably.
*
* @param fps The desired frame rate, in frames per second
*/
public static void sync(int fps) {
synchronized (GlobalLock.lock) {
long gapTo = Sys.getTimerResolution() / fps + timeThen;
timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
timeNow = Sys.getTime();
}
if (gapTo < timeNow)
timeLate = timeNow - gapTo;
else
timeLate = 0;
timeThen = timeNow;
}
}
/**
* @return the X coordinate of the window (always 0 for fullscreen)
*/
/*public static int getX() {
return (fullscreen) ? 0 : x;
}*/
/**
* @return the Y coordinate of the window (always 0 for fullscreen)
*/
/*public static int getY() {
return (fullscreen) ? 0 : y;
}*/
/**
* @return the title of the window
*/
public static String getTitle() {
synchronized (GlobalLock.lock) {
return title;
}
}
private static void resetFullscreen() {
synchronized (GlobalLock.lock) {
if (Display.fullscreen) {
Display.fullscreen = false;
display_impl.resetDisplayMode();
}
}
}
/**
* Set the fullscreen mode of the context. If no context has been created through create(),
* the mode will apply when create() is called. If fullscreen is true, the context will become
* a fullscreen context and the display mode is switched to the mode given by getDisplayMode(). If
* fullscreen is false, the context will become a windowed context with the dimensions given in the
* mode returned by getDisplayMode(). The native cursor position is also reset.
*
* @param fullscreen Specify the fullscreen mode of the context.
* @throws LWJGLException If fullscreen is true, and the current DisplayMode instance is not
* from getAvailableDisplayModes() or if the mode switch fails.
*/
public static void setFullscreen(boolean fullscreen) throws LWJGLException {
synchronized (GlobalLock.lock) {
if (Display.fullscreen != fullscreen) {
Display.fullscreen = fullscreen;
if (!isCreated())
return;
destroyWindow();
try {
if (fullscreen) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
}
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
destroyContext();
destroyPeerInfo();
display_impl.resetDisplayMode();
throw e;
}
}
}
}
/**
* @return whether the Display is in fullscreen mode
*/
public static boolean isFullscreen() {
synchronized (GlobalLock.lock) {
return fullscreen;
}
}
/**
* Set the title of the window. This may be ignored by the underlying OS.
* @param newTitle The new window title
*/
public static void setTitle(String newTitle) {
synchronized (GlobalLock.lock) {
if (newTitle == null) {
newTitle = "";
}
title = newTitle;
if (isCreated())
display_impl.setTitle(title);
}
}
/**
* @return true if the user or operating system has asked the window to close
*/
public static boolean isCloseRequested() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine close requested state of uncreated window");
display_impl.update();
return display_impl.isCloseRequested();
}
}
/**
* @return true if the window is visible, false if not
*/
public static boolean isVisible() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine minimized state of uncreated window");
display_impl.update();
return display_impl.isVisible();
}
}
/**
* @return true if window is active, that is, the foreground display of the operating system.
*/
public static boolean isActive() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine focused state of uncreated window");
display_impl.update();
return display_impl.isActive();
}
}
/**
* Determine if the window's contents have been damaged by external events.
* If you are writing a straightforward game rendering loop and simply paint
* every frame regardless, you can ignore this flag altogether. If you are
* trying to be kind to other processes you can check this flag and only
* redraw when it returns true. The flag is cleared when update() or isDirty() is called.
*
* @return true if the window has been damaged by external changes
* and needs to repaint itself
*/
public static boolean isDirty() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine dirty state of uncreated window");
display_impl.update();
return display_impl.isDirty();
}
}
/**
* Process operating system events. Call this to update the Display's state and make sure the
* input devices receive events. This method is called from update(), and should normally not be called by
* the application.
*/
public static void processMessages() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Display not created");
display_impl.update();
}
}
/**
* Swap the display buffers. This method is called from update(), and should normally not be called by
* the application.
* @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError()
*/
public static void swapBuffers() throws LWJGLException {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Display not created");
//
// Util.checkGLError();
// Context.swapBuffers();
}
}
/**
* Update the window. This calls processMessages(), and if the window is visible
* clears the dirty flag and calls swapBuffers() and finally polls the input devices.
* @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError()
*/
public static void update() {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Display not created");
// We paint only when the window is visible or dirty
if (isVisible() || isDirty()) {
try {
swapBuffers();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
processMessages();
pollDevices();
}
}
static void pollDevices() {
// Poll the input devices while we're here
if (Mouse.isCreated()) {
Mouse.poll();
Mouse.updateCursor();
}
if (Keyboard.isCreated()) {
Keyboard.poll();
}
if(Controllers.isCreated()) {
Controllers.poll();
}
}
/**
* Release the Display context.
*
* @throws LWJGLException If the context could not be released
*/
public static void releaseContext() throws LWJGLException {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Display is not created");
if (context.isCurrent())
Context.releaseCurrentContext();
}
}
/**
* Make the Display the current rendering context for GL calls.
*
* @throws LWJGLException If the context could not be made current
*/
public static void makeCurrent() throws LWJGLException {
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Display is not created");
context.makeCurrent();
}
}
/**
* Create the OpenGL context. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
* will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
* created with the given parameters, a LWJGLException will be thrown.
*
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
*
* @throws LWJGLException
*/
public static void create() throws LWJGLException {
synchronized (GlobalLock.lock) {
create(new PixelFormat());
}
}
/**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
* will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
* created with the given parameters, a LWJGLException will be thrown.
*
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
*
* @param pixel_format Describes the minimum specifications the context must fulfill.
* @throws LWJGLException
*/
public static void create(PixelFormat pixel_format) throws LWJGLException {
synchronized (GlobalLock.lock) {
create(pixel_format, null);
}
}
private static void removeShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Runtime.getRuntime().removeShutdownHook(shutdown_hook);
return null;
}
});
}
private static void registerShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Runtime.getRuntime().addShutdownHook(shutdown_hook);
return null;
}
});
}
/**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
* will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
* created with the given parameters, a LWJGLException will be thrown.
*
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
*
* @param pixel_format Describes the minimum specifications the context must fulfill.
* @param shared_drawable The Drawable to share context with or null.
* @throws LWJGLException
*/
public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException {
synchronized (GlobalLock.lock) {
if (isCreated())
throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
if (pixel_format == null)
throw new NullPointerException("pixel_format cannot be null");
removeShutdownHook();
registerShutdownHook();
if (fullscreen)
switchDisplayMode();
// try {
// peer_info = display_impl.createPeerInfo();
try {
createWindow();
// try {
// context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null);
// try {
// makeCurrentAndSetSwapInterval();
// initContext();
// } catch (LWJGLException e) {
// destroyContext();
// throw e;
// }
// } catch (LWJGLException e) {
// destroyWindow();
// throw e;
// }
} catch (LWJGLException e) {
destroyPeerInfo();
throw e;
}
// } catch (LWJGLException e) {
// display_impl.resetDisplayMode();
// throw e;
// }
}
}
private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
// makeCurrent();
// Util.checkGLError();
// setSwapInterval(swap_interval);
}
// private static void initContext() {
// // Put the window into orthographic projection mode with 1:1 pixel ratio.
// // We haven't used GLU here to do this to avoid an unnecessary dependency.
// GL11.glMatrixMode(GL11.GL_PROJECTION);
// GL11.glLoadIdentity();
// GL11.glOrtho(0.0, current_mode.getWidth(), 0.0, current_mode.getHeight(), -1.0, 1.0);
// GL11.glMatrixMode(GL11.GL_MODELVIEW);
// GL11.glLoadIdentity();
// GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
// // Clear window to avoid the desktop "showing through"
// GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
// update();
// }
//
static DisplayImplementation getImplementation() {
return display_impl;
}
/**
* Gets a boolean property as a privileged action.
*/
static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Boolean(Boolean.getBoolean(property_name));
}
});
return value.booleanValue();
}
private static void initControls() {
// Automatically create mouse, keyboard and controller
if (!getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput")) {
if (!Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse")) {
try {
Mouse.create();
} catch (LWJGLException e) {
if (LWJGLUtil.DEBUG) {
e.printStackTrace(System.err);
} else {
LWJGLUtil.log("Failed to create Mouse: "+e);
}
}
}
if (!Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard")) {
try {
Keyboard.create();
} catch (LWJGLException e) {
if (LWJGLUtil.DEBUG) {
e.printStackTrace(System.err);
} else {
LWJGLUtil.log("Failed to create Keyboard: "+e);
}
}
}
}
}
/**
* Destroy the Display. After this call, there will be no current GL rendering context,
* regardless of whether the Display was the current rendering context.
*/
public static void destroy() {
synchronized (GlobalLock.lock) {
if (!isCreated()) {
return;
}
destroyWindow();
// destroyContext();
// destroyPeerInfo();
x = y = -1;
cached_icons = null;
reset();
removeShutdownHook();
}
}
private static void destroyPeerInfo() {
// peer_info.destroy();
// peer_info = null;
}
private static void destroyContext() {
// try {
// context.forceDestroy();
// } catch (LWJGLException e) {
// throw new RuntimeException(e);
// } finally {
// context = null;
// }
}
/*
* Reset display mode if fullscreen. This method is also called from the shutdown hook added
* in the static constructor
*/
private static void reset() {
display_impl.resetDisplayMode();
current_mode = initial_mode;
}
/**
* @return true if the window's native peer has been created
*/
public static boolean isCreated() {
synchronized (GlobalLock.lock) {
return window_created;
}
}
/**
* Set the buffer swap interval. This call is a best-attempt at changing
* the monitor swap interval, which is the minimum periodicity of color buffer swaps,
* measured in video frame periods, and is not guaranteed to be successful.
*
* A video frame period is the time required to display a full frame of video data.
*
* @param sync true to synchronize; false to ignore synchronization
*/
public static void setSwapInterval(int value) {
synchronized (GlobalLock.lock) {
swap_interval = value;
if (isCreated())
Context.setSwapInterval(swap_interval);
}
}
/**
* Enable or disable vertical monitor synchronization. This call is a best-attempt at changing
* the vertical refresh synchronization of the monitor, and is not guaranteed to be successful.
* @param sync true to synchronize; false to ignore synchronization
*/
public static void setVSyncEnabled(boolean sync) {
synchronized (GlobalLock.lock) {
setSwapInterval(sync ? 1 : 0);
}
}
/**
* Set the window's location. This is a no-op on fullscreen windows.
* The window is clamped to remain entirely on the screen. If you attempt
* to position the window such that it would extend off the screen, the window
* is simply placed as close to the edge as possible.
* <br><b>note</b>If no location has been specified (or x == y == -1) the window will be centered
* @param x The new window location on the x axis
* @param y The new window location on the y axis
*/
public static void setLocation(int new_x, int new_y) {
synchronized (GlobalLock.lock) {
if (fullscreen) {
return;
}
// cache position
x = new_x;
y = new_y;
// offset if already created
if(isCreated()) {
display_impl.reshape(x, y, current_mode.getWidth(), current_mode.getHeight());
}
}
}
/**
* Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2",
* "Radeon9700". If the adapter cannot be determined, this function returns null.
* @return a String
*/
public static String getAdapter() {
synchronized (GlobalLock.lock) {
return display_impl.getAdapter();
}
}
/**
* Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined,
* this function returns null.
* @return a String
*/
public static String getVersion() {
synchronized (GlobalLock.lock) {
return display_impl.getVersion();
}
}
/**
* Sets one or more icons for the Display.
* <ul>
* <li>On Windows you should supply at least one 16x16 icon and one 32x32.</li>
* <li>Linux (and similar platforms) expect one 32x32 icon.</li>
* <li>Mac OS X should be supplied one 128x128 icon</li>
* </ul>
* The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform.
* <p>
* <b>NOTE:</b> The display will make a deep copy of the supplied byte buffer array, for the purpose
* of recreating the icons when you go back and forth fullscreen mode. You therefore only need to
* set the icon once per instance.
*
* @param icons Array of icons in RGBA mode. Pass the icons in order of preference.
* @return number of icons used, or 0 if display hasn't been created
*/
public static int setIcon(ByteBuffer[] icons) {
synchronized (GlobalLock.lock) {
// make deep copy so we dont rely on the supplied buffers later on
// don't recache!
if(cached_icons != icons) {
cached_icons = new ByteBuffer[icons.length];
for(int i=0;i<icons.length; i++) {
cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity());
cached_icons[i].put(icons[i]);
cached_icons[i].flip();
}
}
if(Display.isCreated()) {
return display_impl.setIcon(cached_icons);
} else {
return 0;
}
}
}
public static long getHwnd() {
return WindowsDisplay.getHwnd();
}
}

View File

@ -1,133 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
interface DisplayImplementation extends InputImplementation {
void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
void destroyWindow();
void switchDisplayMode(DisplayMode mode) throws LWJGLException;
/**
* Reset the display mode to whatever it was when LWJGL was initialized.
* Fails silently.
*/
void resetDisplayMode();
/**
* Return the length of the gamma ramp arrays. Returns 0 if gamma settings are
* unsupported.
*
* @return the length of each gamma ramp array, or 0 if gamma settings are unsupported.
*/
int getGammaRampLength();
/**
* Method to set the gamma ramp.
*/
void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
/**
* Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2",
* "Radeon9700". If the adapter cannot be determined, this function returns null.
* @return a String
*/
String getAdapter();
/**
* Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined,
* this function returns null.
* @return a String
*/
String getVersion();
/**
* Initialize and return the current display mode.
*/
DisplayMode init() throws LWJGLException;
/**
* Implementation of setTitle(). This will read the window's title member
* and stash it in the native title of the window.
*/
void setTitle(String title);
boolean isCloseRequested();
boolean isVisible();
boolean isActive();
boolean isDirty();
/**
* Create the native PeerInfo.
* @throws LWJGLException
*/
PeerInfo createPeerInfo() throws LWJGLException;
// void destroyPeerInfo();
/**
* Updates the windows internal state. This must be called at least once per video frame
* to handle window close requests, moves, paints, etc.
*/
void update();
void reshape(int x, int y, int width, int height);
/**
* Method for getting displaymodes
*/
DisplayMode[] getAvailableDisplayModes() throws LWJGLException;
/**
* Sets one or more icons for the Display.
* <ul>
* <li>On Windows you should supply at least one 16x16 icon and one 32x32.</li>
* <li>Linux (and similar platforms) expect one 32x32 icon.</li>
* <li>Mac OS X should be supplied one 128x128 icon</li>
* </ul>
* The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform.
*
* @param icons Array of icons in RGBA mode
* @return number of icons used.
*/
public int setIcon(ByteBuffer[] icons);
}

View File

@ -1,142 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
*
* This class encapsulates the properties for a given display mode.
* This class is not instantiable, and is aquired from the <code>Display.
* getAvailableDisplayModes()</code> method.
*
* @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision: 2286 $
* $Id: DisplayMode.java 2286 2006-03-23 19:32:21Z matzon $
*/
public class DisplayMode {
/** properties of the display mode */
private final int width, height, bpp, freq;
/** If true, this instance can be used for fullscreen modes */
private final boolean fullscreen;
/**
* Construct a display mode. DisplayModes constructed through the
* public constructor can only be used to specify the dimensions of
* the Display in windowed mode. To get the available DisplayModes for
* fullscreen modes, use Display.getAvailableDisplayModes().
*
* @param width The Display width.
* @param height The Display height.
* @see Display
*/
public DisplayMode(int width, int height) {
this(width, height, 0, 0, false);
}
DisplayMode(int width, int height, int bpp, int freq) {
this(width, height, bpp, freq, true);
}
private DisplayMode(int width, int height, int bpp, int freq, boolean fullscreen) {
this.width = width;
this.height = height;
this.bpp = bpp;
this.freq = freq;
this.fullscreen = fullscreen;
}
/** True iff this instance can be used for fullscreen modes */
boolean isFullscreen() {
return fullscreen;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int getBitsPerPixel() {
return bpp;
}
public int getFrequency() {
return freq;
}
/**
* Tests for <code>DisplayMode</code> equality
*
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof DisplayMode)) {
return false;
}
DisplayMode dm = (DisplayMode) obj;
return dm.width == width
&& dm.height == height
&& dm.bpp == bpp
&& dm.freq == freq;
}
/**
* Retrieves the hashcode for this object
*
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return width ^ height ^ freq ^ bpp;
}
/**
* Retrieves a String representation of this <code>DisplayMode</code>
*
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer sb = new StringBuffer(32);
sb.append(width);
sb.append(" x ");
sb.append(height);
sb.append(" x ");
sb.append(bpp);
sb.append(" @");
sb.append(freq);
sb.append("Hz");
return sb.toString();
}
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* The Drawable interface describes an OpenGL drawable with an associated
* Context.
*
* @author elias_naur
*/
public interface Drawable {
Context getContext();
}

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* A java implementation of a LWJGL compatible event queue.
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
class EventQueue {
private static final int QUEUE_SIZE = 200;
private final int event_size;
private final ByteBuffer queue;
protected EventQueue(int event_size) {
this.event_size = event_size;
this.queue = ByteBuffer.allocate(QUEUE_SIZE*event_size);
}
protected synchronized void clearEvents() {
queue.clear();
}
/**
* Copy available events into the specified buffer.
*/
public synchronized void copyEvents(ByteBuffer dest) {
queue.flip();
int old_limit = queue.limit();
if (dest.remaining() < queue.remaining())
queue.limit(dest.remaining() + queue.position());
dest.put(queue);
queue.limit(old_limit);
queue.compact();
}
/**
* Put an event into the queue.
* @return true if the event fitted into the queue, false otherwise
*/
public synchronized boolean putEvent(ByteBuffer event) {
if (event.remaining() != event_size)
throw new IllegalArgumentException("Internal error: event size " + event_size + " does not equal the given event size " + event.remaining());
if (queue.remaining() >= event.remaining()) {
queue.put(event);
return true;
} else
return false;
}
}

View File

@ -1,26 +0,0 @@
package org.lwjgl.d3d;
public class GUID {
public long Data1; //4 DWORD
public short Data2; //2 WORD
public short Data3; //2 WORD
public byte Data4[] = new byte[8]; //8 BYTE
public String toString() {
return
"\nGUID = " + padDigits(Integer.toHexString((int)Data1).toUpperCase(), 8) + "-" +
padDigits(Integer.toHexString(Data2).toUpperCase(), 4) + "-" +
padDigits(Integer.toHexString(Data3).toUpperCase(), 4) + "-" +
padDigits(Integer.toHexString(((((int)Data4[0]) << 8) + ((int)Data4[1])) & 0xFFFF).toUpperCase(), 4) + "-" +
padDigits(Integer.toHexString((((int)Data4[2]) << 24) + (((int)Data4[3]) << 16) + (((int)Data4[4]) << 8) + ((int)Data4[5])).toUpperCase(), 8) +
padDigits(Integer.toHexString(((((int)Data4[6]) << 8) + ((int)Data4[7])) & 0xFFFF).toUpperCase(), 4);
}
private String padDigits(String source, int size) {
while(source.length() < size) {
source = "0" + source;
}
return source;
}
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This class contains the global lock that LWJGL will use to
* synchronize access to Display.
*/
final class GlobalLock {
final static Object lock = new Object();
}

View File

@ -1,259 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import org.lwjgl.BufferChecks;
/**
*
* @author Mark
*
*/
public final class IDirect3D9 {
private long iDirect3D9;
/**
* Constructor for creating a Direct3D9 interface.
*
* @param iDirect3D9 A pointer to the native interface.
*/
private IDirect3D9(long iDirect3D9) {
this.iDirect3D9 = iDirect3D9;
}
/**
* HRESULT CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
* D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
*
* @param adapter
* @param deviceType
* @param adapterFormat
* @param renderTargetFormat
* @param depthStencilFormat
* @return
*/
public final long checkDepthStencilMatch(int adapter, int deviceType, int adapterFormat,
int renderTargetFormat, int depthStencilFormat){
return nCheckDepthStencilMatch(iDirect3D9, adapter, deviceType, adapterFormat, renderTargetFormat, depthStencilFormat);
}
/**
*HRESULT CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
* DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
*
* @param adapter
* @param deviceType
* @param adapterFormat
* @param usage
* @param resoruceType
* @param checkFormat
* @return
*/
public final long checkDeviceFormat(int adapter, int deviceType, int adapterFormat,
int usage, int resoruceType, int checkFormat){
return nCheckDeviceFormat(iDirect3D9, adapter, deviceType, adapterFormat, usage, resoruceType, checkFormat);
}
/**
*HRESULT CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat,
* D3DFORMAT TargetFormat);
*
* @param adapter
* @param deviceType
* @param sourceFormat
* @param targetFormat
* @return
*/
public final long checkDeviceFormatConversion(int adapter, int deviceType, int sourceFormat, int targetFormat){
return nCheckDeviceFormatConversion(iDirect3D9, adapter, deviceType, sourceFormat, targetFormat);
}
/**
* HRESULT CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
* BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels);
*
* @param adapter
* @param deviceType
* @param surfaceFormat
* @param windowed
* @param multiSampleType
* @param qualityLevels
* @return
*/
public final long checkDeviceMultiSampleType(int adapter, int deviceType, int surfaceFormat,
boolean windowed, int multiSampleType, IntBuffer qualityLevels){
if(qualityLevels != null) {
BufferChecks.checkBuffer(qualityLevels, 1);
}
return nCheckDeviceMultiSampleType(iDirect3D9, adapter, deviceType, surfaceFormat, windowed, multiSampleType, qualityLevels);
}
/**
* HRESULT CheckDeviceType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT DisplayFormat,
* D3DFORMAT BackBufferFormat, BOOL Windowed);
*
* @param adapter
* @param deviceType
* @param displayFormat
* @param backBufferFormat
* @param windowed
* @return
*/
public final long checkDeviceType(int adapter, int deviceType, int displayFormat,
int backBufferFormat, boolean windowed){
return nCheckDeviceType(iDirect3D9, adapter, deviceType, displayFormat, backBufferFormat, windowed);
}
/**
* HRESULT CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags,
* D3DPRESENT_PARAMETERS * pPresentationParameters,
* IDirect3DDevice9 ** ppReturnedDeviceInterface);
*
* @param adapter
* @param deviceType
* @param focusWindow
* @param behaviorFlags
* @param presentationParameters
* @param returnedDeviceInterface
* @return
*/
public final long createDevice(int adapter, int deviceType, long focusWindow, int behaviorFlags,
D3DPresentParameters presentationParameters, IDirect3DDevice9 returnedDeviceInterface){
return nCreateDevice(iDirect3D9, adapter, deviceType, focusWindow, behaviorFlags, presentationParameters.getBuffer(), returnedDeviceInterface);
}
/**
* HRESULT EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode);
*
* @param adapter
* @param format
* @param modeIndex
* @param mode
* @return
*/
public final long enumAdapterModes(int adapter, int format, int modeIndex, D3DDisplaymode mode){
return nEnumAdapterModes(iDirect3D9, adapter, format, modeIndex, mode.getEmptyBuffer());
}
/**
* UINT GetAdapterCount();
*
* @return
*/
public final int getAdapterCount(){
return nGetAdapterCount(iDirect3D9);
}
/**
* HRESULT GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE * pMode);
*
* @param adapter
* @param mode
* @return
*/
public final long getAdapterDisplayMode(int adapter, D3DDisplaymode mode){
ByteBuffer buffer = mode.getEmptyBuffer();
long result = nGetAdapterDisplayMode(iDirect3D9, adapter, buffer);
mode.setBuffer(buffer);
return result;
}
/**
* HRESULT GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 * pIdentifier);
*
* @param adapter
* @param flags
* @param identifier
* @return
*/
public final long getAdapterIdentifier(int adapter, int flags, D3DAdapterIdentifier9 identifier){
ByteBuffer buffer = identifier.getEmptyBuffer();
long result = nGetAdapterIdentifier(iDirect3D9, adapter, flags, buffer);
identifier.setBuffer(buffer);
return result;
}
/**
* UINT GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
*
* @param adapter
* @param format
* @return
*/
public final int getAdapterModeCount(int adapter, int format){
return nGetAdapterModeCount(iDirect3D9, adapter, format);
}
/**
* HMONITOR GetAdapterMonitor(UINT Adapter);
*
* @param adapter
* @return
*/
public final long getAdapterMonitor(int adapter){
return nGetAdapterMonitor(iDirect3D9, adapter);
}
/**
* HRESULT GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 * pCaps);
*
* @param adapter
* @param deviceType
* @param caps
* @return
*/
public final long getDeviceCaps(int adapter, int deviceType, D3DCaps9 caps){
ByteBuffer buffer = caps.getEmptyBuffer();
long result = nGetDeviceCaps(iDirect3D9, adapter, deviceType, buffer);
caps.setBuffer(buffer);
return result;
}
/**
* HRESULT RegisterSoftwareDevice(void * pInitializeFunction);
*
* @return
*/
public final long registerSoftwareDevice(){
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Release the native resources associated with this interface.
* To get another interface, a new call to create needs to be made.
*
*/
public final void release() {
nRelease(iDirect3D9);
}
/**
* Create the Direct3D interface and store the pointer to the native interface in this class.
*
* @return A IDirect3D9 class representing the native interface.
*/
public final static IDirect3D9 create() {
long tempiDirect3D9 = nCreate();
return new IDirect3D9(tempiDirect3D9);
}
/**
* Get the pointer to the native interface.
*
* @return The pointer to the native interface.
*/
public final long getIDirect3D9() {
return iDirect3D9;
}
//native methods
private final native long nCheckDepthStencilMatch(long iDirect3D9, int adapter, int deviceType, int adapterFormat, int renderTargetFormat, int depthStencilFormat);
private final native long nCheckDeviceFormat(long iDirect3D9, int adapter, int deviceType, int adapterFormat, int usage, int resoruceType, int checkFormat);
private final native long nCheckDeviceFormatConversion(long iDirect3D9, int adapter, int deviceType, int sourceFormat, int targetFormat);
private final native long nCheckDeviceMultiSampleType(long iDirect3D9, int adapter, int deviceType, int surfaceFormat, boolean windowed, int multiSampleType, IntBuffer qualityLevels);
private final native long nCheckDeviceType(long iDirect3D9, int adapter, int deviceType, int displayFormat, int backBufferFormat, boolean windowed);
private final native long nCreateDevice(long iDirect3D9, int adapter, int deviceType, long focusWindow, int behaviorFlags, ByteBuffer presentationParameters, IDirect3DDevice9 returnedDeviceInterface);
private final native long nEnumAdapterModes(long iDirect3D9, int adapter, int format, int modeIndex, ByteBuffer mode);
private final native int nGetAdapterCount(long iDirect3D9);
private final native long nGetAdapterDisplayMode(long iDirect3D9, int adapter, ByteBuffer mode);
private final native long nGetAdapterIdentifier(long iDirect3D9, int adapter, int flags, ByteBuffer identifier);
private final native int nGetAdapterModeCount(long iDirect3D9, int adapter, int format);
private final native long nGetAdapterMonitor(long iDirect3D9, int adapter);
private final native long nGetDeviceCaps(long iDirect3D9, int adapter, int deviceType, ByteBuffer caps);
private final native long nRegisterSoftwareDevice(long iDirect3D9);
private final native void nRelease(long iDirect3D9);
private static native long nCreate();
}

View File

@ -1,37 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3D9Ex {
private long iDirect3D9Ex;
//HRESULT CreateDeviceEx(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags,
// D3DPRESENT_PARAMETERS* pPresentationParameters,
// D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3DDevice9Ex **ppReturnedDeviceInterface);
public long CreateDeviceEx(int adapter, int deviceType, long focusWindow, long behaviorFlags,
D3DPresentParameters presentationParameters, D3DDisplaymodeEx fullscreenDisplayMode,
IDirect3DDevice9Ex returnedDeviceInterface){
return nCreateDeviceEx(iDirect3D9Ex, adapter, deviceType, focusWindow, behaviorFlags,
presentationParameters, fullscreenDisplayMode, returnedDeviceInterface);
}
//HRESULT EnumAdapterModesEx(UINT Adapter, CONST D3DDISPLAYMODEFILTER* pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode);
public long EnumAdapterModesEx(int adapter, D3DDisplaymodeFilter filter, int mode, D3DDisplaymodeEx displayMode){
return nEnumAdapterModesEx(iDirect3D9Ex, adapter, filter, mode, displayMode);
}
//HRESULT GetAdapterDisplayModeEx(UINT Adapter, D3DDISPLAYMODEEX * pMode, D3DDISPLAYROTATION * pRotation);
public long GetAdapterDisplayModeEx(int adapter, D3DDisplaymodeEx mode, int rotation){
return nGetAdapterDisplayModeEx(iDirect3D9Ex, adapter, mode, rotation);
}
//HRESULT GetAdapterLUID(UINT Adapter, LUID *pLUID);
public long GetAdapterLUID(int adapter, LUID LUID){
return nGetAdapterLUID(iDirect3D9Ex, adapter, LUID);
}
//UINT GetAdapterModeCountEx(UINT Adapter, CONST D3DDISPLAYMODEFILTER* pFilter);
public int GetAdapterModeCountEx(int adapter, D3DDisplaymodeFilter filter){
return nGetAdapterModeCountEx(iDirect3D9Ex, adapter, filter);
}
//natives
private native long nCreateDeviceEx(long iDirect3D9Ex, int adapter, int deviceType, long focusWindow, long behaviorFlags, D3DPresentParameters presentationParameters, D3DDisplaymodeEx fullscreenDisplayMode, IDirect3DDevice9Ex returnedDeviceInterface);
private native long nEnumAdapterModesEx(long iDirect3D9Ex, int adapter, D3DDisplaymodeFilter filter, int mode, D3DDisplaymodeEx displayMode);
private native long nGetAdapterDisplayModeEx(long iDirect3D9Ex, int adapter, D3DDisplaymodeEx mode, int rotation);
private native long nGetAdapterLUID(long iDirect3D9Ex, int adapter, LUID LUID);
private native int nGetAdapterModeCountEx(long iDirect3D9Ex, int adapter, D3DDisplaymodeFilter filter);
}

View File

@ -1,44 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DBaseTexture9 {
private long iDirect3DBaseTexture9;
//VOID GenerateMipSubLevels();
public void GenerateMipSubLevels(){
nGenerateMipSubLevels(iDirect3DBaseTexture9);
}
//D3DTEXTUREFILTERTYPE GetAutoGenFilterType();
public int GetAutoGenFilterType(){
return nGetAutoGenFilterType(iDirect3DBaseTexture9);
}
//DWORD GetLevelCount();
public long GetLevelCount(){
return nGetLevelCount(iDirect3DBaseTexture9);
}
//DWORD GetLOD();
public long GetLOD(){
return nGetLOD(iDirect3DBaseTexture9);
}
//HRESULT SetAutoGenFilterType(D3DTEXTUREFILTERTYPE FilterType);
public long SetAutoGenFilterType(int filterType){
return nSetAutoGenFilterType(iDirect3DBaseTexture9, filterType);
}
//DWORD SetLOD(DWORD LODNew);
public long SetLOD(long LODNew){
return nSetLOD(iDirect3DBaseTexture9, LODNew);
}
public long getIDirect3DBaseTexture9() {
return iDirect3DBaseTexture9;
}
public void setIDirect3DBaseTexture9(long direct3DBaseTexture9) {
iDirect3DBaseTexture9 = direct3DBaseTexture9;
}
//natives
private native void nGenerateMipSubLevels(long iDirect3DBaseTexture9);
private native int nGetAutoGenFilterType(long iDirect3DBaseTexture9);
private native long nGetLevelCount(long iDirect3DBaseTexture9);
private native long nGetLOD(long iDirect3DBaseTexture9);
private native long nSetAutoGenFilterType(long iDirect3DBaseTexture9, int filterType);
private native long nSetLOD(long iDirect3DBaseTexture9, long LODNew);
}

View File

@ -1,38 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DCubeTexture9 {
private long iDirect3DCubeTexture9;
//HRESULT AddDirtyRect(D3DCUBEMAP_FACES FaceType, CONST RECT * pDirtyRect);
public long AddDirtyRect(int faceType, Rectangle dirtyRect){
return nAddDirtyRect(iDirect3DCubeTexture9, faceType, dirtyRect);
}
//HRESULT GetCubeMapSurface(D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 ** ppCubeMapSurface);
public long GetCubeMapSurface(int faceType, int level, IDirect3DSurface9 cubeMapSurface){
return nGetCubeMapSurface(iDirect3DCubeTexture9, faceType, level, cubeMapSurface);
}
//HRESULT GetLevelDesc(UINT Level, D3DSURFACE_DESC * pDesc);
public long GetLevelDesc(int level, D3DSsurfaceDesc desc){
return nGetLevelDesc(iDirect3DCubeTexture9, level, desc);
}
//HRESULT LockRect(D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT * pLockedRect, CONST RECT * pRect, DWORD Flags);
public long LockRect(int faceType, int level, D3DLockedRect lockedRect, Rectangle rect, long flags){
return nLockRect(iDirect3DCubeTexture9, faceType, level, lockedRect, rect, flags);
}
//HRESULT UnlockRect(D3DCUBEMAP_FACES FaceType, UINT Level);
public long UnlockRect(int faceType, int level){
return nUnlockRect(iDirect3DCubeTexture9, faceType, level);
}
public long getIDirect3DCubeTexture9() {
return iDirect3DCubeTexture9;
}
public void setIDirect3DCubeTexture9(long direct3DCubeTexture9) {
iDirect3DCubeTexture9 = direct3DCubeTexture9;
}
//natives
private native long nAddDirtyRect(long iDirect3DCubeTexture9, int faceType, Rectangle dirtyRect);
private native long nGetCubeMapSurface(long iDirect3DCubeTexture9, int faceType, int level, IDirect3DSurface9 cubeMapSurface);
private native long nGetLevelDesc(long iDirect3DCubeTexture9, int level, D3DSsurfaceDesc desc);
private native long nLockRect(long iDirect3DCubeTexture9, int faceType, int level, D3DLockedRect lockedRect, Rectangle rect, long flags);
private native long nUnlockRect(long iDirect3DCubeTexture9, int faceType, int level);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,98 +0,0 @@
package org.lwjgl.d3d;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
public class IDirect3DDevice9Ex {
private long iDirect3DDevice9Ex;
//HRESULT CheckDeviceState(HWND hWindow);
public long CheckDeviceState(long window){
return nCheckDeviceState(iDirect3DDevice9Ex, window);
}
//HRESULT CheckResourceResidency(IDirect3DResource9 * pResourceArray, UINT32 NumResources);
public long CheckResourceResidency(IDirect3DResource9 resourceArray, long numResources){
return nCheckResourceResidency(iDirect3DDevice9Ex, resourceArray, numResources);
}
//HRESULT CreateDepthStencilSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format,
// D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard,
// IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage);
public long CreateDepthStencilSurfaceEx(int width, int height, int format, int multiSample,
long multisampleQuality, boolean discard, IDirect3DSurface9 surface, long sharedHandle, long usage){
return nCreateDepthStencilSurfaceEx(iDirect3DDevice9Ex, width, height, format, multiSample,
multisampleQuality, discard, surface, sharedHandle, usage);
}
//HRESULT CreateOffscreenPlainSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format, DWORD Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage);
public long CreateOffscreenPlainSurfaceEx(int width, int height, int format, long pool,
IDirect3DSurface9 surface, long sharedHandle, long usage){
return nCreateOffscreenPlainSurfaceEx(iDirect3DDevice9Ex, width, height, format, pool, surface,
sharedHandle, usage);
}
//HRESULT CreateRenderTargetEx(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage);
public long CreateRenderTargetEx(int width, int height, int format, int multiSample, long multisampleQuality, boolean lockable, IDirect3DSurface9 surface, long sharedHandle, long usage){
return nCreateRenderTargetEx(iDirect3DDevice9Ex, width, height, format, multiSample, multisampleQuality,
lockable, surface, sharedHandle, usage);
}
//HRESULT ComposeRect(IDirect3DSurface9 *pSource, IDirect3DSurface9 *pDestination, IDirect3DVertexBuffer9 *pSrcRectDescriptors, UINT NumRects, IDirect3DVertexBuffer9 *pDstRectDescriptors, D3DCOMPOSEOP Operation, INT XOffset, INT YOffset);
public long ComposeRect(IDirect3DSurface9 source, IDirect3DSurface9 destination, IDirect3DVertexBuffer9 srcRectDescriptors, int numRects, IDirect3DVertexBuffer9 dstRectDescriptors, int operation, int xOffset, int yOffset){
return nComposeRect(iDirect3DDevice9Ex, source, destination, srcRectDescriptors, numRects,
dstRectDescriptors, operation, xOffset, yOffset);
}
//HRESULT GetDisplayModeEx(UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
public long GetDisplayModeEx(int swapChain, D3DDisplaymodeEx mode, int rotation){
return nGetDisplayModeEx(iDirect3DDevice9Ex, swapChain, mode, rotation);
}
//HRESULT GetGPUThreadPriority(INT *pPriority);
public long GetGPUThreadPriority(IntBuffer priority){
return nGetGPUThreadPriority(iDirect3DDevice9Ex, priority);
}
//GetMaximumFrameLatency(UINT *pMaxLatency);
public long GetMaximumFrameLatency(IntBuffer maxLatency){
return nGetMaximumFrameLatency(iDirect3DDevice9Ex, maxLatency);
}
//HRESULT PresentEx(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags);
public long PresentEx(Rectangle sourceRect, Rectangle destRect, long destWindowOverride, D3DRegionData dirtyRegion, long flags){
return nPresentEx(iDirect3DDevice9Ex, sourceRect, destRect, destWindowOverride, dirtyRegion, flags);
}
//HRESULT ResetEx(D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode);
public long ResetEx(D3DPresentParameters presentationParameters, D3DDisplaymodeEx fullscreenDisplayMode){
return nResetEx(iDirect3DDevice9Ex, presentationParameters, fullscreenDisplayMode);
}
//HRESULT SetConvolutionMonoKernel(UINT Width, UINT Height, float *RowWeights, float *ColumnWeights);
public long SetConvolutionMonoKernel(int width, int height, FloatBuffer rowWeights, FloatBuffer columnWeights){
return nSetConvolutionMonoKernel(iDirect3DDevice9Ex, width, height, rowWeights, columnWeights);
}
//HRESULT SetGPUThreadPriority(INT pPriority);
public long SetGPUThreadPriority(int priority){
return nSetGPUThreadPriority(iDirect3DDevice9Ex, priority);
}
//HRESULT SetMaximumFrameLatency(UINT pMaxLatency);
public long SetMaximumFrameLatency(int maxLatency){
return nSetMaximumFrameLatency(iDirect3DDevice9Ex, maxLatency);
}
//HRESULT TestCooperativeLevel();
public long TestCooperativeLevel(){
return nTestCooperativeLevel(iDirect3DDevice9Ex);
}
//HRESULT WaitForVBlank(UINT SwapChainIndex);
public long WaitForVBlank(int swapChainIndex){
return nWaitForVBlank(iDirect3DDevice9Ex, swapChainIndex);
}
//natives
private native long nCheckDeviceState(long iDirect3DDevice9Ex, long window);
private native long nCheckResourceResidency(long iDirect3DDevice9Ex, IDirect3DResource9 resourceArray, long numResources);
private native long nCreateDepthStencilSurfaceEx(long iDirect3DDevice9Ex, int width, int height, int format, int multiSample, long multisampleQuality, boolean discard, IDirect3DSurface9 surface, long sharedHandle, long usage);
private native long nCreateOffscreenPlainSurfaceEx(long iDirect3DDevice9Ex, int width, int height, int format, long pool, IDirect3DSurface9 surface, long sharedHandle, long usage);
private native long nCreateRenderTargetEx(long iDirect3DDevice9Ex, int width, int height, int format, int multiSample, long multisampleQuality, boolean lockable, IDirect3DSurface9 surface, long sharedHandle, long usage);
private native long nComposeRect(long iDirect3DDevice9Ex, IDirect3DSurface9 source, IDirect3DSurface9 destination, IDirect3DVertexBuffer9 srcRectDescriptors, int numRects, IDirect3DVertexBuffer9 dstRectDescriptors, int operation, int xOffset, int yOffset);
private native long nGetDisplayModeEx(long iDirect3DDevice9Ex, int swapChain, D3DDisplaymodeEx mode, int rotation);
private native long nGetGPUThreadPriority(long iDirect3DDevice9Ex, IntBuffer priority);
private native long nGetMaximumFrameLatency(long iDirect3DDevice9Ex, IntBuffer maxLatency);
private native long nPresentEx(long iDirect3DDevice9Ex, Rectangle sourceRect, Rectangle destRect, long destWindowOverride, D3DRegionData dirtyRegion, long flags);
private native long nResetEx(long iDirect3DDevice9Ex, D3DPresentParameters presentationParameters, D3DDisplaymodeEx fullscreenDisplayMode);
private native long nSetConvolutionMonoKernel(long iDirect3DDevice9Ex, int width, int height, FloatBuffer rowWeights, FloatBuffer columnWeights);
private native long nSetGPUThreadPriority(long iDirect3DDevice9Ex, int priority);
private native long nSetMaximumFrameLatency(long iDirect3DDevice9Ex, int maxLatency);
private native long nTestCooperativeLevel(long iDirect3DDevice9Ex);
private native long nWaitForVBlank(long iDirect3DDevice9Ex, int swapChainIndex);
}

View File

@ -1,31 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class IDirect3DIndexBuffer9 {
private long iDirect3DIndexBuffer9;
//HRESULT GetDesc(D3DINDEXBUFFER_DESC * pDesc);
public long GetDesc(D3DIndexBufferDesc desc){
return nGetDesc(iDirect3DIndexBuffer9, desc);
}
//HRESULT Lock(UINT OffsetToLock, UINT SizeToLock, VOID ** ppbData, DWORD Flags);
public long Lock(int offsetToLock, int sizeToLock, ByteBuffer data, long flags){
return nLock(iDirect3DIndexBuffer9, offsetToLock, sizeToLock, data, flags);
}
//HRESULT Unlock();
public long Unlock(){
return nUnlock(iDirect3DIndexBuffer9);
}
public long getIDirect3DIndexBuffer9() {
return iDirect3DIndexBuffer9;
}
public void setIDirect3DIndexBuffer9(long direct3DIndexBuffer9) {
iDirect3DIndexBuffer9 = direct3DIndexBuffer9;
}
//natives
private native long nGetDesc(long iDirect3DIndexBuffer9, D3DIndexBufferDesc desc);
private native long nLock(long iDirect3DIndexBuffer9, int offsetToLock, int sizeToLock, ByteBuffer data, long flags);
private native long nUnlock(long iDirect3DIndexBuffer9);
}

View File

@ -1,27 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
public class IDirect3DPixelShader9 {
private long iDirect3DPixelShader9;
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DPixelShader9, device);
}
//HRESULT GetFunction(void* pData, UINT* pSizeOfData);
public long GetFunction(ByteBuffer data, IntBuffer sizeOfData){
return nGetFunction(iDirect3DPixelShader9, data, sizeOfData);
}
public long getIDirect3DPixelShader9() {
return iDirect3DPixelShader9;
}
public void setIDirect3DPixelShader9(long direct3DPixelShader9) {
iDirect3DPixelShader9 = direct3DPixelShader9;
}
//natives
private native long nGetDevice(long iDirect3DPixelShader9, IDirect3DDevice9 device);
private native long nGetFunction(long iDirect3DPixelShader9, ByteBuffer data, IntBuffer sizeOfData);
}

View File

@ -1,40 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class IDirect3DQuery9 {
private long iDirect3DQuery9;
//HRESULT GetData(void* pData, DWORD dwSize, DWORD dwGetDataFlags);
public long GetData(ByteBuffer data, long size, long getDataFlags){
return nGetData(iDirect3DQuery9, data, size, getDataFlags);
}
//DWORD GetDataSize();
public long GetDataSize(){
return nGetDataSize(iDirect3DQuery9);
}
//HRESULT GetDevice(IDirect3DDevice9 ** pDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DQuery9, device);
}
//D3DQUERYTYPE GetType();
public int GetType(){
return nGetType(iDirect3DQuery9);
}
//HRESULT Issue(DWORD dwIssueFlags);
public long Issue(long issueFlags){
return nIssue(iDirect3DQuery9, issueFlags);
}
public long getIDirect3DQuery9() {
return iDirect3DQuery9;
}
public void setIDirect3DQuery9(long direct3DQuery9) {
iDirect3DQuery9 = direct3DQuery9;
}
//natives
private native long nGetData(long iDirect3DQuery9, ByteBuffer data, long size, long getDataFlags);
private native long nGetDataSize(long iDirect3DQuery9);
private native long nGetDevice(long iDirect3DQuery9, IDirect3DDevice9 device);
private native int nGetType(long iDirect3DQuery9);
private native long nIssue(long iDirect3DQuery9, long issueFlags);
}

View File

@ -1,50 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.LongBuffer;
public class IDirect3DResource9 {
private long iDirect3DResource9;
//HRESULT FreePrivateData(REFGUID refguid);
public long FreePrivateData(GUID refguid){
return nFreePrivateData(iDirect3DResource9, refguid);
}
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DResource9, device);
}
//DWORD GetPriority();
public long GetPriority(){
return nGetPriority(iDirect3DResource9);
}
//HRESULT GetPrivateData(REFGUID refguid, void * pData, DWORD * pSizeOfData);
public long GetPrivateData(GUID refguid, ByteBuffer data, LongBuffer sizeOfData){
return nGetPrivateData(iDirect3DResource9, refguid, data, sizeOfData);
}
//D3DRESOURCETYPE GetType();
public int GetType(){
return nGetType(iDirect3DResource9);
}
//
public void PreLoad(){
nPreLoad(iDirect3DResource9);
}
//DWORD SetPriority(DWORD PriorityNew);
public long SetPriority(long priorityNew){
return nSetPriority(iDirect3DResource9, priorityNew);
}
//HRESULT SetPrivateData(REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
public long SetPrivateData(GUID refguid, ByteBuffer data, long sizeOfData, long flags){
return nSetPrivateData(iDirect3DResource9, refguid, data, sizeOfData, flags);
}
//natives
private native long nFreePrivateData(long iDirect3DResource9, GUID refguid);
private native long nGetDevice(long iDirect3DResource9, IDirect3DDevice9 device);
private native long nGetPriority(long iDirect3DResource9);
private native long nGetPrivateData(long iDirect3DResource9, GUID refguid, ByteBuffer data, LongBuffer sizeOfData);
private native int nGetType(long iDirect3DResource9);
private native void nPreLoad(long iDirect3DResource9);
private native long nSetPriority(long iDirect3DResource9, long priorityNew);
private native long nSetPrivateData(long iDirect3DResource9, GUID refguid, ByteBuffer data, long sizeOfData, long flags);
}

View File

@ -1,28 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DStateBlock9 {
private long iDirect3DStateBlock9;
//HRESULT Apply();
public long Apply(){
return nApply(iDirect3DStateBlock9);
}
//HRESULT Capture();
public long Capture(){
return nCapture(iDirect3DStateBlock9);
}
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DStateBlock9, device);
}
public long getIDirect3DStateBlock9() {
return iDirect3DStateBlock9;
}
public void setIDirect3DStateBlock9(long direct3DStateBlock9) {
iDirect3DStateBlock9 = direct3DStateBlock9;
}
//natives
private native long nApply(long iDirect3DStateBlock9);
private native long nCapture(long iDirect3DStateBlock9);
private native long nGetDevice(long iDirect3DStateBlock9, IDirect3DDevice9 device);
}

View File

@ -1,47 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class IDirect3DSurface9 {
private long iDirect3DSurface9;
//HRESULT GetContainer(REFIID riid, void ** ppContainer);
//TODO: find definition of REFIID
public long GetContainer(long riid, ByteBuffer container){
return nGetContainer(iDirect3DSurface9, riid, container);
}
//HRESULT GetDC(HDC* phdc);
public long GetDC(long hdc){
return nGetDC(iDirect3DSurface9, hdc);
}
//HRESULT GetDesc(D3DSURFACE_DESC * pDesc);
public long GetDesc(D3DSurfaceDesc desc){
return nGetDesc(iDirect3DSurface9, desc);
}
//HRESULT LockRect(D3DLOCKED_RECT * pLockedRect, CONST RECT * pRect, DWORD Flags);
public long LockRect(D3DLockedRect lockedRect, Rectangle rect, long flags){
return nLockRect(iDirect3DSurface9, lockedRect, rect, flags);
}
//HRESULT ReleaseDC(HDC hdc);
public long ReleaseDC(long hdc){
return nReleaseDC(iDirect3DSurface9, hdc);
}
//HRESULT UnlockRect();
public long UnlockRect(){
return nUnlockRect(iDirect3DSurface9);
}
public long getIDirect3DSurface9() {
return iDirect3DSurface9;
}
public void setIDirect3DSurface9(long direct3DSurface9) {
iDirect3DSurface9 = direct3DSurface9;
}
//natives
private native long nGetContainer(long iDirect3DSurface9, long riid, ByteBuffer container);
private native long nGetDC(long iDirect3DSurface9, long hdc);
private native long nGetDesc(long iDirect3DSurface9, D3DSurfaceDesc desc);
private native long nLockRect(long iDirect3DSurface9, D3DLockedRect lockedRect, Rectangle rect, long flags);
private native long nReleaseDC(long iDirect3DSurface9, long hdc);
private native long nUnlockRect(long iDirect3DSurface9);
}

View File

@ -1,48 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DSwapChain9 {
private long iDirect3DSwapChain9;
//HRESULT GetBackBuffer(UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 ** ppBackBuffer);
public long GetBackBuffer(int backBuffer, int type, IDirect3DSurface9 backBufferSurface){
return nGetBackBuffer(iDirect3DSwapChain9, backBuffer, type, backBufferSurface);
}
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DSwapChain9, device);
}
//HRESULT GetDisplayMode(D3DDISPLAYMODE * pMode);
public long GetDisplayMode(D3DDisplaymode mode){
return nGetDisplayMode(iDirect3DSwapChain9, mode);
}
//HRESULT GetFrontBufferData(IDirect3DSurface9 * pDestSurface);
public long GetFrontBufferData(IDirect3DSurface9 destSurface){
return nGetFrontBufferData(iDirect3DSwapChain9, destSurface);
}
//HRESULT GetPresentParameters(D3DPRESENT_PARAMETERS* pPresentationParameters);
public long GetPresentParameters(D3DPresentParameters presentationParameters){
return nGetPresentParameters(iDirect3DSwapChain9, presentationParameters);
}
//HRESULT GetRasterStatus(D3DRASTER_STATUS * pRasterStatus);
public long GetRasterStatus(D3DRasterStatus rasterStatus){
return nGetRasterStatus(iDirect3DSwapChain9, rasterStatus);
}
//HRESULT Present(CONST RECT * pSourceRect, CONST RECT * pDestRect, HWND hDestWindowOverride, CONST RGNDATA * pDirtyRegion, DWORD dwFlags);
public long Present(Rectangle sourceRect, Rectangle destRect, long destWindowOverride, RegionData dirtyRegion, long flags){
return nPresent(iDirect3DSwapChain9, sourceRect, destRect, destWindowOverride, dirtyRegion, flags);
}
public long getIDirect3DSwapChain9() {
return iDirect3DSwapChain9;
}
public void setIDirect3DSwapChain9(long direct3DSwapChain9) {
iDirect3DSwapChain9 = direct3DSwapChain9;
}
//natives
private native long nGetBackBuffer(long iDirect3DSwapChain9, int backBuffer, int type, IDirect3DSurface9 backBufferSurface);
private native long nGetDevice(long iDirect3DSwapChain9, IDirect3DDevice9 device);
private native long nGetDisplayMode(long iDirect3DSwapChain9, D3DDisplaymode mode);
private native long nGetFrontBufferData(long iDirect3DSwapChain9, IDirect3DSurface9 destSurface);
private native long nGetPresentParameters(long iDirect3DSwapChain9, D3DPresentParameters presentationParameters);
private native long nGetRasterStatus(long iDirect3DSwapChain9, D3DRasterStatus rasterStatus);
private native long nPresent(long iDirect3DSwapChain9, Rectangle sourceRect, Rectangle destRect, long destWindowOverride, RegionData dirtyRegion, long flags);
}

View File

@ -1,24 +0,0 @@
package org.lwjgl.d3d;
import java.nio.IntBuffer;
public class IDirect3DSwapChain9Ex {
private long iDirect3DSwapChain9Ex;
//HRESULT GetDisplayModeEx(D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
public long GetDisplayModeEx(D3DDisplaymodeEx mode, int rotation){
return nGetDisplayModeEx(iDirect3DSwapChain9Ex, mode, rotation);
}
//HRESULT GetLastPresentCount(UINT * pLastPresentCount);
public long GetLastPresentCount(IntBuffer lastPresentCount){
return nGetLastPresentCount(iDirect3DSwapChain9Ex, lastPresentCount);
}
//HRESULT GetPresentStatistics(D3DPRESENTSTATS * pPresentationStatistics);
public long GetPresentStatistics(D3DPresentStats presentationStatistics){
return nGetPresentStatistics(iDirect3DSwapChain9Ex, presentationStatistics);
}
//natives
private native long nGetDisplayModeEx(long iDirect3DSwapChain9Ex, D3DDisplaymodeEx mode, int rotation);
private native long nGetLastPresentCount(long iDirect3DSwapChain9Ex, IntBuffer lastPresentCount);
private native long nGetPresentStatistics(long iDirect3DSwapChain9Ex, D3DPresentStats presentationStatistics);
}

View File

@ -1,32 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DTexture9 {
private long iDirect3DTexture9;
//HRESULT AddDirtyRect(CONST RECT * pDirtyRect);
public long AddDirtyRect(Rectangle dirtyRect){
return nAddDirtyRect(iDirect3DTexture9, dirtyRect);
}
//HRESULT GetLevelDesc(UINT Level, D3DSURFACE_DESC * pDesc);
public long GetLevelDesc(int level, D3DSurfaceDesc desc){
return nGetLevelDesc(iDirect3DTexture9, level, desc);
}
//HRESULT GetSurfaceLevel(UINT Level, IDirect3DSurface9 ** ppSurfaceLevel);
public long GetSurfaceLevel(int level, IDirect3DSurface9 surfaceLevel){
return nGetSurfaceLevel(iDirect3DTexture9, level, surfaceLevel);
}
//HRESULT LockRect(UINT Level, D3DLOCKED_RECT * pLockedRect, CONST RECT * pRect, DWORD Flags);
public long LockRect(int level, D3DLockedRect lockedRect, Rectangle rect, long flags){
return nLockRect(iDirect3DTexture9, level, lockedRect, rect, flags);
}
//HRESULT UnlockRect(UINT Level);
public long UnlockRect(int level){
return nUnlockRect(iDirect3DTexture9, level);
}
//natives
private native long nAddDirtyRect(long iDirect3DTexture9, Rectangle dirtyRect);
private native long nGetLevelDesc(long iDirect3DTexture9, int level, D3DSurfaceDesc desc);
private native long nGetSurfaceLevel(long iDirect3DTexture9, int level, IDirect3DSurface9 surfaceLevel);
private native long nLockRect(long iDirect3DTexture9, int level, D3DLockedRect lockedRect, Rectangle rect, long flags);
private native long nUnlockRect(long iDirect3DTexture9, int level);
}

View File

@ -1,58 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class IDirect3DVertexBuffer9 {
private long iDirect3DVertexBuffer9;
public IDirect3DVertexBuffer9() {
create(this);
}
/**
* HRESULT GetDesc(D3DVERTEXBUFFER_DESC * pDesc);
*
* @param desc
* @return
*/
public final long GetDesc(D3DVertexBufferDesc desc) {
ByteBuffer buffer = desc.getBuffer();
long hResult = nGetDesc(iDirect3DVertexBuffer9, buffer);
desc.setBuffer(buffer);
return hResult;
}
/**
* HRESULT Lock(UINT OffsetToLock, UINT SizeToLock, VOID ** ppbData, DWORD Flags);
*
* @param offsetToLock
* @param sizeToLock
* @param ata
* @param flags
* @return
*/
public final long Lock(int offsetToLock, int sizeToLock, ByteBuffer ata, long flags){
return nLock(iDirect3DVertexBuffer9, offsetToLock, sizeToLock, ata, flags, ata.capacity());
}
/**
* HRESULT Unlock();
*
* @return
*/
public final long Unlock(){
return nUnlock(iDirect3DVertexBuffer9);
}
public final long getIDirect3DVertexBuffer9() {
return iDirect3DVertexBuffer9;
}
public final void setIDirect3DVertexBuffer9(long direct3DVertexBuffer9) {
iDirect3DVertexBuffer9 = direct3DVertexBuffer9;
}
//natives
private final native long nGetDesc(long iDirect3DVertexBuffer9, ByteBuffer desc);
private final native long nLock(long iDirect3DVertexBuffer9, int offsetToLock, int sizeToLock, ByteBuffer ata, long flags, int bufferSize);
private final native long nUnlock(long iDirect3DVertexBuffer9);
private final native void create(IDirect3DVertexBuffer9 iDirect3DVertexBuffer9);
}

View File

@ -1,26 +0,0 @@
package org.lwjgl.d3d;
import java.nio.IntBuffer;
public class IDirect3DVertexDeclaration9 {
private long iDirect3DVertexDeclaration9;
//HRESULT GetDeclaration(D3DVERTEXELEMENT9* pDecl, UINT* pNumElements);
public long GetDeclaration(D3DVertexElement9 decl, IntBuffer numElements){
return nGetDeclaration(iDirect3DVertexDeclaration9, decl, numElements);
}
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DVertexDeclaration9, device);
}
public long getIDirect3DVertexDeclaration9() {
return iDirect3DVertexDeclaration9;
}
public void setIDirect3DVertexDeclaration9(long direct3DVertexDeclaration9) {
iDirect3DVertexDeclaration9 = direct3DVertexDeclaration9;
}
//natives
private native long nGetDeclaration(long iDirect3DVertexDeclaration9, D3DVertexElement9 decl, IntBuffer numElements);
private native long nGetDevice(long iDirect3DVertexDeclaration9, IDirect3DDevice9 device);
}

View File

@ -1,27 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
public class IDirect3DVertexShader9 {
private long iDirect3DVertexShader9;
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DVertexShader9, device);
}
//HRESULT GetFunction(void* pData, UINT* pSizeOfData);
public long GetFunction(ByteBuffer data, IntBuffer sizeOfData){
return nGetFunction(iDirect3DVertexShader9, data, sizeOfData);
}
public long getIDirect3DVertexShader9() {
return iDirect3DVertexShader9;
}
public void setIDirect3DVertexShader9(long direct3DVertexShader9) {
iDirect3DVertexShader9 = direct3DVertexShader9;
}
//natives
private native long nGetDevice(long iDirect3DVertexShader9, IDirect3DDevice9 device);
private native long nGetFunction(long iDirect3DVertexShader9, ByteBuffer data, IntBuffer sizeOfData);
}

View File

@ -1,50 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
public class IDirect3DVolume9 {
private long iDirect3DVolume9;
//HRESULT FreePrivateData(REFGUID refguid);
public long FreePrivateData(GUID refguid){
return nFreePrivateData(iDirect3DVolume9, refguid);
}
//HRESULT GetContainer(REFIID riid, void ** ppContainer);
//TODO: find REFIID definition
public long GetContainer(long riid, ByteBuffer container){
return nGetContainer(iDirect3DVolume9, riid, container);
}
//HRESULT GetDesc(D3DVOLUME_DESC * pDesc);
public long GetDesc(D3DVolumeDesc desc){
return nGetDesc(iDirect3DVolume9, desc);
}
//HRESULT GetDevice(IDirect3DDevice9 ** ppDevice);
public long GetDevice(IDirect3DDevice9 device){
return nGetDevice(iDirect3DVolume9, device);
}
//HRESULT GetPrivateData(REFGUID refguid, void * pData, DWORD * pSizeOfData);
public long GetPrivateData(GUID refguid, ByteBuffer data, long sizeOfData){
return nGetPrivateData(iDirect3DVolume9, refguid, data, sizeOfData);
}
//HRESULT LockBox(D3DLOCKED_BOX * pLockedVolume, CONST D3DBOX * pBox, DWORD Flags);
public long LockBox(D3DLockedBox lockedVolume, D3DBox box, long flags){
return nLockBox(iDirect3DVolume9, lockedVolume, box, flags);
}
//HRESULT SetPrivateData(REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
public long SetPrivateData(GUID refguid, ByteBuffer data, long sizeOfData, long flags){
return nSetPrivateData(iDirect3DVolume9, refguid, data, sizeOfData, flags);
}
//HRESULT UnlockBox();
public long UnlockBox(){
return nUnlockBox(iDirect3DVolume9);
}
//natives
private native long nFreePrivateData(long iDirect3DVolume9, GUID refguid);
private native long nGetContainer(long iDirect3DVolume9, long riid, ByteBuffer container);
private native long nGetDesc(long iDirect3DVolume9, D3DVolumeDesc desc);
private native long nGetDevice(long iDirect3DVolume9, IDirect3DDevice9 device);
private native long nGetPrivateData(long iDirect3DVolume9, GUID refguid, ByteBuffer data, long sizeOfData);
private native long nLockBox(long iDirect3DVolume9, D3DLockedBox lockedVolume, D3DBox box, long flags);
private native long nSetPrivateData(long iDirect3DVolume9, GUID refguid, ByteBuffer data, long sizeOfData, long flags);
private native long nUnlockBox(long iDirect3DVolume9);
}

View File

@ -1,38 +0,0 @@
package org.lwjgl.d3d;
public class IDirect3DVolumeTexture9 {
private long iDirect3DVolumeTexture9;
//HRESULT AddDirtyBox(CONST D3DBOX * pDirtyBox);
public long AddDirtyBox(D3DBox dirtyBox){
return nAddDirtyBox(iDirect3DVolumeTexture9, dirtyBox);
}
//HRESULT GetLevelDesc(UINT Level, D3DVOLUME_DESC * pDesc);
public long GetLevelDesc(int level, D3DVolumeDesc desc){
return nGetLevelDesc(iDirect3DVolumeTexture9, level, desc);
}
//HRESULT GetVolumeLevel(UINT Level, IDirect3DVolume9 ** ppVolumeLevel);
public long GetVolumeLevel(int level, IDirect3DVolume9 volumeLevel){
return nGetVolumeLevel(iDirect3DVolumeTexture9, level, volumeLevel);
}
//HRESULT LockBox(UINT Level, D3DLOCKED_BOX * pLockedVolume, CONST D3DBOX * pBox, DWORD Flags);
public long LockBox(int level, D3DLockedBox lockedVolume, D3DBox box, long flags){
return nLockBox(iDirect3DVolumeTexture9, level, lockedVolume, box, flags);
}
//HRESULT UnlockBox(UINT Level);
public long UnlockBox(int level){
return nUnlockBox(iDirect3DVolumeTexture9, level);
}
public long getIDirect3DVolumeTexture9() {
return iDirect3DVolumeTexture9;
}
public void setIDirect3DVolumeTexture9(long direct3DVolumeTexture9) {
iDirect3DVolumeTexture9 = direct3DVolumeTexture9;
}
//natives
private native long nAddDirtyBox(long iDirect3DVolumeTexture9, D3DBox dirtyBox);
private native long nGetLevelDesc(long iDirect3DVolumeTexture9, int level, D3DVolumeDesc desc);
private native long nGetVolumeLevel(long iDirect3DVolumeTexture9, int level, IDirect3DVolume9 volumeLevel);
private native long nLockBox(long iDirect3DVolumeTexture9, int level, D3DLockedBox lockedVolume, D3DBox box, long flags);
private native long nUnlockBox(long iDirect3DVolumeTexture9, int level);
}

View File

@ -1,125 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
public interface InputImplementation {
/*
* Mouse methods
*/
/** Query of wheel support */
boolean hasWheel();
/** Query of button count */
int getButtonCount();
/**
* Method to create the mouse.
*/
void createMouse() throws LWJGLException;
/**
* Method the destroy the mouse
*/
void destroyMouse();
/**
* Method to poll the mouse
*/
void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
/**
* Method to read the keyboard buffer
*/
void readMouse(ByteBuffer buffer);
void grabMouse(boolean grab);
/**
* Function to determine native cursor support
*/
int getNativeCursorCapabilities();
/** Method to set the native cursor position */
void setCursorPosition(int x, int y);
/** Method to set the native cursor */
void setNativeCursor(Object handle) throws LWJGLException;
/** Method returning the minimum cursor size */
int getMinCursorSize();
/** Method returning the maximum cursor size */
int getMaxCursorSize();
/*
* Keyboard methods
*/
/**
* Method to create the keyboard
*/
void createKeyboard() throws LWJGLException;
/**
* Method to destroy the keyboard
*/
void destroyKeyboard();
/**
* Method to poll the keyboard.
*
* @param keyDownBuffer the address of a 256-byte buffer to place
* key states in.
*/
void pollKeyboard(ByteBuffer keyDownBuffer);
/**
* Method to read the keyboard buffer
*/
void readKeyboard(ByteBuffer buffer);
// int isStateKeySet(int key);
/** Native cursor handles */
Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException;
void destroyCursor(Object cursor_handle);
int getWidth();
int getHeight();
}

View File

@ -1,7 +0,0 @@
package org.lwjgl.d3d;
public class LUID {
public long LowPart; //DWORD
public long HighPart;
}

View File

@ -1,135 +0,0 @@
package org.lwjgl.d3d;
import java.util.Arrays;
import java.util.HashSet;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class NewDisplay {
private static final DisplayMode initialMode;
private static DisplayMode currentMode;
private static long hwnd;
private static boolean created;
private static boolean fullscreen;
private static boolean modeSet;
static {
try {
currentMode = initialMode = nGetCurrentDisplayMode();
LWJGLUtil.log("Initial mode: " + initialMode);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
private NewDisplay(){}
public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
synchronized (GlobalLock.lock) {
Object[] unfilteredModes = nGetAvailableDisplayModes();
if (unfilteredModes == null) {
return new DisplayMode[0];
}
// We'll use a HashSet to filter out the duplicated modes
HashSet modes = new HashSet(unfilteredModes.length);
modes.addAll(Arrays.asList(unfilteredModes));
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
LWJGLUtil.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes");
return filteredModes;
}
}
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
synchronized (GlobalLock.lock) {
if (mode == null)
throw new NullPointerException("mode must be non-null");
currentMode = mode;
if (isCreated()) {
destroyWindow();
// If mode is not fullscreen capable, make sure we are in windowed mode
if (!mode.isFullscreen())
resetFullscreen();
try {
if (fullscreen) {
switchDisplayMode();
}
createWindow();
// makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
// destroyContext();
// destroyPeerInfo();
resetDisplayMode();
throw e;
}
}
}
}
public static void create() throws LWJGLException {
//TODO
}
public static void destroy() {
//TODO
}
public static boolean isCreated() {
return created;
}
private static void destroyWindow() {
if (created) {
// if (Mouse.isCreated()) {
// Mouse.destroy();
// }
// if (Keyboard.isCreated()) {
// Keyboard.destroy();
// }
nDestroyWindow();
// resetCursorClipping();
created = false;
}
}
private static void resetFullscreen() {
synchronized (GlobalLock.lock) {
if (NewDisplay.fullscreen) {
NewDisplay.fullscreen = false;
resetDisplayMode();
}
}
}
private static void switchDisplayMode() throws LWJGLException {
if (!currentMode.isFullscreen()) {
LWJGLUtil.log("Switching to " + initialMode);
setDisplayMode(initialMode);
}
switchDisplayMode(initialMode);
}
public static void switchDisplayMode(DisplayMode mode) throws LWJGLException {
nSwitchDisplayMode(mode);
currentMode = mode;
modeSet = true;
}
private static void createWindow() {
//TODO
}
private static void resetDisplayMode() {
if (modeSet) {
modeSet = false;
nResetDisplayMode();
}
// resetCursorClipping();
}
private static native void nDestroyWindow();
private static native DisplayMode[] nGetAvailableDisplayModes();
private static native void nSetDisplayMode(DisplayMode mode);
private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException;
private static native void nResetDisplayMode();
private static native DisplayMode nGetCurrentDisplayMode() throws LWJGLException;
}

View File

@ -1,42 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class PaletteEntry {
public byte peRed;
public byte peGreen;
public byte peBlue;
public byte peFlags;
private static final int D3D_VECTOR_BYTE_SIZE = 4;
private ByteBuffer buffer;
public PaletteEntry() {
buffer = ByteBuffer.allocateDirect(D3D_VECTOR_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.put(peRed);
buffer.put(peGreen);
buffer.put(peBlue);
buffer.put(peFlags);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
peRed = buffer.get();
peGreen = buffer.get();
peBlue = buffer.get();
peFlags = buffer.get();
}
}

View File

@ -1,97 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
/**
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2286 $
* $Id: PeerInfo.java 2286 2006-03-23 19:32:21Z matzon $
*/
abstract class PeerInfo {
private final ByteBuffer handle;
private Thread locking_thread; // Thread that has locked this PeerInfo
private int lock_count;
protected PeerInfo(ByteBuffer handle) {
this.handle = handle;
}
private final void lockAndInitHandle() throws LWJGLException {
doLockAndInitHandle();
}
public synchronized final void unlock() throws LWJGLException {
if (lock_count <= 0)
throw new IllegalStateException("PeerInfo not locked!");
if (Thread.currentThread() != locking_thread)
throw new IllegalStateException("PeerInfo already locked by " + locking_thread);
lock_count--;
if (lock_count == 0) {
doUnlock();
locking_thread = null;
notify();
}
}
protected abstract void doLockAndInitHandle() throws LWJGLException;
protected abstract void doUnlock() throws LWJGLException;
public synchronized final ByteBuffer lockAndGetHandle() throws LWJGLException {
Thread this_thread = Thread.currentThread();
while (locking_thread != null && locking_thread != this_thread) {
try {
wait();
} catch (InterruptedException e) {
LWJGLUtil.log("Interrupted while waiting for PeerInfo lock: " + e);
}
}
if (lock_count == 0) {
locking_thread = this_thread;
doLockAndInitHandle();
}
lock_count++;
return getHandle();
}
protected final ByteBuffer getHandle() {
return handle;
}
public void destroy() {
}
}

View File

@ -1,151 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This class describes pixel format properties for an OpenGL context. Instances
* of this class is used as arguments to Display.create(), Pbuffer.create() and
* AWTGLCanvas, to indicate minimum required properties.
*
* WARNING: Some pixel formats are known to cause troubles on certain buggy drivers.
* Example: Under Windows, specifying samples != 0 will enable the ARB
* pixel format selection path, which could trigger a crash.
*
* @author elias_naur@sourceforge.net
* @version $Revision: 2361 $
*/
public final class PixelFormat {
/**
* The number of bits per pixel, exluding alpha.
* This parameter is ignored in Display.create().
*/
private final int bpp;
/** The number of alpha bits. */
private final int alpha;
/** The number of depth buffer bits*/
private final int depth;
/** The number of stencil bits */
private final int stencil;
/**
* The number of samples to use in anti-aliasing.
* 0 means that anti-aliasing is disabled.
*/
private final int samples;
/** The number of auxilliary buffers */
private final int num_aux_buffers;
/** The number of bits per pixel in the accumulation buffer */
private final int accum_bpp;
/** The number of alpha bits in the accumulation buffer */
private final int accum_alpha;
/** Whether this format requires a stereo buffer */
private final boolean stereo;
/** Whether this format specifies a floating point format */
private final boolean floating_point;
/**
* Default pixel format is minimum 8 bits depth, and no alpha
* nor stencil requirements.
*/
public PixelFormat() {
this(0, 8, 0);
}
public PixelFormat(int alpha, int depth, int stencil) {
this(alpha, depth, stencil, 0);
}
public PixelFormat(int alpha, int depth, int stencil, int samples) {
this(0, alpha, depth, stencil, samples);
}
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples) {
this(bpp, alpha, depth, stencil, samples, 0, 0, 0, false);
}
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo) {
this(bpp, alpha, depth, stencil, samples, num_aux_buffers, accum_bpp, accum_alpha, stereo, false);
}
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo, boolean floating_point) {
this.bpp = bpp;
this.alpha = alpha;
this.depth = depth;
this.stencil = stencil;
this.samples = samples;
this.num_aux_buffers = num_aux_buffers;
this.accum_bpp = accum_bpp;
this.accum_alpha = accum_alpha;
this.stereo = stereo;
this.floating_point = floating_point;
}
public int getBitsPerPixel() {
return bpp;
}
public int getAlphaBits() {
return alpha;
}
public int getDepthBits() {
return depth;
}
public int getStencilBits() {
return stencil;
}
public int getSamples() {
return samples;
}
public int getAuxBuffers() {
return num_aux_buffers;
}
public int getAccumulationBitsPerPixel() {
return accum_bpp;
}
public int getAccumulationAlpha() {
return accum_alpha;
}
public boolean isStereo() {
return stereo;
}
public boolean isFloatingPoint() {
return floating_point;
}
}

View File

@ -1,37 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class Point {
public long x;
public long y;
private static final int RECTANGLE_BYTE_SIZE = 8;
private ByteBuffer buffer;
public Point() {
buffer = ByteBuffer.allocateDirect(RECTANGLE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
buffer.clear();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)x);
buffer.putInt((int)y);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
x = buffer.getInt();
y = buffer.getInt();
}
}

View File

@ -1,51 +0,0 @@
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
//From RECT
public class Rectangle {
public long left;
public long top;
public long right;
public long bottom;
private static final int RECTANGLE_BYTE_SIZE = 16;
private ByteBuffer buffer;
public Rectangle() {
buffer = ByteBuffer.allocateDirect(RECTANGLE_BYTE_SIZE);
buffer.order(ByteOrder.nativeOrder());
buffer.clear();
}
public ByteBuffer getEmptyBuffer() {
buffer.rewind();
buffer.clear();
return buffer;
}
public ByteBuffer getBuffer() {
buffer.rewind();
buffer.putInt((int)left);
buffer.putInt((int)top);
buffer.putInt((int)right);
buffer.putInt((int)bottom);
return buffer;
}
public void setBuffer(ByteBuffer buffer) {
buffer.rewind();
left = buffer.getInt();
top = buffer.getInt();
right = buffer.getInt();
bottom = buffer.getInt();
}
public String toString() {
return
" left = " + left +
" top = " + top +
" right = " + right +
"bottom = " + bottom;
}
}

View File

@ -1,6 +0,0 @@
package org.lwjgl.d3d;
public class RegionData {
public RegionDataHeader rdh; //RGNDATAHEADER
public char Buffer[] = new char[1];
}

View File

@ -1,9 +0,0 @@
package org.lwjgl.d3d;
public class RegionDataHeader {
public long dwSize; //DWORD
public long iType; //DWORD
public long nCount; //DWORD
public long nRgnSize; //DWORD
public Rectangle rcBound; //RECT
}

View File

@ -1,110 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
/**
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2832 $
* $Id: WindowsContextImplementation.java 2832 2007-05-27 15:32:25Z elias_naur $
*/
final class WindowsContextImplementation implements ContextImplementation {
public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
return nCreate(peer_handle, shared_context_handle);
} finally {
peer_info.unlock();
}
}
private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException;
public void swapBuffers(PeerInfo peerInfo) throws LWJGLException {
// Context current_context = Context.getCurrentContext();
// if (current_context == null)
// throw new IllegalStateException("No context is current");
// synchronized (current_context) {
// PeerInfo current_peer_info = current_context.getPeerInfo();
ByteBuffer peer_handle = peerInfo.lockAndGetHandle();
try {
nSwapBuffers(peer_handle);
} finally {
peerInfo.unlock();
}
// }
}
private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException;
public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException {
}
public void update(ByteBuffer context_handle) {
}
public void releaseCurrentContext() throws LWJGLException {
nReleaseCurrentContext();
}
private static native void nReleaseCurrentContext() throws LWJGLException;
public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
nMakeCurrent(peer_handle, handle);
} finally {
peer_info.unlock();
}
}
private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException;
public boolean isCurrent(ByteBuffer handle) throws LWJGLException {
boolean result = nIsCurrent(handle);
return result;
}
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setSwapInterval(int value) {
boolean success = nSetSwapInterval(value);
if (!success)
LWJGLUtil.log("Failed to set swap interval");
}
private static native boolean nSetSwapInterval(int value);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
nDestroy(handle);
}
private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException;
}

View File

@ -1,78 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInput base class
* @author elias_naur
*/
import org.lwjgl.LWJGLException;
abstract class WindowsDirectInput {
public final static int KEYBOARD_TYPE = 1;
public final static int MOUSE_TYPE = 2;
/* DirectInput constants */
public final static int DI_OK = 0x00000000;
public final static int DI_NOEFFECT = 0x00000001;
public final static int DI_PROPNOEFFECT = 0x00000001;
public final static int DI_POLLEDDEVICE = 0x00000002;
public final static int DI_DOWNLOADSKIPPED = 0x00000003;
public final static int DI_EFFECTRESTARTED = 0x00000004;
public final static int DI_TRUNCATED = 0x00000008;
public final static int DI_SETTINGSNOTSAVED = 0x0000000B;
public final static int DI_TRUNCATEDANDRESTARTED = 0x0000000C;
public final static int DI_BUFFEROVERFLOW = 0x00000001;
public final static int DIERR_INPUTLOST = 0x8007001E;
public final static int DIERR_NOTACQUIRED = 0x8007001C;
public final static int DIERR_OTHERAPPHASPRIO = 0x80070005;
private final long di_interface;
public WindowsDirectInput(long hinst) throws LWJGLException {
di_interface = createDirectInput(hinst);
}
protected abstract long createDirectInput(long hinst) throws LWJGLException;
public WindowsDirectInputDevice createDevice(int type) throws LWJGLException {
return createDevice(di_interface, type);
}
protected abstract WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException;
public void release() {
release(di_interface);
}
protected abstract void release(long di_interface);
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInput3 interface
* @author elias_naur
*/
import org.lwjgl.LWJGLException;
final class WindowsDirectInput3 extends WindowsDirectInput {
/* Re-define device types to get them included in the native headers */
public final static int KEYBOARD_TYPE = WindowsDirectInput.KEYBOARD_TYPE;
public final static int MOUSE_TYPE = WindowsDirectInput.MOUSE_TYPE;
public WindowsDirectInput3(long hinst) throws LWJGLException {
super(hinst);
}
protected native long createDirectInput(long hinst) throws LWJGLException;
protected WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException {
long device = nCreateDevice(di_interface, type);
return new WindowsDirectInputDevice3(device);
}
private static native long nCreateDevice(long di_interface, int type) throws LWJGLException;
protected native void release(long di_interface);
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInput8 interface
* @author elias_naur
*/
import org.lwjgl.LWJGLException;
final class WindowsDirectInput8 extends WindowsDirectInput {
/* Re-define device types to get them included in the native headers */
public final static int KEYBOARD_TYPE = WindowsDirectInput.KEYBOARD_TYPE;
public final static int MOUSE_TYPE = WindowsDirectInput.MOUSE_TYPE;
public WindowsDirectInput8(long hinst) throws LWJGLException {
super(hinst);
}
protected native long createDirectInput(long hinst) throws LWJGLException;
protected WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException {
long device = nCreateDevice(di_interface, type);
return new WindowsDirectInputDevice8(device);
}
private static native long nCreateDevice(long di_interface, int type) throws LWJGLException;
protected native void release(long di_interface);
}

View File

@ -1,132 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInputDevice interface
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.BufferUtils;
abstract class WindowsDirectInputDevice {
public final static int DISCL_EXCLUSIVE = 0x00000001;
public final static int DISCL_NONEXCLUSIVE = 0x00000002;
public final static int DISCL_FOREGROUND = 0x00000004;
public final static int DISCL_BACKGROUND = 0x00000008;
public final static int DISCL_NOWINKEY = 0x00000010;
public final static int GUID_XAxis = 1;
public final static int GUID_YAxis = 2;
public final static int GUID_ZAxis = 3;
public final static int GUID_Button = 4;
public final static int GUID_Unknown = 5;
public final static int DATA_SIZE = 3;
private final long di_device;
private ByteBuffer event_buffer;
public WindowsDirectInputDevice(long di_device) {
this.di_device = di_device;
}
public void release() {
release(di_device);
}
protected abstract void release(long di_device);
public int poll() {
return poll(di_device);
}
protected abstract int poll(long di_device);
public void setDataFormat(int type) throws LWJGLException {
int ret = setDataFormat(di_device, type);
if (ret != WindowsDirectInput.DI_OK)
throw new LWJGLException("Failed to set data format (" + Integer.toHexString(ret) + ")");
}
protected abstract int setDataFormat(long di_device, int type);
public void setCooperateLevel(long hwnd, int flags) throws LWJGLException {
int ret = setCooperativeLevel(di_device, hwnd, flags);
if (ret != WindowsDirectInput.DI_OK)
throw new LWJGLException("Failed to set cooperative level (" + Integer.toHexString(ret) + ")");
}
protected abstract int setCooperativeLevel(long di_device, long hwnd, int flags);
public int acquire() {
return acquire(di_device);
}
protected abstract int acquire(long di_device);
public void setBufferSize(int buffer_size) throws LWJGLException {
int ret = setBufferSize(di_device, buffer_size);
if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_PROPNOEFFECT && ret != WindowsDirectInput.DI_POLLEDDEVICE)
throw new LWJGLException("Failed to set buffer size (" + Integer.toHexString(ret) + ")");
int event_buffer_size = getEventSize()*buffer_size;
event_buffer = BufferUtils.createByteBuffer(event_buffer_size);
}
protected abstract int setBufferSize(long di_device, int buffer_size);
public int getDeviceData(IntBuffer buffer) {
int events_remaining = buffer.remaining()/DATA_SIZE;
if (event_buffer == null || events_remaining > event_buffer.remaining()/getEventSize())
event_buffer = BufferUtils.createByteBuffer(events_remaining*getEventSize());
return getDeviceData(di_device, event_buffer, event_buffer.capacity(), buffer, buffer.position(), buffer.remaining());
}
protected abstract int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
/**
* Device data is returned in tuples of the form <dwOfs, dwData>.
* buffer position() is moved accordingly to number of events.
*/
public int getDeviceState(ByteBuffer buffer) {
return getDeviceState(di_device, buffer, buffer.position(), buffer.remaining());
}
protected abstract int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
public void unacquire() {
unacquire(di_device);
}
protected abstract int unacquire(long di_device);
public int enumObjects(WindowsDirectInputDeviceObjectCallback enumerator) {
return enumObjects(di_device, enumerator);
}
protected abstract int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
protected abstract int getEventSize();
}

View File

@ -1,79 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInputDevice3 interface
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
final class WindowsDirectInputDevice3 extends WindowsDirectInputDevice {
/** Re-declare to get the constants into the native headers */
public final static int GUID_XAxis = WindowsDirectInputDevice.GUID_XAxis;
public final static int GUID_YAxis = WindowsDirectInputDevice.GUID_YAxis;
public final static int GUID_ZAxis = WindowsDirectInputDevice.GUID_ZAxis;
public final static int GUID_Button = WindowsDirectInputDevice.GUID_Button;
public final static int GUID_Unknown = WindowsDirectInputDevice.GUID_Unknown;
public final static int DATA_SIZE = WindowsDirectInputDevice.DATA_SIZE;
public WindowsDirectInputDevice3(long di_device) {
super(di_device);
}
protected native int setDataFormat(long di_device, int type);
protected native int setCooperativeLevel(long di_device, long hwnd, int flags);
protected native int acquire(long di_device);
protected native int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
protected native int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
protected native int unacquire(long di_device);
protected int poll(long di_device) {
return WindowsDirectInput.DI_OK;
}
protected native int setBufferSize(long di_device, int buffer_size);
protected native int getEventSize();
protected native void release(long di_device);
protected native int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
}

View File

@ -1,77 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInputDevice3 interface
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
final class WindowsDirectInputDevice8 extends WindowsDirectInputDevice {
/** Re-declare to get the constants into the native headers */
public final static int GUID_XAxis = WindowsDirectInputDevice.GUID_XAxis;
public final static int GUID_YAxis = WindowsDirectInputDevice.GUID_YAxis;
public final static int GUID_ZAxis = WindowsDirectInputDevice.GUID_ZAxis;
public final static int GUID_Button = WindowsDirectInputDevice.GUID_Button;
public final static int GUID_Unknown = WindowsDirectInputDevice.GUID_Unknown;
public final static int DATA_SIZE = WindowsDirectInputDevice.DATA_SIZE;
public WindowsDirectInputDevice8(long di_device) {
super(di_device);
}
protected native int setDataFormat(long di_device, int type);
protected native int setCooperativeLevel(long di_device, long hwnd, int flags);
protected native int acquire(long di_device);
protected native int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
protected native int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
protected native int unacquire(long di_device);
protected native int poll(long di_device);
protected native int setBufferSize(long di_device, int buffer_size);
protected native int getEventSize();
protected native void release(long di_device);
protected native int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the DirectInputDevice callback interface
* @author elias_naur
*/
interface WindowsDirectInputDeviceObjectCallback {
public boolean nextObject(int type, String name);
}

View File

@ -1,751 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the Display implementation interface. Display delegates
* to implementors of this interface. There is one DisplayImplementation
* for each supported platform.
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Cursor;
final class WindowsDisplay implements DisplayImplementation {
private final static int GAMMA_LENGTH = 256;
private final static int WM_MOUSEMOVE = 0x0200;
private final static int WM_LBUTTONDOWN = 0x0201;
private final static int WM_LBUTTONUP = 0x0202;
private final static int WM_LBUTTONDBLCLK = 0x0203;
private final static int WM_RBUTTONDOWN = 0x0204;
private final static int WM_RBUTTONUP = 0x0205;
private final static int WM_RBUTTONDBLCLK = 0x0206;
private final static int WM_MBUTTONDOWN = 0x0207;
private final static int WM_MBUTTONUP = 0x0208;
private final static int WM_MBUTTONDBLCLK = 0x0209;
private final static int WM_MOUSEWHEEL = 0x020A;
private final static int WM_KEYDOWN = 256;
private final static int WM_KEYUP = 257;
private final static int WM_SYSKEYUP = 261;
private final static int WM_SYSKEYDOWN = 260;
private final static int WM_CHAR = 258;
private final static int WM_QUIT = 0x0012;
private final static int WM_CLOSE = 0x0010;
private final static int WM_DESTROY = 0x0002;
private final static int WM_SYSCOMMAND = 0x0112;
private final static int WM_PAINT = 0x000F;
private final static int SC_SIZE = 0xF000;
private final static int SC_MOVE = 0xF010;
private final static int SC_MINIMIZE = 0xF020;
private final static int SC_MAXIMIZE = 0xF030;
private final static int SC_NEXTWINDOW = 0xF040;
private final static int SC_PREVWINDOW = 0xF050;
private final static int SC_CLOSE = 0xF060;
private final static int SC_VSCROLL = 0xF070;
private final static int SC_HSCROLL = 0xF080;
private final static int SC_MOUSEMENU = 0xF090;
private final static int SC_KEYMENU = 0xF100;
private final static int SC_ARRANGE = 0xF110;
private final static int SC_RESTORE = 0xF120;
private final static int SC_TASKLIST = 0xF130;
private final static int SC_SCREENSAVE = 0xF140;
private final static int SC_HOTKEY = 0xF150;
private final static int SC_DEFAULT = 0xF160;
private final static int SC_MONITORPOWER = 0xF170;
private final static int SC_CONTEXTHELP = 0xF180;
private final static int SC_SEPARATOR = 0xF00F;
final static int SM_CXCURSOR = 13;
final static int SM_CYCURSOR = 14;
final static int SM_CMOUSEBUTTONS = 43;
final static int SM_MOUSEWHEELPRESENT = 75;
private final static int SIZE_RESTORED = 0;
private final static int SIZE_MINIMIZED = 1;
private final static int SIZE_MAXIMIZED = 2;
private final static int WM_SIZE = 0x0005;
private final static int WM_ACTIVATE = 0x0006;
private final static int WA_INACTIVE = 0;
private final static int WA_ACTIVE = 1;
private final static int WA_CLICKACTIVE = 2;
private final static int SW_SHOWMINNOACTIVE = 7;
private final static int SW_SHOWDEFAULT = 10;
private final static int SW_RESTORE = 9;
private final static IntBuffer rect_buffer = BufferUtils.createIntBuffer(4);
private final static Rect rect = new Rect();
private final static Rect rect2 = new Rect();
private static WindowsDisplay current_display;
private static boolean cursor_clipped;
private WindowsDisplayPeerInfo peer_info;
private Object current_cursor;
private WindowsKeyboard keyboard;
private WindowsMouse mouse;
private boolean close_requested;
private boolean is_dirty;
private ByteBuffer current_gamma;
private ByteBuffer saved_gamma;
private DisplayMode current_mode;
private boolean mode_set;
private boolean isFullscreen;
private boolean isMinimized;
private boolean isFocused;
private boolean did_maximize;
private boolean inAppActivate;
public WindowsDisplay() {
current_display = this;
}
public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException {
close_requested = false;
is_dirty = false;
isFullscreen = fullscreen;
isMinimized = false;
isFocused = false;
did_maximize = false;
nCreateWindow(mode, fullscreen, x, y);
// peer_info.initDC();
showWindow(getHwnd(), SW_SHOWDEFAULT);
setForegroundWindow(getHwnd());
setFocus(getHwnd());
}
private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
public void destroyWindow() {
nDestroyWindow();
resetCursorClipping();
}
private static native void nDestroyWindow();
static void resetCursorClipping() {
if (cursor_clipped) {
try {
clipCursor(0, null);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to reset cursor clipping: " + e);
}
cursor_clipped = false;
}
}
private static void getGlobalClientRect(long hwnd, Rect rect) {
rect_buffer.put(0, 0).put(1, 0);
clientToScreen(hwnd, rect_buffer);
int offset_x = rect_buffer.get(0);
int offset_y = rect_buffer.get(1);
getClientRect(hwnd, rect_buffer);
rect.copyFromBuffer(rect_buffer);
rect.offset(offset_x, offset_y);
}
static WindowsDirectInput createDirectInput() throws LWJGLException {
try {
return new WindowsDirectInput8(getDllInstance());
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to create DirectInput 8 interface, falling back to DirectInput 3");
return new WindowsDirectInput3(getDllInstance());
}
}
static void setupCursorClipping(long hwnd) throws LWJGLException {
cursor_clipped = true;
getGlobalClientRect(hwnd, rect);
rect.copyToBuffer(rect_buffer);
clipCursor(hwnd, rect_buffer);
}
private static native void clipCursor(long hwnd, IntBuffer rect) throws LWJGLException;
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
nSwitchDisplayMode(mode);
current_mode = mode;
mode_set = true;
}
private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException;
/*
* Called when the application is alt-tabbed to or from
*/
private void appActivate(boolean active) {
if (inAppActivate) {
return;
}
inAppActivate = true;
isFocused = active;
if (active) {
if (isFullscreen) {
restoreDisplayMode();
}
showWindow(getHwnd(), SW_RESTORE);
setForegroundWindow(getHwnd());
setFocus(getHwnd());
did_maximize = true;
} else if (isFullscreen) {
showWindow(getHwnd(), SW_SHOWMINNOACTIVE);
resetDisplayMode();
}
inAppActivate = false;
}
private static native void showWindow(long hwnd, int mode);
private static native void setForegroundWindow(long hwnd);
private static native void setFocus(long hwnd);
private void restoreDisplayMode() {
try {
doSetGammaRamp(current_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore gamma: " + e.getMessage());
}
if (!mode_set) {
mode_set = true;
try {
nSwitchDisplayMode(current_mode);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore display mode: " + e.getMessage());
}
}
}
public void resetDisplayMode() {
try {
doSetGammaRamp(saved_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to reset gamma ramp: " + e.getMessage());
}
current_gamma = saved_gamma;
if (mode_set) {
mode_set = false;
nResetDisplayMode();
}
resetCursorClipping();
}
private static native void nResetDisplayMode();
public int getGammaRampLength() {
return GAMMA_LENGTH;
}
public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException {
doSetGammaRamp(convertToNativeRamp(gammaRamp));
}
private static native ByteBuffer convertToNativeRamp(FloatBuffer gamma_ramp) throws LWJGLException;
private static native ByteBuffer getCurrentGammaRamp() throws LWJGLException;
private void doSetGammaRamp(ByteBuffer native_gamma) throws LWJGLException {
nSetGammaRamp(native_gamma);
current_gamma = native_gamma;
}
private static native void nSetGammaRamp(ByteBuffer native_ramp) throws LWJGLException;
public String getAdapter() {
try {
String adapter_string = WindowsRegistry.queryRegistrationKey(
WindowsRegistry.HKEY_LOCAL_MACHINE,
"HARDWARE\\DeviceMap\\Video",
"\\Device\\Video0");
String root_key = "\\registry\\machine\\";
if (adapter_string.toLowerCase().startsWith(root_key)) {
String driver_value = WindowsRegistry.queryRegistrationKey(
WindowsRegistry.HKEY_LOCAL_MACHINE,
adapter_string.substring(root_key.length()),
"InstalledDisplayDrivers");
return driver_value;
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while querying registry: " + e);
}
return null;
}
public String getVersion() {
String driver = getAdapter();
if (driver != null) {
WindowsFileVersion version = nGetVersion(driver + ".dll");
if (version != null)
return version.toString();
}
return null;
}
private native WindowsFileVersion nGetVersion(String driver);
public DisplayMode init() throws LWJGLException {
current_gamma = saved_gamma = getCurrentGammaRamp();
return current_mode = getCurrentDisplayMode();
}
private static native DisplayMode getCurrentDisplayMode() throws LWJGLException;
public native void setTitle(String title);
public boolean isCloseRequested() {
boolean saved = close_requested;
close_requested = false;
return saved;
}
public boolean isVisible() {
return !isMinimized;
}
public boolean isActive() {
return isFocused;
}
public boolean isDirty() {
boolean saved = is_dirty;
is_dirty = false;
return saved;
}
public PeerInfo createPeerInfo() throws LWJGLException {
peer_info = new WindowsDisplayPeerInfo();
return peer_info;
}
public void update() {
nUpdate();
if (did_maximize) {
did_maximize = false;
/**
* WORKAROUND:
* Making the context current (redundantly) when the window
* is maximized helps some gfx recover from fullscreen
*/
try {
if (Display.getDrawable().getContext() != null && Display.getDrawable().getContext().isCurrent())
Display.getDrawable().getContext().makeCurrent();
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while trying to make context current: " + e);
}
}
}
private static native void nUpdate();
public void reshape(int x, int y, int width, int height) {
if (!isFullscreen)
nReshape(getHwnd(), x, y, width, height);
}
private static native void nReshape(long hwnd, int x, int y, int width, int height);
public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException;
/* Mouse */
public boolean hasWheel() {
return mouse.hasWheel();
}
public int getButtonCount() {
return mouse.getButtonCount();
}
public void createMouse() throws LWJGLException {
mouse = new WindowsMouse(getHwnd());
}
public void destroyMouse() {
if (mouse != null)
mouse.destroy();
mouse = null;
}
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
update();
mouse.poll(coord_buffer, buttons);
}
public void readMouse(ByteBuffer buffer) {
update();
mouse.read(buffer);
}
public void grabMouse(boolean grab) {
mouse.grab(grab, shouldGrab());
try {
updateCursor();
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to update cursor: " + e);
}
}
public int getNativeCursorCapabilities() {
return Cursor.CURSOR_ONE_BIT_TRANSPARENCY;
}
public void setCursorPosition(int x, int y) {
getGlobalClientRect(getHwnd(), rect);
int transformed_x = rect.left + x;
int transformed_y = rect.bottom - 1 - y;
nSetCursorPosition(transformed_x, transformed_y);
setMousePosition(x, y);
}
private static native void nSetCursorPosition(int x, int y);
public void setNativeCursor(Object handle) throws LWJGLException {
current_cursor = handle;
updateCursor();
}
private void updateCursor() throws LWJGLException {
if (mouse != null && mouse.isGrabbed())
nSetNativeCursor(getHwnd(), mouse.getBlankCursor());
else
nSetNativeCursor(getHwnd(), current_cursor);
}
static native void nSetNativeCursor(long hwnd, Object handle) throws LWJGLException;
public int getMinCursorSize() {
return getSystemMetrics(SM_CXCURSOR);
}
public int getMaxCursorSize() {
return getSystemMetrics(SM_CXCURSOR);
}
static native int getSystemMetrics(int index);
private static native long getDllInstance();
public static native long getHwnd();
private static native long getDesktopWindow();
static void centerCursor(long hwnd) {
getGlobalClientRect(getHwnd(), rect);
int local_offset_x = rect.left;
int local_offset_y = rect.top;
getGlobalClientRect(getDesktopWindow(), rect2);
Rect.intersect(rect, rect2, rect);
int center_x = (rect.left + rect.right)/2;
int center_y = (rect.top + rect.bottom)/2;
nSetCursorPosition(center_x, center_y);
int local_x = center_x - local_offset_x;
int local_y = center_y - local_offset_y;
if (current_display != null)
current_display.setMousePosition(local_x, transformY(getHwnd(), local_y));
}
private void setMousePosition(int x, int y) {
if (mouse != null)
mouse.setPosition(x, y);
}
/* Keyboard */
public void createKeyboard() throws LWJGLException {
keyboard = new WindowsKeyboard(getHwnd());
}
public void destroyKeyboard() {
keyboard.destroy();
keyboard = null;
}
public void pollKeyboard(ByteBuffer keyDownBuffer) {
update();
keyboard.poll(keyDownBuffer);
}
public void readKeyboard(ByteBuffer buffer) {
update();
keyboard.read(buffer);
}
// public native int isStateKeySet(int key);
public static native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException;
public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
return doCreateCursor(width, height, xHotspot, yHotspot, numImages, images, delays);
}
static Object doCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1);
}
public void destroyCursor(Object cursorHandle) {
doDestroyCursor(cursorHandle);
}
static native void doDestroyCursor(Object cursorHandle);
// public int getPbufferCapabilities() {
// try {
// // Return the capabilities of a minimum pixel format
// return nGetPbufferCapabilities(new PixelFormat(0, 0, 0, 0, 0, 0, 0, 0, false));
// } catch (LWJGLException e) {
// LWJGLUtil.log("Exception occurred while determining pbuffer capabilities: " + e);
// return 0;
// }
// }
// private native int nGetPbufferCapabilities(PixelFormat format) throws LWJGLException;
/**
* Sets one or more icons for the Display.
* <ul>
* <li>On Windows you should supply at least one 16x16 icon and one 32x32.</li>
* <li>Linux (and similar platforms) expect one 32x32 icon.</li>
* <li>Mac OS X should be supplied one 128x128 icon</li>
* </ul>
* The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform.
*
* @param icons Array of icons in RGBA mode
* @return number of icons used.
*/
public int setIcon(ByteBuffer[] icons) {
boolean done16 = false;
boolean done32 = false;
int used = 0;
for (int i=0;i<icons.length;i++) {
int size = icons[i].limit() / 4;
if ((((int) Math.sqrt(size)) == 16) && (!done16)) {
nSetWindowIcon16(icons[i].asIntBuffer());
used++;
done16 = true;
}
if ((((int) Math.sqrt(size)) == 32) && (!done32)) {
nSetWindowIcon32(icons[i].asIntBuffer());
used++;
done32 = true;
}
}
return used;
}
private static native int nSetWindowIcon16(IntBuffer icon);
private static native int nSetWindowIcon32(IntBuffer icon);
private void handleMouseButton(int button, int state, long millis) {
if (mouse != null)
mouse.handleMouseButton((byte)button, (byte)state, millis);
}
private boolean shouldGrab() {
return !isMinimized && isFocused;
}
private void handleMouseMoved(int x, int y, long millis) {
if (mouse != null)
mouse.handleMouseMoved(x, y, millis, shouldGrab());
}
private void handleMouseScrolled(int amount, long millis) {
if (mouse != null)
mouse.handleMouseScrolled(amount, millis);
}
private static native void getClientRect(long hwnd, IntBuffer rect);
private void handleChar(long wParam, long lParam, long millis) {
byte previous_state = (byte)((lParam >>> 30) & 0x1);
byte state = (byte)(1 - ((lParam >>> 31) & 0x1));
boolean repeat = state == previous_state;
if (keyboard != null)
keyboard.handleChar((int)(wParam & 0xFF), millis, repeat);
}
private void handleKeyButton(long wParam, long lParam, long millis) {
byte previous_state = (byte)((lParam >>> 30) & 0x1);
byte state = (byte)(1 - ((lParam >>> 31) & 0x1));
boolean repeat = state == previous_state; // Repeat message
byte extended = (byte)((lParam >>> 24) & 0x1);
int scan_code = (int)((lParam >>> 16) & 0xFF);
if (keyboard != null)
keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat);
}
private static int transformY(long hwnd, int y) {
getClientRect(hwnd, rect_buffer);
rect.copyFromBuffer(rect_buffer);
return (rect.bottom - rect.top) - 1 - y;
}
private static native void clientToScreen(long hwnd, IntBuffer point);
private static boolean handleMessage(long hwnd, int msg, long wParam, long lParam, long millis) {
if (current_display != null)
return current_display.doHandleMessage(hwnd, msg, wParam, lParam, millis);
else
return false;
}
private boolean doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) {
if ((isFullscreen || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused) {
try {
setupCursorClipping(getHwnd());
} catch (LWJGLException e) {
LWJGLUtil.log("setupCursorClipping failed: " + e.getMessage());
}
} else {
resetCursorClipping();
}
switch (msg) {
// disable screen saver and monitor power down messages which wreak havoc
case WM_ACTIVATE:
switch ((int)wParam) {
case WA_ACTIVE:
case WA_CLICKACTIVE:
appActivate(true);
break;
case WA_INACTIVE:
appActivate(false);
break;
}
return true;
case WM_SIZE:
switch ((int)wParam) {
case SIZE_RESTORED:
case SIZE_MAXIMIZED:
isMinimized = false;
break;
case SIZE_MINIMIZED:
isMinimized = true;
break;
}
return false;
case WM_MOUSEMOVE:
int xPos = (int)(short)(lParam & 0xFFFF);
int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF));
handleMouseMoved(xPos, yPos, millis);
return true;
case WM_MOUSEWHEEL:
int dwheel = (int)(short)((wParam >> 16) & 0xFFFF);
handleMouseScrolled(dwheel, millis);
return true;
case WM_LBUTTONDOWN:
handleMouseButton(0, 1, millis);
return true;
case WM_LBUTTONUP:
handleMouseButton(0, 0, millis);
return true;
case WM_RBUTTONDOWN:
handleMouseButton(1, 1, millis);
return true;
case WM_RBUTTONUP:
handleMouseButton(1, 0, millis);
return true;
case WM_MBUTTONDOWN:
handleMouseButton(2, 1, millis);
return true;
case WM_MBUTTONUP:
handleMouseButton(2, 0, millis);
return true;
case WM_CHAR:
handleChar(wParam, lParam, millis);
return true;
case WM_SYSKEYDOWN: /* Fall through */
case WM_SYSKEYUP: /* Fall through */
case WM_KEYUP: /* Fall through */
case WM_KEYDOWN:
handleKeyButton(wParam, lParam, millis);
return false;
case WM_DESTROY:
case WM_CLOSE:
case WM_QUIT:
close_requested = true;
return true;
case WM_SYSCOMMAND:
switch ((int)(wParam & 0xfff0)) {
case SC_KEYMENU:
case SC_MOUSEMENU:
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return true;
case SC_CLOSE:
close_requested = true;
return true;
default:
break;
}
return false;
case WM_PAINT:
is_dirty = true;
return false;
default:
return false;
}
}
public int getWidth() {
return Display.getDisplayMode().getWidth();
}
public int getHeight() {
return Display.getDisplayMode().getHeight();
}
private static final class Rect {
public int top;
public int bottom;
public int left;
public int right;
public void copyToBuffer(IntBuffer buffer) {
buffer.put(0, top).put(1, bottom).put(2, left).put(3, right);
}
public void copyFromBuffer(IntBuffer buffer) {
top = buffer.get(0);
bottom = buffer.get(1);
left = buffer.get(2);
right = buffer.get(3);
}
public void offset(int offset_x, int offset_y) {
left += offset_x;
right += offset_x;
top += offset_y;
bottom += offset_y;
}
public static void intersect(Rect r1, Rect r2, Rect dst) {
dst.top = Math.max(r1.top, r2.top);
dst.bottom = Math.min(r1.bottom, r2.bottom);
dst.left = Math.max(r1.left, r2.left);
dst.right = Math.min(r1.right, r2.right);
}
public String toString() {
return "Rect: top = " + top + " bottom = " + bottom + " left = " + left + " right = " + right;
}
}
}

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
/**
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2575 $
* $Id: WindowsDisplayPeerInfo.java 2575 2006-09-19 14:17:13Z elias_naur $
*/
final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
// private final PixelFormat pixel_format;
public WindowsDisplayPeerInfo() {
// this.pixel_format = pixel_format;
// GLContext.loadOpenGLLibrary();
}
void initDC() throws LWJGLException {
nInitDC(getHandle());
// choosePixelFormat(0, 0, pixel_format, null, true, true, false, true);
}
private static native void nInitDC(ByteBuffer peer_info_handle);
protected void doLockAndInitHandle() throws LWJGLException {
// NO-OP
}
protected void doUnlock() throws LWJGLException {
// NO-OP
}
public void destroy() {
super.destroy();
// GLContext.unloadOpenGLLibrary();
}
}

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* @author elias_naur
*/
final class WindowsFileVersion {
private final int product_version_ms;
private final int product_version_ls;
public WindowsFileVersion(int product_version_ms, int product_version_ls) {
this.product_version_ms = product_version_ms;
this.product_version_ls = product_version_ls;
}
public String toString() {
int f1 = (product_version_ms >> 16) & 0xFFFF;
int f2 = product_version_ms & 0xFFFF;
int f3 = (product_version_ls >> 16) & 0xFFFF;
int f4 = product_version_ls & 0xFFFF;
return f1 + "." + f2 + "." + f3 + "." + f4;
}
}

View File

@ -1,178 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the Windows implementation of the Keyboard.
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.CharBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Keyboard;
final class WindowsKeyboard {
private final static int MAPVK_VK_TO_VSC = 0;
private final static int BUFFER_SIZE = 50;
private final long hwnd;
private final ByteBuffer keyboard_state;
private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE];
private final EventQueue event_queue = new EventQueue(Keyboard.EVENT_SIZE);
private final ByteBuffer tmp_event = ByteBuffer.allocate(Keyboard.EVENT_SIZE);
private boolean grabbed;
private boolean has_retained_event; // Indicates if we're waiting for a WM_CHAR
private int retained_key_code;
private byte retained_state;
private int retained_char;
private long retained_millis;
private boolean retained_repeat;
public WindowsKeyboard(long hwnd) throws LWJGLException {
this.hwnd = hwnd;
keyboard_state = BufferUtils.createByteBuffer(256);
}
private static native boolean isWindowsNT();
public void destroy() {
}
public void grab(boolean grab) {
if(grab) {
if (!grabbed) {
grabbed = true;
}
} else {
if (grabbed) {
grabbed = false;
}
}
}
public void poll(ByteBuffer keyDownBuffer) {
int old_position = keyDownBuffer.position();
keyDownBuffer.put(key_down_buffer);
keyDownBuffer.position(old_position);
}
private static native int MapVirtualKey(int uCode, int uMapType);
private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags);
private static native int ToAscii(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, ByteBuffer lpChar, int flags);
private static native int GetKeyboardState(ByteBuffer lpKeyState);
private static native int GetKeyState(int virt_key);
private void putEvent(int keycode, byte state, int ch, long millis, boolean repeat) {
tmp_event.clear();
tmp_event.putInt(keycode).put(state).putInt(ch).putLong(millis*1000000).put(repeat ? (byte)1 : (byte)0);
tmp_event.flip();
event_queue.putEvent(tmp_event);
}
private boolean checkShiftKey(int virt_key, byte state) {
int key_state = (GetKeyState(virt_key) >>> 15) & 0x1;
int lwjgl_code = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key);
return (key_down_buffer[lwjgl_code] == 1 - state) && (key_state == state);
}
private int translateShift(int scan_code, byte state) {
if (checkShiftKey(WindowsKeycodes.VK_LSHIFT, state)) {
return WindowsKeycodes.VK_LSHIFT;
} else if (checkShiftKey(WindowsKeycodes.VK_RSHIFT, state)) {
return WindowsKeycodes.VK_RSHIFT;
} else {
if (scan_code== 0x2A)
return WindowsKeycodes.VK_LSHIFT;
else {
if (scan_code == 0x36)
return WindowsKeycodes.VK_RSHIFT;
else
return WindowsKeycodes.VK_LSHIFT;
}
}
}
private int translateExtended(int virt_key, int scan_code, byte state, boolean extended) {
switch (virt_key) {
case WindowsKeycodes.VK_SHIFT:
return translateShift(scan_code, state);
case WindowsKeycodes.VK_CONTROL:
return extended ? WindowsKeycodes.VK_RCONTROL : WindowsKeycodes.VK_LCONTROL;
case WindowsKeycodes.VK_MENU:
return extended ? WindowsKeycodes.VK_RMENU : WindowsKeycodes.VK_LMENU;
default:
return virt_key;
}
}
private void flushRetained() {
if (has_retained_event) {
has_retained_event = false;
putEvent(retained_key_code, retained_state, retained_char, retained_millis, retained_repeat);
}
}
public void handleKey(int virt_key, int scan_code, boolean extended, byte event_state, long millis, boolean repeat) {
virt_key = translateExtended(virt_key, scan_code, event_state, extended);
flushRetained();
has_retained_event = true;
int keycode = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key);
if (keycode < key_down_buffer.length)
key_down_buffer[keycode] = event_state;
retained_key_code = keycode;
retained_state = event_state;
retained_millis = millis;
retained_char = 0;
retained_repeat = repeat;
}
public void handleChar(int event_char, long millis, boolean repeat) {
if (has_retained_event && retained_char != 0)
flushRetained();
if (!has_retained_event) {
putEvent(0, (byte)0, event_char, millis, repeat);
} else
retained_char = event_char;
}
public void read(ByteBuffer buffer) {
flushRetained();
event_queue.copyEvents(buffer);
}
}

View File

@ -1,577 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* @author elias_naur
*/
import org.lwjgl.input.Keyboard;
final class WindowsKeycodes {
public final static int VK_LBUTTON = 0x01;
public final static int VK_RBUTTON = 0x02;
public final static int VK_CANCEL = 0x03;
public final static int VK_MBUTTON = 0x04; /* NOT contiguous with L & RBUTTON */
public final static int VK_XBUTTON1 = 0x05; /* NOT contiguous with L & RBUTTON */
public final static int VK_XBUTTON2 = 0x06; /* NOT contiguous with L & RBUTTON */
/*
* 0x07 : unassigned
*/
public final static int VK_BACK = 0x08;
public final static int VK_TAB = 0x09;
/*
* 0x0A - 0x0B : reserved
*/
public final static int VK_CLEAR = 0x0C;
public final static int VK_RETURN = 0x0D;
public final static int VK_SHIFT = 0x10;
public final static int VK_CONTROL = 0x11;
public final static int VK_MENU = 0x12;
public final static int VK_PAUSE = 0x13;
public final static int VK_CAPITAL = 0x14;
public final static int VK_KANA = 0x15;
public final static int VK_HANGEUL = 0x15; /* old name - should be here for compatibility */
public final static int VK_HANGUL = 0x15;
public final static int VK_JUNJA = 0x17;
public final static int VK_FINAL = 0x18;
public final static int VK_HANJA = 0x19;
public final static int VK_KANJI = 0x19;
public final static int VK_ESCAPE = 0x1B;
public final static int VK_CONVERT = 0x1C;
public final static int VK_NONCONVERT = 0x1D;
public final static int VK_ACCEPT = 0x1E;
public final static int VK_MODECHANGE = 0x1F;
public final static int VK_SPACE = 0x20;
public final static int VK_PRIOR = 0x21;
public final static int VK_NEXT = 0x22;
public final static int VK_END = 0x23;
public final static int VK_HOME = 0x24;
public final static int VK_LEFT = 0x25;
public final static int VK_UP = 0x26;
public final static int VK_RIGHT = 0x27;
public final static int VK_DOWN = 0x28;
public final static int VK_SELECT = 0x29;
public final static int VK_PRINT = 0x2A;
public final static int VK_EXECUTE = 0x2B;
public final static int VK_SNAPSHOT = 0x2C;
public final static int VK_INSERT = 0x2D;
public final static int VK_DELETE = 0x2E;
public final static int VK_HELP = 0x2F;
/*
* VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
* 0x40 : unassigned
* VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
*/
public final static int VK_0 = 0x30;
public final static int VK_1 = 0x31;
public final static int VK_2 = 0x32;
public final static int VK_3 = 0x33;
public final static int VK_4 = 0x34;
public final static int VK_5 = 0x35;
public final static int VK_6 = 0x36;
public final static int VK_7 = 0x37;
public final static int VK_8 = 0x38;
public final static int VK_9 = 0x39;
public final static int VK_A = 0x41;
public final static int VK_B = 0x42;
public final static int VK_C = 0x43;
public final static int VK_D = 0x44;
public final static int VK_E = 0x45;
public final static int VK_F = 0x46;
public final static int VK_G = 0x47;
public final static int VK_H = 0x48;
public final static int VK_I = 0x49;
public final static int VK_J = 0x4A;
public final static int VK_K = 0x4B;
public final static int VK_L = 0x4C;
public final static int VK_M = 0x4D;
public final static int VK_N = 0x4E;
public final static int VK_O = 0x4F;
public final static int VK_P = 0x50;
public final static int VK_Q = 0x51;
public final static int VK_R = 0x52;
public final static int VK_S = 0x53;
public final static int VK_T = 0x54;
public final static int VK_U = 0x55;
public final static int VK_V = 0x56;
public final static int VK_W = 0x57;
public final static int VK_X = 0x58;
public final static int VK_Y = 0x59;
public final static int VK_Z = 0x5A;
public final static int VK_LWIN = 0x5B;
public final static int VK_RWIN = 0x5C;
public final static int VK_APPS = 0x5D;
/*
* 0x5E : reserved;
*/
public final static int VK_SLEEP = 0x5F;
public final static int VK_NUMPAD0 = 0x60;
public final static int VK_NUMPAD1 = 0x61;
public final static int VK_NUMPAD2 = 0x62;
public final static int VK_NUMPAD3 = 0x63;
public final static int VK_NUMPAD4 = 0x64;
public final static int VK_NUMPAD5 = 0x65;
public final static int VK_NUMPAD6 = 0x66;
public final static int VK_NUMPAD7 = 0x67;
public final static int VK_NUMPAD8 = 0x68;
public final static int VK_NUMPAD9 = 0x69;
public final static int VK_MULTIPLY = 0x6A;
public final static int VK_ADD = 0x6B;
public final static int VK_SEPARATOR = 0x6C;
public final static int VK_SUBTRACT = 0x6D;
public final static int VK_DECIMAL = 0x6E;
public final static int VK_DIVIDE = 0x6F;
public final static int VK_F1 = 0x70;
public final static int VK_F2 = 0x71;
public final static int VK_F3 = 0x72;
public final static int VK_F4 = 0x73;
public final static int VK_F5 = 0x74;
public final static int VK_F6 = 0x75;
public final static int VK_F7 = 0x76;
public final static int VK_F8 = 0x77;
public final static int VK_F9 = 0x78;
public final static int VK_F10 = 0x79;
public final static int VK_F11 = 0x7A;
public final static int VK_F12 = 0x7B;
public final static int VK_F13 = 0x7C;
public final static int VK_F14 = 0x7D;
public final static int VK_F15 = 0x7E;
public final static int VK_F16 = 0x7F;
public final static int VK_F17 = 0x80;
public final static int VK_F18 = 0x81;
public final static int VK_F19 = 0x82;
public final static int VK_F20 = 0x83;
public final static int VK_F21 = 0x84;
public final static int VK_F22 = 0x85;
public final static int VK_F23 = 0x86;
public final static int VK_F24 = 0x87;
/*
* 0x88 - 0x8F : unassigned;
*/
public final static int VK_NUMLOCK = 0x90;
public final static int VK_SCROLL = 0x91;
/*
* NEC PC-9800 kbd definitions
*/
public final static int VK_OEM_NEC_EQUAL = 0x92; // '=' key on numpad
/*
* Fujitsu/OASYS kbd definitions
*/
public final static int VK_OEM_FJ_JISHO = 0x92; // 'Dictionary' key
public final static int VK_OEM_FJ_MASSHOU = 0x93; // 'Unregister word' key
public final static int VK_OEM_FJ_TOUROKU = 0x94; // 'Register word' key
public final static int VK_OEM_FJ_LOYA = 0x95; // 'Left OYAYUBI' key
public final static int VK_OEM_FJ_ROYA = 0x96; // 'Right OYAYUBI' key
/*
* 0x97 - 0x9F : unassigned
*/
/*
* VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
* Used only as parameters to GetAsyncKeyState() and GetKeyState().
* No other API or message will distinguish left and right keys in this way.
*/
public final static int VK_LSHIFT = 0xA0;
public final static int VK_RSHIFT = 0xA1;
public final static int VK_LCONTROL = 0xA2;
public final static int VK_RCONTROL = 0xA3;
public final static int VK_LMENU = 0xA4;
public final static int VK_RMENU = 0xA5;
public final static int VK_BROWSER_BACK = 0xA6;
public final static int VK_BROWSER_FORWARD = 0xA7;
public final static int VK_BROWSER_REFRESH = 0xA8;
public final static int VK_BROWSER_STOP = 0xA9;
public final static int VK_BROWSER_SEARCH = 0xAA;
public final static int VK_BROWSER_FAVORITES = 0xAB;
public final static int VK_BROWSER_HOME = 0xAC;
public final static int VK_VOLUME_MUTE = 0xAD;
public final static int VK_VOLUME_DOWN = 0xAE;
public final static int VK_VOLUME_UP = 0xAF;
public final static int VK_MEDIA_NEXT_TRACK = 0xB0;
public final static int VK_MEDIA_PREV_TRACK = 0xB1;
public final static int VK_MEDIA_STOP = 0xB2;
public final static int VK_MEDIA_PLAY_PAUSE = 0xB3;
public final static int VK_LAUNCH_MAIL = 0xB4;
public final static int VK_LAUNCH_MEDIA_SELECT = 0xB5;
public final static int VK_LAUNCH_APP1 = 0xB6;
public final static int VK_LAUNCH_APP2 = 0xB7;
/*
* 0xB8 - 0xB9 : reserved
*/
public final static int VK_OEM_1 = 0xBA; // ';:' for US
public final static int VK_OEM_PLUS = 0xBB; // '+' any country
public final static int VK_OEM_COMMA = 0xBC; // ',' any country
public final static int VK_OEM_MINUS = 0xBD; // '-' any country
public final static int VK_OEM_PERIOD = 0xBE; // '.' any country
public final static int VK_OEM_2 = 0xBF; // '/?' for US
public final static int VK_OEM_3 = 0xC0; // '`~' for US
/*
* 0xC1 - 0xD7 : reserved
*/
/*
* 0xD8 - 0xDA : unassigned
*/
public final static int VK_OEM_4 = 0xDB; // '[{' for US
public final static int VK_OEM_5 = 0xDC; // '\|' for US
public final static int VK_OEM_6 = 0xDD; // ']}' for US
public final static int VK_OEM_7 = 0xDE; // ''"' for US
public final static int VK_OEM_8 = 0xDF;
/*
* 0xE0 : reserved
*/
/*
* Various extended or enhanced keyboards
*/
public final static int VK_OEM_AX = 0xE1; // 'AX' key on Japanese AX kbd
public final static int VK_OEM_102 = 0xE2; // "<>" or "\|" on RT 102-key kbd.
public final static int VK_ICO_HELP = 0xE3; // Help key on ICO
public final static int VK_ICO_00 = 0xE4; // 00 key on ICO
public final static int VK_PROCESSKEY = 0xE5;
public final static int VK_ICO_CLEAR = 0xE6;
public final static int VK_PACKET = 0xE7;
/*
* 0xE8 : unassigned
*/
/*
* Nokia/Ericsson definitions
*/
public final static int VK_OEM_RESET = 0xE9;
public final static int VK_OEM_JUMP = 0xEA;
public final static int VK_OEM_PA1 = 0xEB;
public final static int VK_OEM_PA2 = 0xEC;
public final static int VK_OEM_PA3 = 0xED;
public final static int VK_OEM_WSCTRL = 0xEE;
public final static int VK_OEM_CUSEL = 0xEF;
public final static int VK_OEM_ATTN = 0xF0;
public final static int VK_OEM_FINISH = 0xF1;
public final static int VK_OEM_COPY = 0xF2;
public final static int VK_OEM_AUTO = 0xF3;
public final static int VK_OEM_ENLW = 0xF4;
public final static int VK_OEM_BACKTAB = 0xF5;
public final static int VK_ATTN = 0xF6;
public final static int VK_CRSEL = 0xF7;
public final static int VK_EXSEL = 0xF8;
public final static int VK_EREOF = 0xF9;
public final static int VK_PLAY = 0xFA;
public final static int VK_ZOOM = 0xFB;
public final static int VK_NONAME = 0xFC;
public final static int VK_PA1 = 0xFD;
public final static int VK_OEM_CLEAR = 0xFE;
public static int mapVirtualKeyToLWJGLCode(int virt_key) {
switch (virt_key) {
case VK_ESCAPE:
return Keyboard.KEY_ESCAPE;
case VK_1:
return Keyboard.KEY_1;
case VK_2:
return Keyboard.KEY_2;
case VK_3:
return Keyboard.KEY_3;
case VK_4:
return Keyboard.KEY_4;
case VK_5:
return Keyboard.KEY_5;
case VK_6:
return Keyboard.KEY_6;
case VK_7:
return Keyboard.KEY_7;
case VK_8:
return Keyboard.KEY_8;
case VK_9:
return Keyboard.KEY_9;
case VK_0:
return Keyboard.KEY_0;
case VK_OEM_MINUS:
return Keyboard.KEY_MINUS;
/* case VK_EQUALS:
return Keyboard.KEY_EQUALS;*/
case VK_BACK:
return Keyboard.KEY_BACK;
case VK_TAB:
return Keyboard.KEY_TAB;
case VK_Q:
return Keyboard.KEY_Q;
case VK_W:
return Keyboard.KEY_W;
case VK_E:
return Keyboard.KEY_E;
case VK_R:
return Keyboard.KEY_R;
case VK_T:
return Keyboard.KEY_T;
case VK_Y:
return Keyboard.KEY_Y;
case VK_U:
return Keyboard.KEY_U;
case VK_I:
return Keyboard.KEY_I;
case VK_O:
return Keyboard.KEY_O;
case VK_P:
return Keyboard.KEY_P;
case VK_OEM_4:
return Keyboard.KEY_LBRACKET;
case VK_OEM_6:
return Keyboard.KEY_RBRACKET;
case VK_RETURN:
return Keyboard.KEY_RETURN;
case VK_LCONTROL:
return Keyboard.KEY_LCONTROL;
case VK_A:
return Keyboard.KEY_A;
case VK_S:
return Keyboard.KEY_S;
case VK_D:
return Keyboard.KEY_D;
case VK_F:
return Keyboard.KEY_F;
case VK_G:
return Keyboard.KEY_G;
case VK_H:
return Keyboard.KEY_H;
case VK_J:
return Keyboard.KEY_J;
case VK_K:
return Keyboard.KEY_K;
case VK_L:
return Keyboard.KEY_L;
case VK_OEM_1:
return Keyboard.KEY_SEMICOLON;
case VK_OEM_7:
return Keyboard.KEY_APOSTROPHE;
case VK_OEM_3:
return Keyboard.KEY_GRAVE;
case VK_LSHIFT:
return Keyboard.KEY_LSHIFT;
case VK_OEM_5:
return Keyboard.KEY_BACKSLASH;
case VK_Z:
return Keyboard.KEY_Z;
case VK_X:
return Keyboard.KEY_X;
case VK_C:
return Keyboard.KEY_C;
case VK_V:
return Keyboard.KEY_V;
case VK_B:
return Keyboard.KEY_B;
case VK_N:
return Keyboard.KEY_N;
case VK_M:
return Keyboard.KEY_M;
case VK_OEM_COMMA:
return Keyboard.KEY_COMMA;
case VK_OEM_PERIOD:
return Keyboard.KEY_PERIOD;
case VK_OEM_2:
return Keyboard.KEY_SLASH;
case VK_RSHIFT:
return Keyboard.KEY_RSHIFT;
case VK_MULTIPLY:
return Keyboard.KEY_MULTIPLY;
case VK_LMENU:
return Keyboard.KEY_LMENU;
case VK_SPACE:
return Keyboard.KEY_SPACE;
case VK_CAPITAL:
return Keyboard.KEY_CAPITAL;
case VK_F1:
return Keyboard.KEY_F1;
case VK_F2:
return Keyboard.KEY_F2;
case VK_F3:
return Keyboard.KEY_F3;
case VK_F4:
return Keyboard.KEY_F4;
case VK_F5:
return Keyboard.KEY_F5;
case VK_F6:
return Keyboard.KEY_F6;
case VK_F7:
return Keyboard.KEY_F7;
case VK_F8:
return Keyboard.KEY_F8;
case VK_F9:
return Keyboard.KEY_F9;
case VK_F10:
return Keyboard.KEY_F10;
case VK_NUMLOCK:
return Keyboard.KEY_NUMLOCK;
case VK_SCROLL:
return Keyboard.KEY_SCROLL;
case VK_NUMPAD7:
return Keyboard.KEY_NUMPAD7;
case VK_NUMPAD8:
return Keyboard.KEY_NUMPAD8;
case VK_NUMPAD9:
return Keyboard.KEY_NUMPAD9;
case VK_SUBTRACT:
return Keyboard.KEY_SUBTRACT;
case VK_NUMPAD4:
return Keyboard.KEY_NUMPAD4;
case VK_NUMPAD5:
return Keyboard.KEY_NUMPAD5;
case VK_NUMPAD6:
return Keyboard.KEY_NUMPAD6;
case VK_ADD:
return Keyboard.KEY_ADD;
case VK_NUMPAD1:
return Keyboard.KEY_NUMPAD1;
case VK_NUMPAD2:
return Keyboard.KEY_NUMPAD2;
case VK_NUMPAD3:
return Keyboard.KEY_NUMPAD3;
case VK_NUMPAD0:
return Keyboard.KEY_NUMPAD0;
case VK_DECIMAL:
return Keyboard.KEY_DECIMAL;
case VK_F11:
return Keyboard.KEY_F11;
case VK_F12:
return Keyboard.KEY_F12;
case VK_F13:
return Keyboard.KEY_F13;
case VK_F14:
return Keyboard.KEY_F14;
case VK_F15:
return Keyboard.KEY_F15;
case VK_KANA:
return Keyboard.KEY_KANA;
case VK_CONVERT:
return Keyboard.KEY_CONVERT;
case VK_NONCONVERT:
return Keyboard.KEY_NOCONVERT;
/* case VK_YEN:
return Keyboard.KEY_YEN;
case VK_NUMPADEQUALS:
return Keyboard.KEY_NUMPADEQUALS;
case VK_CIRCUMFLEX:
return Keyboard.KEY_CIRCUMFLEX;
case VK_AT:
return Keyboard.KEY_AT;
case VK_COLON:
return Keyboard.KEY_COLON;
case VK_UNDERLINE:
return Keyboard.KEY_UNDERLINE;*/
case VK_KANJI:
return Keyboard.KEY_KANJI;
/* case VK_STOP:
return Keyboard.KEY_STOP;
case VK_AX:
return Keyboard.KEY_AX;
case VK_UNLABELED:
return Keyboard.KEY_UNLABELED;
case VK_NUMPADENTER:
return Keyboard.KEY_NUMPADENTER;*/
case VK_RCONTROL:
return Keyboard.KEY_RCONTROL;
case VK_SEPARATOR:
return Keyboard.KEY_NUMPADCOMMA;
case VK_DIVIDE:
return Keyboard.KEY_DIVIDE;
case VK_PRINT:
return Keyboard.KEY_SYSRQ;
case VK_RMENU:
return Keyboard.KEY_RMENU;
case VK_PAUSE:
return Keyboard.KEY_PAUSE;
case VK_HOME:
return Keyboard.KEY_HOME;
case VK_UP:
return Keyboard.KEY_UP;
case VK_PRIOR:
return Keyboard.KEY_PRIOR;
case VK_LEFT:
return Keyboard.KEY_LEFT;
case VK_RIGHT:
return Keyboard.KEY_RIGHT;
case VK_END:
return Keyboard.KEY_END;
case VK_DOWN:
return Keyboard.KEY_DOWN;
case VK_NEXT:
return Keyboard.KEY_NEXT;
case VK_INSERT:
return Keyboard.KEY_INSERT;
case VK_DELETE:
return Keyboard.KEY_DELETE;
case VK_LWIN:
return Keyboard.KEY_LWIN;
case VK_RWIN:
return Keyboard.KEY_RWIN;
case VK_APPS:
return Keyboard.KEY_APPS;
/* case VK_POWER:
return Keyboard.KEY_POWER;*/
case VK_SLEEP:
return Keyboard.KEY_SLEEP;
default:
return Keyboard.KEY_NONE;
}
}
}

View File

@ -1,200 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is the Windows implementation of the Mouse.
* @author elias_naur
*/
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.CharBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Mouse;
import org.lwjgl.input.Cursor;
final class WindowsMouse {
private final long hwnd;
private final int mouse_button_count;
private final boolean has_wheel;
private final EventQueue event_queue = new EventQueue(Mouse.EVENT_SIZE);
private final ByteBuffer mouse_event = ByteBuffer.allocate(Mouse.EVENT_SIZE);
private final Object blank_cursor;
private boolean mouse_grabbed;
private byte[] button_states;
private int accum_dx;
private int accum_dy;
private int accum_dwheel;
private int last_x;
private int last_y;
public WindowsMouse(long hwnd) throws LWJGLException {
this.hwnd = hwnd;
this.mouse_button_count = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CMOUSEBUTTONS);
this.has_wheel = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_MOUSEWHEELPRESENT) != 0;
this.blank_cursor = createBlankCursor();
this.button_states = new byte[mouse_button_count];
}
private Object createBlankCursor() throws LWJGLException {
int width = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CXCURSOR);
int height = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CYCURSOR);
IntBuffer pixels = BufferUtils.createIntBuffer(width*height);
return WindowsDisplay.doCreateCursor(width, height, 0, 0, 1, pixels, null);
}
public boolean isGrabbed() {
return mouse_grabbed;
}
public boolean hasWheel() {
return has_wheel;
}
public int getButtonCount() {
return mouse_button_count;
}
public void poll(IntBuffer coord_buffer, ByteBuffer buttons) {
for (int i = 0; i < coord_buffer.remaining(); i++)
coord_buffer.put(coord_buffer.position() + i, 0);
int num_buttons = mouse_button_count;
coord_buffer.put(coord_buffer.position() + 2, accum_dwheel);
if (num_buttons > button_states.length)
num_buttons = button_states.length;
for (int j = 0; j < num_buttons; j++) {
buttons.put(buttons.position() + j, button_states[j]);
}
if (isGrabbed()) {
coord_buffer.put(coord_buffer.position() + 0, accum_dx);
coord_buffer.put(coord_buffer.position() + 1, accum_dy);
} else {
coord_buffer.put(coord_buffer.position() + 0, last_x);
coord_buffer.put(coord_buffer.position() + 1, last_y);
}
accum_dx = accum_dy = accum_dwheel = 0;
}
private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) {
mouse_event.clear();
mouse_event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos);
mouse_event.flip();
event_queue.putEvent(mouse_event);
}
private void putMouseEvent(byte button, byte state, int dz, long nanos) {
if (mouse_grabbed)
putMouseEventWithCoords(button, state, 0, 0, dz, nanos);
else
putMouseEventWithCoords(button, state, last_x, last_y, dz, nanos);
}
public void read(ByteBuffer buffer) {
event_queue.copyEvents(buffer);
}
public Object getBlankCursor() {
return blank_cursor;
}
public void grab(boolean grab, boolean should_center) {
if (grab) {
if (!mouse_grabbed) {
mouse_grabbed = true;
try {
WindowsDisplay.setupCursorClipping(hwnd);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to setup cursor clipping: " + e);
}
if (should_center)
centerCursor();
}
} else {
if (mouse_grabbed) {
mouse_grabbed = false;
WindowsDisplay.resetCursorClipping();
}
}
event_queue.clearEvents();
}
public void handleMouseScrolled(int event_dwheel, long millis) {
accum_dwheel += event_dwheel;
putMouseEvent((byte)-1, (byte)0, event_dwheel, millis*1000000);
}
private void centerCursor() {
WindowsDisplay.centerCursor(hwnd);
}
public void setPosition(int x, int y) {
this.last_x = x;
this.last_y = y;
}
public void destroy() {
WindowsDisplay.doDestroyCursor(blank_cursor);
}
public void handleMouseMoved(int x, int y, long millis, boolean should_center) {
int dx = x - last_x;
int dy = y - last_y;
if (dx != 0 || dy != 0) {
accum_dx += dx;
accum_dy += dy;
last_x = x;
last_y = y;
long nanos = millis*1000000;
if (mouse_grabbed) {
putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos);
if (should_center)
centerCursor();
} else {
putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos);
}
}
}
public void handleMouseButton(byte button, byte state, long millis) {
putMouseEvent(button, state, 0, millis*1000000);
if (button < button_states.length)
button_states[button] = state != 0 ? (byte)1 : (byte)0;
}
}

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
/**
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2618 $
* $Id: WindowsPeerInfo.java 2618 2006-10-30 15:46:42Z elias_naur $
*/
abstract class WindowsPeerInfo extends PeerInfo {
public WindowsPeerInfo() {
super(createHandle());
}
private static native ByteBuffer createHandle();
protected void choosePixelFormat(int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException {
nChoosePixelFormat(getHandle(), origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered);
}
private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException;
public final long getHwnd() {
return nGetHwnd(getHandle());
}
private static native long nGetHwnd(ByteBuffer handle);
}

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
*/
package org.lwjgl.d3d;
/**
* This is an interface to the windows registry
* @author elias_naur
*/
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
final class WindowsRegistry {
final static int HKEY_CLASSES_ROOT = 1;
final static int HKEY_CURRENT_USER = 2;
final static int HKEY_LOCAL_MACHINE = 3;
final static int HKEY_USERS = 4;
static {
Sys.initialize();
}
/**
* Query the registry value specified by the root key, subkey, value tuple
*/
static String queryRegistrationKey(int root_key, String subkey, String value) throws LWJGLException {
switch (root_key) {
case HKEY_CLASSES_ROOT:
case HKEY_CURRENT_USER:
case HKEY_LOCAL_MACHINE:
case HKEY_USERS:
break;
default:
throw new IllegalArgumentException("Invalid enum: " + root_key);
}
return nQueryRegistrationKey(root_key, subkey, value);
}
private static native String nQueryRegistrationKey(int root_key, String subkey, String value) throws LWJGLException;
}

View File

@ -1,107 +0,0 @@
package org.lwjgl.test.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
import org.lwjgl.LWJGLException;
import org.lwjgl.d3d.D3DPresentParameters;
import org.lwjgl.d3d.Direct3DConstants;
import org.lwjgl.d3d.Display;
import org.lwjgl.d3d.DisplayMode;
import org.lwjgl.d3d.IDirect3D9;
import org.lwjgl.d3d.IDirect3DDevice9;
import org.lwjgl.input.Keyboard;
public class DrunkenHyenaLines {
private static final int STRUCTURE_SIZE = 20;
private static final int WIDTH = 640;
private static final int HEIGHT = 480;
public void run() {
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == 640 && modes[i].getHeight() == 480 && modes[i].getBitsPerPixel() >= 32 && modes[i].getFrequency() <= 75) {
try {
Display.setDisplayMode(modes[i]);
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.create();
}
catch(Exception e) {
e.printStackTrace();
}
IDirect3D9 iDirect3D9 = IDirect3D9.create();
D3DPresentParameters params = new D3DPresentParameters();
params.Windowed = true;
params.BackBufferCount = 1;
params.SwapEffect = Direct3DConstants.D3DSWAPEFFECT_FLIP;
params.BackBufferFormat = Direct3DConstants.D3DFMT_UNKNOWN;
IDirect3DDevice9 iDirect3DDevice9 = new IDirect3DDevice9();
iDirect3D9.createDevice(Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL,
Display.getHwnd(), Direct3DConstants.D3DCREATE_SOFTWARE_VERTEXPROCESSING, params,
iDirect3DDevice9);
try {
Keyboard.create();
}
catch(LWJGLException e) {
e.printStackTrace();
}
ByteBuffer sineData = ByteBuffer.allocateDirect(WIDTH * STRUCTURE_SIZE);
sineData.order(ByteOrder.nativeOrder());
for(int i=0;i<WIDTH;i++) {
sineData.putFloat(i);
float y = (float)Math.sin(i / 10.0f);
sineData.putFloat(y * (HEIGHT / 4.0f) + (HEIGHT / 2.0f));
sineData.putFloat(1.0f);
sineData.putFloat(1.0f);
int blue = ((int)(Math.ceil(((float)i / (float)WIDTH) * 200.0f) + 55)) & 0x000000ff;
int green = ((int)(Math.ceil((((float)WIDTH - (float)i) / (float)WIDTH) * 200.0f) + 55)) & 0x000000ff;
int red = ((int)(Math.ceil(Math.abs(y) * 200.0f) + 55.0f)) & 0x000000ff;
sineData.putInt((red << 16) | (green << 8) | blue);
}
ByteBuffer randomData = ByteBuffer.allocateDirect(WIDTH * STRUCTURE_SIZE);
randomData.order(ByteOrder.nativeOrder());
Random random = new Random(System.currentTimeMillis());
for(int i=0;i<WIDTH;i++) {
randomData.putFloat(random.nextFloat() * WIDTH);
randomData.putFloat(random.nextFloat() * HEIGHT);
randomData.putFloat(1.0f);
randomData.putFloat(1.0f);
randomData.putInt((random.nextInt(255) << 16) | (random.nextInt(255) << 8) | random.nextInt(255));
}
int primitiveType = Direct3DConstants.D3DPT_LINELIST;
int size = WIDTH / 2;
ByteBuffer data = randomData;
while(Keyboard.getEventKey() != Keyboard.KEY_ESCAPE || Display.isCloseRequested()) {
iDirect3DDevice9.beginScene();
iDirect3DDevice9.clear(0, null, Direct3DConstants.D3DCLEAR_TARGET, 0, 1.0f, 0);
iDirect3DDevice9.setFVF(Direct3DConstants.D3DFVF_XYZRHW | Direct3DConstants.D3DFVF_DIFFUSE);
iDirect3DDevice9.drawPrimitiveUP(primitiveType, size, data, STRUCTURE_SIZE);
iDirect3DDevice9.endScene();
iDirect3DDevice9.present(null, null, 0, null);
Display.update();
try {
Thread.sleep(100);
}
catch(Exception e) {}
}
iDirect3DDevice9.release();
iDirect3D9.release();
Display.destroy();
}
public static void main(String args[]) {
new DrunkenHyenaLines().run();
System.exit(0);
}
}

View File

@ -1,106 +0,0 @@
package org.lwjgl.test.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
import org.lwjgl.LWJGLException;
import org.lwjgl.d3d.D3DPresentParameters;
import org.lwjgl.d3d.Direct3DConstants;
import org.lwjgl.d3d.Display;
import org.lwjgl.d3d.DisplayMode;
import org.lwjgl.d3d.IDirect3D9;
import org.lwjgl.d3d.IDirect3DDevice9;
import org.lwjgl.input.Keyboard;
public class DrunkenHyenaPoints {
private static final int STRUCTURE_SIZE = 20;
private static final int WIDTH = 640;
private static final int HEIGHT = 480;
public void run() {
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == 640 && modes[i].getHeight() == 480 && modes[i].getBitsPerPixel() >= 32 && modes[i].getFrequency() <= 75) {
try {
Display.setDisplayMode(modes[i]);
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.create();
}
catch(Exception e) {
e.printStackTrace();
}
IDirect3D9 iDirect3D9 = IDirect3D9.create();
D3DPresentParameters params = new D3DPresentParameters();
params.Windowed = true;
params.BackBufferCount = 1;
params.SwapEffect = Direct3DConstants.D3DSWAPEFFECT_FLIP;
params.BackBufferFormat = Direct3DConstants.D3DFMT_UNKNOWN;
IDirect3DDevice9 iDirect3DDevice9 = new IDirect3DDevice9();
iDirect3D9.createDevice(Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL,
Display.getHwnd(), Direct3DConstants.D3DCREATE_SOFTWARE_VERTEXPROCESSING, params,
iDirect3DDevice9);
try {
Keyboard.create();
}
catch(LWJGLException e) {
e.printStackTrace();
}
ByteBuffer sineData = ByteBuffer.allocateDirect(WIDTH * STRUCTURE_SIZE);
sineData.order(ByteOrder.nativeOrder());
for(int i=0;i<WIDTH;i++) {
sineData.putFloat(i);
float y = (float)Math.sin(i / 10.0f);
sineData.putFloat(y * (HEIGHT / 4.0f) + (HEIGHT / 2.0f));
sineData.putFloat(1.0f);
sineData.putFloat(1.0f);
int blue = ((int)(Math.ceil(((float)i / (float)WIDTH) * 200.0f) + 55)) & 0x000000ff;
int green = ((int)(Math.ceil((((float)WIDTH - (float)i) / (float)WIDTH) * 200.0f) + 55)) & 0x000000ff;
int red = ((int)(Math.ceil(Math.abs(y) * 200.0f) + 55.0f)) & 0x000000ff;
sineData.putInt((red << 16) | (green << 8) | blue);
}
ByteBuffer randomData = ByteBuffer.allocateDirect(WIDTH * STRUCTURE_SIZE);
randomData.order(ByteOrder.nativeOrder());
Random random = new Random(System.currentTimeMillis());
for(int i=0;i<WIDTH;i++) {
randomData.putFloat(random.nextFloat() * WIDTH);
randomData.putFloat(random.nextFloat() * HEIGHT);
randomData.putFloat(1.0f);
randomData.putFloat(1.0f);
randomData.putInt((random.nextInt(255) << 16) | (random.nextInt(255) << 8) | random.nextInt(255));
}
ByteBuffer data = sineData;
while(Keyboard.getEventKey() != Keyboard.KEY_ESCAPE || Display.isCloseRequested()) {
iDirect3DDevice9.beginScene();
iDirect3DDevice9.clear(0, null, Direct3DConstants.D3DCLEAR_TARGET, 0, 1.0f, 0);
iDirect3DDevice9.setFVF(Direct3DConstants.D3DFVF_XYZRHW | Direct3DConstants.D3DFVF_DIFFUSE);
iDirect3DDevice9.drawPrimitiveUP(Direct3DConstants.D3DPT_POINTLIST, WIDTH, data, STRUCTURE_SIZE);
iDirect3DDevice9.endScene();
iDirect3DDevice9.present(null, null, 0, null);
Display.update();
try {
Thread.sleep(100);
}
catch(Exception e) {}
}
iDirect3DDevice9.release();
iDirect3D9.release();
Display.destroy();
}
public static void main(String args[]) {
new DrunkenHyenaPoints().run();
System.exit(0);
}
}

View File

@ -1,210 +0,0 @@
package org.lwjgl.test.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.LWJGLException;
import org.lwjgl.d3d.D3DPresentParameters;
import org.lwjgl.d3d.Direct3DConstants;
import org.lwjgl.d3d.Display;
import org.lwjgl.d3d.DisplayMode;
import org.lwjgl.d3d.IDirect3D9;
import org.lwjgl.d3d.IDirect3DDevice9;
import org.lwjgl.input.Keyboard;
public class DrunkenHyenaTriangles {
private static final int STRUCTURE_SIZE = 20;
private static final int WIDTH = 640;
private static final int HEIGHT = 480;
private ByteBuffer fan1;
private ByteBuffer fan2;
private ByteBuffer strip;
public void run() {
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == WIDTH && modes[i].getHeight() == HEIGHT && modes[i].getBitsPerPixel() >= 32 && modes[i].getFrequency() <= 75) {
try {
Display.setDisplayMode(modes[i]);
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.create();
}
catch(Exception e) {
e.printStackTrace();
}
IDirect3D9 iDirect3D9 = IDirect3D9.create();
D3DPresentParameters params = new D3DPresentParameters();
params.Windowed = true;
params.BackBufferCount = 1;
params.SwapEffect = Direct3DConstants.D3DSWAPEFFECT_FLIP;
params.BackBufferFormat = Direct3DConstants.D3DFMT_UNKNOWN;
IDirect3DDevice9 iDirect3DDevice9 = new IDirect3DDevice9();
iDirect3D9.createDevice(Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL,
Display.getHwnd(), Direct3DConstants.D3DCREATE_SOFTWARE_VERTEXPROCESSING, params,
iDirect3DDevice9);
try {
Keyboard.create();
}
catch(LWJGLException e) {
e.printStackTrace();
}
createPrimitives();
while(Keyboard.getEventKey() != Keyboard.KEY_ESCAPE || Display.isCloseRequested()) {
iDirect3DDevice9.beginScene();
iDirect3DDevice9.clear(0, null, Direct3DConstants.D3DCLEAR_TARGET, 0, 1.0f, 0);
iDirect3DDevice9.setFVF(Direct3DConstants.D3DFVF_XYZRHW | Direct3DConstants.D3DFVF_DIFFUSE);
iDirect3DDevice9.drawPrimitiveUP(Direct3DConstants.D3DPT_TRIANGLEFAN, 4, fan1, STRUCTURE_SIZE);
iDirect3DDevice9.drawPrimitiveUP(Direct3DConstants.D3DPT_TRIANGLEFAN, 4, fan2, STRUCTURE_SIZE);
iDirect3DDevice9.drawPrimitiveUP(Direct3DConstants.D3DPT_TRIANGLESTRIP, 9, strip, STRUCTURE_SIZE);
iDirect3DDevice9.endScene();
iDirect3DDevice9.present(null, null, 0, null);
Display.update();
try {
Thread.sleep(100);
}
catch(Exception e) {}
}
iDirect3DDevice9.release();
iDirect3D9.release();
Display.destroy();
}
private void createPrimitives() {
fan1 = ByteBuffer.allocateDirect(6 * STRUCTURE_SIZE);
fan1.order(ByteOrder.nativeOrder());
fan1.putFloat(100.0f);
fan1.putFloat(100.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xff000000);
fan1.putFloat(0.0f);
fan1.putFloat(0.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xffff0000);
fan1.putFloat(200.0f);
fan1.putFloat(0.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xff00ff00);
fan1.putFloat(200.0f);
fan1.putFloat(200.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xff0000ff);
fan1.putFloat(0.0f);
fan1.putFloat(200.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xffffffff);
fan1.putFloat(0.0f);
fan1.putFloat(0.0f);
fan1.putFloat(1.0f);
fan1.putFloat(1.0f);
fan1.putInt(0xffff0000);
fan2 = ByteBuffer.allocateDirect(6 * STRUCTURE_SIZE);
fan2.order(ByteOrder.nativeOrder());
fan2.putFloat(75.0f);
fan2.putFloat(350.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xffffffff);
fan2.putFloat(0.0f);
fan2.putFloat(225.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xffff0000);
fan2.putFloat(50.0f);
fan2.putFloat(215.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xff7f7f00);
fan2.putFloat(75.0f);
fan2.putFloat(205.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xff00ff00);
fan2.putFloat(125.0f);
fan2.putFloat(215.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xff007f7f);
fan2.putFloat(150.0f);
fan2.putFloat(235.0f);
fan2.putFloat(1.0f);
fan2.putFloat(1.0f);
fan2.putInt(0xff0000ff);
strip = ByteBuffer.allocateDirect(11 * STRUCTURE_SIZE);
strip.order(ByteOrder.nativeOrder());
strip.putFloat(250.0f);
strip.putFloat(150.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xffff0000);
strip.putFloat(300.0f);
strip.putFloat(50.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff00ff00);
strip.putFloat(350.0f);
strip.putFloat(150.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff0000ff);
strip.putFloat(400.0f);
strip.putFloat(50.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xffff0000);
strip.putFloat(450.0f);
strip.putFloat(150.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff7f7f00);
strip.putFloat(450.0f);
strip.putFloat(150.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff7f7f00);
strip.putFloat(250.0f);
strip.putFloat(350.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xffff0000);
strip.putFloat(300.0f);
strip.putFloat(250.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff00ff00);
strip.putFloat(350.0f);
strip.putFloat(350.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff0000ff);
strip.putFloat(400.0f);
strip.putFloat(250.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xffff0000);
strip.putFloat(450.0f);
strip.putFloat(350.0f);
strip.putFloat(1.0f);
strip.putFloat(1.0f);
strip.putInt(0xff7f7f00);
}
public static void main(String args[]) {
new DrunkenHyenaTriangles().run();
System.exit(0);
}
}

View File

@ -1,323 +0,0 @@
package org.lwjgl.test.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.LWJGLException;
import org.lwjgl.d3d.D3DMatrix;
import org.lwjgl.d3d.D3DPresentParameters;
import org.lwjgl.d3d.D3DUtil;
import org.lwjgl.d3d.D3DVector;
import org.lwjgl.d3d.Direct3DConstants;
import org.lwjgl.d3d.Display;
import org.lwjgl.d3d.DisplayMode;
import org.lwjgl.d3d.IDirect3D9;
import org.lwjgl.d3d.IDirect3DDevice9;
import org.lwjgl.d3d.IDirect3DVertexBuffer9;
import org.lwjgl.input.Keyboard;
public class DrunkenHyenaWorldTransform {
private static final int STRUCTURE_SIZE = 16;
private static final int WIDTH = 640;
private static final int HEIGHT = 480;
private IDirect3D9 iDirect3D9;
private IDirect3DDevice9 iDirect3DDevice9;
private IDirect3DVertexBuffer9 iDirect3DVertexBuffer9;
private int g_list_count;
float scaledTri_scale_x = 1.0f;
float scaledTri_scale_y = 1.0f;
float scaledTri_dir_x = 1.0f;
float scaledTri_dir_y = 1.0f;
float translatedTri_pos_x = 1.0f;
float translatedTri_dir_x = 1.0f;
float rotatedTri_rot_y = 0.0f;
float rotAndTransTri_rot_z = 0.0f;
float rotAndTransTri_pos_x = 1.0f;
float rotAndTransTri_dir_x = 1.0f;
public void run() {
long curentTime = System.currentTimeMillis();
long elapsed = 0;
long diffTime = 0;
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == WIDTH
&& modes[i].getHeight() == HEIGHT
&& modes[i].getBitsPerPixel() >= 32
&& modes[i].getFrequency() <= 75) {
try {
Display.setDisplayMode(modes[i]);
}
catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.create();
}
catch (Exception e) {
e.printStackTrace();
}
long hResult = Direct3DConstants.D3D_OK;
iDirect3D9 = IDirect3D9.create();
D3DPresentParameters params = new D3DPresentParameters();
params.Windowed = true;
params.BackBufferCount = 1;
params.SwapEffect = Direct3DConstants.D3DSWAPEFFECT_FLIP;
params.BackBufferFormat = Direct3DConstants.D3DFMT_UNKNOWN;
iDirect3DDevice9 = new IDirect3DDevice9();
hResult = iDirect3D9.createDevice(Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL,
Display.getHwnd(), Direct3DConstants.D3DCREATE_SOFTWARE_VERTEXPROCESSING, params, iDirect3DDevice9);
if (hResult != Direct3DConstants.D3D_OK) {
throw new RuntimeException("Unable to create the device(" + hResult
+ ")");
}
iDirect3DDevice9.setRenderState(Direct3DConstants.D3DRS_LIGHTING, 0);
iDirect3DDevice9.setRenderState(Direct3DConstants.D3DRS_CULLMODE, Direct3DConstants.D3DCULL_NONE);
initMatrices();
ByteBuffer triangleList = ByteBuffer.allocateDirect(3 * STRUCTURE_SIZE);
triangleList.order(ByteOrder.nativeOrder());
triangleList.putFloat(0);
triangleList.putFloat(1);
triangleList.putFloat(0);
triangleList.putInt(0xFFFF0000);
triangleList.putFloat(1);
triangleList.putFloat(-1);
triangleList.putFloat(0);
triangleList.putInt(0xFF00FF00);
triangleList.putFloat(-1);
triangleList.putFloat(-1);
triangleList.putFloat(0);
triangleList.putInt(0xFF0000FF);
int vert_count = triangleList.capacity() / STRUCTURE_SIZE;
int byte_count = vert_count * STRUCTURE_SIZE;
g_list_count = vert_count / 3;
iDirect3DVertexBuffer9 = new IDirect3DVertexBuffer9();
hResult = iDirect3DDevice9.createVertexBuffer(byte_count, Direct3DConstants.D3DUSAGE_WRITEONLY,
Direct3DConstants.D3DFVF_XYZ | Direct3DConstants.D3DFVF_DIFFUSE,
Direct3DConstants.D3DPOOL_MANAGED, iDirect3DVertexBuffer9, 0);
if (hResult != Direct3DConstants.D3D_OK) {
throw new RuntimeException("Unable to create the vertex buffer(" + hResult + ")");
}
hResult = iDirect3DVertexBuffer9.Lock(0, 0, triangleList, 0);
if (hResult != Direct3DConstants.D3D_OK) {
throw new RuntimeException("Failed to lock the vertex buffer(" + hResult + ")");
}
iDirect3DVertexBuffer9.Unlock();
try {
Keyboard.create();
}
catch (LWJGLException e) {
e.printStackTrace();
}
while (Keyboard.getEventKey() != Keyboard.KEY_ESCAPE || Display.isCloseRequested()) {
diffTime = System.currentTimeMillis() - curentTime;
curentTime = System.currentTimeMillis();
elapsed += diffTime;
iDirect3DDevice9.beginScene();
iDirect3DDevice9.clear(0, null, Direct3DConstants.D3DCLEAR_TARGET, 0x00000000, 1.0f, 0);
iDirect3DDevice9.setFVF(Direct3DConstants.D3DFVF_XYZ | Direct3DConstants.D3DFVF_DIFFUSE);
iDirect3DDevice9.setStreamSource(0, iDirect3DVertexBuffer9, 0, STRUCTURE_SIZE);
render_scaled_tri();
render_translated_tri();
render_rotated_tri();
render_rot_and_trans_tri();
iDirect3DDevice9.endScene();
iDirect3DDevice9.present(null, null, 0, null);
Display.update();
if (elapsed > 5000) {
break;
}
}
iDirect3DDevice9.release();
iDirect3D9.release();
Display.destroy();
}
private void render_scaled_tri() {
D3DMatrix scale_matrix = new D3DMatrix();
D3DUtil.D3DXMatrixScaling(scale_matrix, scaledTri_scale_x,
scaledTri_scale_y, 1.0f);
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_WORLD,
scale_matrix);
iDirect3DDevice9.drawPrimitive(Direct3DConstants.D3DPT_TRIANGLELIST, // PrimitiveType
0, // StartVertex
g_list_count); // PrimitiveCount
scaledTri_scale_x += 0.01f * scaledTri_dir_x;
if (scaledTri_scale_x > 4.0f) {
scaledTri_dir_x = -1.0f;
}
else if (scaledTri_scale_x < 0.25f) {
scaledTri_dir_x = 1.0f;
}
scaledTri_scale_y += 0.011f * scaledTri_dir_y;
if (scaledTri_scale_y > 4.0f) {
scaledTri_dir_y = -1.0f;
}
else if (scaledTri_scale_y < 0.25f) {
scaledTri_dir_y = 1.0f;
}
}
private void render_translated_tri() {
D3DMatrix trans_matrix = new D3DMatrix();
D3DUtil.D3DXMatrixTranslation(trans_matrix, translatedTri_pos_x, 2.5f,
0.0f);
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_WORLD,
trans_matrix);
iDirect3DDevice9.drawPrimitive(Direct3DConstants.D3DPT_TRIANGLELIST, // PrimitiveType
0, // StartVertex
g_list_count); // PrimitiveCount
translatedTri_pos_x += 0.01f * translatedTri_dir_x;
if (translatedTri_pos_x > 3.5f) {
translatedTri_dir_x = -1.0f;
}
else if (translatedTri_pos_x < -3.5f) {
translatedTri_dir_x = 1.0f;
}
}
private void render_rotated_tri() {
D3DMatrix rot_matrix = new D3DMatrix();
D3DUtil.D3DXMatrixRotationY(rot_matrix, rotatedTri_rot_y);
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_WORLD, rot_matrix);
iDirect3DDevice9.drawPrimitive(Direct3DConstants.D3DPT_TRIANGLELIST, // PrimitiveType
0, // StartVertex
g_list_count); // PrimitiveCount
// 2*PI is a complete circle so we reset the value to keep the variable
// from overflowing
rotatedTri_rot_y += 0.01f;
if (rotatedTri_rot_y > Direct3DConstants.D3DX_PI * 2) {
rotatedTri_rot_y -= Direct3DConstants.D3DX_PI * 2;
}
}
private void render_rot_and_trans_tri() {
D3DMatrix rot_matrix = new D3DMatrix();
D3DMatrix trans_matrix = new D3DMatrix();
D3DMatrix world_matrix = new D3DMatrix();
D3DUtil.D3DXMatrixRotationZ(rot_matrix, rotAndTransTri_rot_z);
D3DUtil.D3DXMatrixTranslation(trans_matrix, rotAndTransTri_pos_x, -2.5f, 0.0f);
D3DMatrix temp = D3DUtil.D3DXMatrixMultiply(world_matrix, rot_matrix, trans_matrix); //Rot * Trans
//D3DXMatrixMultiply(&world_matrix,&trans_matrix,&rot_matrix); //Trans * Rot
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_WORLD, world_matrix);
iDirect3DDevice9.drawPrimitive(Direct3DConstants.D3DPT_TRIANGLELIST, //PrimitiveType
0, //StartVertex
g_list_count); //PrimitiveCount
rotAndTransTri_rot_z += 0.01f;
if(rotAndTransTri_rot_z > Direct3DConstants.D3DX_PI * 2){
rotAndTransTri_rot_z -= Direct3DConstants.D3DX_PI * 2;
}
rotAndTransTri_pos_x += 0.01f * rotAndTransTri_dir_x;
if(rotAndTransTri_pos_x > 3.5f){
rotAndTransTri_dir_x = -1.0f;
}
else if(rotAndTransTri_pos_x < -3.5f){
rotAndTransTri_dir_x = 1.0f;
}
}
private void initMatrices() {
D3DMatrix view_matrix = new D3DMatrix();
D3DMatrix projection_matrix = new D3DMatrix();
D3DVector eye_vector = new D3DVector();
D3DVector lookat_vector = new D3DVector();
D3DVector up_vector = new D3DVector();
D3DMatrix world_matrix = new D3DMatrix();
float aspect;
// Here we build our View Matrix, think of it as our camera.
// First we specify that our viewpoint is 8 units back on the Z-axis
eye_vector.x = 0.0f;
eye_vector.y = 0.0f;
eye_vector.z = -8.0f;
// We are looking towards the origin
lookat_vector.x = 0.0f;
lookat_vector.y = 0.0f;
lookat_vector.z = 0.0f;
// The "up" direction is the positive direction on the y-axis
up_vector.x = 0.0f;
up_vector.y = 1.0f;
up_vector.z = 0.0f;
D3DUtil.D3DXMatrixLookAtLH(view_matrix, eye_vector, lookat_vector,
up_vector);
// Since our 'camera' will never move, we can set this once at the
// beginning and never worry about it again
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_VIEW, view_matrix);
aspect = ((float) WIDTH / (float) WIDTH);
D3DUtil.D3DXMatrixPerspectiveFovLH(projection_matrix, // Result Matrix
(float) Math.PI / 4, // Field of View, in radians.
aspect, // Aspect ratio
1.0f, // Near view plane
100.0f); // Far view plane
// Our Projection matrix won't change either, so we set it now and never
// touch
// it again.
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_PROJECTION,
projection_matrix);
// The World Matrix transforms Model Coordinates into World Space
// coordinates.
// Setting it to Identity means there is no transformation, so Model
// Space is directly
// mapped onto World Space.
D3DUtil.D3DXMatrixIdentity(world_matrix);
iDirect3DDevice9.setTransform(Direct3DConstants.D3DTS_WORLD,
world_matrix);
}
public static void main(String args[]) {
new DrunkenHyenaWorldTransform().run();
System.exit(0);
}
}

View File

@ -1,126 +0,0 @@
package org.lwjgl.test.d3d;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.LWJGLException;
import org.lwjgl.d3d.D3DAdapterIdentifier9;
import org.lwjgl.d3d.D3DCaps9;
import org.lwjgl.d3d.D3DDisplaymode;
import org.lwjgl.d3d.D3DPresentParameters;
import org.lwjgl.d3d.Direct3DConstants;
import org.lwjgl.d3d.Display;
import org.lwjgl.d3d.DisplayMode;
import org.lwjgl.d3d.IDirect3D9;
import org.lwjgl.d3d.IDirect3DDevice9;
import org.lwjgl.input.Keyboard;
public class IDirect3D9Test {
public IDirect3D9Test() {
}
public void run() {
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == 800 && modes[i].getHeight() == 600 && modes[i].getBitsPerPixel() >= 32 && modes[i].getFrequency() <= 75) {
try {
Display.setDisplayMode(modes[i]);
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.create();
}
catch(Exception e) {
e.printStackTrace();
}
IDirect3D9 iDirect3D9 = IDirect3D9.create();
System.out.println("pointer to IDirect3D9 = " + iDirect3D9.getIDirect3D9());
System.out.println(" adapter count = " + iDirect3D9.getAdapterCount());
//
// D3DDisplaymode displaymode = new D3DDisplaymode();
// displaymode.Width = 1024;
// displaymode.Height = 768;
// displaymode.RefreshRate = 85;
// displaymode.Format = Direct3DConstants.D3DFMT_X8R8G8B8;
// System.out.println("enumAdapterModes = " + iDirect3D9.enumAdapterModes(
// Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DFMT_X8R8G8B8, 0, displaymode));
// displaymode = new D3DDisplaymode();
// System.out.println("getAdapterDisplayMode = " + iDirect3D9.getAdapterDisplayMode(
// Direct3DConstants.D3DADAPTER_DEFAULT, displaymode));
// System.out.println(displaymode);
//
// D3DAdapterIdentifier9 identifier = new D3DAdapterIdentifier9();
// System.out.println("getAdapterIdentifier = " + iDirect3D9.getAdapterIdentifier(
// Direct3DConstants.D3DADAPTER_DEFAULT, 0, identifier));
// System.out.println(identifier);
//
// System.out.println("getAdapterModeCount = " + iDirect3D9.getAdapterModeCount(
// Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DFMT_X8R8G8B8));
//
// D3DCaps9 caps = new D3DCaps9();
// System.out.println("getDeviceCaps = " + iDirect3D9.getDeviceCaps(
// Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL, caps));
// System.out.println(caps);
D3DPresentParameters params = new D3DPresentParameters();
params.Windowed = true;
params.BackBufferCount = 1;
params.SwapEffect = Direct3DConstants.D3DSWAPEFFECT_FLIP;
params.BackBufferFormat = Direct3DConstants.D3DFMT_UNKNOWN;
IDirect3DDevice9 iDirect3DDevice9 = new IDirect3DDevice9();
System.out.println("createDevice = " + iDirect3D9.createDevice(Direct3DConstants.D3DADAPTER_DEFAULT, Direct3DConstants.D3DDEVTYPE_HAL,
Display.getHwnd(), Direct3DConstants.D3DCREATE_SOFTWARE_VERTEXPROCESSING, params, iDirect3DDevice9));
System.out.println("pointer to iDirect3DDevice9 = " + iDirect3DDevice9.getIDirect3DDevice9());
try {
Keyboard.create();
}
catch(LWJGLException e) {
e.printStackTrace();
}
ByteBuffer vertex = ByteBuffer.allocateDirect(60);
vertex.order(ByteOrder.nativeOrder());
vertex.putFloat(800.0f / 2.0f);
vertex.putFloat(100.0f);
vertex.putFloat(1.0f);
vertex.putFloat(1.0f);
vertex.putInt(0xffffffff);
vertex.putFloat(800.0f * 3.0f / 4.0f);
vertex.putFloat(350.0f);
vertex.putFloat(1.0f);
vertex.putFloat(1.0f);
vertex.putInt(0xffffffff);
vertex.putFloat(800.0f / 4.0f);
vertex.putFloat(350.0f);
vertex.putFloat(1.0f);
vertex.putFloat(1.0f);
vertex.putInt(0xffffffff);
while(Keyboard.getEventKey() != Keyboard.KEY_ESCAPE || Display.isCloseRequested()) {
iDirect3DDevice9.beginScene();
iDirect3DDevice9.clear(0, null, Direct3DConstants.D3DCLEAR_TARGET, 0, 1.0f, 0);
iDirect3DDevice9.setFVF(Direct3DConstants.D3DFVF_XYZRHW | Direct3DConstants.D3DFVF_DIFFUSE);
iDirect3DDevice9.drawPrimitiveUP(Direct3DConstants.D3DPT_TRIANGLELIST, 1, vertex, 20);
iDirect3DDevice9.endScene();
iDirect3DDevice9.present(null, null, 0, null);
Display.update();
try {
Thread.sleep(100);
}
catch(Exception e) {}
}
iDirect3DDevice9.release();
iDirect3D9.release();
Display.destroy();
}
public static void main(String args[]) {
new IDirect3D9Test().run();
System.exit(0);
}
}

View File

@ -1,120 +0,0 @@
#include <D3dx9math.h>
#include "org_lwjgl_d3d_D3DUtil.h"
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixLookAtLH
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixLookAtLH
(JNIEnv *env, jclass clazz, jobject outBuffer, jobject eyeBuffer, jobject atBuffer, jobject upBuffer) {
D3DXMATRIX* out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
CONST D3DXVECTOR3 *eye = (D3DXVECTOR3*)((*env)->GetDirectBufferAddress(env, eyeBuffer));
CONST D3DXVECTOR3 *at = (D3DXVECTOR3*)((*env)->GetDirectBufferAddress(env, atBuffer));
CONST D3DXVECTOR3 *up = (D3DXVECTOR3*)((*env)->GetDirectBufferAddress(env, upBuffer));
D3DXMatrixLookAtLH(out, eye, at, up);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixPerspectiveFovLH
* Signature: (Ljava/nio/ByteBuffer;FFFF)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixPerspectiveFovLH
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat fovy, jfloat aspect, jfloat zn, jfloat zf) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixPerspectiveFovLH(out, fovy, aspect, zn, zf);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixIdentity
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixIdentity
(JNIEnv *env, jclass clazz, jobject outBuffer) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixIdentity(out);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixScaling
* Signature: (Ljava/nio/ByteBuffer;FFF)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixScaling
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat sx, jfloat sy, jfloat sz) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixScaling(out, sx, sy, sz);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixTranslation
* Signature: (Ljava/nio/ByteBuffer;FFF)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixTranslation
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat x, jfloat y, jfloat z) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixTranslation(out, x, y, z);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixRotationX
* Signature: (Ljava/nio/ByteBuffer;F)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixRotationX
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat angle) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixRotationY(out, angle);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixRotationY
* Signature: (Ljava/nio/ByteBuffer;F)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixRotationY
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat angle) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixRotationY(out, angle);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixRotationZ
* Signature: (Ljava/nio/ByteBuffer;F)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixRotationZ
(JNIEnv *env, jclass clazz, jobject outBuffer, jfloat angle) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
D3DXMatrixRotationY(out, angle);
}
/*
* Class: org_lwjgl_d3d_D3DUtil
* Method: nD3DXMatrixMultiply
* Signature: (Ljava/nio/ByteBuffer;Lorg/lwjgl/d3d/D3DMatrix;Lorg/lwjgl/d3d/D3DMatrix;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_D3DUtil_nD3DXMatrixMultiply
(JNIEnv *env, jclass clazz, jobject outBuffer, jobject m1Buffer, jobject m2Buffer) {
D3DXMATRIX *out = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, outBuffer));
CONST D3DXMATRIX *m1 = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, m1Buffer));
CONST D3DXMATRIX *m2 = (D3DXMATRIX*)((*env)->GetDirectBufferAddress(env, m2Buffer));
D3DXMATRIX *result = D3DXMatrixMultiply(out, m1, m2);
jobject resultBuffer = (*env)->NewDirectByteBuffer(env, result, sizeof(D3DXMATRIX));
return resultBuffer;
}

View File

@ -1,200 +0,0 @@
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <stdio.h>
#include "org_lwjgl_d3d_IDirect3D9.h"
#include "context.h"
extern void setPointer(JNIEnv *env, jobject classInstance, const char* methodName, jlong pointer);
//void setPointer(JNIEnv *env, jobject classInstance, const char* methodName, jlong pointer) {
// jclass clazz = (*env)->GetObjectClass(env, classInstance);
// jmethodID mid = (*env)->GetMethodID(env, clazz, methodName, "(J)V");
// if (mid != NULL) {
// (*env)->CallVoidMethod(env, classInstance, mid, pointer);
// }
//}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCheckDepthStencilMatch
* Signature: (IIIII)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCheckDepthStencilMatch
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jint adapterFormat, jint renderTargetFormat, jint depthStencilFormat) {
return IDirect3D9_CheckDepthStencilMatch((IDirect3D9 *)iDirect3D9, adapter, deviceType, adapterFormat, renderTargetFormat, depthStencilFormat);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCheckDeviceFormat
* Signature: (IIIJII)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCheckDeviceFormat
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jint adapterFormat, jint usage, jint resoruceType, jint checkFormat) {
return IDirect3D9_CheckDeviceFormat((IDirect3D9 *)iDirect3D9, adapter, deviceType, adapterFormat, usage, resoruceType, checkFormat);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCheckDeviceFormatConversion
* Signature: (IIII)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCheckDeviceFormatConversion
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jint sourceFormat, jint targetFormat) {
return IDirect3D9_CheckDeviceFormatConversion((IDirect3D9 *)iDirect3D9, adapter, deviceType, sourceFormat, targetFormat);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCheckDeviceMultiSampleType
* Signature: (IIIZILjava/nio/IntBuffer;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCheckDeviceMultiSampleType
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jint surfaceFormat, boolean windowed, jint multiSampleType, jobject qualityLevels) {
DWORD * quality = NULL;
if(qualityLevels != NULL) {
DWORD * quality = (DWORD *)((*env)->GetDirectBufferAddress(env, qualityLevels));
}
return IDirect3D9_CheckDeviceMultiSampleType((IDirect3D9 *)iDirect3D9, adapter, deviceType, surfaceFormat, windowed, multiSampleType, quality);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCheckDeviceType
* Signature: (IIIIZ)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCheckDeviceType
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jint displayFormat, jint backBufferFormat, boolean windowed) {
return IDirect3D9_CheckDeviceType((IDirect3D9 *)iDirect3D9, adapter, deviceType, displayFormat, backBufferFormat, windowed);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCreateDevice
* Signature: (IIJJLorg/lwjgl/d3d/IDirect3D9$D3DPRESENT_PARAMETERS;Lorg/lwjgl/d3d/IDirect3DDevice9;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCreateDevice
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jlong focusWindow, jint behaviorFlags, jobject presentationParameters, jobject returnedDeviceInterface) {
IDirect3DDevice9 *iDirect3DDevice9;
HWND myHwnd = (HWND)(INT_PTR)focusWindow;
D3DPRESENT_PARAMETERS* pPresentationParameters = (D3DPRESENT_PARAMETERS*)((*env)->GetDirectBufferAddress(env, presentationParameters));
HRESULT hResult = IDirect3D9_CreateDevice((IDirect3D9 *)iDirect3D9, adapter, deviceType,
myHwnd, behaviorFlags, pPresentationParameters, &iDirect3DDevice9);
setPointer(env, returnedDeviceInterface, "setIDirect3DDevice9", (jlong)iDirect3DDevice9);
return hResult;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nEnumAdapterModes
* Signature: (IIILorg/lwjgl/d3d/IDirect3D9$D3DDISPLAYMODE;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nEnumAdapterModes
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint format, jint modeIndex, jobject mode) {
D3DDISPLAYMODE * displayMode = (D3DDISPLAYMODE *)((*env)->GetDirectBufferAddress(env, mode));
return IDirect3D9_EnumAdapterModes((IDirect3D9 *)iDirect3D9, adapter, format, modeIndex, displayMode);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetAdapterCount
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetAdapterCount
(JNIEnv *env, jobject object, jlong iDirect3D9) {
return IDirect3D9_GetAdapterCount((IDirect3D9 *)iDirect3D9);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetAdapterDisplayMode
* Signature: (ILorg/lwjgl/d3d/IDirect3D9$D3DDISPLAYMODE;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetAdapterDisplayMode
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jobject mode) {
D3DDISPLAYMODE * displayMode = (D3DDISPLAYMODE *)((*env)->GetDirectBufferAddress(env, mode));
return IDirect3D9_GetAdapterDisplayMode((IDirect3D9 *)iDirect3D9, adapter, displayMode);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetAdapterIdentifier
* Signature: (IJLorg/lwjgl/d3d/IDirect3D9$D3DADAPTER_IDENTIFIER9;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetAdapterIdentifier
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint flags, jobject identifier) {
D3DADAPTER_IDENTIFIER9 * adapterIdentifier = (D3DADAPTER_IDENTIFIER9 *)((*env)->GetDirectBufferAddress(env, identifier));
return IDirect3D9_GetAdapterIdentifier((IDirect3D9 *)iDirect3D9, adapter, flags, adapterIdentifier);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetAdapterModeCount
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetAdapterModeCount
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint format) {
return IDirect3D9_GetAdapterModeCount((IDirect3D9 *)iDirect3D9, adapter, format);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetAdapterMonitor
* Signature: (I)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetAdapterMonitor
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter) {
return (jlong)IDirect3D9_GetAdapterMonitor((IDirect3D9 *)iDirect3D9, adapter);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nGetDeviceCaps
* Signature: (IILorg/lwjgl/d3d/IDirect3D9$D3DCAPS9;)I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nGetDeviceCaps
(JNIEnv *env, jobject object, jlong iDirect3D9, jint adapter, jint deviceType, jobject caps) {
D3DCAPS9 * d3dCaps = (D3DCAPS9 *)((*env)->GetDirectBufferAddress(env, caps));
return IDirect3D9_GetDeviceCaps((IDirect3D9 *)iDirect3D9, adapter, deviceType, d3dCaps);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nRegisterSoftwareDevice
* Signature: ()I
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nRegisterSoftwareDevice
(JNIEnv *env, jobject object, jlong iDirect3D9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nRelease
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_IDirect3D9_nRelease
(JNIEnv *env, jobject object, jlong iDirect3D9) {
IDirect3D9_Release((IDirect3D9 *)iDirect3D9);
}
/*
* Class: org_lwjgl_d3d_IDirect3D9
* Method: nCreate
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9_nCreate
(JNIEnv *env, jclass clazz) {
IDirect3D9 *direct3DInterface = Direct3DCreate9(D3D_SDK_VERSION);
return (jlong)direct3DInterface;
}

View File

@ -1,51 +0,0 @@
#include "org_lwjgl_d3d_IDirect3D9Ex.h"
/*
* Class: org_lwjgl_d3d_IDirect3D9Ex
* Method: nCreateDeviceEx
* Signature: (JIIJJLorg/lwjgl/d3d/D3DPresentParameters;Lorg/lwjgl/d3d/D3DDisplaymodeEx;Lorg/lwjgl/d3d/IDirect3DDevice9Ex;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9Ex_nCreateDeviceEx
(JNIEnv *env, jobject obj, jlong IDirect3D9Ex, jint adapter, jint deviceType, jlong focusWindow, jlong behaviorFlags, jobject presentationParameters, jobject fullscreenDisplayMode, jobject returnedDeviceInterface) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9Ex
* Method: nEnumAdapterModesEx
* Signature: (JILorg/lwjgl/d3d/D3DDisplaymodeFilter;ILorg/lwjgl/d3d/D3DDisplaymodeEx;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9Ex_nEnumAdapterModesEx
(JNIEnv *env, jobject obj, jlong IDirect3D9Ex, jint adapter, jobject filter, jint mode, jobject displayMode) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9Ex
* Method: nGetAdapterDisplayModeEx
* Signature: (JILorg/lwjgl/d3d/D3DDisplaymodeEx;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9Ex_nGetAdapterDisplayModeEx
(JNIEnv *env, jobject obj, jlong IDirect3D9Ex, jint adapter, jobject mode, jint rotation) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9Ex
* Method: nGetAdapterLUID
* Signature: (JILorg/lwjgl/d3d/LUID;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3D9Ex_nGetAdapterLUID
(JNIEnv *env, jobject obj, jlong IDirect3D9Ex, jint adapter, jobject LUID) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3D9Ex
* Method: nGetAdapterModeCountEx
* Signature: (JILorg/lwjgl/d3d/D3DDisplaymodeFilter;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3D9Ex_nGetAdapterModeCountEx
(JNIEnv *env, jobject obj, jlong IDirect3D9Ex, jint adapter, jobject filter) {
return 0;
}

View File

@ -1,60 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DBaseTexture9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nGenerateMipSubLevels
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nGenerateMipSubLevels
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9) {
}
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nGetAutoGenFilterType
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nGetAutoGenFilterType
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nGetLevelCount
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nGetLevelCount
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nGetLOD
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nGetLOD
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nSetAutoGenFilterType
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nSetAutoGenFilterType
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9, jint filterType) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DBaseTexture9
* Method: nSetLOD
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DBaseTexture9_nSetLOD
(JNIEnv *env, jobject obj, jlong IDirect3DBaseTexture9, jlong LODNew) {
return 0;
}

View File

@ -1,51 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DCubeTexture9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DCubeTexture9
* Method: nAddDirtyRect
* Signature: (JILorg/lwjgl/d3d/Rectangle;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DCubeTexture9_nAddDirtyRect
(JNIEnv *env, jobject obj, jlong IDirect3DCubeTexture9, jint faceType, jobject dirtyRect) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DCubeTexture9
* Method: nGetCubeMapSurface
* Signature: (JIILorg/lwjgl/d3d/IDirect3DSurface9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DCubeTexture9_nGetCubeMapSurface
(JNIEnv *env, jobject obj, jlong IDirect3DCubeTexture9, jint faceType, jint level, jobject cubeMapSurface) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DCubeTexture9
* Method: nGetLevelDesc
* Signature: (JILorg/lwjgl/d3d/D3DSsurfaceDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DCubeTexture9_nGetLevelDesc
(JNIEnv *env, jobject obj, jlong IDirect3DCubeTexture9, jint level, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DCubeTexture9
* Method: nLockRect
* Signature: (JIILorg/lwjgl/d3d/D3DLockedRect;Lorg/lwjgl/d3d/Rectangle;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DCubeTexture9_nLockRect
(JNIEnv *env, jobject obj, jlong IDirect3DCubeTexture9, jint faceType, jint level, jobject lockedRect, jobject rect, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DCubeTexture9
* Method: nUnlockRect
* Signature: (JII)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DCubeTexture9_nUnlockRect
(JNIEnv *env, jobject obj, jlong IDirect3DCubeTexture9, jint faceType, jint level) {
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,161 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DDevice9Ex.h"
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nCheckDeviceState
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nCheckDeviceState
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jlong window) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nCheckResourceResidency
* Signature: (JLorg/lwjgl/d3d/IDirect3DResource9;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nCheckResourceResidency
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject resourceArray, jlong numResources) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nCreateDepthStencilSurfaceEx
* Signature: (JIIIIJZLorg/lwjgl/d3d/IDirect3DSurface9;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nCreateDepthStencilSurfaceEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint width, jint height, jint format, jint multiSample, jlong multisampleQuality, jboolean discard, jobject surface, jlong sharedHandle, jlong usage) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nCreateOffscreenPlainSurfaceEx
* Signature: (JIIIJLorg/lwjgl/d3d/IDirect3DSurface9;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nCreateOffscreenPlainSurfaceEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint width, jint height, jint format, jlong pool, jobject surface, jlong sharedHandle, jlong usage) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nCreateRenderTargetEx
* Signature: (JIIIIJZLorg/lwjgl/d3d/IDirect3DSurface9;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nCreateRenderTargetEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint width, jint height, jint format, jint multiSample, jlong multisampleQuality, jboolean lockable, jobject surface, jlong sharedHandle, jlong usage) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nComposeRect
* Signature: (JLorg/lwjgl/d3d/IDirect3DSurface9;Lorg/lwjgl/d3d/IDirect3DSurface9;Lorg/lwjgl/d3d/IDirect3DVertexBuffer9;ILorg/lwjgl/d3d/IDirect3DVertexBuffer9;III)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nComposeRect
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject source, jobject destination, jobject srcRectDescriptors, jint numRects, jobject dstRectDescriptors, jint operation, jint xOffset, jint yOffset) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nGetDisplayModeEx
* Signature: (JILorg/lwjgl/d3d/D3DDisplaymodeEx;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nGetDisplayModeEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint swapChain, jobject mode, jint rotation) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nGetGPUThreadPriority
* Signature: (JLjava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nGetGPUThreadPriority
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject priority) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nGetMaximumFrameLatency
* Signature: (JLjava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nGetMaximumFrameLatency
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject maxLatency) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nPresentEx
* Signature: (JLorg/lwjgl/d3d/Rectangle;Lorg/lwjgl/d3d/Rectangle;JLorg/lwjgl/d3d/D3DRegionData;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nPresentEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject sourceRect, jobject destRect, jlong destWindowOverride, jobject dirtyRegion, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nResetEx
* Signature: (JLorg/lwjgl/d3d/D3DPresentParameters;Lorg/lwjgl/d3d/D3DDisplaymodeEx;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nResetEx
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jobject presentationParameters, jobject fullscreenDisplayMode) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nSetConvolutionMonoKernel
* Signature: (JIILjava/nio/FloatBuffer;Ljava/nio/FloatBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nSetConvolutionMonoKernel
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint width, jint height, jobject rowWeights, jobject columnWeights) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nSetGPUThreadPriority
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nSetGPUThreadPriority
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint priority) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nSetMaximumFrameLatency
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nSetMaximumFrameLatency
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint maxLatency) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nTestCooperativeLevel
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nTestCooperativeLevel
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DDevice9Ex
* Method: nWaitForVBlank
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DDevice9Ex_nWaitForVBlank
(JNIEnv *env, jobject obj, jlong IDirect3DDevice9Ex, jint swapChainIndex) {
return 0;
}

View File

@ -1,31 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DIndexBuffer9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DIndexBuffer9
* Method: nGetDesc
* Signature: (JLorg/lwjgl/d3d/D3DIndexBufferDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DIndexBuffer9_nGetDesc
(JNIEnv *env, jobject obj, jlong IDirect3DIndexBuffer9, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DIndexBuffer9
* Method: nLock
* Signature: (JIILjava/nio/ByteBuffer;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DIndexBuffer9_nLock
(JNIEnv *env, jobject obj, jlong IDirect3DIndexBuffer9, jint offsetToLock, jint sizeToLock, jobject data, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DIndexBuffer9
* Method: nUnlock
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DIndexBuffer9_nUnlock
(JNIEnv *env, jobject obj, jlong IDirect3DIndexBuffer9) {
return 0;
}

View File

@ -1,21 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DPixelShader9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DPixelShader9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DPixelShader9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DPixelShader9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DPixelShader9
* Method: nGetFunction
* Signature: (JLjava/nio/ByteBuffer;Ljava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DPixelShader9_nGetFunction
(JNIEnv *env, jobject obj, jlong IDirect3DPixelShader9, jobject data, jobject sizeOfData) {
return 0;
}

View File

@ -1,51 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DQuery9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DQuery9
* Method: nGetData
* Signature: (JLjava/nio/ByteBuffer;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DQuery9_nGetData
(JNIEnv *env, jobject obj, jlong IDirect3DQuery9, jobject data, jlong size, jlong getDataFlags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DQuery9
* Method: nGetDataSize
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DQuery9_nGetDataSize
(JNIEnv *env, jobject obj, jlong IDirect3DQuery9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DQuery9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DQuery9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DQuery9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DQuery9
* Method: nGetType
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3DQuery9_nGetType
(JNIEnv *env, jobject obj, jlong IDirect3DQuery9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DQuery9
* Method: nIssue
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DQuery9_nIssue
(JNIEnv *env, jobject obj, jlong IDirect3DQuery9, jlong issueFlags) {
return 0;
}

View File

@ -1,80 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DResource9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nFreePrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nFreePrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DResource9, jobject refguid) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DResource9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nGetPriority
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nGetPriority
(JNIEnv *env, jobject obj, jlong IDirect3DResource9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nGetPrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nGetPrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DResource9, jobject refguid, jobject data, jobject sizeOfData) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nGetType
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nGetType
(JNIEnv *env, jobject obj, jlong IDirect3DResource9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nPreLoad
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nPreLoad
(JNIEnv *env, jobject obj, jlong IDirect3DResource9) {
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nSetPriority
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nSetPriority
(JNIEnv *env, jobject obj, jlong IDirect3DResource9, jlong priorityNew) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DResource9
* Method: nSetPrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;Ljava/nio/ByteBuffer;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DResource9_nSetPrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DResource9, jobject refguid, jobject data, jlong sizeOfData, jlong flags) {
return 0;
}

View File

@ -1,31 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DStateBlock9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DStateBlock9
* Method: nApply
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DStateBlock9_nApply
(JNIEnv *env, jobject obj, jlong IDirect3DStateBlock9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DStateBlock9
* Method: nCapture
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DStateBlock9_nCapture
(JNIEnv *env, jobject obj, jlong IDirect3DStateBlock9) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DStateBlock9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DStateBlock9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DStateBlock9, jobject device) {
return 0;
}

View File

@ -1,61 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DSurface9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nGetContainer
* Signature: (JJLjava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nGetContainer
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9, jlong riid, jobject container) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nGetDC
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nGetDC
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9, jlong hdc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nGetDesc
* Signature: (JLorg/lwjgl/d3d/D3DSurfaceDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nGetDesc
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nLockRect
* Signature: (JLorg/lwjgl/d3d/D3DLockedRect;Lorg/lwjgl/d3d/Rectangle;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nLockRect
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9, jobject lockedRect, jobject rect, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nReleaseDC
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nReleaseDC
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9, jlong hdc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSurface9
* Method: nUnlockRect
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSurface9_nUnlockRect
(JNIEnv *env, jobject obj, jlong IDirect3DSurface9) {
return 0;
}

View File

@ -1,71 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DSwapChain9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetBackBuffer
* Signature: (JIILorg/lwjgl/d3d/IDirect3DSurface9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetBackBuffer
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jint backBuffer, jint type, jobject backBufferSurface) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetDisplayMode
* Signature: (JLorg/lwjgl/d3d/D3DDisplaymode;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetDisplayMode
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject mode) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetFrontBufferData
* Signature: (JLorg/lwjgl/d3d/IDirect3DSurface9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetFrontBufferData
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject destSurface) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetPresentParameters
* Signature: (JLorg/lwjgl/d3d/D3DPresentParameters;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetPresentParameters
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject presentationParameters) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nGetRasterStatus
* Signature: (JLorg/lwjgl/d3d/D3DRasterStatus;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nGetRasterStatus
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject rasterStatus) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9
* Method: nPresent
* Signature: (JLorg/lwjgl/d3d/Rectangle;Lorg/lwjgl/d3d/Rectangle;JLorg/lwjgl/d3d/RegionData;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9_nPresent
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9, jobject sourceRect, jobject destRect, jlong destWindowOverride, jobject dirtyRegion, jlong flags) {
return 0;
}

View File

@ -1,31 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DSwapChain9Ex.h"
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9Ex
* Method: nGetDisplayModeEx
* Signature: (JLorg/lwjgl/d3d/D3DDisplaymodeEx;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9Ex_nGetDisplayModeEx
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9Ex, jobject mode, jint rotation) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9Ex
* Method: nGetLastPresentCount
* Signature: (JLjava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9Ex_nGetLastPresentCount
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9Ex, jobject lastPresentCount) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DSwapChain9Ex
* Method: nGetPresentStatistics
* Signature: (JLorg/lwjgl/d3d/D3DPresentStats;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DSwapChain9Ex_nGetPresentStatistics
(JNIEnv *env, jobject obj, jlong IDirect3DSwapChain9Ex, jobject presentationStatistics) {
return 0;
}

View File

@ -1,51 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DTexture9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DTexture9
* Method: nAddDirtyRect
* Signature: (JLorg/lwjgl/d3d/Rectangle;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DTexture9_nAddDirtyRect
(JNIEnv *env, jobject obj, jlong IDirect3DTexture9, jobject dirtyRect) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DTexture9
* Method: nGetLevelDesc
* Signature: (JILorg/lwjgl/d3d/D3DSurfaceDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DTexture9_nGetLevelDesc
(JNIEnv *env, jobject obj, jlong IDirect3DTexture9, jint level, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DTexture9
* Method: nGetSurfaceLevel
* Signature: (JILorg/lwjgl/d3d/IDirect3DSurface9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DTexture9_nGetSurfaceLevel
(JNIEnv *env, jobject obj, jlong IDirect3DTexture9, jint level, jobject surfaceLevel) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DTexture9
* Method: nLockRect
* Signature: (JILorg/lwjgl/d3d/D3DLockedRect;Lorg/lwjgl/d3d/Rectangle;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DTexture9_nLockRect
(JNIEnv *env, jobject obj, jlong IDirect3DTexture9, jint level, jobject lockedRect, jobject rect, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DTexture9
* Method: nUnlockRect
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DTexture9_nUnlockRect
(JNIEnv *env, jobject obj, jlong IDirect3DTexture9, jint level) {
return 0;
}

View File

@ -1,63 +0,0 @@
#include <d3d9.h>
#include "org_lwjgl_d3d_IDirect3DVertexBuffer9.h"
extern void setPointer(JNIEnv *env, jobject classInstance, const char* methodName, jlong pointer);
//void setPointer(JNIEnv *env, jobject classInstance, const char* methodName, jlong pointer) {
// jclass clazz = (*env)->GetObjectClass(env, classInstance);
// jmethodID mid = (*env)->GetMethodID(env, clazz, methodName, "(J)V");
// if (mid != NULL) {
// (*env)->CallVoidMethod(env, classInstance, mid, pointer);
// }
//}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexBuffer9
* Method: nGetDesc
* Signature: (JLjava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexBuffer9_nGetDesc
(JNIEnv *env, jobject obj, jlong iDirect3DVertexBuffer9, jobject descBuffer) {
D3DVERTEXBUFFER_DESC *desc = (D3DVERTEXBUFFER_DESC*)((*env)->GetDirectBufferAddress(env, descBuffer));
return IDirect3DVertexBuffer9_GetDesc((IDirect3DVertexBuffer9*)iDirect3DVertexBuffer9, desc);
}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexBuffer9
* Method: nLock
* Signature: (JIILjava/nio/ByteBuffer;JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexBuffer9_nLock
(JNIEnv *env, jobject obj, jlong iDirect3DVertexBuffer9, jint offsetToLock, jint sizeToLock, jobject ataBuffer, jlong flags, jint bufferSize) {
void *ata;
HRESULT hResult = IDirect3DVertexBuffer9_Lock((IDirect3DVertexBuffer9*)iDirect3DVertexBuffer9, offsetToLock, sizeToLock, &ata, flags);
void *ataAddress = (void*)((*env)->GetDirectBufferAddress(env, ataBuffer));
memcpy(ata, ataAddress, bufferSize);
return hResult;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexBuffer9
* Method: nUnlock
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexBuffer9_nUnlock
(JNIEnv *env, jobject obj, jlong iDirect3DVertexBuffer9) {
return IDirect3DVertexBuffer9_Unlock((IDirect3DVertexBuffer9*)iDirect3DVertexBuffer9);
}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexBuffer9
* Method: create
* Signature: (Lorg/lwjgl/d3d/IDirect3DVertexBuffer9;)J
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_IDirect3DVertexBuffer9_create
(JNIEnv *env, jobject obj, jobject iDirect3DVertexBuffer9) {
IDirect3DVertexBuffer9 *buffer = NULL;
setPointer(env, iDirect3DVertexBuffer9, "setIDirect3DVertexBuffer9", (jlong)buffer);
}

View File

@ -1,21 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DVertexDeclaration9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DVertexDeclaration9
* Method: nGetDeclaration
* Signature: (JLorg/lwjgl/d3d/D3DVertexElement9;Ljava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexDeclaration9_nGetDeclaration
(JNIEnv *env, jobject obj, jlong IDirect3DVertexDeclaration9, jobject decl, jobject numElements) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexDeclaration9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexDeclaration9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DVertexDeclaration9, jobject device) {
return 0;
}

View File

@ -1,21 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DVertexShader9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DVertexShader9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexShader9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DVertexShader9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVertexShader9
* Method: nGetFunction
* Signature: (JLjava/nio/ByteBuffer;Ljava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVertexShader9_nGetFunction
(JNIEnv *env, jobject obj, jlong IDirect3DVertexShader9, jobject data, jobject sizeOfData) {
return 0;
}

View File

@ -1,81 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DVolume9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nFreePrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nFreePrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject refguid) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nGetContainer
* Signature: (JJLjava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nGetContainer
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jlong riid, jobject container) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nGetDesc
* Signature: (JLorg/lwjgl/d3d/D3DVolumeDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nGetDesc
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nGetDevice
* Signature: (JLorg/lwjgl/d3d/IDirect3DDevice9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nGetDevice
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject device) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nGetPrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;Ljava/nio/ByteBuffer;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nGetPrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject refguid, jobject data, jlong sizeOfData) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nLockBox
* Signature: (JLorg/lwjgl/d3d/D3DLockedBox;Lorg/lwjgl/d3d/D3DBox;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nLockBox
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject lockedVolume, jobject box, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nSetPrivateData
* Signature: (JLorg/lwjgl/d3d/GUID;Ljava/nio/ByteBuffer;JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nSetPrivateData
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9, jobject refguid, jobject data, jlong sizeOfData, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolume9
* Method: nUnlockBox
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolume9_nUnlockBox
(JNIEnv *env, jobject obj, jlong IDirect3DVolume9) {
return 0;
}

View File

@ -1,51 +0,0 @@
#include "org_lwjgl_d3d_IDirect3DVolumeTexture9.h"
/*
* Class: org_lwjgl_d3d_IDirect3DVolumeTexture9
* Method: nAddDirtyBox
* Signature: (JLorg/lwjgl/d3d/D3DBox;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolumeTexture9_nAddDirtyBox
(JNIEnv *env, jobject obj, jlong IDirect3DVolumeTexture9, jobject dirtyBox) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolumeTexture9
* Method: nGetLevelDesc
* Signature: (JILorg/lwjgl/d3d/D3DVolumeDesc;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolumeTexture9_nGetLevelDesc
(JNIEnv *env, jobject obj, jlong IDirect3DVolumeTexture9, jint level, jobject desc) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolumeTexture9
* Method: nGetVolumeLevel
* Signature: (JILorg/lwjgl/d3d/IDirect3DVolume9;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolumeTexture9_nGetVolumeLevel
(JNIEnv *env, jobject obj, jlong IDirect3DVolumeTexture9, jint level, jobject volumeLevel) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolumeTexture9
* Method: nLockBox
* Signature: (JILorg/lwjgl/d3d/D3DLockedBox;Lorg/lwjgl/d3d/D3DBox;J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolumeTexture9_nLockBox
(JNIEnv *env, jobject obj, jlong IDirect3DVolumeTexture9, jint level, jobject lockedVolume, jobject box, jlong flags) {
return 0;
}
/*
* Class: org_lwjgl_d3d_IDirect3DVolumeTexture9
* Method: nUnlockBox
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_IDirect3DVolumeTexture9_nUnlockBox
(JNIEnv *env, jobject obj, jlong IDirect3DVolumeTexture9, jint level) {
return 0;
}

View File

@ -1,122 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_d3d_WindowsContextImplementation.c 2832 2007-05-27 15:32:25Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2832 $
*/
#include <jni.h>
#include "org_lwjgl_d3d_WindowsContextImplementation.h"
#include "context.h"
#include "common_tools.h"
typedef struct {
HGLRC context;
} WindowsContext;
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nCreate
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject shared_context_handle) {
WindowsPeerInfo *peer_info;
WindowsContext *shared_context_info;
WindowsContext *context_info;
HGLRC context;
HGLRC shared_context = NULL;
HDC saved_hdc;
HGLRC saved_context;
jobject context_handle = newJavaManagedByteBuffer(env, sizeof(WindowsContext));
if (context_handle == NULL) {
throwException(env, "Could not create handle buffer");
return NULL;
}
peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
context = wglCreateContext(peer_info->drawable_hdc);
if (context == NULL) {
throwException(env, "Could not create context");
return NULL;
}
if (shared_context_handle != NULL) {
shared_context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle);
shared_context = shared_context_info->context;
if (!wglShareLists(shared_context, context)) {
wglDeleteContext(context);
throwException(env, "Could not share contexts");
return NULL;
}
}
context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
context_info->context = context;
return context_handle;
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nSwapBuffers
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
SwapBuffers(peer_info->drawable_hdc);
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nReleaseCurrentContext
(JNIEnv *env, jclass clazz) {
wglMakeCurrent(NULL, NULL);
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nMakeCurrent
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) {
WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context))
throwException(env, "Could not make context current");
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nIsCurrent
(JNIEnv *env, jclass clazz, jobject context_handle) {
WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
return wglGetCurrentContext() == context_info->context;
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nSetSwapInterval
(JNIEnv *env, jclass clazz, jint value) {
WGLExtensions extensions;
extgl_InitWGL(&extensions);
if (extensions.WGL_EXT_swap_control) {
return extensions.wglSwapIntervalEXT(value) ? JNI_TRUE : JNI_FALSE;
} else
return JNI_FALSE;
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsContextImplementation_nDestroy
(JNIEnv *env, jclass clazz, jobject context_handle) {
WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
wglDeleteContext(context_info->context);
}

View File

@ -1,88 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2385 $
*/
#undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0300
#include "Window.h"
#include <dinput.h>
#include <jni.h>
#include "org_lwjgl_d3d_WindowsDirectInput3.h"
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDirectInput3_createDirectInput(JNIEnv *env, jobject unused, jlong hinst_int) {
HINSTANCE hinst = (HINSTANCE)(LONG_PTR)hinst_int;
LPDIRECTINPUT lpdi;
HRESULT ret;
ret = DirectInputCreate(hinst, DIRECTINPUT_VERSION, &lpdi, NULL);
if (ret != DI_OK) {
throwFormattedException(env, "Failed to create DirectInput (%x)", ret);
return (LONG_PTR)NULL;
}
return (LONG_PTR)lpdi;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDirectInput3_nCreateDevice(JNIEnv *env, jclass unused, jlong di_interface, jint type) {
LPDIRECTINPUT lpdi = (LPDIRECTINPUT)(LONG_PTR)di_interface;
LPDIRECTINPUTDEVICE lpdevice;
GUID device_guid;
HRESULT ret;
switch (type) {
case org_lwjgl_d3d_WindowsDirectInput3_KEYBOARD_TYPE:
device_guid = GUID_SysKeyboard;
break;
case org_lwjgl_d3d_WindowsDirectInput3_MOUSE_TYPE:
device_guid = GUID_SysMouse;
break;
default:
throwFormattedException(env, "Unknown device type (%d)", type);
return (LONG_PTR)NULL;
}
ret = IDirectInput_CreateDevice(lpdi, &device_guid, &lpdevice, NULL);
if (ret != DI_OK) {
throwFormattedException(env, "Failed to create keyboard (%x).", ret);
return (LONG_PTR)NULL;
}
return (LONG_PTR)lpdevice;
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDirectInput3_release(JNIEnv *env, jobject unused, jlong di_interface) {
LPDIRECTINPUT lpdi = (LPDIRECTINPUT)(LONG_PTR)di_interface;
IDirectInput_Release(lpdi);
}

View File

@ -1,101 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2385 $
*/
#undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#include "Window.h"
#include <dinput.h>
#include <jni.h>
#include "org_lwjgl_d3d_WindowsDirectInput8.h"
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDirectInput8_createDirectInput(JNIEnv *env, jobject unused, jlong hinst_int) {
HINSTANCE hinst = (HINSTANCE)(LONG_PTR)hinst_int;
LPDIRECTINPUT8 lpdi;
HRESULT ret;
ret = CoInitialize(NULL);
if (ret != S_OK && ret != S_FALSE) {
throwFormattedException(env, "CoInitialize failed (%x)", ret);
return (LONG_PTR)NULL;
}
ret = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectInput8, (void *)&lpdi);
if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION) {
throwFormattedException(env, "Failed to create DirectInput (%x)", ret);
return (LONG_PTR)NULL;
}
ret = IDirectInput8_Initialize(lpdi, hinst, DIRECTINPUT_VERSION);
if (FAILED(ret)) {
throwFormattedException(env, "Failed to initialize DirectInput (%x)", ret);
IDirectInput8_Release(lpdi);
return (LONG_PTR)NULL;
}
return (LONG_PTR)lpdi;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDirectInput8_nCreateDevice(JNIEnv *env, jclass unused, jlong di_interface, jint type) {
LPDIRECTINPUT8 lpdi = (LPDIRECTINPUT8)(LONG_PTR)di_interface;
LPDIRECTINPUTDEVICE8 lpdevice;
GUID device_guid;
HRESULT ret;
switch (type) {
case org_lwjgl_d3d_WindowsDirectInput8_KEYBOARD_TYPE:
device_guid = GUID_SysKeyboard;
break;
case org_lwjgl_d3d_WindowsDirectInput8_MOUSE_TYPE:
device_guid = GUID_SysMouse;
break;
default:
throwFormattedException(env, "Unknown device type (%d)", type);
return (LONG_PTR)NULL;
}
ret = IDirectInput8_CreateDevice(lpdi, &device_guid, &lpdevice, NULL);
if (ret != DI_OK) {
throwFormattedException(env, "Failed to create keyboard (%x).", ret);
return (LONG_PTR)NULL;
}
return (LONG_PTR)lpdevice;
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDirectInput8_release(JNIEnv *env, jobject unused, jlong di_interface) {
LPDIRECTINPUT8 lpdi = (LPDIRECTINPUT8)(LONG_PTR)di_interface;
IDirectInput8_Release(lpdi);
CoUninitialize();
}

View File

@ -1,160 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2385 $
*/
#undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0300
#include "Window.h"
#include "dinputhelper.h"
#include <dinput.h>
#include <jni.h>
#include "org_lwjgl_d3d_WindowsDirectInput3.h"
#include "org_lwjgl_d3d_WindowsDirectInputDevice3.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_unacquire(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
return IDirectInputDevice_Unacquire(lpdevice);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_setDataFormat(JNIEnv *env, jobject unused, jlong di_device, jint type) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
LPCDIDATAFORMAT format;
switch (type) {
case org_lwjgl_d3d_WindowsDirectInput3_KEYBOARD_TYPE:
format = &c_dfDIKeyboard;
break;
case org_lwjgl_d3d_WindowsDirectInput3_MOUSE_TYPE:
format = &c_dfDIMouse;
break;
default:
throwFormattedException(env, "Unknown device type (%d)", type);
return DIERR_INVALIDPARAM;
}
return IDirectInputDevice_SetDataFormat(lpdevice, format);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_getDeviceState(JNIEnv *env, jobject unused, jlong di_device, jobject buffer_obj, jint pos, jint size) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
jbyte *buffer = pos + (jbyte *)(*env)->GetDirectBufferAddress(env, buffer_obj);
return IDirectInputDevice_GetDeviceState(lpdevice, size, buffer);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_getEventSize(JNIEnv *env, jobject unused) {
return sizeof(DIDEVICEOBJECTDATA);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_getDeviceData(JNIEnv *env, jobject unused, jlong di_device, jobject event_buffer_obj, jint event_buffer_size, jobject buffer_obj, jint buffer_pos, jint buffer_size) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
jint *buffer = buffer_pos + (jint *)(*env)->GetDirectBufferAddress(env, buffer_obj);
DIDEVICEOBJECTDATA *event_buffer = (*env)->GetDirectBufferAddress(env, event_buffer_obj);
DIDEVICEOBJECTDATA *current_event;
DWORD num_events = event_buffer_size/sizeof(DIDEVICEOBJECTDATA);
HRESULT ret = IDirectInputDevice_GetDeviceData(lpdevice, sizeof(DIDEVICEOBJECTDATA), event_buffer, &num_events, 0);
jint num_buffer_events = buffer_size/org_lwjgl_d3d_WindowsDirectInputDevice3_DATA_SIZE;
jint i;
if (ret != DI_OK && ret != DI_BUFFEROVERFLOW)
return ret;
if (num_buffer_events < num_events) {
num_events = num_buffer_events;
ret = DI_BUFFEROVERFLOW;
}
for (i = 0; i < num_events; i++) {
current_event = event_buffer + i;
buffer[buffer_pos++] = current_event->dwOfs;
buffer[buffer_pos++] = current_event->dwData;
buffer[buffer_pos++] = current_event->dwTimeStamp;
}
positionBuffer(env, buffer_obj, buffer_pos);
return ret;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_acquire(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
return IDirectInputDevice_Acquire(lpdevice);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_setBufferSize(JNIEnv *env, jobject unused, jlong di_device, jint buffer_size) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
DIPROPDWORD dipropdw;
dipropdw.diph.dwSize = sizeof(DIPROPDWORD);
dipropdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipropdw.diph.dwObj = 0;
dipropdw.diph.dwHow = DIPH_DEVICE;
dipropdw.dwData = buffer_size;
return IDirectInputDevice_SetProperty(lpdevice, DIPROP_BUFFERSIZE, &dipropdw.diph);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_setCooperativeLevel(JNIEnv *env, jobject unused, jlong di_device, jlong hwnd_int, jint flags) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
HWND hwnd = (HWND)(LONG_PTR)hwnd_int;
return IDirectInputDevice_SetCooperativeLevel(lpdevice, hwnd, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_release(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
IDirectInputDevice_Release(lpdevice);
}
static BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) {
enum_context_t *enum_context = (enum_context_t *)pvRef;
jint object_type;
if (IsEqualGUID(&lpddoi->guidType, &GUID_Button)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice3_GUID_Button;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_XAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice3_GUID_XAxis;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_YAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice3_GUID_YAxis;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_ZAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice3_GUID_ZAxis;
} else {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice3_GUID_Unknown;
}
return objectCallback(enum_context->env, enum_context->enumerator, object_type, lpddoi->tszName) ? DIENUM_CONTINUE : DIENUM_STOP;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice3_enumObjects(JNIEnv *env, jobject unused, jlong di_device, jobject enumerator) {
LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
enum_context_t enum_context;
enum_context.env = env;
enum_context.enumerator = enumerator;
return IDirectInputDevice_EnumObjects(lpdevice, EnumMouseObjectsCallback, &enum_context, DIDFT_ALL);
}

View File

@ -1,165 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2385 $
*/
#undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#include "Window.h"
#include "dinputhelper.h"
#include <dinput.h>
#include <jni.h>
#include "org_lwjgl_d3d_WindowsDirectInput8.h"
#include "org_lwjgl_d3d_WindowsDirectInputDevice8.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_unacquire(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
return IDirectInputDevice8_Unacquire(lpdevice);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_poll(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
return IDirectInputDevice8_Poll(lpdevice);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_setDataFormat(JNIEnv *env, jobject unused, jlong di_device, jint type) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
LPCDIDATAFORMAT format;
switch (type) {
case org_lwjgl_d3d_WindowsDirectInput8_KEYBOARD_TYPE:
format = &c_dfDIKeyboard;
break;
case org_lwjgl_d3d_WindowsDirectInput8_MOUSE_TYPE:
format = &c_dfDIMouse;
break;
default:
throwFormattedException(env, "Unknown device type (%d)", type);
return DIERR_INVALIDPARAM;
}
return IDirectInputDevice8_SetDataFormat(lpdevice, format);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_getDeviceState(JNIEnv *env, jobject unused, jlong di_device, jobject buffer_obj, jint pos, jint size) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
jbyte *buffer = pos + (jbyte *)(*env)->GetDirectBufferAddress(env, buffer_obj);
return IDirectInputDevice8_GetDeviceState(lpdevice, size, buffer);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_getEventSize(JNIEnv *env, jobject unused) {
return sizeof(DIDEVICEOBJECTDATA);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_getDeviceData(JNIEnv *env, jobject unused, jlong di_device, jobject event_buffer_obj, jint event_buffer_size, jobject buffer_obj, jint buffer_pos, jint buffer_size) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
jint *buffer = buffer_pos + (jint *)(*env)->GetDirectBufferAddress(env, buffer_obj);
DIDEVICEOBJECTDATA *event_buffer = (*env)->GetDirectBufferAddress(env, event_buffer_obj);
DIDEVICEOBJECTDATA *current_event;
DWORD num_events = event_buffer_size/sizeof(DIDEVICEOBJECTDATA);
HRESULT ret = IDirectInputDevice8_GetDeviceData(lpdevice, sizeof(DIDEVICEOBJECTDATA), event_buffer, &num_events, 0);
jint num_buffer_events = buffer_size/org_lwjgl_d3d_WindowsDirectInputDevice8_DATA_SIZE;
jint i;
if (ret != DI_OK && ret != DI_BUFFEROVERFLOW)
return ret;
if (num_buffer_events < num_events) {
num_events = num_buffer_events;
ret = DI_BUFFEROVERFLOW;
}
for (i = 0; i < num_events; i++) {
current_event = event_buffer + i;
buffer[buffer_pos++] = current_event->dwOfs;
buffer[buffer_pos++] = current_event->dwData;
buffer[buffer_pos++] = current_event->dwTimeStamp;
}
positionBuffer(env, buffer_obj, buffer_pos);
return ret;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_acquire(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
return IDirectInputDevice8_Acquire(lpdevice);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_setBufferSize(JNIEnv *env, jobject unused, jlong di_device, jint buffer_size) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
DIPROPDWORD dipropdw;
dipropdw.diph.dwSize = sizeof(DIPROPDWORD);
dipropdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipropdw.diph.dwObj = 0;
dipropdw.diph.dwHow = DIPH_DEVICE;
dipropdw.dwData = buffer_size;
return IDirectInputDevice8_SetProperty(lpdevice, DIPROP_BUFFERSIZE, &dipropdw.diph);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_setCooperativeLevel(JNIEnv *env, jobject unused, jlong di_device, jlong hwnd_int, jint flags) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
HWND hwnd = (HWND)(LONG_PTR)hwnd_int;
return IDirectInputDevice8_SetCooperativeLevel(lpdevice, hwnd, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_release(JNIEnv *env, jobject unused, jlong di_device) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
IDirectInputDevice8_Release(lpdevice);
}
static BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) {
enum_context_t *enum_context = (enum_context_t *)pvRef;
jint object_type;
if (IsEqualGUID(&lpddoi->guidType, &GUID_Button)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice8_GUID_Button;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_XAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice8_GUID_XAxis;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_YAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice8_GUID_YAxis;
} else if(IsEqualGUID(&lpddoi->guidType, &GUID_ZAxis)) {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice8_GUID_ZAxis;
} else {
object_type = org_lwjgl_d3d_WindowsDirectInputDevice8_GUID_Unknown;
}
return objectCallback(enum_context->env, enum_context->enumerator, object_type, lpddoi->tszName) ? DIENUM_CONTINUE : DIENUM_STOP;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDirectInputDevice8_enumObjects(JNIEnv *env, jobject unused, jlong di_device, jobject enumerator) {
LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
enum_context_t enum_context;
enum_context.env = env;
enum_context.enumerator = enumerator;
return IDirectInputDevice8_EnumObjects(lpdevice, EnumMouseObjectsCallback, &enum_context, DIDFT_ALL);
}

View File

@ -1,682 +0,0 @@
#include <jni.h>
#include <windows.h>
#include "common_tools.h"
#include "org_lwjgl_d3d_WindowsDisplay.h"
#define WINDOWCLASSNAME "LWJGL"
static HICON small_icon = NULL;
static HICON large_icon = NULL;
static HWND displayHwnd = NULL; // Handle to the window
static HDC displayHdc = NULL; // Device context
extern HINSTANCE dll_handle; // Handle to the LWJGL dll
HDC getD3DHDC() {
return displayHdc;
}
HWND getD3DHWND() {
return displayHwnd;
}
static void freeLargeIcon() {
if (large_icon != NULL) {
DestroyIcon(large_icon);
large_icon = NULL;
}
}
static void freeSmallIcon() {
if (small_icon != NULL) {
DestroyIcon(small_icon);
small_icon = NULL;
}
}
static void copyBufferToRect(JNIEnv *env, jobject buffer_handle, RECT *rect) {
jint *buffer = (jint *)(*env)->GetDirectBufferAddress(env, buffer_handle);
jlong size = (*env)->GetDirectBufferCapacity(env, buffer_handle);
if (size < 4) {
throwFormattedRuntimeException(env, "Buffer size < 4", size);
return;
}
rect->top = buffer[0];
rect->bottom = buffer[1];
rect->left = buffer[2];
rect->right = buffer[3];
}
void d3dSetGammaRamp(JNIEnv * env, jobject gammaRampBuffer) {
HDC screenDC;
WORD *gammaRamp = (WORD *)(*env)->GetDirectBufferAddress(env, gammaRampBuffer);
screenDC = GetDC(NULL);
if (SetDeviceGammaRamp(screenDC, gammaRamp) == FALSE) {
throwException(env, "Failed to set device gamma.");
}
ReleaseDC(NULL, screenDC);
}
/*
* Create a window with the specified title, position, size, and
* fullscreen attribute. The window will have DirectInput associated
* with it.
*
* Returns true for success, or false for failure
*/
HWND d3dCreateWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated)
{
RECT clientSize;
DWORD exstyle, windowflags;
HWND new_hwnd;
getWindowFlags(&windowflags, &exstyle, fullscreen, undecorated);
// If we're not a fullscreen window, adjust the height to account for the
// height of the title bar (unless undecorated)
clientSize.bottom = height;
clientSize.left = 0;
clientSize.right = width;
clientSize.top = 0;
AdjustWindowRectEx(
&clientSize, // client-rectangle structure
windowflags, // window styles
FALSE, // menu-present option
exstyle // extended window style
);
// Create the window now, using that class:
new_hwnd = CreateWindowEx (
exstyle,
window_class_name,
"",
windowflags,
x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top,
NULL,
NULL,
dll_handle,
NULL);
return new_hwnd;
}
static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height) {
unsigned char col;
unsigned char mask;
BITMAPINFO bitmapInfo;
HBITMAP cursorMask;
HBITMAP colorBitmap;
ICONINFO iconInfo;
HICON icon;
char *ptrCursorImage;
int x, y;
char *dstPtr;
int wordAlignedWidth;
int imageSize;
unsigned char *maskPixels;
int widthInBytes;
int leftShift;
int maskPixelsOff;
int scanlineWidth;
HBITMAP colorDIB;
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.bmiHeader.biWidth = width;
bitmapInfo.bmiHeader.biHeight = -height;
bitmapInfo.bmiHeader.biPlanes = 1;
bitmapInfo.bmiHeader.biBitCount = 24;
bitmapInfo.bmiHeader.biCompression = BI_RGB;
colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo),
DIB_RGB_COLORS, (void*)&(ptrCursorImage), NULL, 0);
if (!ptrCursorImage) {
throwException(env, "Could not allocate DIB section.");
}
wordAlignedWidth = width * 3;
if (wordAlignedWidth % sizeof(long) != 0) {
wordAlignedWidth = (wordAlignedWidth / sizeof(long)) * sizeof(long) + sizeof(long);
}
for (y = 0; y < height; y++ ) {
dstPtr = ptrCursorImage + wordAlignedWidth*y;;
for (x = 0; x < width; x++ ) {
if ((pixels[y*width+x] & 0xFF000000) != 0)
{
dstPtr[0] = (pixels[y*width+x] >> 0x10) & 0xFF;
dstPtr[1] = (pixels[y*width+x] >> 0x08) & 0xFF;
dstPtr[2] = pixels[y*width+x] & 0xFF;
}
else
{
dstPtr[0] = 0;
dstPtr[1] = 0;
dstPtr[2] = 0;
}
dstPtr += 3;
}
}
colorBitmap = CreateDIBitmap(GetDC(NULL),
(BITMAPINFOHEADER*)&bitmapInfo.bmiHeader,
CBM_INIT,
(void *)ptrCursorImage,
(BITMAPINFO*)&bitmapInfo,
DIB_RGB_COLORS);
DeleteObject(colorDIB);
// Convert alpha map to pixel packed mask
// number of bytes it takes to fit a bit packed scan line.
widthInBytes = (width & 0x7) != 0 ? (width >> 3) + 1 : (width >> 3);
// number of bytes it takes to fit WORD padded scan line.
scanlineWidth = widthInBytes;
if (scanlineWidth % sizeof(WORD) != 0) {
scanlineWidth = (scanlineWidth / sizeof(WORD)) * sizeof(WORD) + sizeof(WORD);
}
imageSize = scanlineWidth*height;
maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize);
memset(maskPixels, 0, imageSize);
for (y = 0; y < height; y++) {
leftShift = 7;
mask = 0;
maskPixelsOff = scanlineWidth*y;
for (x = 0; x < width; x++) {
col = (((pixels[(width*y)+x] & 0xFF000000) != 0) ? 1 : 0) << leftShift;
mask = mask | col;
leftShift--;
if (leftShift == -1) {
maskPixels[maskPixelsOff++] = ~mask;
leftShift = 7;
mask = 0;
}
}
// write what is left over
if (leftShift != 7) {
maskPixels[maskPixelsOff++] = ~mask;
}
}
cursorMask = CreateBitmap(width, height, 1, 1, maskPixels);
memset(&iconInfo, 0, sizeof(ICONINFO));
iconInfo.hbmMask = cursorMask;
iconInfo.hbmColor = colorBitmap;
iconInfo.fIcon = TRUE;
iconInfo.xHotspot = 0;
iconInfo.yHotspot = 0;
icon = CreateIconIndirect(&iconInfo);
DeleteObject(colorBitmap);
DeleteObject(cursorMask);
free(maskPixels);
return icon;
}
/*
* WindowProc for the GL window.
*/
static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
jclass display_class;
jclass display_class_global;
jmethodID handleMessage_method;
LONG message_time;
JNIEnv *env = getThreadEnv();
if (env != NULL && !(*env)->ExceptionOccurred(env)) {
/*
* We'll cache a global reference to the WindowsDisplay class in the window's user data.
* This is not so much to avoid lookup overhead as it is to avoid problems
* with AWT. Specifically, awt code can indirectly call this message handler
* when it does a SendMessage on the main thread to the currently focused window,
* which could be a LWJGL window. The FindClass will then fail because the calling
* internal awt class is using the system class loader, not the application loader
* where lwjgl is found.
*
* The very first message sent to this handler is sent when
* a window is created, where we are sure that the calling class' classloader has
* LWJGL classes in it.
*/
display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (display_class_global == NULL) {
display_class = (*env)->FindClass(env, "org/lwjgl/d3d/WindowsDisplay");
if (display_class != NULL) {
display_class_global = (*env)->NewGlobalRef(env, display_class);
if (display_class_global != NULL)
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)display_class_global);
}
}
if (display_class_global != NULL) {
message_time = GetMessageTime();
handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)Z");
if (handleMessage_method != NULL)
if ((*env)->CallStaticBooleanMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time))
return 0;
}
}
// default action
return DefWindowProc(hWnd, msg, wParam, lParam);
}
/*
* Handle native Windows messages
*/
static void handleMessages(JNIEnv *env) {
/*
* Now's our chance to deal with Windows messages that are
* otherwise just piling up and causing everything not to
* work properly
*/
MSG msg;
if (displayHwnd != NULL) {
while (!(*env)->ExceptionOccurred(env) && PeekMessage(
&msg, // message information
NULL, // handle to window
0, // first message
0, // last message
PM_REMOVE // removal options
))
{
DispatchMessage(&msg);
TranslateMessage(&msg);
}
}
}
static jobject createDisplayMode(JNIEnv *env, DEVMODE *devmode) {
jclass displayModeClass;
jmethodID displayModeConstructor;
displayModeClass = (*env)->FindClass(env, "org/lwjgl/d3d/DisplayMode");
if (displayModeClass == NULL)
return NULL;
displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V");
if (displayModeConstructor == NULL)
return NULL;
return (*env)->NewObject(env, displayModeClass, displayModeConstructor,
devmode->dmPelsWidth, devmode->dmPelsHeight,
devmode->dmBitsPerPel, devmode->dmDisplayFrequency);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nCreateWindow
* Signature: (Lorg/lwjgl/d3d/DisplayMode;ZII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nCreateWindow
(JNIEnv *env, jobject obj, jobject mode, jboolean fullscreen, jint x, jint y) {
jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
int width = (*env)->GetIntField(env, mode, fid_width);
int height = (*env)->GetIntField(env, mode, fid_height);
bool isUndecorated; // Whether we're undecorated or not
static bool oneShotInitialised = false;
if (!oneShotInitialised) {
if (!registerWindow(lwjglWindowProc, WINDOWCLASSNAME)) {
throwException(env, "Could not register window class");
return;
}
oneShotInitialised = true;
}
isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
displayHwnd = d3dCreateWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, isUndecorated);
if (displayHwnd == NULL) {
throwException(env, "Failed to create the window.");
return;
}
displayHdc = GetDC(displayHwnd);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nDestroyWindow
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nDestroyWindow
(JNIEnv *env, jclass clazz) {
jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(displayHwnd, GWLP_USERDATA);
closeWindow(&displayHwnd, &displayHdc);
if (display_class_global != NULL) {
(*env)->DeleteGlobalRef(env, display_class_global);
}
freeLargeIcon();
freeSmallIcon();
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: clipCursor
* Signature: (JLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_clipCursor
(JNIEnv *env, jclass clazz, jlong hwndPtr, jobject handleBuffer) {
HWND hwnd = (HWND)(INT_PTR)hwndPtr;
RECT clip_rect;
LPRECT clip_rect_ptr;
if (handleBuffer != NULL) {
copyBufferToRect(env, handleBuffer, &clip_rect);
clip_rect_ptr = &clip_rect;
} else
clip_rect_ptr = NULL;
if (ClipCursor(clip_rect_ptr) == 0)
throwFormattedException(env, "ClipCursor failed (%d)", GetLastError());
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSwitchDisplayMode
* Signature: (Lorg/lwjgl/d3d/DisplayMode;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSwitchDisplayMode
(JNIEnv *env, jclass clazz, jobject mode) {
DEVMODE devmode;
jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
jfieldID fid_bpp = (*env)->GetFieldID(env, cls_displayMode, "bpp", "I");
jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I");
int width = (*env)->GetIntField(env, mode, fid_width);
int height = (*env)->GetIntField(env, mode, fid_height);
int bpp = (*env)->GetIntField(env, mode, fid_bpp);
int freq = (*env)->GetIntField(env, mode, fid_freq);
LONG cdsret;
ZeroMemory(&devmode, sizeof(DEVMODE));
devmode.dmSize = sizeof(DEVMODE);
devmode.dmBitsPerPel = bpp;
devmode.dmPelsWidth = width;
devmode.dmPelsHeight = height;
devmode.dmDisplayFrequency = freq;
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
if (freq != 0)
devmode.dmFields |= DM_DISPLAYFREQUENCY;
cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN);
if (cdsret != DISP_CHANGE_SUCCESSFUL) {
throwFormattedException(env, "Failed to set display mode (%ld).", cdsret);
return;
}
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: showWindow
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_showWindow
(JNIEnv *env, jclass clazz, jlong hwndPtr, jint mode) {
HWND hwnd = (HWND)(INT_PTR)hwndPtr;
ShowWindow(hwnd, mode);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: setForegroundWindow
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_setForegroundWindow
(JNIEnv *env, jclass clazz, jlong hwndPtr) {
HWND hwnd = (HWND)(INT_PTR)hwndPtr;
SetForegroundWindow(hwnd);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: setFocus
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_setFocus
(JNIEnv *env, jclass clazz, jlong hwndPtr) {
HWND hwnd = (HWND)(INT_PTR)hwndPtr;
SetFocus(hwnd);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nResetDisplayMode
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nResetDisplayMode
(JNIEnv *env, jclass clazz) {
ChangeDisplaySettings(NULL, 0);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: convertToNativeRamp
* Signature: (Ljava/nio/FloatBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsDisplay_convertToNativeRamp
(JNIEnv *env, jclass clazz, jobject gammaRamp) {
return NULL;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getCurrentGammaRamp
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getCurrentGammaRamp
(JNIEnv *env, jclass clazz) {
return NULL;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSetGammaRamp
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSetGammaRamp
(JNIEnv *env, jclass clazz, jobject nativeRamp) {
d3dSetGammaRamp(env, nativeRamp);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nGetVersion
* Signature: (Ljava/lang/String;)Lorg/lwjgl/d3d/WindowsFileVersion;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nGetVersion
(JNIEnv *env, jobject obj, jstring driver) {
return NULL;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getCurrentDisplayMode
* Signature: ()Lorg/lwjgl/d3d/DisplayMode;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getCurrentDisplayMode
(JNIEnv *env, jclass clazz) {
DEVMODE devmode;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode)) {
throwFormattedException(env, "Couldn't get current display settings (%ld)", GetLastError());
return NULL;
}
return createDisplayMode(env, &devmode);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: setTitle
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_setTitle
(JNIEnv *env, jobject obj, jstring title_obj) {
char * title = GetStringNativeChars(env, title_obj);
SetWindowText(displayHwnd, title);
free(title);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nUpdate
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nUpdate
(JNIEnv *env, jclass clazz) {
handleMessages(env);
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nReshape
* Signature: (JIIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nReshape
(JNIEnv *env, jclass clazz, jlong hwndPtr, jint x, jint y, jint width, jint height) {
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getAvailableDisplayModes
* Signature: ()[Lorg/lwjgl/d3d/DisplayMode;
*/
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getAvailableDisplayModes
(JNIEnv *env, jobject obj) {
int i = 0, j = 0, n = 0;
DEVMODE DevMode;
jobject *display_mode_objects = NULL;
int list_size = 0;
jclass displayModeClass;
jobjectArray ret;
displayModeClass = (*env)->FindClass(env, "org/lwjgl/d3d/DisplayMode");
ZeroMemory(&DevMode, sizeof(DEVMODE));
DevMode.dmSize = sizeof(DEVMODE);
while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) {
// Filter out indexed modes
if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) {
jobject displayMode;
if (list_size <= n) {
list_size += 1;
display_mode_objects = (jobject *)realloc(display_mode_objects, sizeof(jobject)*list_size);
if (display_mode_objects == NULL) {
return NULL;
}
}
displayMode = createDisplayMode(env, &DevMode);
display_mode_objects[n++] = displayMode;
}
}
printfDebugJava(env, "Found %d displaymodes", n);
ret = (*env)->NewObjectArray(env, n, displayModeClass, NULL);
for (i = 0; i < n; i++) {
(*env)->SetObjectArrayElement(env, ret, i, display_mode_objects[i]);
}
free(display_mode_objects);
return ret;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSetCursorPosition
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSetCursorPosition
(JNIEnv *env, jclass clazz, jint x, jint y) {
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSetNativeCursor
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSetNativeCursor
(JNIEnv *env, jclass clazz, jlong hwndPtr, jobject handle) {
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getSystemMetrics
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getSystemMetrics
(JNIEnv *env, jclass clazz, jint index) {
return 0;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getDllInstance
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getDllInstance
(JNIEnv *env, jclass clazz) {
return 0;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getHwnd
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getHwnd
(JNIEnv *env, jclass clazz) {
return (jlong)getD3DHWND();
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getDesktopWindow
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getDesktopWindow
(JNIEnv *env, jclass clazz) {
return 0;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSetWindowIcon16
* Signature: (Ljava/nio/IntBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSetWindowIcon16
(JNIEnv *env, jclass clazz, jobject icon) {
return 0;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: nSetWindowIcon32
* Signature: (Ljava/nio/IntBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsDisplay_nSetWindowIcon32
(JNIEnv *env, jclass clazz, jobject icon) {
return 0;
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: getClientRect
* Signature: (JLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_getClientRect
(JNIEnv *env, jclass clazz, jlong hwndPtr, jobject rect) {
}
/*
* Class: org_lwjgl_d3d_WindowsDisplay
* Method: clientToScreen
* Signature: (JLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplay_clientToScreen
(JNIEnv *env, jclass clazz, jlong hwndPtr, jobject point) {
}

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_d3d_WindowsDisplayPeerInfo.c 2618 2006-10-30 15:46:42Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2618 $
*/
#include <jni.h>
#include "Window.h"
#include "org_lwjgl_d3d_WindowsDisplayPeerInfo.h"
#include "context.h"
#include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsDisplayPeerInfo_nInitDC
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
peer_info->drawable_hdc = getCurrentHDC();
peer_info->u.hwnd = getCurrentHWND();
}

View File

@ -1,75 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
*
* @author elias_naue <elias_naur@users.sourceforge.net>
* @version $Revision: 2385 $
*/
#include "Window.h"
#include <jni.h>
#include "org_lwjgl_d3d_WindowsKeyboard.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_GetKeyState(JNIEnv *env, jclass unused, jint virt_key) {
return GetKeyState(virt_key);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_MapVirtualKey(JNIEnv *env, jclass unused, jint uCode, jint uMapType) {
return MapVirtualKey(uCode, uMapType);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_isWindowsNT(JNIEnv *env, jclass unused) {
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(osvi);
GetVersionEx(&osvi);
return osvi.dwPlatformId == VER_PLATFORM_WIN32_NT ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_ToUnicode(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject pwszBuff_obj, jint cchBuff, jint flags) {
const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
LPWSTR pwszBuff = (*env)->GetDirectBufferAddress(env, pwszBuff_obj);
return ToUnicode(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_ToAscii(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject lpChar_obj, jint flags) {
const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
LPWORD lpChar = (*env)->GetDirectBufferAddress(env, lpChar_obj);
return ToAscii(wVirtKey, wScanCode, lpKeyState, lpChar, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_d3d_WindowsKeyboard_GetKeyboardState(JNIEnv *env, jclass unused, jobject lpKeyState_obj) {
PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
return GetKeyboardState(lpKeyState);
}

View File

@ -1,65 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_d3d_WindowsPeerInfo.c 2619 2006-10-30 15:49:02Z elias_naur $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2619 $
*/
#include <jni.h>
#include "org_lwjgl_d3d_WindowsPeerInfo.h"
#include "context.h"
#include "common_tools.h"
JNIEXPORT jobject JNICALL Java_org_lwjgl_d3d_WindowsPeerInfo_createHandle
(JNIEnv *env, jclass clazz) {
return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo));
}
JNIEXPORT void JNICALL Java_org_lwjgl_d3d_WindowsPeerInfo_nChoosePixelFormat
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
int pixel_format_id = findPixelFormatOnDC(env, peer_info->drawable_hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
if (pixel_format_id == -1)
return;
// Let it throw
applyPixelFormat(env, peer_info->drawable_hdc, pixel_format_id);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_d3d_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
return (intptr_t)peer_info->u.hwnd;
}

View File

@ -1,145 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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: org_lwjgl_d3d_WindowsRegistry.c 2775 2007-04-19 22:21:04Z matzon $
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 2775 $
*/
#include <jni.h>
#include <windows.h>
#include "org_lwjgl_d3d_WindowsRegistry.h"
#include "common_tools.h"
/*
* Return a string containing the queried value, or NULL of the method fails.
* In that case, a java exception is thrown.
*/
static jstring queryRegistrationKey(JNIEnv *env, HKEY root_key, LPCTSTR subkey, LPCTSTR value) {
DWORD buf_size = 1;
char *result;
HKEY hKey;
LONG lRet;
jstring java_result;
if(RegOpenKeyEx(root_key,
TEXT(subkey),
0,
KEY_QUERY_VALUE,
&hKey) != ERROR_SUCCESS) {
throwException(env, "Failed to open registry key");
return NULL;
}
result = (char *)malloc(buf_size);
if (result == NULL) {
RegCloseKey(hKey);
throwException(env, "Failed to allocate buffer");
return NULL;
}
while (1) {
lRet = RegQueryValueEx(hKey,
TEXT(value),
NULL,
NULL,
(LPBYTE)result,
&buf_size);
if (lRet != ERROR_SUCCESS && lRet != ERROR_MORE_DATA) {
RegCloseKey(hKey);
free(result);
throwException(env, "Failed query key value");
return NULL;
}
if (lRet == ERROR_SUCCESS) {
RegCloseKey(hKey);
// make sure the result has a terminating null
buf_size += 1;
result = (char *)realloc(result, buf_size);
if (result == NULL) {
throwException(env, "Failed to resize buffer");
return NULL;
}
result[buf_size - 1] = '\0';
java_result = NewStringNativeWithLength(env, result, strlen(result));
free(result);
return java_result;
}
result = (char *)realloc(result, buf_size);
if (result == NULL) {
RegCloseKey(hKey);
throwException(env, "Failed to resize buffer");
return NULL;
}
}
}
static HKEY enumToRootKey(jint root_key_enum) {
switch (root_key_enum) {
case org_lwjgl_d3d_WindowsRegistry_HKEY_CLASSES_ROOT:
return HKEY_CLASSES_ROOT;
case org_lwjgl_d3d_WindowsRegistry_HKEY_CURRENT_USER:
return HKEY_CURRENT_USER;
case org_lwjgl_d3d_WindowsRegistry_HKEY_LOCAL_MACHINE:
return HKEY_LOCAL_MACHINE;
case org_lwjgl_d3d_WindowsRegistry_HKEY_USERS:
return HKEY_USERS;
default:
return 0;
}
}
JNIEXPORT jstring JNICALL Java_org_lwjgl_d3d_WindowsRegistry_nQueryRegistrationKey (JNIEnv *env, jclass unused, jint root_key, jstring subkey, jstring value) {
HKEY root = enumToRootKey(root_key);
char *subkey_native;
char *value_native;
jstring result;
subkey_native = GetStringNativeChars(env, subkey);
if (subkey_native == NULL) {
throwException(env, "Failed to fetch the native string");
return NULL;
}
value_native = GetStringNativeChars(env, value);
if (value_native == NULL) {
free(subkey_native);
throwException(env, "Failed to fetch the native string");
return NULL;
}
result = queryRegistrationKey(env, root, subkey_native, value_native);
free(subkey_native);
free(value_native);
return result;
}