-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
# linc_glfw | ||
GLFW bindings for Haxe | ||
|
||
Intended to serve as an alternative to linc_sdl for minimal windowing/glcontext/input bootstrapping on OSX and Windows. Bindings will be developed according to this scenario. | ||
## Overview (verbatim from [glfw.org](http://glfw.org)) | ||
GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events. | ||
|
||
GLFW is written in C and has native support for Windows, macOS and many Unix-like systems using the X Window System, such as Linux and FreeBSD. | ||
|
||
GLFW is licensed under the zlib/libpng license. | ||
|
||
## Motivation | ||
The linc_sdl bindings are excellent and cover significant ground in game development. However, for some scenarios GLFW is by far the lighter and more direct alternative for windowing, input and OGL rendering. These Haxe bindings enable the creation of a window and opengl context + event loop on windows and osx in the following lines: | ||
|
||
```Haxe | ||
import glfw.GLFW.*; | ||
class Test { | ||
public static function main(){ | ||
if(glfwInit() != 0){ | ||
var window = glfwCreateWindow(640, 480, "Hello World", null, null); | ||
glfwMakeContextCurrent(window); | ||
while (glfwWindowShouldClose(window) != GLFW_TRUE) | ||
{ | ||
glfwPollEvents(); | ||
// Render here | ||
} | ||
}else{ | ||
throw 'GLFW init fail'; | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The bindings are written according to the [linc guidelines](http://snowkit.github.io/linc/), meaning knowledge gleaned from the [official docs](http://www.glfw.org/documentation.html) should apply directly to your Haxe source. | ||
|
||
These bindings are written in a style that foregoes non-c++ targets, meaning liberal reliance on the cpp namespace and hxcpp types. Expect to see (and have to deal with) cpp.Pointers where the official docs specify pointer types. |