Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Lwjgl backend files to Gdx #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.katzstudio.kreativity.ui.backend.lwjgl3;
package com.katzstudio.kreativity.ui.backend.gdx;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
Expand All @@ -19,26 +19,26 @@
import java.util.Map;

/**
* This backed works with the libgdx Lwjgl3 backend.
* This backend works with libgdx.
*/
public class KrLwjgl3Backend implements KrBackend {
public class KrGdxBackend implements KrBackend {

private final Map<Color, Drawable> drawableCache = new HashMap<>();

private final KrLwjgl3Renderer renderer;
private final KrGdxRenderer renderer;

private final KrLwjgl3FontMetrics fontMetrics;
private final KrGdxFontMetrics fontMetrics;

private final KrLwjgl3InputSource inputSource;
private final KrGdxInputSource inputSource;

private final Clipboard clipboard;

private KrCursor currentCursor;

public KrLwjgl3Backend() {
renderer = new KrLwjgl3Renderer();
fontMetrics = new KrLwjgl3FontMetrics();
inputSource = new KrLwjgl3InputSource();
public KrGdxBackend() {
renderer = new KrGdxRenderer();
fontMetrics = new KrGdxFontMetrics();
inputSource = new KrGdxInputSource();
clipboard = Gdx.app.getClipboard();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.katzstudio.kreativity.ui.backend.lwjgl3;
package com.katzstudio.kreativity.ui.backend.gdx;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.math.Rectangle;
import com.katzstudio.kreativity.ui.KrFontMetrics;

/**
* {@link KrFontMetrics} implementation for the libgdx lwjgl3 backend
* {@link KrFontMetrics} implementation for the libgdx backend
*/
public class KrLwjgl3FontMetrics extends KrFontMetrics {
public class KrGdxFontMetrics extends KrFontMetrics {

private GlyphLayout layout = new GlyphLayout();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.katzstudio.kreativity.ui.backend.lwjgl3;
package com.katzstudio.kreativity.ui.backend.gdx;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
Expand All @@ -17,9 +17,9 @@
import static com.badlogic.gdx.Input.Keys.*;

/**
* {@link KrInputSource} implementation for libgdx lwjgl3 backend.
* {@link KrInputSource} implementation for the libgdx backend.
*/
public class KrLwjgl3InputSource extends InputAdapter implements KrInputSource {
public class KrGdxInputSource extends InputAdapter implements KrInputSource {

private static final float KEY_REPEAT_INITIAL_TIME = 0.4f;

Expand Down Expand Up @@ -63,7 +63,7 @@ public class KrLwjgl3InputSource extends InputAdapter implements KrInputSource {

private Vector2 mousePosition = new Vector2();

public KrLwjgl3InputSource() {
public KrGdxInputSource() {
// TODO: investigate pointer offset on MAC OSX. Compensating here with a small hack
if (((String) System.getProperties().get("os.name")).contains("Mac")) {
inputOffsetX = -4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.katzstudio.kreativity.ui.backend.lwjgl3;
package com.katzstudio.kreativity.ui.backend.gdx;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
Expand All @@ -22,9 +22,9 @@
import static com.katzstudio.kreativity.ui.KrToolkit.getDefaultToolkit;

/**
* {@link KrRenderer} implementation for the libgdx lwjgl3 backend
* {@link KrRenderer} implementation for the libgdx backend
*/
public class KrLwjgl3Renderer extends KrRenderer {
public class KrGdxRenderer extends KrRenderer {

private final RenderMode spriteBatchRenderMode;

Expand Down Expand Up @@ -56,7 +56,7 @@ public class KrLwjgl3Renderer extends KrRenderer {

@Getter private float opacity = 1;

public KrLwjgl3Renderer() {
public KrGdxRenderer() {
spriteBatch = new SpriteBatch(100);
shapeRenderer = new ShapeRenderer(100);
shapeRenderer.setAutoShapeType(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import com.badlogic.gdx.graphics.Color;
import com.katzstudio.kreativity.ui.backend.lwjgl3.KrLwjgl3Renderer;
import com.katzstudio.kreativity.ui.backend.gdx.KrGdxRenderer;
import com.katzstudio.kreativity.ui.render.KrColorBrush;
import com.katzstudio.kreativity.ui.render.KrRenderer;

Expand All @@ -30,7 +30,7 @@ public void create() {
gl.glDepthMask(true);
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
renderer = new KrLwjgl3Renderer();
renderer = new KrGdxRenderer();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/katzstudio/kreativity/ui/demo/UiDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.katzstudio.kreativity.ui.*;
import com.katzstudio.kreativity.ui.backend.lwjgl3.KrLwjgl3Backend;
import com.katzstudio.kreativity.ui.backend.gdx.KrGdxBackend;
import com.katzstudio.kreativity.ui.component.*;
import com.katzstudio.kreativity.ui.component.KrMenu.KrMenuItem;
import com.katzstudio.kreativity.ui.component.KrMenu.KrMenuItemSeparator;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void create() {
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.glClearColor(0.3f, 0.3f, 0.3f, 1);

KrToolkit.initialize(new KrLwjgl3Backend());
KrToolkit.initialize(new KrGdxBackend());
Gdx.input.setInputProcessor((InputAdapter) getDefaultToolkit().getInputSource());
canvas = KrToolkit.getDefaultToolkit().getCanvas();

Expand Down