DefOS - Extra native OS functions

Repo here: https://github.com/subsoap/defos

DefOS

Extra native OS functions for games written using the Defold game engine

Use issues for feature requests.

23 Likes

This weekend or sooner Iā€™ll work on getting Linux version working with same features. Unless anyone else with more Linux experience would like to give it a go.

4 Likes

Really cool! Good job @Pkeod and @AGulev!

3 Likes

Great job and thanks for the extensions!

@britzl: any chance of having a more in depth tutorial on extensions? It would be great (and learn) how to wrap one, and the thought process behind it.

2 Likes

Have you read the manual on Native Extensions? I think that manual page covers all of the important stuff.

1 Like

Yes, but there are things for which my knowledge is lacking an where a ā€œreal worldā€ tutorial might help (?)

Iā€™ll help make a practical use tutorial later if there is no tutorial later. We still need to wait until all targets get Native Extensions support. I was personally waiting on that to really use it. Sounds like itā€™s happening within next few weeks!

For majority of users, you will probably never develop your own Native Extensions and instead use the generic ones already made, because majority of a game can be accomplished without them, and there are only so many reasons most devs would want extra features such as implementing 3rd party 3dks for ads or using target os api /hardware features which are not already implemented in vanilla Defold engine.

4 Likes

Got sick Friday and kind of killed my productivity. I did still spend a few hours today reading X11 docs for Linux. I think after figuring out a few issues the rest should be easy. Main issue right now is how to get the applicationā€™s Windowā€¦ I can think of some hacky ways of doing it but not what seems the right way. Linux doesnā€™t have Native Extensions support yet, right? Might be better to wait until it does because then I can use dmGraphics::GetNativeX11Window and itā€™s easy.

Edit: canā€™t use ffi on Linux anyway so have to wait for sure?

Yes, not long now. Iā€™ll check with Sven and Mathias to confirm when.

Really? Why?

If I do

```local ffi = package.preload.ffi()`

on Linux it will give error

attempt to call field ffi (a nil value)

I think same error happens on macOS right now too?

1 Like

New methods was added to the library :smirk_cat: :

defos.set_window_title("I set this title using Defos")
defos.toggle_fullscreen()
defos.is_fullscreen()
3 Likes

Few more new methods:

	defos.toggle_maximize()
	defos.is_maximized()

And new example:

UPD: Thanks @britzl !!! defos.is_maximize() was replaced with defos.is_maximized(). Screenshot and readme was updated too.

5 Likes

Wow, this extension is really developing into something super useful for those devs creating desktop games using Defold! Well done!

I pushed a fix to a typo and also added an FFI check and defaulting to the native extension if it exists.

Should it perhaps be defos.is_maximized() with a ā€˜dā€™?

5 Likes

I think you right!
Iā€™ll fix it right now. And thanks for your fixes!!!

3 Likes

Hey guys, whatā€™s the status with DefOS, now that Native Extensions work on Windows?

It needs work but Iā€™m giving attention to other projects first right now. Which features do you need?

5 Likes

Yeah, no rush, Iā€™m mostly just curious at the moment. Toggling fullscreen and the mouse cursor would fill my needs.

2 Likes

Good to know that somebody want to use extension. Unfortunately I have no Windows PC to remake DefOS like an extension for Windows, but Iā€™ll try to come up with something.

2 Likes

Yeah, I think itā€™s a great extension! Itā€™s pretty necessary for a professional desktop game.

So the Lua FFI module works perfectly on windows (why I doubted I donā€™t know). Is that not available on Linux? I guess it will be nice when Linux Native Extensions are released and you can use the same approach for all three.

Again, Iā€™m not trying to nag at all, just checking out possibilities for my next project.

1 Like

Tried to compile example project from github and got the build error:

PC, win10
whatā€™s wrong?

UPD: Solved by renaming/removing ext.manifest/NE