Skip to content

Commit

Permalink
Include linc_glfw.h as header
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjammer committed Jul 12, 2019
1 parent 37c44ce commit f6b4653
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
20 changes: 9 additions & 11 deletions glfw/GLFW.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ typedef HWND = cpp.Pointer<cpp.Void>;

@:keep
@:native("GLFWwindow")
@:include("GLFW/glfw3.h")
@:include("linc_glfw.h")
extern class GLFWwindow {}

@:keep
@:native("GLFWcursor")
@:include("GLFW/glfw3.h")
@:include("linc_glfw.h")
extern class GLFWcursor {}

@:keep
@:native("GLFWmonitor")
@:include("GLFW/glfw3.h")
@:include("linc_glfw.h")
extern class GLFWmonitor {}

typedef GLFWerrorfun = Int -> String -> Void;
Expand Down Expand Up @@ -175,23 +175,21 @@ extern class GLFWvidmode {
public var refreshRate: Int;
}

// See https://www.glfw.org/docs/latest/group__native.html
@:keep
@:include('linc_glfw.h')
#if !display
@:cppFileCode("
#include <GLFW/glfw3.h>
#ifdef HX_WINDOWS
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#endif
")
@:build(linc.Linc.touch())
@:build(linc.Linc.xml('glfw'))
#end
extern class GLFW {
//Bindings

@:native('glfwInit')
static function glfwInit() : Int;
static inline function glfwInit() : Int{
force_include();
return untyped __cpp__('glfwInit()');
}

@:native('glfwTerminate')
static function glfwTerminate() : Void;
Expand Down
5 changes: 5 additions & 0 deletions linc/linc_glfw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <GLFW/glfw3.h>
#ifdef HX_WINDOWS
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#endif
5 changes: 3 additions & 2 deletions linc/linc_glfw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<set name="GLFW_LIB_PATH" value="${LINC_GLFW_PATH}lib/linux" if="linux" />

<files id='haxe'>
<compilerflag value='-I${LINC_GLFW_PATH}/linc/'/>
<compilerflag value='-DLINC_GLFW'/>
<compilerflag value='-DGLFW_INCLUDE_NONE'/> <!-- Haxe realm, don't be too helpful -->
<compilerflag value='-DGLFW_INCLUDE_NONE'/> <!-- Don't include GL headers -->
<compilerflag value='-I${LINC_GLFW_PATH}lib/'/>
</files>

<files id='__main__'>
<compilerflag value='-I${LINC_GLFW_PATH}lib/'/>
</files>
Expand Down

0 comments on commit f6b4653

Please sign in to comment.