Remove click drag test system

This commit is contained in:
Retera 2020-10-25 12:05:16 -04:00
parent 5b7db285e2
commit e21bb492c1
7 changed files with 62 additions and 54 deletions

View File

@ -161,8 +161,8 @@ public class WarsmashGdxMapGame extends ApplicationAdapter implements CanvasProv
// this.mainModel = (MdxModel) this.viewer.load("UI\\Glues\\MainMenu\\MainMenu3D_exp\\MainMenu3D_exp.mdx",
// libGDX stuff
final float w = Gdx.graphics.getWidth();
final float h = Gdx.graphics.getHeight();
final int width = Gdx.graphics.getWidth();
final int height = Gdx.graphics.getHeight();
final FreeTypeFontGenerator fontGenerator = new FreeTypeFontGenerator(
new DataSourceFileHandle(this.viewer.dataSource, "fonts\\FRIZQT__.TTF"));
@ -177,8 +177,18 @@ public class WarsmashGdxMapGame extends ApplicationAdapter implements CanvasProv
// height
// Height is multiplied by aspect ratio.
this.uiCamera = new OrthographicCamera();
this.uiViewport = new ExtendViewport(1600, 1200, this.uiCamera);
this.uiViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
int aspect3By4Width;
int aspect3By4Height;
if (width < ((height * 4) / 3)) {
aspect3By4Width = width;
aspect3By4Height = (width * 3) / 4;
}
else {
aspect3By4Width = (height * 4) / 3;
aspect3By4Height = height;
}
this.uiViewport = new ExtendViewport(aspect3By4Width, aspect3By4Height, this.uiCamera);
this.uiViewport.update(width, height);
this.uiCamera.position.set(this.uiViewport.getMinWorldWidth() / 2, this.uiViewport.getMinWorldHeight() / 2, 0);
this.uiCamera.update();
@ -237,7 +247,7 @@ public class WarsmashGdxMapGame extends ApplicationAdapter implements CanvasProv
updateUIScene();
resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
resize(width, height);
try {
this.viewer.loadAfterUI();

View File

@ -0,0 +1,33 @@
package com.etheller.warsmash.parsers.fdf.frames;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.etheller.warsmash.parsers.fdf.datamodel.Vector4Definition;
import com.etheller.warsmash.parsers.mdlx.Layer.FilterMode;
public class FilterModeTextureFrame extends TextureFrame {
private int blendSrc;
private int blendDst;
public FilterModeTextureFrame(final String name, final UIFrame parent, final boolean decorateFileNames,
final Vector4Definition texCoord) {
super(name, parent, decorateFileNames, texCoord);
}
@Override
protected void internalRender(final SpriteBatch batch, final BitmapFont baseFont, final GlyphLayout glyphLayout) {
final int blendDstFunc = batch.getBlendDstFunc();
final int blendSrcFunc = batch.getBlendSrcFunc();
batch.setBlendFunction(this.blendSrc, this.blendDst);
super.internalRender(batch, baseFont, glyphLayout);
batch.setBlendFunction(blendSrcFunc, blendDstFunc);
}
public void setFilterMode(final FilterMode filterMode) {
final int[] layerFilterMode = com.etheller.warsmash.viewer5.handlers.mdx.FilterMode.layerFilterMode(filterMode);
this.blendSrc = layerFilterMode[0];
this.blendDst = layerFilterMode[1];
}
}

View File

@ -66,9 +66,6 @@ public class TextureFrame extends AbstractRenderableFrame {
@Override
public UIFrame touchDown(final float screenX, final float screenY, final int button) {
if (this.renderBounds.contains(screenX, screenY)) {
return this;
}
return super.touchDown(screenX, screenY, button);
}
}

View File

@ -0,0 +1,5 @@
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.orders;
public class COrderTargetWidget {
}

View File

@ -14,7 +14,6 @@ import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
@ -138,8 +137,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
private int selectedSoundCount = 0;
private final ActiveCommandUnitTargetFilter activeCommandUnitTargetFilter;
private UIFrame clickUI = null;
public MeleeUI(final DataSource dataSource, final Viewport uiViewport, final FreeTypeFontGenerator fontGenerator,
final Scene uiScene, final Scene portraitScene, final CameraPreset[] cameraPresets,
final CameraRates cameraRates, final War3MapViewer war3MapViewer, final RootFrameListener rootFrameListener,
@ -421,7 +418,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
mouseX = Math.max(minX, Math.min(maxX, mouseX));
mouseY = Math.max(minY, Math.min(maxY, mouseY));
// Gdx.input.setCursorPosition(mouseX, mouseY);
if (Gdx.input.isCursorCatched()) {
Gdx.input.setCursorPosition(mouseX, mouseY);
}
screenCoordsVector.set(mouseX, mouseY);
this.uiViewport.unproject(screenCoordsVector);
@ -481,18 +480,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.meleeUIMinimap.render(batch, this.war3MapViewer.units);
this.timeIndicator.setFrameByRatio(this.war3MapViewer.simulation.getGameTimeOfDay()
/ this.war3MapViewer.simulation.getGameplayConstants().getGameDayHours());
if (this.clickUI != null) {
batch.end();
this.shapeRenderer.setProjectionMatrix(this.uiViewport.getCamera().combined);
this.shapeRenderer.begin(ShapeType.Line);
this.shapeRenderer.rect(this.clickUI.getFramePointX(FramePoint.LEFT),
this.clickUI.getFramePointY(FramePoint.BOTTOM),
this.clickUI.getFramePointX(FramePoint.RIGHT) - this.clickUI.getFramePointX(FramePoint.LEFT),
this.clickUI.getFramePointY(FramePoint.TOP) - this.clickUI.getFramePointY(FramePoint.BOTTOM));
this.shapeRenderer.end();
batch.begin();
}
}
public void portraitTalk() {
@ -787,8 +774,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.cameraManager.scrolled(amount);
}
private float lastX, lastY;
public boolean touchDown(final int screenX, final int screenY, final float worldScreenY, final int button) {
screenCoordsVector.set(screenX, screenY);
this.uiViewport.unproject(screenCoordsVector);
@ -797,8 +782,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
screenCoordsVector.y);
this.cameraManager.target.x = worldPoint.x;
this.cameraManager.target.y = worldPoint.y;
this.lastX = screenCoordsVector.x;
this.lastY = screenCoordsVector.y;
return true;
}
final UIFrame clickedUIFrame = this.rootFrame.touchDown(screenCoordsVector.x, screenCoordsVector.y, button);
@ -973,11 +956,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
}
}
}
else {
this.clickUI = clickedUIFrame;
this.lastX = screenCoordsVector.x;
this.lastY = screenCoordsVector.y;
}
return false;
}
@ -988,19 +966,13 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
public boolean touchDragged(final int screenX, final int screenY, final float worldScreenY, final int pointer) {
screenCoordsVector.set(screenX, screenY);
this.uiViewport.unproject(screenCoordsVector);
final float dx = screenCoordsVector.x - this.lastX;
final float dy = screenCoordsVector.y - this.lastY;
if (this.meleeUIMinimap.containsMouse(screenCoordsVector.x, screenCoordsVector.y)) {
this.meleeUIMinimap.touchDragged(screenX, screenY, worldScreenY, pointer, dx, dy);
final Vector2 worldPoint = this.meleeUIMinimap.getWorldPointFromScreen(screenCoordsVector.x,
screenCoordsVector.y);
this.cameraManager.target.x = worldPoint.x;
this.cameraManager.target.y = worldPoint.y;
}
else if (this.clickUI != null) {
this.clickUI.setFramePointX(FramePoint.LEFT, this.clickUI.getFramePointX(FramePoint.LEFT) + dx);
this.clickUI.setFramePointY(FramePoint.BOTTOM, this.clickUI.getFramePointY(FramePoint.BOTTOM) + dy);
}
this.lastX = screenCoordsVector.x;
this.lastY = screenCoordsVector.y;
return false;
}
}

