Commit 7ebd1bc1 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

Merge branch 'feature-desktop-hd-assets' into 'V3.6.3'

#884 Feature desktop hd assets

See merge request !714
parents 985ccb6c 993f0a81
......@@ -463,8 +463,8 @@ public class CrimeSceneGame extends AbstractTablexiaGame<CrimeSceneGameState> {
highlightedGameObjectLayer.addActor(gameObject);
gameObject.getAction().setBounds(0, 0, ACTION_CARD_EXTRA_LARGE, ACTION_CARD_EXTRA_LARGE);
gameObject.setPosition(getViewportWidth() / 2 - ACTION_CARD_EXTRA_LARGE / 2 - actionsStripWidget.getWidth() / 2,
getViewportHeight() / 2 - ACTION_CARD_EXTRA_LARGE / 2);
gameObject.setPosition(getViewportWidth() / 2 - gameObject.getAction().getWidth() / 2 - actionsStripWidget.getWidth() / 2,
getViewportHeight() / 2 - gameObject.getAction().getHeight() / 2);
setDimmerVisible(true);
replayMusic(gameObject);
......
......@@ -24,12 +24,14 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.DragListener;
import com.badlogic.gdx.utils.Timer;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.util.entity.Touch;
class DesktopCrimeSceneAction extends CrimeSceneAction {
private static final float DELAY = 0.15f;
private static final float DEFAULT_DESKTOP_DOWNSCALE = 0.45f;
private Touch lastRecordedTouchDown;
private boolean lastTapValid;
......@@ -40,6 +42,9 @@ class DesktopCrimeSceneAction extends CrimeSceneAction {
public DesktopCrimeSceneAction(String texturePath, int orderNumber, int actionSize, AbstractTablexiaGame tablexiaGame, int actionNumber, GameObject gameObject) {
super(texturePath, orderNumber, actionSize, tablexiaGame, actionNumber, gameObject);
if (TablexiaSettings.getInstance().isUseHdAssets()){
setSize(getWidth() * DEFAULT_DESKTOP_DOWNSCALE, getHeight() * DEFAULT_DESKTOP_DOWNSCALE);
}
timer = new Timer();
}
......
......@@ -27,6 +27,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.game.games.protocol.ProtocolGame;
import cz.nic.tablexia.game.games.protocol.controller.RoomPosition;
import cz.nic.tablexia.game.games.protocol.gameobjects.furniture.Furniture;
......@@ -65,6 +66,9 @@ public class GameObject extends ObjectModel {
private static final float LABEL_WITH_RATIO = 0.95f;
private static final float LABEL_PADDING_BOTTOM = 18f;
private static final float DEFAULT_SCALE_NONE = 1f;
private static final float DEFAULT_SCALE_DESKTOP_HD = 0.45f;
private boolean biggerScale = false;
private boolean inRoom = false;
......@@ -149,9 +153,10 @@ public class GameObject extends ObjectModel {
}
private void changeSize() {
if (isInRoom())
objectImage.setSize(objectImage.getDrawable().getMinWidth(), objectImage.getDrawable().getMinHeight());
else
if (isInRoom()) {
float scaleFactor = TablexiaSettings.getInstance().isUseHdAssets() ? DEFAULT_SCALE_DESKTOP_HD : DEFAULT_SCALE_NONE;
objectImage.setSize(objectImage.getDrawable().getMinWidth() * scaleFactor, objectImage.getDrawable().getMinHeight() * scaleFactor);
} else
objectImage.setSize(ProtocolGame.CARD_SMALL_SIZE, ProtocolGame.CARD_SMALL_SIZE);
}
......
......@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.game.games.protocol.controller.RoomPosition;
import cz.nic.tablexia.game.games.protocol.gameobjects.ObjectModel;
import cz.nic.tablexia.game.games.protocol.utils.ObjectsPositionComparator;
......@@ -42,14 +43,19 @@ public class Furniture extends ObjectModel {
private List<ObjectModel> objectOnFurniture;
private static final float DEFAULT_SCALE_NONE = 1f;
private static final float DEFAULT_SCALE_DESKTOP_HD = 0.45f;
public Furniture(FurnitureType type, TextureRegion texture, float resizePercent) {
this.type = type;
this.texture = texture;
furnitureImage = new Image(texture);
furnitureImage.setWidth((furnitureImage.getDrawable().getMinWidth() * resizePercent) / 100);
furnitureImage.setHeight((furnitureImage.getDrawable().getMinHeight() * resizePercent / 100));
float scaleFactor = TablexiaSettings.getInstance().isUseHdAssets() ? DEFAULT_SCALE_DESKTOP_HD : DEFAULT_SCALE_NONE;
furnitureImage.setWidth((furnitureImage.getDrawable().getMinWidth() * resizePercent * scaleFactor) / 100);
furnitureImage.setHeight((furnitureImage.getDrawable().getMinHeight() * resizePercent * scaleFactor) / 100);
float xMiddle = furnitureImage.getWidth() * type.getMiddleRatio()[0] - 5;
float yMiddle = furnitureImage.getHeight() * type.getMiddleRatio()[1] - 5;
......
......@@ -74,6 +74,9 @@ public class GamePageGroup extends Group {
private static final float TITLE_MIN_HEIGHT = 0.25f;
private static final float TITLE_MAX_HEIGHT = 0.37f;
private static final float DESKTOP_SCALE_HD = 0.7f;
private static final float DESKTOP_SCALE_NONE = 1f;
/*
* offset to the center of edge buttons on difficulty bar
* multiply this value with difficulty bars width to get offset for current screens coord system
......@@ -255,7 +258,9 @@ public class GamePageGroup extends Group {
//Difficulty Thumb
final TextureRegion diff = getScreen().getCommonGamePageTextureRegion(GamePageAssets.DIFF_THUMB_EASY);
float diffWidth = getScreen().getSceneWidth() * DIFFICULTY_THUMB_WIDTH;
float scaleFactor = TablexiaSettings.getInstance().isUseHdAssets() ? DESKTOP_SCALE_HD : DESKTOP_SCALE_NONE;
float diffWidth = getScreen().getSceneWidth() * DIFFICULTY_THUMB_WIDTH * scaleFactor;
float diffHeight = (int) (diffWidth * (diff.getRegionHeight() / (float) diff.getRegionWidth()));
//Centers thumb difficulty button to difficulty bar
......
......@@ -104,6 +104,9 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
private static final float MOUSE_DIALOG_PADDING_TRESHOLD_SCALE = 1.7f;
private static final int MOUSE_RANK_UP_TIMEOUT = 2 * 24 * 60 * 60 * 1000; //2 days in ms
private static final int HEAP_WIDTH = 418;
private static final int HEAP_HEIGHT = 578;
private static final Vector2 MOUSE_DIALOG_OFFSET = new Vector2(32, 16);
public static final String HALL_OF_FAME_SPEECH = MFX_PATH + "halloffame.mp3";
......@@ -491,7 +494,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
float heapScale = heapProperties.getThird();
heapImage.setPosition(heapX, heapY);
heapImage.setScale(heapScale);
heapImage.setSize(418,578);
heapImage.setSize(HEAP_WIDTH,HEAP_HEIGHT);
heapImage.addListener(new ClickListener() {
@Override
......