com.badlogic.gdx.Graphics Java Examples

The following examples show how to use com.badlogic.gdx.Graphics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShatteredPixelDungeon.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void resize(int width, int height) {
	
	if (scene instanceof PixelScene &&
			(height != Game.height || width != Game.width)) {
		((PixelScene) scene).saveWindows();
	}
	
	super.resize(width, height);

	Graphics.DisplayMode mode = Gdx.graphics.getDisplayMode();
	boolean maximized = width >= mode.width || height >= mode.height;
	
	if (!maximized && !SPDSettings.fullscreen()){
		SPDSettings.put(SPDSettings.KEY_WINDOW_WIDTH, width);
		SPDSettings.put(SPDSettings.KEY_WINDOW_HEIGHT, height);
	}
}
 
Example #2
Source File: DesktopLauncher.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void centerWindow(Graphics graphics) {
    var g = (Lwjgl3Graphics) graphics;
    var mode = g.getDisplayMode();
    var window = g.getWindow();
    window.setPosition(mode.width / 2 - g.getWidth() / 2, mode.height / 2 - g.getHeight() / 2);
}
 
Example #3
Source File: DesktopLauncher.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void sizeWindowToFit(int maxWidth, int maxHeight, int displayBorder, Graphics graphics) {
    var mode = graphics.getDisplayMode();
    
    int width = Math.min(mode.width - displayBorder * 2, maxWidth);
    int height = Math.min(mode.height - displayBorder * 2, maxHeight);
    
    graphics.setWindowedMode(width, height);
    
    centerWindow(graphics);
}
 
Example #4
Source File: DeferredRunnableTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    Mdx.platform = Platform.WINDOWS;

    mockery.setImposteriser(ClassImposteriser.INSTANCE);

    assetManager = mockery.mock(AssetManager.class);
    graphics = mockery.mock(Graphics.class);
    uiContainer = mockery.mock(UiContainer.class);
    Gdx.graphics = graphics;
}
 
Example #5
Source File: GdxDemoActivity.java    From thunderboard-android with Apache License 2.0 4 votes vote down vote up
public Graphics getGraphics() {
    return this.graphics;
}
 
Example #6
Source File: MainLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public static Graphics.DisplayMode[] getAvailableDisplayMode() {
	return LwjglApplicationConfiguration.getDisplayModes();
}
 
Example #7
Source File: MainLoader.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public static Graphics.DisplayMode getDesktopDisplayMode() {
	return LwjglApplicationConfiguration.getDesktopDisplayMode();
}
 
Example #8
Source File: DesktopMini2DxGame.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
@Override
public Graphics getGraphics() {
	return currentWindow.getGraphics();
}
 
Example #9
Source File: DesktopWorker.java    From skin-composer with MIT License votes vote down vote up
void sizeWindowToFit(int maxWidth, int maxHeight, int displayBorder, Graphics graphics); 
Example #10
Source File: DesktopWorker.java    From skin-composer with MIT License votes vote down vote up
void centerWindow(Graphics graphics);