Approaching using a header-only C library

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

Re: Approaching using a header-only C library

Post by Ortimh »

Use SWIG to convert it to Lua, but it's not recommended though because after that I couldn't tell you what to do next. I read this demo for SDL/OpenGL 3, from what I can see.. you need to integrate Nuklear library to LOVE (and Lua, also SDL) by hacking a few things in here and here, also maybe elsewhere. That's not going to be easy though.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Approaching using a header-only C library

Post by airstruck »

Tanner wrote:you're going to need access to Love's Window:getHandle which isn't exposed to Lua. This (someone correct me if I'm wrong) means that your best bet would be to compile your shared library against Love as well and get the SDL_Window instance there.
You should be able to get the window handle with SDL_GL_GetCurrentWindow.

Try this:

Code: Select all

local ffi = require 'ffi'
local sdl = ffi.load 'SDL2'

ffi.cdef [[
typedef void SDL_Window;

SDL_Window* SDL_GL_GetCurrentWindow (void);

void SDL_MinimizeWindow (SDL_Window* window);
]]

local sdlWindow = sdl.SDL_GL_GetCurrentWindow()
sdl.SDL_MinimizeWindow(sdlWindow)
User avatar
Tanner
Party member
Posts: 166
Joined: Tue Apr 10, 2012 1:51 am

Re: Approaching using a header-only C library

Post by Tanner »

airstruck wrote:You should be able to get the window handle with SDL_GL_GetCurrentWindow.

Try this:

Code: Select all

local ffi = require 'ffi'
local sdl = ffi.load 'SDL2'

ffi.cdef [[
typedef void SDL_Window;

SDL_Window* SDL_GL_GetCurrentWindow (void);

void SDL_MinimizeWindow (SDL_Window* window);
]]

local sdlWindow = sdl.SDL_GL_GetCurrentWindow()
sdl.SDL_MinimizeWindow(sdlWindow)
Oooh, nice! Yeah, I'd definitely try that first.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 80 guests