Jump to content

The constructor DisplayMode(int, int) is undefined. (Error in LWGJL)

Nineshadow
Go to solution Solved by Nineshadow,

Nevermind.I found the problem. @Ciccioo

 

I was importing the wrong DisplayMode.

Should have been : 

import org.lwjgl.opengl.DisplayMode;

So,I've started working on a game engine in Java using LWJGL and Slick_util and this is what I've got so far :

Main class :

package com.base.engine;public class MainComponent {		public static final int WIDTH = 800;	public static final int HEIGHT = 600;	public static final String TITLE = "Game";		public static void main(String[] args) {		Window.createWindow(WIDTH, HEIGHT, TITLE);			}}

Window class :

package com.base.engine;import java.awt.DisplayMode;import org.lwjgl.LWJGLException;import org.lwjgl.opengl.Display;public class Window {		public static void createWindow(int width, int height,String title) {		Display.setTitle(title);                try { 		Display.setDisplayMode(new DisplayMode(width, height));                Display.create();   }catch (LWGJLException e) {e.printStackTrace()}                 	}}

Now,at the new DisplayMode constructor it asks me for 4 arguments,which is total bullshit,but I just added some random numbers and then it asks me to change "Display.setDisplayMode" to "Display.setDisplayModeAndFullscreen".THEEEN it asks me to change it back,and it simply keeps crashing.Why the hell do I have to use 4 arguments to construct a DisplayMode?

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

i have no idea what you're doing and how it works, but if that thing needs 4 parameters, i guess it just needs 4 parameters

 

width

height

bit depth

refresh rate

 

and yes, pushing random numbers in things may lead to suddent death of the program

 

because documentation: http://docs.oracle.com/javase/7/docs/api/java/awt/DisplayMode.html

Link to comment
Share on other sites

Link to post
Share on other sites

i have no idea what you're doing and how it works, but if that thing needs 4 parameters, i guess it just needs 4 parameters

 

width

height

bit depth

refresh rate

 

and yes, pushing random numbers in things may lead to suddent death of the program

 

because documentation: http://docs.oracle.com/javase/7/docs/api/java/awt/DisplayMode.html

But it doesn't need 4 parameters.

 

http://lwjgl.org/javadoc/org/lwjgl/opengl/DisplayMode.html

 

DisplayMode(int width, int height)

Construct a display mode.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Nevermind.I found the problem. @Ciccioo

 

I was importing the wrong DisplayMode.

Should have been : 

import org.lwjgl.opengl.DisplayMode;

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×