GithubHelp home page GithubHelp logo

Comments (11)

aqiank avatar aqiank commented on July 16, 2024

I added a (temporary?) wrapper for it. Let me know if you have any issues with it.

from go-sdl2.

fire avatar fire commented on July 16, 2024

http://wiki.libsdl.org/SDL_SysWMinfo

How do I access SDL Version and SDL_SYSWM_TYPE seems to be a constant returned from the c side.

from go-sdl2.

aqiank avatar aqiank commented on July 16, 2024

I added a struct called SysWMInfo. You should be able to access the version number and subsystem now by doing something like:

sdl.VERSION(&info.Version)
status := window.GetWMInfo(&info)
subsystem := info.Subsystem
fmt.Println(status, info.Version.Major, info.Version.Minor, info.Version.Patch, subsystem)

Still need to figure out the best way to provide access to the union though (if we need it at all).

from go-sdl2.

fire avatar fire commented on July 16, 2024

I'm trying to port this code over.

Ogre::String OSX_cocoa_view( SDL_SysWMinfo &info ) {
NSWindow * window = info.info.cocoa.window;
NSView * view = [window contentView];
return Ogre::StringConverter::toString( (unsigned long)view );
}

from go-sdl2.

fire avatar fire commented on July 16, 2024

I was thinking maybe use the subsystem to generate different types.

from go-sdl2.

fire avatar fire commented on July 16, 2024

Any idea how to provide access to the union?

from go-sdl2.

aqiank avatar aqiank commented on July 16, 2024

I added some methods to access them. You probably still need to write some C functions though to actually use it as I don't know about the underlying system. Any help here would be nice.

from go-sdl2.

fire avatar fire commented on July 16, 2024

http://stackoverflow.com/questions/7751097/can-an-ogre-engine-render-into-any-window
OSX:
returns unsigned long for NSView * view = [window contentView];

Win:
type WindowsInfo struct {
Window unsafe.Pointer
}

Window is an unsigned long

Linux:
Window is an Unsigned Long
Ogre::StringConverter::toString( (unsigned long)syswm_info.info.x11.window )

Not sure what surface is.

Summary: I have to turn these integer types into a string for ogre

macHandle := FormatUint(Window, 2)
params.AddPair("parentWindowHandle", macWindow)

from go-sdl2.

fire avatar fire commented on July 16, 2024

I was able to get the information I needed through:

osxWindow := info.GetCocoaInfo()
windowString := strconv.FormatUint(uint64(_(_uint32)(osxWindow.Window)), 10)

from go-sdl2.

aqiank avatar aqiank commented on July 16, 2024

Glad it worked for you! Sorry couldn't help much. Busy doing unrelated things in real life.

from go-sdl2.

fire avatar fire commented on July 16, 2024

Might want to make a cast to unsigned long though for the window pointers.

from go-sdl2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.