本文整理匯總了Java中org.lwjgl.glfw.GLFW.glfwSetWindowPos方法的典型用法代碼示例。如果您正苦於以下問題:Java GLFW.glfwSetWindowPos方法的具體用法?Java GLFW.glfwSetWindowPos怎麽用?Java GLFW.glfwSetWindowPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.glfw.GLFW
的用法示例。
在下文中一共展示了GLFW.glfwSetWindowPos方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeWindowCentered
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
public void makeWindowCentered()
{
// Get the thread stack and push a new frame
try (MemoryStack stack = MemoryStack.stackPush())
{
IntBuffer pWidth = stack.mallocInt(1); // int*
IntBuffer pHeight = stack.mallocInt(1); // int*
// Get the window size passed to glfwCreateWindow
GLFW.glfwGetWindowSize(this.handle, pWidth, pHeight);
this.width = pWidth.get(0);
this.height = pHeight.get(0);
// Get the resolution of the primary monitor
GLFWVidMode vidmode = getCurrentVideoMode();
// Center the window
GLFW.glfwSetWindowPos(
this.handle,
this.x = ((vidmode.width() - this.width) / 2),
this.y = ((vidmode.height() - this.height) / 2)
);
} // the stack frame is popped automatically
}
示例2: generate
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
public static Window generate(WindowHandle handle) {
long windowID = GLFW.glfwCreateWindow(handle.width, handle.height, handle.title, NULL, NULL);
if (windowID == NULL)
throw new GLFWException("Failed to create GLFW Window '" + handle.title + "'");
Window window = new Window(windowID, handle.width, handle.height);
GLFW.glfwSetWindowPos(windowID, Variables.X, Variables.Y);
int[] h = new int[1];
int[] w = new int[1];
GLFW.glfwGetFramebufferSize(windowID, w, h);
window.framebufferHeight = h[0];
window.framebufferWidth = w[0];
GLFW.glfwGetWindowSize(windowID, w, h);
window.height = h[0];
window.width = w[0];
window.pixelRatio = (float) window.framebufferWidth / (float) window.width;
return window;
}
示例3: setPosition
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
public void setPosition(int x, int y){
if(this.x == x && this.y == y){
return;
}
GLFW.glfwSetWindowPos(handle, x, y);
}
示例4: setPosition
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
public Window setPosition(int x, int y)
{
if (this.handle == MemoryUtil.NULL)
{
this.x = x;
this.y = y;
}
else
{
GLFW.glfwSetWindowPos(this.handle, x, y);
}
return this;
}