c/raylib demo
This commit is contained in:
18
c/raylib/_demo/raylibdemo/raydemo.go
Normal file
18
c/raylib/_demo/raylibdemo/raydemo.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/c/raylib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
const screenWidth = 800
|
||||
const screenHeight = 450
|
||||
raylib.InitWindow(screenWidth, screenHeight, c.Str("Raylib DEMO"))
|
||||
for !raylib.WindowShouldClose() {
|
||||
raylib.BeginDrawing()
|
||||
raylib.ClearBackground(raylib.RAYWHITE)
|
||||
raylib.DrawRectangle(screenWidth/2-50, screenHeight/2-50, 100, 100, raylib.BLUE)
|
||||
raylib.EndDrawing()
|
||||
}
|
||||
}
|
||||
BIN
c/raylib/llgo_autogen.lla
Normal file
BIN
c/raylib/llgo_autogen.lla
Normal file
Binary file not shown.
@@ -53,9 +53,39 @@ type Vector4 struct {
|
||||
type Quaternion = Vector4
|
||||
|
||||
// Color, 4 components, R8G8B8A8 (32bit)
|
||||
type Color struct {
|
||||
R, G, B, A uint8
|
||||
}
|
||||
// R, G, B, A uint8
|
||||
type Color uint32
|
||||
|
||||
const (
|
||||
LIGHTGRAY = Color(200 | 200<<8 | 200<<16 | 255<<24) // Light Gray
|
||||
GRAY = Color(130 | 130<<8 | 130<<16 | 255<<24) // Gray
|
||||
DARKGRAY = Color(80 | 80<<8 | 80<<16 | 255<<24) // Dark Gray
|
||||
YELLOW = Color(253 | 249<<8 | 0<<16 | 255<<24) // Yellow
|
||||
GOLD = Color(255 | 203<<8 | 0<<16 | 255<<24) // Gold
|
||||
ORANGE = Color(255 | 161<<8 | 0<<16 | 255<<24) // Orange
|
||||
PINK = Color(255 | 109<<8 | 194<<16 | 255<<24) // Pink
|
||||
RED = Color(230 | 41<<8 | 55<<16 | 255<<24) // Red
|
||||
MAROON = Color(190 | 33<<8 | 55<<16 | 255<<24) // Maroon
|
||||
GREEN = Color(0 | 228<<8 | 48<<16 | 255<<24) // Green
|
||||
LIME = Color(0 | 158<<8 | 47<<16 | 255<<24) // Lime
|
||||
DARKGREEN = Color(0 | 117<<8 | 44<<16 | 255<<24) // Dark Green
|
||||
SKYBLUE = Color(102 | 191<<8 | 255<<16 | 255<<24) // Sky Blue
|
||||
BLUE = Color(0 | 121<<8 | 241<<16 | 255<<24) // Blue
|
||||
|
||||
DARKBLUE = Color(0 | 82<<8 | 172<<16 | 255<<24) // Dark Blue
|
||||
PURPLE = Color(200 | 122<<8 | 255<<16 | 255<<24) // Purple
|
||||
VIOLET = Color(135 | 60<<8 | 190<<16 | 255<<24) // Violet
|
||||
DARKPURPLE = Color(112 | 31<<8 | 126<<16 | 255<<24) // Dark Purple
|
||||
BEIGE = Color(211 | 176<<8 | 131<<16 | 255<<24) // Beige
|
||||
BROWN = Color(127 | 106<<8 | 79<<16 | 255<<24) // Brown
|
||||
DARKBROWN = Color(76 | 63<<8 | 47<<16 | 255<<24) // Dark Brown
|
||||
|
||||
WHITE = Color(255 | 255<<8 | 255<<16 | 255<<24) // White
|
||||
BLACK = Color(0 | 0<<8 | 0<<16 | 255<<24) // Black
|
||||
BLANK = Color(0 | 0<<8 | 0<<16 | 0<<24) // Blank (Transparent)
|
||||
MAGENTA = Color(255 | 0<<8 | 255<<16 | 255<<24) // Magenta
|
||||
RAYWHITE = Color(245 | 245<<8 | 245<<16 | 255<<24) // My own White (raylib logo)
|
||||
)
|
||||
|
||||
// Image, pixel data stored in CPU memory (RAM)
|
||||
type Image struct {
|
||||
@@ -297,3 +327,10 @@ func BeginScissorMode(x, y, width, height c.Int)
|
||||
func EndScissorMode()
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Draw a color-filled rectangle
|
||||
//
|
||||
//go:linkname DrawRectangle C.DrawRectangle
|
||||
func DrawRectangle(posX, posY, width, height c.Int, color Color)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user