mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
convert point to vector2
This commit is contained in:
@@ -296,7 +296,7 @@ public class Forge implements ApplicationListener {
|
||||
|
||||
afterDBloaded = true;
|
||||
//selection
|
||||
if (isLandscapeMode() && !GuiBase.isAndroid())
|
||||
if (isLandscapeMode())
|
||||
splashScreen.setShowModeSelector(true);
|
||||
else
|
||||
openHomeDefault();
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.badlogic.gdx.utils.Align;
|
||||
import forge.Forge;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Controls;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.util.Localizer;
|
||||
|
||||
@@ -171,6 +172,7 @@ public class SettingsScene extends UIScene {
|
||||
addLabel("Plane");
|
||||
settingGroup.add(plane).align(Align.right);
|
||||
|
||||
if (!GuiBase.isAndroid()) {
|
||||
addSettingField("Fullscreen", Config.instance().getSettingData().fullScreen, new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
@@ -194,6 +196,7 @@ public class SettingsScene extends UIScene {
|
||||
Config.instance().saveSettings();
|
||||
}
|
||||
});
|
||||
}
|
||||
addCheckBox(localizer.getMessage("lblCardName"), ForgePreferences.FPref.UI_OVERLAY_CARD_NAME);
|
||||
addSettingSlider(localizer.getMessage("cbAdjustMusicVolume"), ForgePreferences.FPref.UI_VOL_MUSIC,0,100);
|
||||
addSettingSlider(localizer.getMessage("cbAdjustSoundsVolume"), ForgePreferences.FPref.UI_VOL_SOUNDS, 0,100);
|
||||
@@ -207,8 +210,8 @@ public class SettingsScene extends UIScene {
|
||||
addCheckBox(localizer.getMessage("lblBattlefieldTextureFiltering"), ForgePreferences.FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||
addCheckBox(localizer.getMessage("lblAltZoneTabs"), ForgePreferences.FPref.UI_ALT_PLAYERZONETABS);
|
||||
addCheckBox(localizer.getMessage("lblAnimatedCardTapUntap"), ForgePreferences.FPref.UI_ANIMATED_CARD_TAPUNTAP);
|
||||
if (!GuiBase.isAndroid()) {
|
||||
addCheckBox(localizer.getMessage("lblBorderMaskOption"), ForgePreferences.FPref.UI_ENABLE_BORDER_MASKING);
|
||||
if (!Forge.isMobileAdventureMode) {
|
||||
addCheckBox(localizer.getMessage("lblPreloadExtendedArtCards"), ForgePreferences.FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
||||
addCheckBox(localizer.getMessage("lblAutoCacheSize"), ForgePreferences.FPref.UI_AUTO_CACHE_SIZE);
|
||||
addCheckBox(localizer.getMessage("lblDisposeTextures"), ForgePreferences.FPref.UI_ENABLE_DISPOSE_TEXTURES);
|
||||
|
||||
@@ -3,10 +3,10 @@ package forge.adventure.stage;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import forge.adventure.world.WorldSave;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -37,36 +37,36 @@ public class WorldBackground extends Actor {
|
||||
if (chunks == null) {
|
||||
initialize();
|
||||
}
|
||||
Point pos = translateFromWorldToChunk(playerX, playerY);
|
||||
Vector2 pos = translateFromWorldToChunk(playerX, playerY);
|
||||
if (currentChunkX != pos.x || currentChunkY != pos.y) {
|
||||
int xDiff = currentChunkX - pos.x;
|
||||
int yDiff = currentChunkY - pos.y;
|
||||
ArrayList<Point> points = new ArrayList<Point>();
|
||||
int xDiff = currentChunkX - (int)pos.x;
|
||||
int yDiff = currentChunkY - (int)pos.y;
|
||||
ArrayList<Vector2> points = new ArrayList<>();
|
||||
for (int x = -1; x < 2; x++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
points.add(new Point(pos.x + x, pos.y + y));
|
||||
points.add(new Vector2(pos.x + x, pos.y + y));
|
||||
}
|
||||
}
|
||||
for (int x = -1; x < 2; x++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
Point point = new Point(currentChunkX + x, currentChunkY + y);
|
||||
Vector2 point = new Vector2(currentChunkX + x, currentChunkY + y);
|
||||
if (points.contains(point))// old Point is part of new points
|
||||
{
|
||||
points.remove(point);
|
||||
} else {
|
||||
if (point.y < 0 || point.x < 0 || point.y >= chunks[0].length || point.x >= chunks.length)
|
||||
continue;
|
||||
unLoadChunk(point.x, point.y);
|
||||
unLoadChunk((int)point.x, (int)point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Point point : points) {
|
||||
for (Vector2 point : points) {
|
||||
if (point.y < 0 || point.x < 0 || point.y >= chunks[0].length || point.x >= chunks.length)
|
||||
continue;
|
||||
loadChunk(point.x, point.y);
|
||||
loadChunk((int)point.x, (int)point.y);
|
||||
}
|
||||
currentChunkX = pos.x;
|
||||
currentChunkY = pos.y;
|
||||
currentChunkX = (int)pos.x;
|
||||
currentChunkY = (int)pos.y;
|
||||
}
|
||||
batch.disableBlending();
|
||||
for (int x = -1; x < 2; x++) {
|
||||
@@ -75,7 +75,7 @@ public class WorldBackground extends Actor {
|
||||
continue;
|
||||
|
||||
|
||||
batch.draw(getChunkTexture(pos.x + x, pos.y + y), transChunkToWorld(pos.x + x), transChunkToWorld(pos.y + y));
|
||||
batch.draw(getChunkTexture((int)pos.x + x, (int)pos.y + y), transChunkToWorld((int)pos.x + x), transChunkToWorld((int)pos.y + y));
|
||||
}
|
||||
}
|
||||
batch.enableBlending();
|
||||
@@ -154,10 +154,10 @@ public class WorldBackground extends Actor {
|
||||
|
||||
for (int x = -1; x < 2; x++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
Point point = new Point(currentChunkX + x, currentChunkY + y);
|
||||
Vector2 point = new Vector2(currentChunkX + x, currentChunkY + y);
|
||||
if (point.y < 0 || point.x < 0 || point.y >= chunks[0].length || point.x >= chunks.length)
|
||||
continue;
|
||||
loadChunk(point.x, point.y);
|
||||
loadChunk((int)point.x, (int)point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,10 +171,10 @@ public class WorldBackground extends Actor {
|
||||
return xy * tileSize * chunkSize;
|
||||
}
|
||||
|
||||
Point translateFromWorldToChunk(float x, float y) {
|
||||
Vector2 translateFromWorldToChunk(float x, float y) {
|
||||
float worldWidthTiles = x / tileSize;
|
||||
float worldHeightTiles = y / tileSize;
|
||||
return new Point((int) worldWidthTiles / chunkSize, (int) worldHeightTiles / chunkSize);
|
||||
return new Vector2((int) worldWidthTiles / chunkSize, (int) worldHeightTiles / chunkSize);
|
||||
}
|
||||
|
||||
public void setPlayerPos(float x, float y) {
|
||||
|
||||
Reference in New Issue
Block a user