Skip to content

Commit

Permalink
Ran Scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Jan 19, 2025
1 parent 5f357d1 commit fdcf775
Show file tree
Hide file tree
Showing 45 changed files with 76 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ final case class LegacyEffects(
border: Border,
glow: Glow,
fillType: FillType
) extends Material
derives CanEqual:
) extends Material derives CanEqual:

def withAlpha(newAlpha: Double): LegacyEffects =
this.copy(alpha = newAlpha)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ final case class AssetBundleTracker(val register: List[AssetBundle]):
key,
assets.size,
assets.map { assetType =>
(assetType.path -> AssetToLoad(assetType, false, false))
assetType.path -> AssetToLoad(assetType, false, false)
}.toMap
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ object WindowManager:

case None =>
if w.hasFocus || windowUnderPointer.exists(_ == w.id) then UIState.Active
else UIState.InActive
),
else UIState.InActive),
w
)(e)
}
Expand Down
2 changes: 1 addition & 1 deletion indigo/indigo/src/main/scala/indigo/IndigoShader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ trait IndigoShader extends GameLauncher[IndigoShaderModel, IndigoShaderModel, Un
val c3 = flags.get(Channel3Name).map(p => AssetPath(p)).orElse(channel3)

val channelAssets: Set[AssetType] =
(c0.toSet.map(Channel0Name -> _) ++
(c0.toSet.map(Channel0Name -> _) ++
c1.toSet.map(Channel1Name -> _) ++
c2.toSet.map(Channel2Name -> _) ++
c3.toSet.map(Channel3Name -> _)).map { case (channel, path) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ final class RendererInitialiser(
}

def useWebGL2(): (WebGLRenderingContext, RenderingTechnology) = {
val gl2 = (canvas.getContext("webgl2", args)).asInstanceOf[WebGLRenderingContext]
val gl2 = canvas.getContext("webgl2", args).asInstanceOf[WebGLRenderingContext]
(gl2, RenderingTechnology.WebGL2)
}

Expand Down Expand Up @@ -188,7 +188,7 @@ final class RendererInitialiser(
RenderingTechnology.WebGL1

case RenderingTechnology.WebGL2 =>
val gl2 = (tempCanvas.getContext("webgl2", args)).asInstanceOf[WebGLRenderingContext]
val gl2 = tempCanvas.getContext("webgl2", args).asInstanceOf[WebGLRenderingContext]

if (gl2 == null)
throw new Exception("WebGL 2.0 required by indigo game. This browser does not appear to support WebGL 2.0.")
Expand All @@ -202,7 +202,7 @@ final class RendererInitialiser(
}

case RenderingTechnology.WebGL2WithFallback =>
var gl2 = (tempCanvas.getContext("webgl2", args)).asInstanceOf[WebGLRenderingContext]
var gl2 = tempCanvas.getContext("webgl2", args).asInstanceOf[WebGLRenderingContext]

if (gl2 == null) {
IndigoLogger.info("This browser does not appear to support WebGL 2.0, trying WebGL 1.0.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SceneManager[StartUpData, GameModel, ViewModel](
scenes.toList.map { s =>
val r = new SubSystemsRegister[GameModel]()
r.register(Batch.fromSet(s.subSystems))
(s.name.toString -> r)
s.name.toString -> r
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ object BoundaryLocator:
shape match
case s: Shape.Box =>
Rectangle(
(s.dimensions.position - (s.stroke.width / 2)),
s.dimensions.position - (s.stroke.width / 2),
s.dimensions.size + s.stroke.width
)

Expand Down
13 changes: 6 additions & 7 deletions indigo/indigo/src/main/scala/indigo/shared/Context.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import indigo.shared.time.GameTime
*
* 1. StartUpData: The data that was passed into the game at the start, and is available globally.
*
* 2. Frame: The data that is specific to the current frame, such as the current time, input state, and dice (pseudo
* random number generated seeded on the game's running time at the beginning of the frame), and if only frame values
* are used, then calls to functions like `updateModel` can be considered referentially transparent.
*
* 3. Services: The services that are available to the game, such as the ability to capture the screen, measure text,
* find the bounds of on-screen elements, or access a long running Random instance. Services are side-effecting, long
* running, and / or stateful.
* 2. Frame: The data that is specific to the current frame, such as the current time, input state, and dice (pseudo
* random number generated seeded on the game's running time at the beginning of the frame), and if only frame
* values are used, then calls to functions like `updateModel` can be considered referentially transparent.
* 3. Services: The services that are available to the game, such as the ability to capture the screen, measure text,
* find the bounds of on-screen elements, or access a long running Random instance. Services are side-effecting,
* long running, and / or stateful.
*/
final class Context[StartUpData](
_startUpData: => StartUpData,
Expand Down
3 changes: 1 addition & 2 deletions indigo/indigo/src/main/scala/indigo/shared/Startup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ object Startup:
animations: Set[Animation],
fonts: Set[FontInfo],
shaders: Set[ShaderProgram]
) extends Startup[SuccessType]
derives CanEqual:
) extends Startup[SuccessType] derives CanEqual:
def addAnimations(value: Animation*): Success[SuccessType] =
addAnimations(value.toList)
def addAnimations(value: List[Animation]): Success[SuccessType] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final case class GameConfig(
|- Framerate Limit: ${frameRateLimit.map(_.toString()).getOrElse("Unlimited")}
|- Framerate Delta: ${frameRateDeltaMillis.toString()}
|- Clear color: {red: ${clearColor.r.toString()}, green: ${clearColor.g.toString()}, blue: ${clearColor.b
.toString()}, alpha: ${clearColor.a.toString()}}
.toString()}, alpha: ${clearColor.a.toString()}}
|- Magnification: ${magnification.toString()}
|- Resize Policy: ${resizePolicy.toString()}
|${advanced.asString}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ object Fill:
fromColor: RGBA,
toPoint: Point,
toColor: RGBA
) extends Fill
derives CanEqual:
) extends Fill derives CanEqual:

def withFromColor(newColor: RGBA): LinearGradient =
this.copy(fromColor = newColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object Radians:
def invert: Radians =
negative

def `unary_-` : Radians = negative
def `unary_-`: Radians = negative

def ~==(other: Radians): Boolean =
Math.abs(r.toDouble - other.toDouble) < 0.001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final case class Vector2(x: Double, y: Double) derives CanEqual:
def invert: Vector2 =
Vector2(-x, -y)

def `unary_-` : Vector2 = invert
def `unary_-`: Vector2 = invert

def translate(vec: Vector2): Vector2 =
Vector2.add(this, vec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final case class Vector3(x: Double, y: Double, z: Double) derives CanEqual:
def invert: Vector3 =
Vector3(-x, -y, -z)

def `unary_-` : Vector3 = invert
def `unary_-`: Vector3 = invert

def translate(vec: Vector3): Vector3 =
Vector3.add(this, vec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final case class Vector4(x: Double, y: Double, z: Double, w: Double) derives Can
def invert: Vector4 =
Vector4(-x, -y, -z, -w)

def `unary_-` : Vector4 = invert
def `unary_-`: Vector4 = invert

def translate(vec: Vector4): Vector4 =
Vector4.add(this, vec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ final case class DisplayGroup(
transform: CheapMatrix4,
z: Double,
entities: scalajs.js.Array[DisplayEntity]
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual
object DisplayGroup:
val empty: DisplayGroup =
DisplayGroup(CheapMatrix4.identity, 0.0d, scalajs.js.Array())
Expand All @@ -33,22 +32,19 @@ final case class DisplayCloneBatch(
id: CloneId,
z: Double,
cloneData: scalajs.js.Array[CloneBatchData]
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual

final case class DisplayCloneTiles(
id: CloneId,
z: Double,
cloneData: scalajs.js.Array[CloneTileData]
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual

final case class DisplayMutants(
id: CloneId,
z: Double,
cloneData: scalajs.js.Array[scalajs.js.Array[DisplayObjectUniformData]]
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual

final case class DisplayObject(
x: Float,
Expand Down Expand Up @@ -82,8 +78,7 @@ final case class DisplayObject(
atlasHeight: Float,
shaderId: ShaderId,
shaderUniformData: scalajs.js.Array[DisplayObjectUniformData]
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual
object DisplayObject:

given CanEqual[Option[DisplayObject], Option[DisplayObject]] = CanEqual.derived
Expand Down Expand Up @@ -164,5 +159,4 @@ final case class DisplayText(
z: Double,
width: Int,
height: Int
) extends DisplayEntity
derives CanEqual
) extends DisplayEntity derives CanEqual
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final case class LineSegment(start: Vertex, end: Vertex) derives CanEqual:
def sdf(vertex: Vertex): Double =
val pa: Vertex = vertex - start
val ba: Vertex = end - start
val h: Double = Math.min(1.0, Math.max(0.0, (pa.dot(ba) / ba.dot(ba))))
val h: Double = Math.min(1.0, Math.max(0.0, pa.dot(ba) / ba.dot(ba)))
(pa - (ba * h)).length

def distanceToBoundary(vertex: Vertex): Double =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ final case class Vertex(x: Double, y: Double) derives CanEqual:
Vector2(x, y)

def makeVectorWith(other: Vertex): Vector2 =
Vector2((other.x - x), (other.y - y))
Vector2(other.x - x, other.y - y)

def ~==(other: Vertex): Boolean =
Math.abs(x - other.x) < 0.0001 && Math.abs(y - other.y) < 0.0001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ object BlendMaterial {
overlay: Fill,
saturation: Double,
affectsBackground: Boolean
) extends BlendMaterial
derives CanEqual {
) extends BlendMaterial derives CanEqual {

def withAlpha(newAlpha: Double): BlendEffects =
this.copy(alpha = newAlpha)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ object LightingModel {
emissive: Option[Texture],
normal: Option[Texture],
roughness: Option[Texture]
) extends LightingModel
derives CanEqual {
) extends LightingModel derives CanEqual {

def enableLighting: LightingModel = this
def disableLighting: Unlit.type = Unlit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ object Material:
lighting: LightingModel,
shaderId: Option[ShaderId],
fillType: FillType
) extends Material
derives CanEqual:
) extends Material derives CanEqual:

def withDiffuse(newDiffuse: AssetName): ImageEffects =
this.copy(diffuse = newDiffuse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ final case class BlankEntity(
flip: Flip
) extends EntityNode[BlankEntity]
with Cloneable
with SpatialModifiers[BlankEntity]
derives CanEqual:
with SpatialModifiers[BlankEntity] derives CanEqual:

lazy val x: Int = position.x
lazy val y: Int = position.y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ object Blend {

enum BlendFactor derives CanEqual:
case Zero, One, SrcColor, DstColor, SrcAlpha, DstAlpha, OneMinusSrcColor, OneMinusDstColor, OneMinusSrcAlpha,
OneMinusDstAlpha, SrcAlphaSaturate
OneMinusDstAlpha, SrcAlphaSaturate
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ final case class Clip[M <: Material](
flip: Flip
) extends EntityNode[Clip[M]]
with Cloneable
with SpatialModifiers[Clip[M]]
derives CanEqual:
with SpatialModifiers[Clip[M]] derives CanEqual:

export sheet.frameCount
export sheet.frameDuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ final case class CloneBatch(
depth: Depth,
cloneData: Batch[CloneBatchData],
staticBatchKey: Option[BindingKey]
) extends DependentNode[CloneBatch]
derives CanEqual:
) extends DependentNode[CloneBatch] derives CanEqual:

lazy val scale: Vector2 = Vector2.one
lazy val rotation: Radians = Radians.zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ final case class CloneTiles(
depth: Depth,
cloneData: Batch[CloneTileData],
staticBatchKey: Option[BindingKey]
) extends DependentNode[CloneTiles]
derives CanEqual:
) extends DependentNode[CloneTiles] derives CanEqual:

lazy val scale: Vector2 = Vector2.one
lazy val rotation: Radians = Radians.zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ final case class Graphic[M <: Material](
flip: Flip
) extends RenderNode[Graphic[M]]
with Cloneable
with SpatialModifiers[Graphic[M]]
derives CanEqual:
with SpatialModifiers[Graphic[M]] derives CanEqual:

def bounds: Rectangle =
BoundaryLocator.findBounds(this, position, crop.size, ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ final case class Group(
ref: Point,
flip: Flip
) extends DependentNode[Group]
with SpatialModifiers[Group]
derives CanEqual:
with SpatialModifiers[Group] derives CanEqual:

lazy val x: Int = position.x
lazy val y: Int = position.y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ final case class Mutants(
id: CloneId,
depth: Depth,
uniformBlocks: Array[Batch[UniformBlock]]
) extends DependentNode[Mutants]
derives CanEqual:
) extends DependentNode[Mutants] derives CanEqual:

lazy val scale: Vector2 = Vector2.one
lazy val rotation: Radians = Radians.zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final case class Sprite[M <: Material](
flip: Flip
) extends DependentNode[Sprite[M]]
with Cloneable
with SpatialModifiers[Sprite[M]]
derives CanEqual:
with SpatialModifiers[Sprite[M]] derives CanEqual:

lazy val x: Int = position.x
lazy val y: Int = position.y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ final case class Text[M <: Material](
ref: Point,
flip: Flip
) extends DependentNode[Text[M]]
with SpatialModifiers[Text[M]]
derives CanEqual:
with SpatialModifiers[Text[M]] derives CanEqual:

lazy val x: Int = position.x
lazy val y: Int = position.y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ final case class TextBox(
ref: Point,
flip: Flip
) extends RenderNode[TextBox]
with SpatialModifiers[TextBox]
derives CanEqual:
with SpatialModifiers[TextBox] derives CanEqual:

def bounds: Rectangle =
BoundaryLocator.findBounds(this, position, size, ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ trait BaseEntityShader:
CHANNEL_3_POSITION = scaleCoordsWithOffset(vec2(0.0f), CHANNEL_3_ATLAS_OFFSET)
CHANNEL_0_SIZE = TEXTURE_SIZE / ATLAS_SIZE

val transform: mat4 =
val transform: mat4 =
translate2d(POSITION) *
rotate2d(-1.0f * ROTATION) *
scale2d(SIZE * SCALE) *
Expand Down Expand Up @@ -243,7 +243,7 @@ trait BaseEntityShader:
@nowarn("msg=discarded")
val vertexTemplate: String => String =
inline def tag = "//vertex_placeholder"
inline def placeholder = Shader[IndigoUV.VertexEnv] {_ => RawGLSL(tag)}
inline def placeholder = Shader[IndigoUV.VertexEnv]{_ => RawGLSL(tag)}
val renderedCode =
vertexShader[IndigoUV.VertexEnv](placeholder, IndigoUV.VertexEnv.reference).toGLSL[WebGL2](
ShaderHeader.Version300ES,
Expand Down
Loading

0 comments on commit fdcf775

Please sign in to comment.