mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
all: unwrap const() blocks
This commit is contained in:
parent
399af6768d
commit
f09826e928
436 changed files with 10448 additions and 11207 deletions
|
@ -9,62 +9,59 @@ import gx
|
|||
import gg
|
||||
// import sokol.sapp
|
||||
|
||||
const (
|
||||
block_size = 20 // virtual pixels
|
||||
field_height = 20 // # of blocks
|
||||
field_width = 10
|
||||
tetro_size = 4
|
||||
win_width = block_size * field_width
|
||||
win_height = block_size * field_height
|
||||
timer_period = 250 // ms
|
||||
text_size = 24
|
||||
limit_thickness = 3
|
||||
)
|
||||
const block_size = 20 // virtual pixels
|
||||
|
||||
const (
|
||||
text_cfg = gx.TextCfg{
|
||||
align: .left
|
||||
size: text_size
|
||||
color: gx.rgb(0, 0, 0)
|
||||
}
|
||||
over_cfg = gx.TextCfg{
|
||||
align: .left
|
||||
size: text_size
|
||||
color: gx.white
|
||||
}
|
||||
)
|
||||
const field_height = 20 // # of blocks
|
||||
|
||||
const (
|
||||
// Tetros' 4 possible states are encoded in binaries
|
||||
// 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0
|
||||
// 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3
|
||||
// 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2
|
||||
// 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2
|
||||
// There is a special case 1111, since 15 can't be used.
|
||||
b_tetros = [
|
||||
[66, 66, 66, 66],
|
||||
[27, 131, 72, 232],
|
||||
[36, 231, 36, 231],
|
||||
[63, 132, 63, 132],
|
||||
[311, 17, 223, 74],
|
||||
[322, 71, 113, 47],
|
||||
[1111, 9, 1111, 9],
|
||||
]
|
||||
// Each tetro has its unique color
|
||||
colors = [
|
||||
gx.rgb(0, 0, 0), // unused ?
|
||||
gx.rgb(255, 242, 0), // yellow quad
|
||||
gx.rgb(174, 0, 255), // purple triple
|
||||
gx.rgb(60, 255, 0), // green short topright
|
||||
gx.rgb(255, 0, 0), // red short topleft
|
||||
gx.rgb(255, 180, 31), // orange long topleft
|
||||
gx.rgb(33, 66, 255), // blue long topright
|
||||
gx.rgb(74, 198, 255), // lightblue longest
|
||||
gx.rgb(0, 170, 170),
|
||||
]
|
||||
background_color = gx.white
|
||||
ui_color = gx.rgba(255, 0, 0, 210)
|
||||
)
|
||||
const field_width = 10
|
||||
const tetro_size = 4
|
||||
const win_width = block_size * field_width
|
||||
const win_height = block_size * field_height
|
||||
const timer_period = 250 // ms
|
||||
|
||||
const text_size = 24
|
||||
const limit_thickness = 3
|
||||
|
||||
const text_cfg = gx.TextCfg{
|
||||
align: .left
|
||||
size: text_size
|
||||
color: gx.rgb(0, 0, 0)
|
||||
}
|
||||
const over_cfg = gx.TextCfg{
|
||||
align: .left
|
||||
size: text_size
|
||||
color: gx.white
|
||||
}
|
||||
|
||||
// Tetros' 4 possible states are encoded in binaries
|
||||
// 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0
|
||||
// 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3
|
||||
// 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2
|
||||
// 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2
|
||||
// There is a special case 1111, since 15 can't be used.
|
||||
const b_tetros = [
|
||||
[66, 66, 66, 66],
|
||||
[27, 131, 72, 232],
|
||||
[36, 231, 36, 231],
|
||||
[63, 132, 63, 132],
|
||||
[311, 17, 223, 74],
|
||||
[322, 71, 113, 47],
|
||||
[1111, 9, 1111, 9],
|
||||
]
|
||||
// Each tetro has its unique color
|
||||
const colors = [
|
||||
gx.rgb(0, 0, 0), // unused ?
|
||||
gx.rgb(255, 242, 0), // yellow quad
|
||||
gx.rgb(174, 0, 255), // purple triple
|
||||
gx.rgb(60, 255, 0), // green short topright
|
||||
gx.rgb(255, 0, 0), // red short topleft
|
||||
gx.rgb(255, 180, 31), // orange long topleft
|
||||
gx.rgb(33, 66, 255), // blue long topright
|
||||
gx.rgb(74, 198, 255), // lightblue longest
|
||||
gx.rgb(0, 170, 170),
|
||||
]
|
||||
const background_color = gx.white
|
||||
const ui_color = gx.rgba(255, 0, 0, 210)
|
||||
|
||||
// TODO: type Tetro [tetro_size]struct{ x, y int }
|
||||
struct Block {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue