Clamp mobile view

This commit is contained in:
Anuken
2023-09-13 23:43:16 -04:00
parent 34ba2cfd41
commit f698d4dd37
2 changed files with 12 additions and 24 deletions

View File

@@ -8,14 +8,12 @@ public class Annotations{
/** Indicates that a method overrides other methods. */ /** Indicates that a method overrides other methods. */
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Replace{ public @interface Replace{}
}
/** Indicates that a method should be final in all implementing classes. */ /** Indicates that a method should be final in all implementing classes. */
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Final{ public @interface Final{}
}
/** Indicates that a field will be interpolated when synced. */ /** Indicates that a field will be interpolated when synced. */
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@@ -30,23 +28,18 @@ public class Annotations{
/** Indicates that a field will not be read from the server when syncing the local player state. */ /** Indicates that a field will not be read from the server when syncing the local player state. */
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface SyncLocal{ public @interface SyncLocal{}
}
/** Indicates that a field should not be synced to clients (but may still be non-transient) */ /** Indicates that a field should not be synced to clients (but may still be non-transient) */
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface NoSync{ public @interface NoSync{}
}
/** Indicates that a component field is imported from other components. This means it doesn't actually exist. */ /** Indicates that a component field is imported from other components. This means it doesn't actually exist. */
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Import{ public @interface Import{}
}
/** Indicates that a component field is read-only. */ /** Indicates that a component field is read-only. */
@Target({ElementType.FIELD, ElementType.METHOD}) @Target({ElementType.FIELD, ElementType.METHOD})
@@ -113,8 +106,7 @@ public class Annotations{
/** Indicates an internal interface for entity components. */ /** Indicates an internal interface for entity components. */
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface EntityInterface{ public @interface EntityInterface{}
}
//endregion //endregion
//region misc. utility //region misc. utility
@@ -153,15 +145,12 @@ public class Annotations{
/** Indicates that a method should always call its super version. */ /** Indicates that a method should always call its super version. */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface CallSuper{ public @interface CallSuper{}
}
/** Annotation that allows overriding CallSuper annotation. To be used on method that overrides method with CallSuper annotation from parent class. */ /** Annotation that allows overriding CallSuper annotation. To be used on method that overrides method with CallSuper annotation from parent class. */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface OverrideCallSuper{ public @interface OverrideCallSuper{}
}
//endregion //endregion
//region struct //region struct
@@ -169,9 +158,7 @@ public class Annotations{
/** Marks a class as a special value type struct. Class name must end in 'Struct'. */ /** Marks a class as a special value type struct. Class name must end in 'Struct'. */
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface Struct{ public @interface Struct{}
}
/** Marks a field of a struct. Optional. */ /** Marks a field of a struct. Optional. */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@@ -259,8 +246,7 @@ public class Annotations{
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface TypeIOHandler{ public @interface TypeIOHandler{ }
}
//endregion //endregion
} }

View File

@@ -923,6 +923,8 @@ public class MobileInput extends InputHandler implements GestureListener{
Core.camera.position.y -= deltaY; Core.camera.position.y -= deltaY;
} }
camera.position.clamp(-camera.width/4f, -camera.height/4f, world.unitWidth() + camera.width/4f, world.unitHeight() + camera.height/4f);
return false; return false;
} }