Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
ntop001 committed Mar 4, 2018
1 parent 7b0e8b6 commit 2559f29
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 2 deletions.
Empty file added app/m.md
Empty file.
2 changes: 2 additions & 0 deletions assets/R.go
Expand Up @@ -26,9 +26,11 @@ func Clear() {
var Shader *ShaderManager
var Texture *TextureManager
var Font *FontManager
var PSConfig *ParticleConfigManager

func init() {
Shader = NewShaderManager()
Texture = NewTextureManager()
Font = NewFontManager()
PSConfig = NewParticleConfigManager()
}
23 changes: 23 additions & 0 deletions assets/psconfig_m.go
@@ -0,0 +1,23 @@
package assets

// 粒子系统配置文件管理
type ParticleConfigManager struct {

}

func NewParticleConfigManager() *ParticleConfigManager {
return &ParticleConfigManager{}
}

func (pcm *ParticleConfigManager) Load(file string) {

}

func (pcm *ParticleConfigManager) Unload(file string) {

}

func (pcm *ParticleConfigManager) Get(file string) interface{} {
return nil
}

4 changes: 4 additions & 0 deletions effect/particle.go
Expand Up @@ -168,6 +168,10 @@ func (prf *ParticleRenderFeature) Draw(filter []engi.Entity) {
xt, mt, n := prf.xt, prf.et, prf.et.index
mr := prf.mr

if n == 0 {
return
}

var requireVertexSize int
var requireIndexSize int
for i := 0; i < n; i++ {
Expand Down
24 changes: 24 additions & 0 deletions engi/math/math.go
Expand Up @@ -54,4 +54,28 @@ func UInt16_max(a, b uint16) uint16 {

func UInt32_cnttz(v uint32) uint32{
return 0
}

func Max(a, b float32) float32 {
if a < b {
return b
}
return a
}

func Min(a, b float32) float32 {
if a < b {
return a
}
return b
}

func F32Clamp(v, left, right float32) float32{
if v > right {
return right
}
if v < left {
return left
}
return v
}
Empty file added event/m.md
Empty file.
13 changes: 11 additions & 2 deletions game/game.go
Expand Up @@ -9,11 +9,12 @@ import (
"korok.io/korok/assets"
"korok.io/korok/hid/input"
"korok.io/korok/gfx/dbg"
"korok.io/korok/gui"

"log"
"reflect"
"fmt"
"korok.io/korok/gui"

)

const (
Expand Down Expand Up @@ -47,6 +48,7 @@ type Game struct {
*input.InputSystem
*effect.ParticleSimulateSystem
*ScriptSystem
*anim.AnimationSystem
}

func (g *Game) Camera() *gfx.Camera {
Expand Down Expand Up @@ -84,7 +86,7 @@ func AddScene(scene Scene) {
func (g *Game) Create() {
gfx.Init()
// render system
rs := &gfx.RenderSystem{}
rs := gfx.NewRenderSystem()
g.RenderSystem = rs

//
Expand Down Expand Up @@ -141,6 +143,10 @@ func (g *Game) Create() {
g.ScriptSystem = NewScriptSystem()
g.ScriptSystem.RequireTable(g.DB.Tables)

/// Sprite animation system
g.AnimationSystem = anim.NewAnimationSystem()
g.AnimationSystem.RequireTable(g.DB.Tables)

/// Customized scene
if current != nil {
current.Preload()
Expand Down Expand Up @@ -207,6 +213,9 @@ func (g *Game) Update() {

//// simulation....

// update sprite animation
g.AnimationSystem.Update(dt)

/// 动画更新,骨骼数据
///g.AnimationSystem.Update(dt)

Expand Down
5 changes: 5 additions & 0 deletions korok.go
Expand Up @@ -24,6 +24,11 @@ type Options struct {
Width, Height int
}

func RunScene(options *Options, sc game.Scene) {
PushScene(sc)
Run(options)
}

func Run(options *Options) {
log.Println("Game Start! " + options.Title)

Expand Down

0 comments on commit 2559f29

Please sign in to comment.