Skip to content

Commit

Permalink
Merge pull request #27 from bulatenkom/master
Browse files Browse the repository at this point in the history
Fix README.md (some erratas in code sample)
  • Loading branch information
danaugrs authored Apr 18, 2019
2 parents 2efa959 + e24d300 commit 2df58f4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ package tests
import (
"github.com/g3n/engine/graphic"
"github.com/g3n/engine/math32"
"github.com/g3n/g3nd/app"
"github.com/g3n/g3nd/demos"
"github.com/g3n/g3nd/g3nd"
)

// Sets the category and name of your test in the demos.Map
Expand All @@ -85,33 +85,33 @@ type testsModel struct {
}

// This method will be called once when the test is selected from the G3ND list.
// app is a pointer to the G3ND application.
// It allows access to several methods such as app.Scene(), which returns the current scene,
// app.GuiPanel(), app.Camera(), app.Window() among others.
// You can build your scene adding your objects to the app.Scene()
func (t *testsModel) Initialize(app *g3nd.App) {
// 'a' is a pointer to the G3ND application.
// It allows access to several methods such as a.Scene(), which returns the current scene,
// a.GuiPanel(), a.Camera(), a.Window() among others.
// You can build your scene adding your objects to the a.Scene()
func (t *testsModel) Initialize(a *app.App) {

// Show axis helper
ah := graphic.NewAxisHelper(1.0)
app.Scene().Add(ah)
a.Scene().Add(ah)

// Creates a grid helper and saves its pointer in the test state
t.grid = graphic.NewGridHelper(50, 1, &math32.Color{0.4, 0.4, 0.4})
app.Scene().Add(t.grid)
a.Scene().Add(t.grid)

// Changes the camera position
app.Camera().GetCamera().SetPosition(0, 4, 10)
a.Camera().GetCamera().SetPosition(0, 4, 10)
a.Camera().GetCamera().LookAt(&math32.Vector3{0,0,0})
}

// This method will be called at every frame
// You can animate your objects here.
func (t *testsModel) Render(app *g3nd.App) {
func (t *testsModel) Render(a *app.App) {

// Rotate the grid, just for show.
rps := app.FrameDeltaSeconds() * 2 * math32.Pi
t.grid.AddRotationY(rps * 0.05)
rps := a.FrameDeltaSeconds() * 2 * math32.Pi
t.grid.RotateY(rps * 0.05)
}

```

# Contributing
Expand Down

0 comments on commit 2df58f4

Please sign in to comment.