Merge branch 'gen2brain:master' into master
This commit is contained in:
commit
32413f57ee
3 changed files with 53 additions and 12 deletions
|
@ -160,15 +160,15 @@ func (g *Game) Update() {
|
||||||
if !g.Fruit.Active {
|
if !g.Fruit.Active {
|
||||||
g.Fruit.Active = true
|
g.Fruit.Active = true
|
||||||
g.Fruit.Position = rl.NewVector2(
|
g.Fruit.Position = rl.NewVector2(
|
||||||
float32(rl.GetRandomValue(0, (g.ScreenWidth/squareSize)-1)*squareSize+int32(g.Offset.X)/2),
|
float32(rl.GetRandomValue(0, (g.ScreenWidth/squareSize)-1)*squareSize)+(g.Offset.X)/2,
|
||||||
float32(rl.GetRandomValue(0, (g.ScreenHeight/squareSize)-1)*squareSize+int32(g.Offset.Y)/2),
|
float32(rl.GetRandomValue(0, (g.ScreenHeight/squareSize)-1)*squareSize)+(g.Offset.Y)/2,
|
||||||
)
|
)
|
||||||
|
|
||||||
for i := 0; i < g.CounterTail; i++ {
|
for i := 0; i < g.CounterTail; i++ {
|
||||||
for (g.Fruit.Position.X == g.Snake[i].Position.X) && (g.Fruit.Position.Y == g.Snake[i].Position.Y) {
|
for (g.Fruit.Position.X == g.Snake[i].Position.X) && (g.Fruit.Position.Y == g.Snake[i].Position.Y) {
|
||||||
g.Fruit.Position = rl.NewVector2(
|
g.Fruit.Position = rl.NewVector2(
|
||||||
float32(rl.GetRandomValue(0, (g.ScreenWidth/squareSize)-1)*squareSize),
|
float32(rl.GetRandomValue(0, (g.ScreenWidth/squareSize)-1)*squareSize)+g.Offset.X/2,
|
||||||
float32(rl.GetRandomValue(0, (g.ScreenHeight/squareSize)-1)*squareSize),
|
float32(rl.GetRandomValue(0, (g.ScreenHeight/squareSize)-1)*squareSize)+g.Offset.Y/2,
|
||||||
)
|
)
|
||||||
i = 0
|
i = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -854,15 +854,51 @@ type MaterialMap struct {
|
||||||
// Model is struct of model, meshes, materials and animation data
|
// Model is struct of model, meshes, materials and animation data
|
||||||
type Model struct {
|
type Model struct {
|
||||||
// Local transform matrix
|
// Local transform matrix
|
||||||
Transform Matrix
|
Transform Matrix
|
||||||
MeshCount int32
|
// Number of meshes
|
||||||
|
MeshCount int32
|
||||||
|
// Number of materials
|
||||||
MaterialCount int32
|
MaterialCount int32
|
||||||
Meshes *Mesh
|
// Meshes array (c array)
|
||||||
Materials *Material
|
//
|
||||||
MeshMaterial *int32
|
// Use Model.GetMeshes instead (go slice)
|
||||||
BoneCount int32
|
Meshes *Mesh
|
||||||
Bones *BoneInfo
|
// Materials array (c array)
|
||||||
BindPose *Transform
|
//
|
||||||
|
// Use Model.GetMaterials instead (go slice)
|
||||||
|
Materials *Material
|
||||||
|
// Mesh material number
|
||||||
|
MeshMaterial *int32
|
||||||
|
// Number of bones
|
||||||
|
BoneCount int32
|
||||||
|
// Bones information (skeleton) (c array)
|
||||||
|
//
|
||||||
|
// Use Model.GetBones instead (go slice)
|
||||||
|
Bones *BoneInfo
|
||||||
|
// Bones base transformation (pose) (c array)
|
||||||
|
//
|
||||||
|
// Use Model.GetBindPose instead (go slice)
|
||||||
|
BindPose *Transform
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMeshes returns the meshes of a model as go slice
|
||||||
|
func (m Model) GetMeshes() []Mesh {
|
||||||
|
return unsafe.Slice(m.Meshes, m.MeshCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMaterials returns the materials of a model as go slice
|
||||||
|
func (m Model) GetMaterials() []Material {
|
||||||
|
return unsafe.Slice(m.Materials, m.MaterialCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBones returns the bones information (skeleton) of a model as go slice
|
||||||
|
func (m Model) GetBones() []BoneInfo {
|
||||||
|
return unsafe.Slice(m.Bones, m.BoneCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBindPose returns the bones base transformation of a model as go slice
|
||||||
|
func (m Model) GetBindPose() []Transform {
|
||||||
|
return unsafe.Slice(m.BindPose, m.BoneCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newModelFromPointer - Returns new Model from pointer
|
// newModelFromPointer - Returns new Model from pointer
|
||||||
|
|
|
@ -166,6 +166,11 @@ func LoadImageColors(img *Image) []color.RGBA {
|
||||||
return (*[1 << 24]color.RGBA)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
return (*[1 << 24]color.RGBA)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnloadImageColors - Unload color data loaded with LoadImageColors()
|
||||||
|
func UnloadImageColors(cols []color.RGBA) {
|
||||||
|
C.UnloadImageColors((*C.Color)(unsafe.Pointer(&cols[0])))
|
||||||
|
}
|
||||||
|
|
||||||
// LoadImageFromTexture - Get pixel data from GPU texture and return an Image
|
// LoadImageFromTexture - Get pixel data from GPU texture and return an Image
|
||||||
func LoadImageFromTexture(texture Texture2D) *Image {
|
func LoadImageFromTexture(texture Texture2D) *Image {
|
||||||
ctexture := texture.cptr()
|
ctexture := texture.cptr()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue