1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples/times_table: header color const

This commit is contained in:
Alexander Medvednikov 2019-04-14 02:27:03 +02:00
parent 00ce93d282
commit 257c21745a

View File

@ -2,13 +2,14 @@ import ui
import gx
const (
WIN_SIZE = 540
MIN = 1
MAX = 9
FONT_SIZE = 30
N = MAX - MIN + 1
CELL_SIZE = WIN_SIZE / N
TEXT_CFG = gx.TextCfg { color: gx.BLACK, size: FONT_SIZE }
WIN_SIZE = 540
MIN = 1
MAX = 9
FONT_SIZE = 30
N = MAX - MIN + 1
CELL_SIZE = WIN_SIZE / N
TEXT_CFG = gx.TextCfg { color: gx.BLACK, size: FONT_SIZE }
HEADER_COLOR = gx.rgb(240, 240, 240)
)
fn main() {
@ -32,11 +33,11 @@ fn draw() {
x := CELL_SIZE * (j - MIN)
// Horizontal header
if i == MIN {
gx.draw_rect(x, y, CELL_SIZE, CELL_SIZE, gx.rgb(240, 240, 240))
gx.draw_rect(x, y, CELL_SIZE, CELL_SIZE, HEADER_COLOR)
}
// Vertical header
if j == MIN {
gx.draw_rect(x, y, CELL_SIZE, CELL_SIZE, gx.rgb(240, 240, 240))
gx.draw_rect(x, y, CELL_SIZE, CELL_SIZE, HEADER_COLOR)
}
// Draw the result
if !(i == MIN && j == MIN) {