examples: fix const name warnings due to gx.White, etc...

pull/4971/head
Delyan Angelov 2020-05-22 20:00:46 +03:00
parent acb58a1f98
commit 104359365f
5 changed files with 17 additions and 27 deletions

View File

@ -30,7 +30,7 @@ const (
[live] [live]
fn print_automaton(a &automaton.Automaton){ fn print_automaton(a &automaton.Automaton){
gg.clear(gx.White) gg.clear(gx.white)
square_size := 18 square_size := 18
for y := 1; y<a.field.maxy; y++ { for y := 1; y<a.field.maxy; y++ {
for x := 1; x<a.field.maxx; x++ { for x := 1; x<a.field.maxx; x++ {

View File

@ -56,7 +56,7 @@ fn new_automaton(f [][]int) Automaton {
return Automaton{ field: field new_field: new_field } return Automaton{ field: field new_field: new_field }
} }
pub fn (aa mut Automaton) update() { pub fn (mut aa Automaton) update() {
aa.new_field.clear() aa.new_field.clear()
for y := 1; y<aa.field.maxy; y++ { for y := 1; y<aa.field.maxy; y++ {
for x := 1; x<aa.field.maxx; x++ { for x := 1; x<aa.field.maxx; x++ {

View File

@ -33,7 +33,7 @@ fn main() {
if ctx.gg.window.should_close() { if ctx.gg.window.should_close() {
break break
} }
gg.clear(gx.White) gg.clear(gx.white)
ctx.draw() ctx.draw()
ctx.gg.render() ctx.gg.render()
} }

View File

@ -42,7 +42,7 @@ const (
over_cfg = gx.TextCfg{ over_cfg = gx.TextCfg{
align:gx.align_left align:gx.align_left
size:text_size size:text_size
color:gx.White color:gx.white
} }
) )
@ -96,7 +96,7 @@ const (
gx.rgb(0, 170, 170), // unused ? gx.rgb(0, 170, 170), // unused ?
] ]
background_color = gx.White background_color = gx.white
ui_color = gx.red ui_color = gx.red
) )

View File

@ -12,45 +12,35 @@ pub:
} }
pub const ( pub const (
Blue = Color { r: 0, g: 0, b: 255 }
blue = Color { r: 0, g: 0, b: 255 } blue = Color { r: 0, g: 0, b: 255 }
Red = Color { r: 255, g: 0, b: 0 }
red = Color { r: 255, g: 0, b: 0 } red = Color { r: 255, g: 0, b: 0 }
Green = Color { r: 0, g: 255, b: 0 }
green = Color { r: 0, g: 255, b: 0 } green = Color { r: 0, g: 255, b: 0 }
Yellow = Color { r: 255, g: 255, b: 0 } yellow = Color { r: 255, g: 255, b: 0 }
Orange = Color { r: 255, g: 165, b: 0 }
orange = Color { r: 255, g: 165, b: 0 } orange = Color { r: 255, g: 165, b: 0 }
Purple = Color { r: 128, g: 0, b: 128 } purple = Color { r: 128, g: 0, b: 128 }
Black = Color { r: 0, g: 0, b: 0 }
black = Color { r: 0, g: 0, b: 0 } black = Color { r: 0, g: 0, b: 0 }
Gray = Color { r: 128, g: 128, b: 128 }
gray = Color { r: 128, g: 128, b: 128 } gray = Color { r: 128, g: 128, b: 128 }
Indigo = Color { r: 75, g: 0, b: 130 } indigo = Color { r: 75, g: 0, b: 130 }
Pink = Color { r: 255, g: 192, b: 203 } pink = Color { r: 255, g: 192, b: 203 }
Violet = Color { r: 238, g: 130, b: 238 } violet = Color { r: 238, g: 130, b: 238 }
White = Color { r: 255, g: 255, b: 255 }
white = Color { r: 255, g: 255, b: 255 } white = Color { r: 255, g: 255, b: 255 }
// Shades // Shades
DarkBlue = Color { r: 0, g: 0, b: 139 } dark_blue = Color { r: 0, g: 0, b: 139 }
DarkGray = Color { r: 169, g: 169, b: 169 }
dark_gray = Color { r: 169, g: 169, b: 169 } dark_gray = Color { r: 169, g: 169, b: 169 }
DarkGreen = Color { r: 0, g: 100, b: 0 } dark_green = Color { r: 0, g: 100, b: 0 }
DarkRed = Color { r: 139, g: 0, b: 0 } dark_red = Color { r: 139, g: 0, b: 0 }
LightBlue = Color { r: 173, g: 216, b: 230 }
light_blue = Color { r: 173, g: 216, b: 230 } light_blue = Color { r: 173, g: 216, b: 230 }
LightGray = Color { r: 211, g: 211, b: 211 } light_gray = Color { r: 211, g: 211, b: 211 }
LightGreen = Color { r: 144, g: 238, b: 144 } light_green = Color { r: 144, g: 238, b: 144 }
LightRed = Color { r: 255, g: 204, b: 203 } light_red = Color { r: 255, g: 204, b: 203 }
) )
pub const ( pub const (
align_left = 1 align_left = 1
align_right = 4 align_right = 4
ALIGN_RIGHT = 4
) )
pub struct TextCfg { pub struct TextCfg {