Skip to content

Commit

Permalink
fixed working directory requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
danaugrs committed Aug 18, 2018
1 parent c1e7144 commit 8354b75
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 97 deletions.
12 changes: 6 additions & 6 deletions levelstyle.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type LevelStyle struct {
}

// NewStandardStyle returns a pointer to a LevelStyle object with standard values
func NewStandardStyle() *LevelStyle {
func NewStandardStyle(dataDir string) *LevelStyle {

s := new(LevelStyle)

Expand All @@ -49,20 +49,20 @@ func NewStandardStyle() *LevelStyle {
// Load textures and create materials

s.blockMaterial = material.NewPhong(math32.NewColor("white"))
s.blockMaterial.AddTexture(newTexture("img/floor.png"))
s.blockMaterial.AddTexture(newTexture(dataDir + "/img/floor.png"))

s.padMaterial = material.NewPhong(math32.NewColor("white"))
s.padMaterial.AddTexture(newTexture("img/pad.png"))
s.padMaterial.AddTexture(newTexture(dataDir + "/img/pad.png"))
s.padMaterial.SetTransparent(true) // Makes this material be displayed in front of blockMaterial

s.boxMaterialRed = material.NewPhong(math32.NewColor("white"))
s.boxMaterialRed.AddTexture(newTexture("img/crate_red.png"))
s.boxMaterialRed.AddTexture(newTexture(dataDir + "/img/crate_red.png"))

s.boxMaterialGreen = material.NewPhong(math32.NewColor("white"))
s.boxMaterialGreen.AddTexture(newTexture("img/crate_green2.png"))
s.boxMaterialGreen.AddTexture(newTexture(dataDir + "/img/crate_green2.png"))

s.elevatorMaterial = material.NewPhong(math32.NewColor("white"))
s.elevatorMaterial.AddTexture(newTexture("img/metal_diffuse.png"))
s.elevatorMaterial.AddTexture(newTexture(dataDir + "/img/metal_diffuse.png"))

// Create functions that return a cube mesh using the provided material, reusing the same cube geometry

Expand Down
Loading

1 comment on commit 8354b75

@justinclift
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested here, and yep this works well.

Now Gokoban can be launched from anywhere, and it correctly finds the assets. Excellent. 😄

Please sign in to comment.