This commit is contained in:
Milan Nikolic 2017-02-21 17:16:26 +01:00
parent 10f04b58be
commit 468b700d5d
14 changed files with 130 additions and 124 deletions

View file

@ -5,7 +5,7 @@ import (
)
var (
MaxBuildings int = 100
maxBuildings int = 100
)
func main() {
@ -16,12 +16,12 @@ func main() {
player := raylib.NewRectangle(400, 280, 40, 40)
buildings := make([]raylib.Rectangle, MaxBuildings)
buildColors := make([]raylib.Color, MaxBuildings)
buildings := make([]raylib.Rectangle, maxBuildings)
buildColors := make([]raylib.Color, maxBuildings)
spacing := int32(0)
for i := 0; i < MaxBuildings; i++ {
for i := 0; i < maxBuildings; i++ {
r := raylib.Rectangle{}
r.Width = raylib.GetRandomValue(50, 200)
r.Height = raylib.GetRandomValue(100, 800)
@ -93,7 +93,7 @@ func main() {
raylib.DrawRectangle(-6000, 320, 13000, 8000, raylib.DarkGray)
for i := 0; i < MaxBuildings; i++ {
for i := 0; i < maxBuildings; i++ {
raylib.DrawRectangleRec(buildings[i], buildColors[i])
}

View file

@ -5,7 +5,7 @@ import (
)
const (
MaxColumns = 20
maxColumns = 20
)
func main() {
@ -18,11 +18,11 @@ func main() {
camera.Fovy = 60.0
// Generates some random columns
heights := make([]float32, MaxColumns)
positions := make([]raylib.Vector3, MaxColumns)
colors := make([]raylib.Color, MaxColumns)
heights := make([]float32, maxColumns)
positions := make([]raylib.Vector3, maxColumns)
colors := make([]raylib.Color, maxColumns)
for i := 0; i < MaxColumns; i++ {
for i := 0; i < maxColumns; i++ {
heights[i] = float32(raylib.GetRandomValue(1, 12))
positions[i] = raylib.NewVector3(float32(raylib.GetRandomValue(-15, 15)), heights[i]/2, float32(raylib.GetRandomValue(-15, 15)))
colors[i] = raylib.NewColor(uint8(raylib.GetRandomValue(20, 255)), uint8(raylib.GetRandomValue(10, 55)), 30, 255)
@ -47,7 +47,7 @@ func main() {
raylib.DrawCube(raylib.NewVector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, raylib.Gold) // Draw a yellow wall
// Draw some cubes around
for i := 0; i < MaxColumns; i++ {
for i := 0; i < maxColumns; i++ {
raylib.DrawCube(positions[i], 2.0, heights[i], 2.0, colors[i])
raylib.DrawCubeWires(positions[i], 2.0, heights[i], 2.0, raylib.Maroon)
}

View file

@ -5,7 +5,7 @@ import (
)
var (
MaxGestureStrings int = 20
maxGestureStrings int = 20
)
func main() {
@ -56,7 +56,7 @@ func main() {
gestureStrings = append(gestureStrings, "GESTURE PINCH OUT")
}
if len(gestureStrings) >= MaxGestureStrings {
if len(gestureStrings) >= maxGestureStrings {
gestureStrings = make([]string, 0)
}
}

View file

@ -7,8 +7,8 @@ import (
)
const (
Xbox360NameId = "Xbox 360 Controller"
Ps3NameId = "PLAYSTATION(R)3 Controller"
xbox360NameID = "Xbox 360 Controller"
ps3NameID = "PLAYSTATION(R)3 Controller"
)
func main() {
@ -29,7 +29,7 @@ func main() {
if raylib.IsGamepadAvailable(raylib.GamepadPlayer1) {
raylib.DrawText(fmt.Sprintf("GP1: %s", raylib.GetGamepadName(raylib.GamepadPlayer1)), 10, 10, 10, raylib.Black)
if raylib.IsGamepadName(raylib.GamepadPlayer1, Xbox360NameId) {
if raylib.IsGamepadName(raylib.GamepadPlayer1, xbox360NameID) {
raylib.DrawTexture(texXboxPad, 0, 0, raylib.DarkGray)
// Draw buttons: xbox home
@ -99,7 +99,7 @@ func main() {
raylib.DrawRectangle(170, 30, 15, int32(((1.0+raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisLt))/2.0)*70), raylib.Red)
raylib.DrawRectangle(604, 30, 15, int32(((1.0+raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisRt))/2.0)*70), raylib.Red)
} else if raylib.IsGamepadName(raylib.GamepadPlayer1, Ps3NameId) {
} else if raylib.IsGamepadName(raylib.GamepadPlayer1, ps3NameID) {
raylib.DrawTexture(texPs3Pad, 0, 0, raylib.DarkGray)
// Draw buttons: ps

View file

@ -6,10 +6,6 @@ import (
"github.com/gen2brain/raylib-go/raylib"
)
var (
MaxBuildings int = 100
)
func main() {
screenWidth := int32(800)
screenHeight := int32(450)

View file

@ -7,8 +7,8 @@ import (
)
const (
StorageScore = 0
StorageHiscore = 1
storageScore = 0
storageHiscore = 1
)
func main() {
@ -28,12 +28,12 @@ func main() {
}
if raylib.IsKeyPressed(raylib.KeyEnter) {
raylib.StorageSaveValue(StorageScore, score)
raylib.StorageSaveValue(StorageHiscore, hiscore)
raylib.StorageSaveValue(storageScore, score)
raylib.StorageSaveValue(storageHiscore, hiscore)
} else if raylib.IsKeyPressed(raylib.KeySpace) {
// NOTE: If requested position could not be found, value 0 is returned
score = raylib.StorageLoadValue(StorageScore)
hiscore = raylib.StorageLoadValue(StorageHiscore)
score = raylib.StorageLoadValue(storageScore)
hiscore = raylib.StorageLoadValue(storageHiscore)
}
framesCounter++