本文整理汇总了Java中org.lwjgl.glfw.GLFWvidmode.width方法的典型用法代码示例。如果您正苦于以下问题:Java GLFWvidmode.width方法的具体用法?Java GLFWvidmode.width怎么用?Java GLFWvidmode.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.glfw.GLFWvidmode
的用法示例。
在下文中一共展示了GLFWvidmode.width方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Display
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
Display(long id)
{
this.id = id;
GLFWVidMode.Buffer modes = glfwGetVideoModes(id);
displayModes = new HashSet<>();
for(int i = 0; i < modes.limit(); i++)
{
GLFWVidMode vm = modes.get();
DisplayMode wm = new DisplayMode(
this,
vm.width(),
vm.height(),
vm.redBits(),
vm.refreshRate());
displayModes.add(wm);
}
}
示例2: getNativeDisplayMode
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
/**
* <p>
* Get the native window mode of the display.
* </p>
*
* @return The native window mode.
*/
public final DisplayMode getNativeDisplayMode()
{
GLFWVidMode nvm = glfwGetVideoMode(id);
for(DisplayMode mode : displayModes)
{
if(mode.getWidth() == nvm.width()
&& mode.getHeight() == nvm.height()
&& mode.getBitsPerPixel() == nvm.redBits()
&& mode.getFrequency() == nvm.refreshRate())
{
return mode;
}
}
return null;
}
示例3: getDensity
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public float getDensity () {
intBuffer.clear();
intBuffer2.clear();
glfwGetMonitorPhysicalSize(getWindowMonitor(), intBuffer, intBuffer2);
float mmWidth = intBuffer.get();
float mmHeight = intBuffer2.get();
float inches = (float) Math.sqrt(mmWidth * mmWidth + mmHeight * mmHeight) * 0.03937f; // mm to inches
final GLFWVidMode vidMode = glfwGetVideoMode(getWindowMonitor());
float pixelWidth = vidMode.width();
float pixelHeight = vidMode.height();
float pixels = (float) Math.sqrt(pixelWidth * pixelWidth + pixelHeight * pixelHeight);
float diagonalPpi = pixels / inches;
return diagonalPpi / 160f;
}
示例4: setSize
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
@Override public void setSize (int width, int height, boolean fullscreen) {
if (plat.config.fullscreen != fullscreen) {
plat.log().warn("fullscreen cannot be changed via setSize, use config.fullscreen instead");
return;
}
GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
if (width > vidMode.width()) {
plat.log().debug("Capping window width at desktop width: " + width + " -> " +
vidMode.width());
width = vidMode.width();
}
if (height > vidMode.height()) {
plat.log().debug("Capping window height at desktop height: " + height + " -> " +
vidMode.height());
height = vidMode.height();
}
glfwSetWindowSize(window, width, height);
// plat.log().info("setSize: " + width + "x" + height);
viewSizeM.setSize(width, height);
IntBuffer fbSize = BufferUtils.createIntBuffer(2);
long addr = MemoryUtil.memAddress(fbSize);
nglfwGetFramebufferSize(window, addr, addr + 4);
viewportAndScaleChanged(fbSize.get(0), fbSize.get(1));
}
示例5: init
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
/**
* Initializes the GLFW library, creating a window and any necessary shaders.
*/
void init(GameState gameState, Main client) {
if (!glfwInit()) {
System.err.println("Failed to initialise GLFW");
System.exit(1);
}
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
window = glfwCreateWindow(windowWidth, windowHeight, Constants.TITLE, 0, 0);
if (window == 0) {
System.err.println("Failed to create window.");
System.exit(1);
}
GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
int windowXPosition = (videoMode.width() - windowWidth) / 2;
int windowYPosition = (videoMode.height() - windowHeight) / 2;
glfwSetWindowPos(window, windowXPosition, windowYPosition);
glfwShowWindow(window);
glfwMakeContextCurrent(window);
GL.createCapabilities();
cshader = new ShaderProgram("shaders/cshader.vs","shaders/shader.fs");
rshader = new ShaderProgram("shaders/rshader.vs","shaders/shader.fs");
pshader1 = new ShaderProgram("shaders/pshader.vs","shaders/shader.fs");
pshader2 = new ShaderProgram("shaders/pshader2.vs","shaders/shader.fs");
pshader3 = new ShaderProgram("shaders/pshader3.vs","shaders/shader.fs");
starshader = new ShaderProgram("shaders/starshader.vs","shaders/shader.fs");
registerInputCallbacks(gameState, client);
}
示例6: main
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public static void main(String[] args) {
new Bootstrap(args);
GLFWVidMode vidmode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
Variables.WIDTH = vidmode.width();
Variables.HEIGHT = 40;
Variables.X = 0;
Variables.Y = vidmode.height() - 40;
Variables.ALWAYS_ON_TOP = true;
Variables.DECORATED = false;
Variables.TITLE = "Shell_TrayWnd";
new App(new TaskBar());
}
示例7: getPpiX
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public float getPpiX () {
intBuffer.clear();
glfwGetMonitorPhysicalSize(getWindowMonitor(), intBuffer, null);
final GLFWVidMode vidMode = glfwGetVideoMode(getWindowMonitor());
int pW = intBuffer.get();
return vidMode.width() / (pW * 0.03937f);
}
示例8: getPpcX
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public float getPpcX () {
intBuffer.clear();
glfwGetMonitorPhysicalSize(getWindowMonitor(), intBuffer, null);
final GLFWVidMode vidMode = glfwGetVideoMode(getWindowMonitor());
int pW = intBuffer.get();
return vidMode.width() / (pW / 10);
}
示例9: getDPI
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
@Override
public double getDPI() {
try(MemoryStack stack = MemoryStack.stackPush()) {
IntBuffer width = stack.ints(0), height = stack.ints(0);
glfwGetMonitorPhysicalSize(glfwGetPrimaryMonitor(), width, height);
GLFWVidMode mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
return mode.width() / (width.get(0) / 25.4);
}
}
示例10: getVideoMode
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
/**
* This function returns the current video mode of the specified monitor. If you have created a full screen window
* for that monitor, the return value will depend on whether that window is iconified.
*
* @return The current {@link VideoMode} of this monitor.
*/
public VideoMode getVideoMode()
{
GLFWVidMode mode = glfwGetVideoMode(handle);
int width = mode.width();
int height = mode.height();
int redBits = mode.redBits();
int greenBits = mode.greenBits();
int blueBits = mode.blueBits();
int refreshRate = mode.refreshRate();
return new VideoMode(width, height, redBits, greenBits, blueBits, refreshRate);
}
示例11: getWidth
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
@Override
public int getWidth() {
GLFWVidMode vm = GLFW.glfwGetVideoMode(handle);
return vm.width();
}
示例12: getDesktopDisplayMode
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public DisplayMode getDesktopDisplayMode () {
GLFWVidMode mode = glfwGetVideoMode(getWindowMonitor());
return new JglfwDisplayMode(mode.width(), mode.height(), mode.refreshRate(), mode.redBits() + mode.greenBits() + mode.blueBits());
}
示例13: LWJGLPlatform
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
public LWJGLPlatform (Config config) {
super(config);
// on the Mac we have to force AWT into headless mode to avoid conflicts with GLFW
if (needsHeadless()) {
System.setProperty("java.awt.headless", "true");
}
glfwSetErrorCallback(errorCallback = new GLFWErrorCallback() {
@Override public void invoke(int error, long description) {
log().error("GL Error (" + error + "):" + getDescription(description));
}
});
if (!glfwInit()) throw new RuntimeException("Failed to init GLFW.");
long monitor = glfwGetPrimaryMonitor();
GLFWVidMode vidMode = glfwGetVideoMode(monitor);
int width = config.width, height = config.height;
if (config.fullscreen) {
width = vidMode.width();
height = vidMode.height();
} else {
monitor = 0; // monitor == 0 means non-fullscreen window
}
// NOTE: it's easier to co-exist with GSLES2 if we leave the GLContext in "old and busted"
// mode; so all the GL3.2 "new hotness" is commented out
glfwDefaultWindowHints();
// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
// glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
// glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, 1);
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(width, height, config.appName, monitor, 0);
if (window == 0) throw new RuntimeException("Failed to create window; see error log.");
graphics = new GLFWGraphics(this, window);
input = new GLFWInput(this, window);
glfwSetWindowPos(window, (vidMode.width() - width) / 2, (vidMode.height() - height) / 2);
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
graphics.setSize(config.width, config.height, config.fullscreen);
glfwShowWindow(window);
GL.createCapabilities();
// IntBuffer vao = BufferUtils.createIntBuffer(1);
// GL30.glGenVertexArrays(vao);
// GL30.glBindVertexArray(vao.get(0));
}
示例14: screenSize
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
@Override public IDimension screenSize () {
GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
screenSize.width = vidMode.width();
screenSize.height = vidMode.height();
return screenSize;
}
示例15: initGame
import org.lwjgl.glfw.GLFWvidmode; //导入方法依赖的package包/类
private void initGame() {
// Setup error callback to print to System.err
GLFW.glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
// Initialize GLFW. Most GLFW functions will not work before doing this.
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Failed to initialize GLFW");
}
// Configure the window
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GLFW.GLFW_TRUE);
// Set default size to half the monitor resolution
final GLFWVidMode vidmode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
windowWidth = vidmode.width() / 2;
windowHeight = vidmode.height() / 2;
// Create the window
window = GLFW.glfwCreateWindow(windowWidth, windowHeight, "Ground War", MemoryUtil.NULL,
MemoryUtil.NULL);
if (window == MemoryUtil.NULL) {
throw new RuntimeException("Failed to create the GLFW window");
}
GLFW.glfwSetWindowPos(window,
(vidmode.width() - windowWidth) / 2,
(vidmode.height() - windowHeight) / 2); // Center the window
GLFW.glfwMakeContextCurrent(window);
GLFW.glfwSwapInterval(1); // Enable v-sync
GLFW.glfwShowWindow(window); // Make the window visible
GL.createCapabilities(); // LWJGL needs this
GL11.glClearColor((Colors.CLEAR >> 16 & 0xff) / 255.0f, (Colors.CLEAR >> 8 & 0xff) / 255.0f,
(Colors.CLEAR & 0xff) / 255.0f, 1.0f);
GL11.glOrtho(0, Constants.RES_WIDTH, Constants.RES_HEIGHT, 0, -1, 1);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Initialize input handlers
GLFW.glfwSetKeyCallback(window, keyHandler);
GLFW.glfwSetMouseButtonCallback(window, mouseButtonHandler);
GLFW.glfwSetCursorPosCallback(window, cursorPosHandler);
GLFW.glfwSetWindowSizeCallback(window, windowResizeHandler);
renderer = new Renderer();
loadNewBoard();
currentScreen = new MainMenuScreen(); // Initialize the current screen
}