View File

@ -59,12 +59,4 @@ public class MeleeUIMinimap {
public boolean containsMouse(final float x, final float y) {
return this.minimapFilledArea.contains(x, y);
}
public void touchDragged(final int screenX, final int screenY, final float worldScreenY, final int pointer,
final float dx, final float dy) {
this.minimapFilledArea.x += dx;
this.minimapFilledArea.y += dy;
this.minimap.x += dx;
this.minimap.y += dy;
}
}

View File

@ -24,7 +24,7 @@ import com.etheller.warsmash.viewer5.gl.SoundLengthExtension;
import com.etheller.warsmash.viewer5.gl.WireframeExtension;
public class DesktopLauncher {
public static void main(String[] arg) {
public static void main(final String[] arg) {
Extensions.angleInstancedArrays = new ANGLEInstancedArrays() {
@Override
public void glVertexAttribDivisorANGLE(final int index, final int divisor) {
@ -83,11 +83,10 @@ public class DesktopLauncher {
config.useGL30 = true;
config.gles30ContextMajorVersion = 3;
config.gles30ContextMinorVersion = 3;
//config.samples = 16;
// config.samples = 16;
// config.vSyncEnabled = false;
// config.foregroundFPS = 0;
// config.backgroundFPS = 0;
arg = new String[]{"-windowed"};
if ((arg.length > 0) && "-windowed".equals(arg[0])) {
config.fullscreen = false;
}