Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd3f116
commit b6b7f17
Showing
34 changed files
with
286 additions
and
109 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
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,2 +1,4 @@ | ||
codecov: | ||
token: fdad49d8-8aa1-421e-b50b-607d1881a16d | ||
token: fdad49d8-8aa1-421e-b50b-607d1881a16d | ||
|
||
# bash <(curl -s https://codecov.io/bash) |
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
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
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/org/codetome/zircon/api/beta/component/ProjectionMode.kt
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/org/codetome/zircon/api/builder/AnimationBuilder.kt
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
52 changes: 52 additions & 0 deletions
52
src/main/kotlin/org/codetome/zircon/api/builder/GameAreaBuilder.kt
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.codetome.zircon.api.builder | ||
|
||
import org.codetome.zircon.api.Beta | ||
import org.codetome.zircon.api.game.GameArea | ||
import org.codetome.zircon.api.game.Size3D | ||
import org.codetome.zircon.api.graphics.TextImage | ||
import org.codetome.zircon.internal.game.TextImageGameArea | ||
|
||
/** | ||
* Note that this class is in **BETA**! | ||
* It's API is subject to change! | ||
*/ | ||
@Beta | ||
data class GameAreaBuilder(private var size: Size3D = Size3D.ONE, | ||
private var levels: MutableMap<Int, List<TextImage>> = mutableMapOf()) : Builder<GameArea> { | ||
|
||
|
||
fun size(size: Size3D) = also { | ||
this.size = size | ||
levels = mutableMapOf() | ||
(0 until size.height).forEach { | ||
levels[it] = listOf() | ||
} | ||
} | ||
|
||
fun setLevel(level: Int, vararg images: TextImage) = setLevel(level, images.toList()) | ||
|
||
fun setLevel(level: Int, images: List<TextImage>) = also { | ||
require(level in 0.rangeTo(size.height)) { | ||
"Level '$level' is out of bounds (0 - ${size.height})!" | ||
} | ||
require(images.all { it.getBoundableSize() == size.to2DSize() }) { | ||
"The supplied image(s) do(es) not match the size of the GameArea (${size.to2DSize()})!" | ||
} | ||
this.levels[level] = images | ||
} | ||
|
||
override fun build(): GameArea { | ||
return TextImageGameArea( | ||
size = size, | ||
levels = levels) | ||
} | ||
|
||
override fun createCopy() = copy( | ||
levels = levels.toMutableMap()) | ||
|
||
companion object { | ||
|
||
@JvmStatic | ||
fun newBuilder() = GameAreaBuilder() | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/org/codetome/zircon/api/component/GameComponent.kt
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.codetome.zircon.api.component | ||
|
||
import org.codetome.zircon.api.Beta | ||
import org.codetome.zircon.internal.behavior.Scrollable3D | ||
|
||
/** | ||
* Note that this class is in **BETA**! | ||
* It's API is subject to change! | ||
*/ | ||
@Beta | ||
interface GameComponent : Component, Scrollable3D |
93 changes: 93 additions & 0 deletions
93
src/main/kotlin/org/codetome/zircon/api/component/builder/GameComponentBuilder.kt
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.codetome.zircon.api.component.builder | ||
|
||
import org.codetome.zircon.api.Beta | ||
import org.codetome.zircon.api.Position | ||
import org.codetome.zircon.api.Size | ||
import org.codetome.zircon.api.TextCharacter | ||
import org.codetome.zircon.api.builder.Builder | ||
import org.codetome.zircon.api.builder.ComponentStylesBuilder | ||
import org.codetome.zircon.api.component.ComponentStyles | ||
import org.codetome.zircon.api.component.GameComponent | ||
import org.codetome.zircon.api.font.Font | ||
import org.codetome.zircon.api.game.* | ||
import org.codetome.zircon.internal.component.impl.DefaultGameComponent | ||
import org.codetome.zircon.internal.font.impl.FontSettings | ||
|
||
/** | ||
* Note that this class is in **BETA**! | ||
* It's API is subject to change! | ||
*/ | ||
@Beta | ||
data class GameComponentBuilder(private var gameArea: GameArea = NO_GAME_AREA, | ||
private var projectionMode: ProjectionMode = DEFAULT_PROJECTION_MODE, | ||
private var visibleSize: Size3D = Size3D.ONE, | ||
private var font: Font = FontSettings.NO_FONT, | ||
private var position: Position = Position.DEFAULT_POSITION, | ||
private var componentStyles: ComponentStyles = ComponentStylesBuilder.DEFAULT) : Builder<GameComponent> { | ||
|
||
override fun createCopy() = copy() | ||
|
||
fun gameArea(gameArea: GameArea) = also { | ||
this.gameArea = gameArea | ||
} | ||
|
||
fun projectionMode(projectionMode: ProjectionMode) = also { | ||
this.projectionMode = projectionMode | ||
} | ||
|
||
fun visibleSize(visibleSize: Size3D) = also { | ||
this.visibleSize = visibleSize | ||
} | ||
|
||
fun font(font: Font) = also { | ||
this.font = font | ||
} | ||
|
||
fun position(position: Position) = also { | ||
this.position = position | ||
} | ||
|
||
fun componentStyles(componentStyles: ComponentStyles) = also { | ||
this.componentStyles = componentStyles | ||
} | ||
|
||
override fun build(): DefaultGameComponent { | ||
require(gameArea !== NO_GAME_AREA) { | ||
"A GameComponent will only work with a GameArea as backend. Please set one!" | ||
} | ||
return DefaultGameComponent( | ||
gameArea = gameArea, | ||
projectionMode = projectionMode, | ||
visibleSize = visibleSize, | ||
initialFont = font, | ||
position = position, | ||
componentStyles = componentStyles) | ||
} | ||
|
||
companion object { | ||
|
||
private val NO_GAME_AREA = object : GameArea { | ||
override fun getSize(): Size3D { | ||
TODO("not implemented") | ||
} | ||
|
||
override fun getCharactersAt(position: Position3D): List<TextCharacter> { | ||
TODO("not implemented") | ||
} | ||
|
||
override fun setCharactersAt(position: Position3D, characters: List<TextCharacter>) { | ||
TODO("not implemented") | ||
} | ||
|
||
override fun getSegmentAt(offset: Position3D, size: Size): GameAreaSegment { | ||
TODO("not implemented") | ||
} | ||
} | ||
|
||
@JvmField | ||
val DEFAULT_PROJECTION_MODE = ProjectionMode.TOP_DOWN | ||
|
||
@JvmStatic | ||
fun newBuilder() = GameComponentBuilder() | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
...ome/zircon/api/beta/component/GameArea.kt → .../org/codetome/zircon/api/game/GameArea.kt
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
2 changes: 1 addition & 1 deletion
2
...con/api/beta/component/GameAreaSegment.kt → ...detome/zircon/api/game/GameAreaSegment.kt
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
2 changes: 1 addition & 1 deletion
2
...e/zircon/api/beta/component/Position3D.kt → ...rg/codetome/zircon/api/game/Position3D.kt
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
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/org/codetome/zircon/api/game/ProjectionMode.kt
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.codetome.zircon.api.game | ||
|
||
import org.codetome.zircon.api.Beta | ||
|
||
/** | ||
* Note that this class is in **BETA**! | ||
* It's API is subject to change! | ||
*/ | ||
@Beta | ||
enum class ProjectionMode { | ||
TOP_DOWN, | ||
ISOMETRIC | ||
} |
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
3 changes: 2 additions & 1 deletion
3
src/main/kotlin/org/codetome/zircon/api/resource/ColorThemeResource.kt
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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/org/codetome/zircon/internal/behavior/Scrollable3D.kt
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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/org/codetome/zircon/internal/behavior/impl/DefaultScrollable3D.kt
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.