Comments (11)
I added a (temporary?) wrapper for it. Let me know if you have any issues with it.
from go-sdl2.
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.
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.
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.
I was thinking maybe use the subsystem to generate different types.
from go-sdl2.
Any idea how to provide access to the union?
from go-sdl2.
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.
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.
I was able to get the information I needed through:
osxWindow := info.GetCocoaInfo()
windowString := strconv.FormatUint(uint64(_(_uint32)(osxWindow.Window)), 10)
from go-sdl2.
Glad it worked for you! Sorry couldn't help much. Busy doing unrelated things in real life.
from go-sdl2.
Might want to make a cast to unsigned long though for the window pointers.
from go-sdl2.
Related Issues (20)
- WASI Support
- Not compatible with Go 1.21.0 HOT 7
- SDL/SDL.h: No such file or directory HOT 2
- How to ship release version HOT 4
- Surface panics on color conversions due to nonidiomatic color models HOT 4
- Windows release crashing likely because C.CString deallocated with C.SDL_free HOT 3
- Getting an errror when compiling to wasm HOT 2
- impossible type switch case: sdl.QuitEvent HOT 4
- Cannot find -lsdl2 HOT 10
- SDL_AudioStreamAvailable not correctly wrapped HOT 2
- Missing functions in gamecontroller.go HOT 6
- Readme Example Fix typo HOT 2
- Running readme example yields 30% CPU usage HOT 13
- Fails to link with musl libc HOT 1
- feature req: img.LoadSizedSVG HOT 2
- SdlSetTextureScaleMode HOT 7
- Window Doesn't Show HOT 4
- How to SDL on 64bit Windows Instructions Unclear
- (suggestion) Convert sdl.Rect Fields from int32 to int HOT 3
- pkg-config issue with sdl2_gfx 0.4.35->0.4.39 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-sdl2.