本文整理匯總了Java中org.lwjgl.opengl.Display.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java Display.setTitle方法的具體用法?Java Display.setTitle怎麽用?Java Display.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.opengl.Display
的用法示例。
在下文中一共展示了Display.setTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDisplay
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("MRCEngine");
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
示例2: Window
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(1, 1, 1);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例3: createDisplay
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private void createDisplay() throws LWJGLException {
Display.setResizable(true);
Display.setTitle("Minecraft 1.8.8");
try {
Display.create((new PixelFormat()).withDepthBits(24));
} catch (LWJGLException lwjglexception) {
logger.error((String) "Couldn\'t set pixel format", (Throwable) lwjglexception);
try {
Thread.sleep(1000L);
} catch (InterruptedException var3) {
;
}
if (this.fullscreen) {
this.updateDisplayMode();
}
Display.create();
}
}
示例4: main
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void main(String[] args) {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Display Test");
Display.create();
// create() throws LWJGLException
} catch (LWJGLException e) {
System.err.println("Display wasn't initialized correctly.");
// Throws an exit code of 1
System.exit(1);
}
// While nobody is trying to close the window
while (!Display.isCloseRequested()) {
Display.update();
// FPS is the parameter
Display.sync(60);
}
}
示例5: main
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void main(String[] args) {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("A Fresh New Display");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
while (!Display.isCloseRequested()) {
// render code
// input handling code
// refresh display and poll input
Display.update();
// Maintain a 60fps frame rate
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例6: createDisplay
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static DisplayManager createDisplay(){
try {
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.create(new PixelFormat().withDepthBits(24).withSamples(4));
Display.setTitle(TITLE);
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
System.err.println("Couldn't create display!");
System.exit(-1);
}
GL11.glViewport(0,0, WIDTH, HEIGHT);
return new DisplayManager();
}
示例7: run
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private void run(){
long lns = System.nanoTime();
double ns = 1000000000.0/20.0;
long ls = System.currentTimeMillis();
int fps = 0, tps = 0;
while (!Display.isCloseRequested() && running) {
if(System.nanoTime() - lns > ns){
lns+=ns;
tps++;
update();
}else{
fps++;
render();
Display.update();
}
if(System.currentTimeMillis() - ls >= 1000){
ls = System.currentTimeMillis();
Display.setTitle(title+" | FPS : "+fps+" | TPS : "+tps);
fps = 0; tps = 0;
}
}
Display.destroy();
System.exit(0);
}
示例8: createDisplay
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private void createDisplay() throws LWJGLException
{
Display.setResizable(true);
Display.setTitle("Minecraft 1.8.8");
try
{
Display.create((new PixelFormat()).withDepthBits(24));
}
catch (LWJGLException lwjglexception)
{
logger.error((String)"Couldn\'t set pixel format", (Throwable)lwjglexception);
try
{
Thread.sleep(1000L);
}
catch (InterruptedException var3)
{
;
}
if (this.fullscreen)
{
this.updateDisplayMode();
}
Display.create();
}
}
示例9: Boot
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public Boot() {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Minecraft 2D");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
grid = new BlockGrid();
grid.setAt(10, 10, selection);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
while (!Display.isCloseRequested()) {
// Render Code here
glClear(GL_COLOR_BUFFER_BIT);
input();
grid.draw();
drawSelectionBox();
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例10: createDisplay
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private void createDisplay() throws LWJGLException
{
Display.setResizable(true);
Display.setTitle("Minecraft 1.10.2");
try
{
Display.create((new PixelFormat()).withDepthBits(24));
}
catch (LWJGLException lwjglexception)
{
LOGGER.error((String)"Couldn\'t set pixel format", (Throwable)lwjglexception);
try
{
Thread.sleep(1000L);
}
catch (InterruptedException var3)
{
;
}
if (this.fullscreen)
{
this.updateDisplayMode();
}
Display.create();
}
}
示例11: main
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void main(String[] args) throws FileNotFoundException {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("OpenAL Demo");
Display.create();
AL.create();
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
AL.destroy();
System.exit(1);
}
WaveData data = WaveData.create(new BufferedInputStream(new FileInputStream("res" + File.separatorChar +
"sounds" + File.separatorChar + "thump.wav")));
int buffer = alGenBuffers();
alBufferData(buffer, data.format, data.data, data.samplerate);
data.dispose();
int source = alGenSources();
alSourcei(source, AL_BUFFER, buffer);
while (!Display.isCloseRequested()) {
while (Keyboard.next()) {
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
alSourcePlay(source);
}
}
Display.update();
Display.sync(60);
}
alDeleteBuffers(buffer);
AL.destroy();
Display.destroy();
System.exit(0);
}
示例12: StateDemo
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private StateDemo() {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Game States");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
while (!Display.isCloseRequested()) {
// Render Code here
glClear(GL_COLOR_BUFFER_BIT);
render();
checkInput();
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例13: Replace
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
public static void Replace() {
if (Config.windowTitle != "") {
Display.setTitle(processText(Config.windowTitle));
}
}
示例14: ShiftingCameraLaterally
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
private ShiftingCameraLaterally() {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("X Axis Camera Movement");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
float x_cam = 0;
while (!Display.isCloseRequested()) {
// Render Code here
glClear(GL_COLOR_BUFFER_BIT);
// Put a matrix that's a clone of the original into the matrix stock
glPushMatrix();
// Pushes screen laterally, depending on x_cam
glTranslatef(x_cam, 0, 0);
// Move screen with the Mouse speed
// if the mouse is in the window and space is pressed
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)
&& Mouse.getX() > 0 && Mouse.getX() < 639) {
x_cam += Mouse.getDX();
}
// True coords of the mouse
float mousex = Mouse.getX() - x_cam;
float mousey = 480 - Mouse.getY() - 1;
System.out.println(mousex + ", " + mousey);
glBegin(GL_QUADS);
glVertex2i(400, 400);
glVertex2i(450, 400);
glVertex2i(450, 450);
glVertex2i(400, 450);
glEnd();
glBegin(GL_LINES);
glVertex2i(400, 400);
glVertex2i(400, 400);
glEnd();
// Disposes of translations made to the matrix
glPopMatrix();
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例15: preInit
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
@Override
public void preInit(FMLPreInitializationEvent event) {
Display.setTitle("Minceraft 1.7.10");
}