mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-07 02:54:18 +00:00
Minor Style Fixes
This commit is contained in:
@@ -1,25 +1,7 @@
|
||||
#import "fmt.odin"
|
||||
|
||||
main :: proc() {
|
||||
Entity :: union {
|
||||
Apple: int
|
||||
Banana: f32
|
||||
Goat: struct {
|
||||
x, y: int
|
||||
z, w: f32
|
||||
}
|
||||
}
|
||||
|
||||
a := 123 as Entity.Apple
|
||||
e: Entity = a
|
||||
fmt.println(a)
|
||||
|
||||
if apple, ok := ^e union_cast ^Entity.Apple; ok {
|
||||
apple^ = 321
|
||||
e = apple^
|
||||
}
|
||||
|
||||
apple, ok := e union_cast Entity.Apple
|
||||
fmt.println(apple)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,12 @@ make_window :: proc(title: string, msg, height: int, window_proc: win32.WNDPROC)
|
||||
w: Window
|
||||
w.width, w.height = msg, height
|
||||
|
||||
class_name := "Win32-Odin-Window\x00"
|
||||
c_class_name := class_name.data
|
||||
w.c_title = to_c_string(title)
|
||||
c_class_name := "Win32-Odin-Window\x00".data
|
||||
if title[title.count-1] != 0 {
|
||||
w.c_title = to_c_string(title)
|
||||
} else {
|
||||
w.c_title = title as []u8
|
||||
}
|
||||
|
||||
instance := GetModuleHandleA(nil)
|
||||
|
||||
@@ -190,6 +193,7 @@ run :: proc() {
|
||||
|
||||
draw_rect :: proc(x, y, w, h: f32) {
|
||||
gl.Begin(gl.TRIANGLES)
|
||||
defer gl.End()
|
||||
|
||||
gl.Color3f(1, 0, 0); gl.Vertex3f(x, y, 0)
|
||||
gl.Color3f(0, 1, 0); gl.Vertex3f(x+w, y, 0)
|
||||
@@ -198,8 +202,6 @@ run :: proc() {
|
||||
gl.Color3f(0, 0, 1); gl.Vertex3f(x+w, y+h, 0)
|
||||
gl.Color3f(1, 1, 0); gl.Vertex3f(x, y+h, 0)
|
||||
gl.Color3f(1, 0, 0); gl.Vertex3f(x, y, 0)
|
||||
|
||||
gl.End()
|
||||
}
|
||||
|
||||
draw_rect(pos[0], pos[1], 50, 50)
|
||||
|
||||
Reference in New Issue
Block a user