Skip to content

Commit

Permalink
Doc Update
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Sep 13, 2023
1 parent a31afcf commit 6ddc047
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 158 deletions.
38 changes: 18 additions & 20 deletions core/src/cn/harryh/arkpets/ArkChar.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ArkChar {
public int anim_fps;


/** Initialize an ArkPets character.
/** Initializes an ArkPets character.
* @param $asset_location The path string to the model's directory.
* @param $asset_accessor The Asset Accessor of the model.
* @param $anim_scale The scale of the character.
Expand Down Expand Up @@ -114,13 +114,13 @@ private void loadSkeletonData(String $asset_location, AssetCtrl.AssetAccessor $a
animationState = new AnimationState(asd);
}

/** Set the canvas with transparent background.
/** Sets the canvas with transparent background.
*/
public void setCanvas(int $anim_fps) {
this.setCanvas($anim_fps, new Color(0, 0, 0, 0));
}

/** Set the canvas with the specified background color.
/** Sets the canvas with the specified background color.
*/
public void setCanvas(int $anim_fps, Color $bgColor) {
// Transfer params
Expand All @@ -135,7 +135,7 @@ public void setCanvas(int $anim_fps, Color $bgColor) {
bgTexture = new Texture(pixmap);
}

/** Update the canvas and the camera to keep the character in the center.
/** Updates the canvas and the camera to keep the character in the center.
*/
public void updateCanvas() {
camera.setToOrtho(false, flexibleLayout.getWidth(), flexibleLayout.getHeight());
Expand All @@ -144,7 +144,7 @@ public void updateCanvas() {
batch.getProjectionMatrix().set(camera.combined);
}

/** Adjust the canvas to fit the character's size.
/** Adjusts the canvas to fit the character's size.
*/
public void adjustCanvas(int $reserved_length, String $anim_name, boolean $initialize) {
setCanvas(fpsDefault);
Expand All @@ -162,7 +162,7 @@ public void adjustCanvas(int $reserved_length, String $anim_name, boolean $initi
snapshot.dispose();
}

/** Set the skeleton's target position.
/** Sets the skeleton's target position.
*/
public void setPositionTar(float $pos_x, float $pos_y, float $flip) {
positionTar.set($pos_x, $pos_y, $flip);
Expand All @@ -171,7 +171,7 @@ public void setPositionTar(float $pos_x, float $pos_y, float $flip) {
positionEas.eZ.update($flip);
}

/** Set the skeleton's current position.
/** Sets the skeleton's current position.
*/
public void setPositionCur(float $deltaTime) {
positionCur.set(
Expand All @@ -184,7 +184,7 @@ public void setPositionCur(float $deltaTime) {
skeleton.updateWorldTransform();
}

/** Request to set a new animation.
/** Requests to set a new animation.
* @return true=success, false=failure.
*/
public boolean setAnimation(AnimData $animData) {
Expand All @@ -195,7 +195,7 @@ public boolean setAnimation(AnimData $animData) {
return false;
}

/** Save the current framebuffer contents as an image file. (Only test-use)
/** Saves the current framebuffer contents as an image file. (Only test-use)
* Note that the image may not be flipped along the y-axis.
* @param debug Whether to show debug additions in the pixmap. Note that this will modify the original pixmap.
*/
Expand All @@ -217,7 +217,7 @@ private void saveCurrentTexture(boolean debug) {
pixmap.dispose();
}

/** Render the character to the screen.
/** Renders the character to the screen.
*/
public void renderToScreen() {
// Apply Animation
Expand All @@ -236,7 +236,7 @@ public void renderToScreen() {
batch.end();
}

/** Render the character to a given Pixmap.
/** Renders the character to a given Pixmap.
* Note that the mismatch of the Pixmap's size and the screen's size may cause data loss;
* @param $pixmap The given Pixmap object.
*/
Expand All @@ -249,7 +249,7 @@ private void renderToPixmap(Pixmap $pixmap) {
fbo.end();
}

/** Render the next frame.
/** Renders the next frame.
*/
public void next() {
if (anim_queue[1] != null) {
Expand Down Expand Up @@ -297,13 +297,13 @@ private void changeAnimation() {
}


public static class FrameCtrl {
protected static class FrameCtrl {
private int F_CUR;
private boolean LOOPED;
private final int F_MAX;
private final float DURATION;

/** Frame Data Controller instance.
/** Frame Data Controller object.
* @param $duration The time(seconds) that the animation plays once.
* @param $fps Frame per second.
*/
Expand All @@ -315,7 +315,7 @@ public FrameCtrl(float $duration, int $fps) {
F_MAX = (int) Math.floor($duration / f_TIME) + 2;
}

/** Step to the next frame.
/** Steps to the next frame.
*/
public void next() {
if (F_CUR >= F_MAX) {
Expand All @@ -326,22 +326,20 @@ public void next() {
}
}

/** Get the duration of each loop.
/** Gets the duration of each loop.
* @return The time(seconds) that the animation plays once.
*/
public float getDuration() {
return DURATION;
}

/** Whether the animation has looped before.
* @return true if satisfied.
/** Returns true if the animation has looped before.
*/
public boolean hasLooped() {
return LOOPED;
}

/** Whether the current frame is the final frame of one loop.
* @return true if satisfied.
/** Returns true if the current frame is the final frame of one loop.
*/
public boolean isLoopEnd() {
return F_CUR == F_MAX;
Expand Down
16 changes: 9 additions & 7 deletions core/src/cn/harryh/arkpets/ArkConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ArkConfig {
private ArkConfig() {
}

/** Save the config into the custom file.
/** Saves the config into the custom file.
*/
@JSONField(serialize = false)
public void saveConfig() {
Expand All @@ -78,7 +78,7 @@ public void saveConfig() {
}
}

/** Instantiate an ArkConfig object.
/** Instantiates an ArkConfig object.
* @return ArkConfig object. null if failed.
*/
@JSONField(serialize = false)
Expand Down Expand Up @@ -111,16 +111,18 @@ private static InputStream getDefaultConfigInputStream() {
return Objects.requireNonNull(ArkConfig.class.getResourceAsStream(configDefaultPath));
}

/** @return Whether the config file was generated newly.
/** Returns true if the config file was newly-generated.
*/
@JSONField(serialize = false)
public boolean isNewcomer() {
return isNewcomer;
}

/** Note: Once users upgraded ArkPets to v2.2+ where physic params can be modified manually,
/** Returns true if all the physic params are set to 0.
* <hr>
* Note: Once users upgraded ArkPets to v2.2+ where physic params can be modified manually,
* the physic params will be initialized to 0, which will cause bad behaviors.
* @return Whether all the physic params are set to 0.
* @since ArkPets 2.2
*/
@JSONField(serialize = false)
public boolean isAllPhysicConfigZeroed() {
Expand Down Expand Up @@ -189,7 +191,7 @@ public static boolean isSetStartup() {
}
}

/** Get a content of a VBS script which can start ArkPets.
/** Gets a content of a VBS script which can start ArkPets.
* @return The script's content.
*/
public static String generateScript() {
Expand Down Expand Up @@ -223,7 +225,7 @@ public static class Monitor {
private Monitor() {
}

/** Get the information of all the existing monitors.
/** Gets the information of all the existing monitors.
* @return A list of Monitor objects.
*/
public static Monitor[] getMonitors() {
Expand Down
5 changes: 2 additions & 3 deletions core/src/cn/harryh/arkpets/ArkPets.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,8 @@ public LoopCtrl(float $minIntervalTime) {
minIntervalTime = $minIntervalTime;
}

/** Query whether the loop is executable now.
* @param $deltaTime The delta time.
* @return true=okay.
/** Returns true if the loop is executable now.
* @param $deltaTime The updated delta time.
*/
public boolean isExecutable(float $deltaTime) {
accumTime += $deltaTime;
Expand Down
10 changes: 5 additions & 5 deletions core/src/cn/harryh/arkpets/ArkTray.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ArkTray {
}
}

/** Initialize the ArkPets tray icon instance. <br/>
/** Initializes the ArkPets tray icon instance. <br/>
* Must be used after Gdx.app was initialized.
* @param boundArkPets The ArkPets instance that bound to the tray icon.
*/
Expand Down Expand Up @@ -147,7 +147,7 @@ public void mouseReleased(MouseEvent e) {
}
}

/** Remove the icon from system tray.
/** Removes the icon from system tray.
*/
public void remove() {
if (isTrayIconApplied) {
Expand All @@ -158,7 +158,7 @@ public void remove() {
isTrayIconApplied = false;
}

/** Hide the menu.
/** Hides the menu.
*/
public void hideDialog() {
if (popMenu.isVisible()) {
Expand All @@ -167,7 +167,7 @@ public void hideDialog() {
}
}

/** Show the menu at the given coordinate.
/** Shows the menu at the given coordinate.
*/
public void showDialog(int x, int y) {
/* Use `System.setProperty("sun.java2d.uiScale", "1")` can also avoid system scaling.
Expand All @@ -183,7 +183,7 @@ public void showDialog(int x, int y) {
Logger.debug("Tray", "Shown @ " + x + ", " + y);
}

/** Toggle the menu at the given coordinate.
/** Toggles the menu at the given coordinate.
*/
public void toggleDialog(int x, int y) {
if (popMenu.isVisible()) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/cn/harryh/arkpets/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static class PathConfig {
}


/** Logging preset definition class.
/** Logging presets definition class.
*/
public static class LogConfig {
public static final int logCoreMaxKeep = 32;
Expand Down
27 changes: 14 additions & 13 deletions core/src/cn/harryh/arkpets/behaviors/Behavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Behavior(ArkConfig $config, String[] $animList) {
idxRec = 0;
}

/** Get a random animation.
/** Gets a random animation.
* @param $deltaTime The delta time.
* @return AnimData object.
*/
Expand All @@ -52,10 +52,10 @@ public final AnimData autoCtrl(float $deltaTime) {
return null;
}

/** Randomly select an action to play.
/** Selects an action to play randomly.
* @return The index of the action.
*/
int getRandomAction() {
protected int getRandomAction() {
// Calculate the sum of all action's weight
int weight_sum = 0;
for (AnimAutoData i: action_list) {
Expand All @@ -73,9 +73,10 @@ int getRandomAction() {
return -1;
}

/** Search the most possible animation name.
/** Finds the most possible animation name.
* @return The name of the animation.
*/
String getProperAnimName(String $wanted, String[] $notWanted) {
protected String getProperAnimName(String $wanted, String[] $notWanted) {
HashMap<String, Integer> map = new HashMap<>();
for (String s : anim_list) {
if (s.contains($wanted)) {
Expand All @@ -99,13 +100,13 @@ String getProperAnimName(String $wanted, String[] $notWanted) {
return minK;
}

/** Whether the provided animation list match this behavior class.
/** Returns true if the given animation list matches this behavior class.
* @param animList The animation name list.
* @return true=match, false=mismatch.
*/
abstract boolean match(String[] animList);

/** Select a matched behavior object from a behavior-list.
/** Selects a matched behavior object from a behavior-instances list.
* @param $animList A list contains the name of animations.
* @param $candidateBehaviors A list contains the Behavior objects to be selected.
* @return Behavior object.
Expand All @@ -117,42 +118,42 @@ public static Behavior selectBehavior(String[] $animList, Behavior[] $candidateB
return null;
}

/** Get the default animation.
/** Gets the default animation.
* @return AnimData object.
*/
public AnimData defaultAnim() {
return null;
}

/** Get the animation when mouse-down.
/** Gets the animation when mouse-down.
* @return AnimData object.
*/
public AnimData clickStart() {
return null;
}

/** Get the animation when mouse-up.
/** Gets the animation when mouse-up.
* @return AnimData object.
*/
public AnimData clickEnd() {
return null;
}

/** Get the animation when user start dragging.
/** Gets the animation when the user starts dragging.
* @return AnimData object.
*/
public AnimData dragStart() {
return null;
}

/** Get the animation when user end dragging.
/** Gets the animation when the user finished dragging.
* @return AnimData object.
*/
public AnimData dragEnd() {
return null;
}

/** Get the animation when character dropped.
/** Gets the animation when character dropped.
* @return AnimData object.
*/
public AnimData drop() {
Expand Down
Loading

0 comments on commit 6ddc047

Please sign in to comment.