g3n / g3nd

G3N Game Engine Demo
BSD 2-Clause "Simplified" License
281 stars 31 forks source link

Beginners Issues #20

Closed thenetautohub closed 6 years ago

thenetautohub commented 6 years ago

Hi Guys,

Sorry for some of the newbieness here but I am struggling to find any documentation on how to do the simplest things.

For instance creation of a blank window, from what I can see of the code the the app struct can initialise a window for me but this seems to come with a load of stuff that I don't need, I have also looked at the recommended game and I can see that they don't use an app, and from both I can see they use the following pattern to start the window initialisation.

`
// Window event handling must run on the main OS thread runtime.LockOSThread()

// Get the window manager
Win , err := window.Manager("glfw")
if err != nil {
    panic(err)
}

`

after which they use this to create a window, the issue is that is I try to use this pattern I get

image: unknown format

and cant seem to get to the window setup.

any newb help would be great, a doc would be even better.

thanks

John

danaugrs commented 6 years ago

Hi! If you don't want to use the Application object try starting out based on hellog3n-no-app. Let me know here if you encounter any issues and we'll work to resolve them!

thenetautohub commented 6 years ago

Ok so that demo works, with all the code copied in. however if I strip it back to the following;

func main() {

    // Creates window and OpenGL context
    wmgr, err := window.Manager("glfw")
    if err != nil {
        panic(err)
    }
    win, err := wmgr.CreateWindow(800, 600, "Hello G3N", false)
    if err != nil {
        panic(err)
    }
    fmt.Println(win)
}`

I get the error from the wmgr, err := window.Manager("glfw") line, with the error mentioned before, and as this is the code from the first line I can only assume there is some kind of initilization happening that I am unaware of ?

thanks

John

thenetautohub commented 6 years ago

After doing a little debugging, it would appear that there is something that is required in the

"github.com/g3n/engine/material"

package to add a window. as soon as Imported this module the initialisation worked and I get past the creation of the window manager, should the window manager be tied to this ?

I commented out everythng bar the above and this.

mat := material.NewPhong(math32.NewColor("DarkBlue")) fmt.Println(mat)

and I can get past the manager creation

danaugrs commented 6 years ago

Ok so this is happening because g3n is loading some custom cursors (diagonal resize cursors). Interestingly this error doesn't happen when you import the material package. I'm investigating...

danaugrs commented 6 years ago

Oops you beat me to it. It definitely shouldn't be tied to material.

danaugrs commented 6 years ago

I just fixed it: https://github.com/g3n/engine/commit/9d6952a24f8b3f0ab877138f205b752b236af655. Please get latest and try again 👍

thenetautohub commented 6 years ago

:+1:

Fix is working, thanks for the swift help :-)

John

danaugrs commented 6 years ago

Glad to hear it. Thanks for helping make g3n better!