Some minesweeper adjustments

This commit is contained in:
soywiz
2020-02-16 17:06:06 +01:00
parent c37fe8a963
commit 476ef6580f
3 changed files with 9 additions and 10 deletions

View File

@@ -45,8 +45,8 @@ class Board(
//timeText = Text("", 50, 50, Text.Align.center, Text.Align.middle, Color.white, Font.fromResource("font.ttf", 40));
val FONT_HEIGHT = 32.0
timeText = text("", textSize = FONT_HEIGHT).xy((bwidth * imageset.height) / 2, -FONT_HEIGHT).apply {
//format = Html.Format(align = Html.Alignment.CENTER, size = FONT_HEIGHT.toInt())
format = Html.Format(align = Html.Alignment.CENTER)
format = Html.Format(align = Html.Alignment.CENTER, size = FONT_HEIGHT.toInt())
//format = Html.Format(align = Html.Alignment.CENTER, face = defaultUIFont)
}
// Se pinta el contador como hijo del tablero
//timeText.group.z = this;

View File

@@ -148,8 +148,8 @@ class Key2(val views: Views) {
class MouseV(val views: Views) {
val left: Boolean get() = pressing[0]
val right: Boolean get() = pressing[1] || pressing[2]
val x: Int get() = (views.input.mouse.x / views.stage.scaleX).toInt()
val y: Int get() = (views.input.mouse.y / views.stage.scaleY).toInt()
val x: Int get() = (views.stage.localMouseX(views)).toInt()
val y: Int get() = (views.stage.localMouseY(views)).toInt()
val pressing = BooleanArray(8)
val pressed = BooleanArray(8)
val released = BooleanArray(8)
@@ -224,4 +224,3 @@ fun <T : Bitmap> BitmapSlice<T>.split(width: Int, height: Int): List<BmpSlice> {
}
}
}

View File

@@ -15,17 +15,17 @@ class MainProcess(parent: Container) : Process(parent) {
val lights = arrayListOf<RandomLight>()
override suspend fun main() {
val light = readImage("light.png")
image(readImage("bg.jpg"))
for (n in 0 until 20) {
lights += RandomLight(this, light)
}
val light = readImage("light.png")
val imageset = readImage("buscaminas.png")
val imagenes = imageset.split(imageset.height, imageset.height)
val click = readSound("click.wav")
val boom = readSound("boom.wav")
for (n in 0 until 20) {
lights += RandomLight(this, light)
}
val board = Board(this, imageset, imagenes, click, boom, 22, 15, 40)
while (true) {