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