-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make window layer identifiers into big integers
Affects: #45
- Loading branch information
Showing
7 changed files
with
134 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright © 2022 Mark Raynsford <[email protected]> https://www.io7m.com | ||
* Copyright © 2023 Mark Raynsford <[email protected]> https://www.io7m.com | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
|
@@ -17,50 +17,51 @@ | |
|
||
package com.io7m.jsycamore.api.windows; | ||
|
||
import java.math.BigInteger; | ||
|
||
/** | ||
* Conventional values for window layers. | ||
* An identifier for a window layer. | ||
* | ||
* @param value The value | ||
*/ | ||
|
||
public final class SyWindowLayers | ||
public record SyWindowLayerID(BigInteger value) | ||
implements Comparable<SyWindowLayerID> | ||
{ | ||
private SyWindowLayers() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* @return The layer identifier used for normal windows | ||
*/ | ||
private static final SyWindowLayerID FIRST_ID = | ||
new SyWindowLayerID(BigInteger.ZERO); | ||
|
||
public static int layerForNormalWindows() | ||
@Override | ||
public int compareTo( | ||
final SyWindowLayerID other) | ||
{ | ||
return 0; | ||
return this.value.compareTo(other.value); | ||
} | ||
|
||
/** | ||
* @return The layer identifier used for menus | ||
* @return The next layer ID | ||
*/ | ||
|
||
public static int layerForMenus() | ||
public SyWindowLayerID nextHigher() | ||
{ | ||
return layerHighest(); | ||
return new SyWindowLayerID(this.value.add(BigInteger.ONE)); | ||
} | ||
|
||
/** | ||
* @return The lowest (furthest away from the viewer) layer | ||
* @return The next layer ID | ||
*/ | ||
|
||
public static int layerLowest() | ||
public SyWindowLayerID nextLower() | ||
{ | ||
return Integer.MIN_VALUE; | ||
return new SyWindowLayerID(this.value.subtract(BigInteger.ONE)); | ||
} | ||
|
||
/** | ||
* @return The highest (closest to the viewer) layer | ||
* @return The default layer ID | ||
*/ | ||
|
||
public static int layerHighest() | ||
public static SyWindowLayerID defaultLayer() | ||
{ | ||
return Integer.MAX_VALUE; | ||
return FIRST_ID; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.