-
Notifications
You must be signed in to change notification settings - Fork 0
/
azul3d_clearing.go
35 lines (28 loc) · 922 Bytes
/
azul3d_clearing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 The Azul3D Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Example - Demonstrates clearing the window.
package main
import (
"image"
"azul3d.org/engine/gfx"
"azul3d.org/engine/gfx/window"
)
// gfxLoop is responsible for drawing things to the window.
func gfxLoop(w window.Window, d gfx.Device) {
for {
// Clear the entire area.
d.Clear(d.Bounds(), gfx.Color{1, 1, 1, 1})
// Clear a few rectangles on the window using different background
// colors.
d.Clear(image.Rect(0, 50, 800, 400), gfx.Color{0, 1, 0, 1})
d.Clear(image.Rect(50, 50, 750, 400), gfx.Color{1, 0, 0, 1})
d.Clear(image.Rect(50, 100, 750, 350), gfx.Color{0, 0.5, 0.5, 1})
d.Clear(image.Rect(100, 150, 700, 300), gfx.Color{1, 1, 0, 1})
// Render the whole frame.
d.Render()
}
}
func main() {
window.Run(gfxLoop, nil)
}