aboutsummaryrefslogtreecommitdiff
path: root/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3WindowConfiguration.java
blob: edbac858cc751cc73832dc628371c3cb485c9937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.backends.lwjgl3;

import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics.Lwjgl3DisplayMode;
import com.badlogic.gdx.graphics.Color;

public class Lwjgl3WindowConfiguration {
	int windowX = -1;
	int windowY = -1;
	int windowWidth = 640;
	int windowHeight = 480;
	boolean windowResizable = true;
	boolean windowDecorated = true;
	Lwjgl3WindowListener windowListener;
	Lwjgl3DisplayMode fullscreenMode;
	String title = "";
	Color initialBackgroundColor = Color.BLACK;
	
	/**
	 * Sets the app to use windowed mode.
	 * 
	 * @param width
	 *            the width of the window (default 640)
	 * @param height
	 *            the height of the window (default 480)
	 */
	public void setWindowedMode(int width, int height) {
		this.windowWidth = width;
		this.windowHeight = height;		
	}
	
	/** 
	 * @param resizable whether the windowed mode window is resizable
	 */
	public void setResizable(boolean resizable) {
		this.windowResizable = resizable;
	}
	
	/**
	 * @param decorated whether the windowed mode window is decorated, i.e. displaying the title bars (default true)
	 */
	public void setDecorated(boolean decorated) {
		this.windowDecorated = decorated;
	}
	
	/**
	 * Sets the position of the window in windowed mode on the
	 * primary monitor. Default -1 for booth coordinates for centered.
	 */
	public void setWindowPosition(int x, int y) {
		windowX = x;
		windowY = y;
	}
	
	/**
	 * Sets the {@link Lwjgl3WindowListener} which will be informed about
	 * iconficiation, focus loss and window close events.
	 */
	public void setWindowListener(Lwjgl3WindowListener windowListener) {
		this.windowListener = windowListener;
	}

	/**
	 * Sets the app to use fullscreen mode. Use the static methods like
	 * {@link #getDisplayMode()} on this class to enumerate connected monitors
	 * and their fullscreen display modes.
	 */
	public void setFullscreenMode(DisplayMode mode) {
		this.fullscreenMode = (Lwjgl3DisplayMode)mode;
	}
	
	/**
	 * Sets the window title. Defaults to empty string.
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Sets the initial background color. Defaults to black.
	 */
	public void setInitialBackgroundColor(Color color) {
		initialBackgroundColor = color;
	}
}