Skip to content

Commit

Permalink
Small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Mar 16, 2024
1 parent 93d6975 commit 31e2c36
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 32 deletions.
13 changes: 9 additions & 4 deletions core/src/cn/harryh/arkpets/ArkChar.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public ArkChar(String assetLocation, AssetItem.AssetAccessor assetAccessor, floa
animList = new AnimClipGroup(skeletonData.getAnimations().toArray(Animation.class));
// 4.Animation mixing
AnimationStateData asd = new AnimationStateData(skeletonData);
for (AnimClip i: animList)
for (AnimClip j: animList)
for (AnimClip i : animList)
for (AnimClip j : animList)
if (!i.fullName.equals(j.fullName))
asd.setMix(i.fullName, j.fullName, easingDuration);
// 5.Animation state setup
Expand All @@ -105,6 +105,7 @@ protected void onApply(AnimData playing) {
setCanvas(new Color(0, 0, 0, 0));
stageInsertMap = new HashMap<>();
for (AnimStage stage : animList.clusterByStage().keySet()) {
// Figure out the suitable canvas size
AnimClipGroup stageClips = animList.findAnimations(stage);
double maxHypSize = 0;
for (int i = 0; i < stageClips.size(); i++) {
Expand All @@ -118,12 +119,16 @@ protected void onApply(AnimData playing) {
stageInsertMap.put(stage, camera.getInsert().clone());
}
}
// See if it succeeded
if (!stageInsertMap.containsKey(stage)) {
stageInsertMap.put(stage, new Insert((canvasReserveLength << 1) - (canvasMaxSize >> 1)));
Logger.warn("Character", stage + " figuring camera size failed");
} else {
camera.setInsert(stageInsertMap.get(stage));
Logger.info("Character", stage + " using " + camera);
}
Logger.info("Character", stage + " using " + camera);
}
camera.setInsertMaxed();
}

/** Sets the canvas with the specified background color.
Expand Down Expand Up @@ -220,7 +225,7 @@ protected void renderToBatch() {
}


public static class AnimComposer {
protected static class AnimComposer {
protected final AnimationState state;
protected AnimData playing;

Expand Down
11 changes: 4 additions & 7 deletions core/src/cn/harryh/arkpets/ArkPets.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void create() {
ArkConfig.Monitor primaryMonitor = ArkConfig.Monitor.getMonitors()[0];
initWindow((int)(primaryMonitor.size[0] * 0.1f), (int)(primaryMonitor.size[0] * 0.1f));
// 5.Tray icon setup
tray = new MemberTrayImpl(this, new SocketClient(), UUID.randomUUID());
tray = new MemberTrayImpl(this, new SocketClient());
// Setup complete
Logger.info("App", "Render");
}
Expand Down Expand Up @@ -166,11 +166,8 @@ public void setAlwaysTransparent(boolean alwaysTransparent) {
}

private void changeAnimation(AnimData animData) {
if (animData != null && !animData.isEmpty()) {
// If it is needed to change animation:
if (cha.setAnimation(animData))
offsetY = (int)(animData.offsetY() * config.display_scale);
}
if (cha.setAnimation(animData))
offsetY = (int)(animData.offsetY() * config.display_scale);
}

/* INPUT PROCESS */
Expand Down Expand Up @@ -209,7 +206,7 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
Logger.debug("Input", "Dragged to " + screenX + ", " + screenY);
//Logger.debug("Input", "Dragged to " + screenX + ", " + screenY);
if (pointer <= 0) {
if (isMouseAtSolidPixel()) {
mouse_drag = true;
Expand Down
7 changes: 5 additions & 2 deletions core/src/cn/harryh/arkpets/tray/MemberTray.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ public abstract class MemberTray {
Const.FontsConfig.loadFontsToSwing();
}

public MemberTray(UUID uuid, String name) {
this.uuid = uuid;
/** Initializes a tray icon instance for a ArkPets.
* @param name The name to be displayed in the menu, in the icon tooltip, etc.
*/
public MemberTray(String name) {
this.uuid = UUID.randomUUID();
this.name = name;

optKeepAnimEn .addActionListener(e -> onKeepAnimEn());
Expand Down
8 changes: 4 additions & 4 deletions core/src/cn/harryh/arkpets/tray/MemberTrayImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.awt.geom.AffineTransform;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;

import static cn.harryh.arkpets.Const.iconFilePng;
import static cn.harryh.arkpets.Const.easingDuration;
Expand All @@ -32,12 +31,13 @@ public class MemberTrayImpl extends MemberTray {
private TrayIcon icon;
public AnimData keepAnim;

/** Initializes the ArkPets tray icon instance. <br/>
/** Initializes a per-character tray icon instance for an ArkPets. <br/>
* Must be used after Gdx.app was initialized.
* @param boundArkPets The ArkPets instance that bound to the tray icon.
* @param client The socket client that bound to the tray icon.
*/
public MemberTrayImpl(ArkPets boundArkPets, SocketClient client, UUID uuid) {
super(uuid, getName(boundArkPets));
public MemberTrayImpl(ArkPets boundArkPets, SocketClient client) {
super(getName(boundArkPets));
arkPets = boundArkPets;
this.client = client;

Expand Down
7 changes: 6 additions & 1 deletion core/src/cn/harryh/arkpets/tray/MemberTrayProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ public class MemberTrayProxy extends MemberTray {
private final HostTray hostTray;
private final JMenu popMenu;

/** Initializes a host-proxy tray icon instance for a registering ArkPets.
* @param socketData The ArkPets login data.
* @param session The session to communicate with that ArkPets.
* @param hostTray The host tray to apply this tray instance.
*/
public MemberTrayProxy(SocketData socketData, SocketSession session, HostTray hostTray) {
super(socketData.uuid, socketData.getMsgString());
super(socketData.getMsgString());
this.session = session;
this.hostTray = hostTray;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public int hashCode() {

@Override
public String toString() {
return "^" + top + "\tv" + bottom + "\t<" + left + "\t>" + right;
return "^" + top + " v" + bottom + " <" + left + " >" + right;
}
}
}
10 changes: 1 addition & 9 deletions core/src/cn/harryh/arkpets/utils/HWndCtrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.platform.win32.WinUser;
import com.sun.jna.win32.W32APIOptions;

import java.util.ArrayList;

Expand Down Expand Up @@ -287,13 +286,6 @@ public int hashCode() {

@Override
public String toString() {
return "‘" + windowText + "’ " + windowWidth + "*" + windowHeight;
}


private interface GDI32Extended extends com.sun.jna.platform.win32.GDI32 {
GDI32Extended INSTANCE = Native.load("gdi32", GDI32Extended.class, W32APIOptions.DEFAULT_OPTIONS);

int GetPixel(WinDef.HDC hdc, int x, int y);
return "‘" + windowText + "’ " + windowWidth + "*" + windowHeight + " style=" + getWindowExStyle();
}
}
8 changes: 4 additions & 4 deletions core/src/cn/harryh/arkpets/utils/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* @see <a href="https://semver.org/">semver.org</a>
*/
public class Version {
protected int major;
protected int minor;
protected int patch;
protected static final int defaultNumber = 0;
private final int major;
private final int minor;
private final int patch;
private static final int defaultNumber = 0;

public Version(int major, int minor, int patch) {
this.major = major;
Expand Down

0 comments on commit 31e2c36

Please sign in to comment.