Skip to content

Commit

Permalink
Add NanoVG bindings. Close #99
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Dec 9, 2015
1 parent baaa490 commit ce86fc8
Show file tree
Hide file tree
Showing 27 changed files with 10,695 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.gradle
.DS_Store
*.bat
*.jpg
*.ogg
*.sh
*.ttf
Expand Down
13 changes: 13 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ License terms: http://lwjgl.org/license.php
<arg value="${src.templates.kotlin}/org/lwjgl/egl" if:true="${binding.egl}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/egl/EGLTypes.kt" unless:true="${binding.egl}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/glfw" if:true="${binding.glfw}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/nanovg" if:true="${binding.nanovg}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/openal" if:true="${binding.openal}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/opencl" if:true="${binding.opencl}"/>
<arg value="${src.templates.kotlin}/org/lwjgl/opencl/CLTypes.kt" unless:true="${binding.opencl}"/>
Expand Down Expand Up @@ -241,6 +242,7 @@ License terms: http://lwjgl.org/license.php

<include name="org/lwjgl/egl/**" if:true="${binding.egl}"/>
<include name="org/lwjgl/glfw/**" if:true="${binding.glfw}"/>
<include name="org/lwjgl/nanovg/**" if:true="${binding.nanovg}"/>
<include name="org/lwjgl/openal/**" if:true="${binding.openal}"/>
<include name="org/lwjgl/opencl/**" if:true="${binding.opencl}"/>
<include name="org/lwjgl/opengl/**" if:true="${binding.opengl}"/>
Expand All @@ -252,6 +254,7 @@ License terms: http://lwjgl.org/license.php

<include name="org/lwjgl/egl/**" if:true="${binding.egl}"/>
<include name="org/lwjgl/glfw/**" if:true="${binding.glfw}"/>
<include name="org/lwjgl/nanovg/**" if:true="${binding.nanovg}"/>
<include name="org/lwjgl/openal/**" if:true="${binding.openal}"/>
<include name="org/lwjgl/opencl/**" if:true="${binding.opencl}"/>
<include name="org/lwjgl/opengl/**" if:true="${binding.opengl}"/>
Expand Down Expand Up @@ -307,6 +310,15 @@ License terms: http://lwjgl.org/license.php
</and>
</condition>

<local name="nanovg"/>
<condition property="nanovg" value="true" else="false">
<and>
<istrue value="${binding.nanovg}"/>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opengl}"/>
</and>
</condition>

<lwjgl.javac destdir="${bin.tests}" taskname="Tests">
<classpath>
<pathelement path="${bin.core}"/>
Expand All @@ -322,6 +334,7 @@ License terms: http://lwjgl.org/license.php

<include name="org/lwjgl/demo/egl/**" if:true="${binding.egl}"/>
<include name="org/lwjgl/demo/glfw/**" if:true="${binding.glfw}"/>
<include name="org/lwjgl/demo/nanovg/**" if:true="${nanovg}"/>

<include name="org/lwjgl/demo/openal/**" if:true="${binding.openal}"/>
<exclude name="org/lwjgl/demo/openal/ALCDemo.java" unless:true="${openal_stb}"/>
Expand Down
36 changes: 33 additions & 3 deletions config/build-assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,40 @@ This script is included in /build.xml and depends on /build-definitions.xml
-->
<project name="assets" basedir="../" xmlns:if="ant:if" xmlns:unless="ant:unless">
<target name="-update-assets" description="Updates the demo assets, if necessary">
<uptodate property="refresh-assets" targetfile="${config}/build-assets.xml">
<srcfiles dir="${test.resources}/demo" includes="touch.txt"/>
<uptodate property="assets-uptodate" targetfile="${test.resources}/demo/touch.txt">
<srcfiles dir="${config}/" includes="build-*.xml"/>
</uptodate>
<antcall target="update-assets" if:set="refresh-assets"/>
<antcall target="update-assets" unless:set="assets-uptodate"/>
</target>

<target name="update-assets" description="Updates the demo assets">
<echo message="Updating..." taskname="Assets"/>

<update-demo-asset path="footsteps.ogg"/>
<update-demo-asset path="phero.ogg"/>
<get-quiet name="Asset FiraSans" url="https://github.com/google/fonts/raw/master/ofl/firasans/FiraSans-Regular.ttf" dest="${test.resources}/demo/FiraSans.ttf"/>

<mkdir dir="${test.resources}/demo/nanovg/images" if:true="${binding.nanovg}"/>
<update-nanovg-asset path="entypo.ttf"/>
<update-nanovg-asset path="Roboto-Regular.ttf"/>
<update-nanovg-asset path="Roboto-Bold.ttf"/>
<update-nanovg-asset path="images/image1.jpg"/>
<update-nanovg-asset path="images/image2.jpg"/>
<update-nanovg-asset path="images/image3.jpg"/>
<update-nanovg-asset path="images/image4.jpg"/>
<update-nanovg-asset path="images/image5.jpg"/>
<update-nanovg-asset path="images/image6.jpg"/>
<update-nanovg-asset path="images/image7.jpg"/>
<update-nanovg-asset path="images/image8.jpg"/>
<update-nanovg-asset path="images/image9.jpg"/>
<update-nanovg-asset path="images/image10.jpg"/>
<update-nanovg-asset path="images/image11.jpg"/>
<update-nanovg-asset path="images/image12.jpg"/>

<!-- Add more assets here -->

<touch file="${test.resources}/demo/touch.txt"/>
<echo message="DONE" taskname="Assets"/>
</target>

<macrodef name="update-demo-asset">
Expand All @@ -31,4 +52,13 @@ This script is included in /build.xml and depends on /build-definitions.xml
<get-quiet name="Asset @{path}" url="http://s3.amazonaws.com/build.lwjgl.org/res/demo/@{path}" dest="${test.resources}/demo/@{path}"/>
</sequential>
</macrodef>

<macrodef name="update-nanovg-asset">
<attribute name="path"/>

<sequential>
<get-quiet name="NanoVG asset @{path}" url="https://github.com/memononen/nanovg/raw/master/example/@{path}" dest="${test.resources}/demo/nanovg/@{path}" if:true="${binding.nanovg}"/>
</sequential>
</macrodef>

</project>
21 changes: 18 additions & 3 deletions config/build-bindings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This script is included in /config/build-definitions.xml.
<property name="binding.stb" value="true"/>

<property name="binding.glfw" value="true"/>
<property name="binding.nanovg" value="true"/>

<property name="binding.openal" value="true"/>
<property name="binding.opencl" value="true"/>
Expand All @@ -36,8 +37,8 @@ This script is included in /config/build-definitions.xml.
</and>
</condition>

<local name="glfw_opengl_check"/>
<condition property="glfw_opengl_check" value="1">
<local name="dependency_problem"/>
<condition property="dependency_problem" value="1">
<and>
<or>
<istrue value="${binding.glfw}"/>
Expand All @@ -46,7 +47,21 @@ This script is included in /config/build-definitions.xml.
<isfalse value="${binding.opengl}"/>
</and>
</condition>
<fail if="glfw_opengl_check" message="The OpenGL bindings are required"/>
<fail if="check_dependencies" message="The OpenGL bindings are required."/>

<condition property="dependency_problem" value="1">
<and>
<istrue value="${binding.nanovg}"/>
<or>
<isfalse value="${binding.stb}"/>
<and>
<isfalse value="${binding.opengl}"/>
<isfalse value="${binding.opengles}"/>
</and>
</or>
</and>
</condition>
<fail if="dependency_problem" message="The stb and OpenGL or OpenGL ES bindings are required."/>

<local name="bindings.list"/>
<script language="javascript">
Expand Down
8 changes: 8 additions & 0 deletions config/linux/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ License terms: http://lwjgl.org/license.php
</arguments>
</compile>

<compile if:true="${binding.nanovg}">
<arguments>
<arg value="-I${src.include.rel}/nanovg"/>
<arg value="-I${src.include.rel}/stb"/>
<fileset dir="." includes="${src.generated.native}/nanovg/*.c"/>
</arguments>
</compile>

<compile if:true="${binding.opencl}">
<arguments>
<arg value="-I${src.include.rel}/opencl"/>
Expand Down
10 changes: 9 additions & 1 deletion config/macosx/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ License terms: http://lwjgl.org/license.php
<element name="arguments"/>
<sequential>
<apply dir="${bin.native}" executable="${compiler}" dest="${bin.native}" skipemptyfilesets="true" failonerror="true" parallel="true" taskname="Compiler">
<arg line="-c -std=c99 -O3 -fPIC ${warnings} -DLWJGL_MACOSX -DLWJGL_${build.arch} -isysroot ${sdkroot} -mmacosx-version-min=${macosx-version-min}"/>
<arg line="-c -std=c11 -O3 -fPIC ${warnings} -DLWJGL_MACOSX -DLWJGL_${build.arch} -isysroot ${sdkroot} -mmacosx-version-min=${macosx-version-min}"/>

<arg value="-I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers"/>

Expand Down Expand Up @@ -104,6 +104,14 @@ License terms: http://lwjgl.org/license.php
</arguments>
</compile>

<compile if:true="${binding.nanovg}">
<arguments>
<arg value="-I${src.include.rel}/nanovg"/>
<arg value="-I${src.include.rel}/stb"/>
<fileset dir="." includes="${src.generated.native}/nanovg/*.c"/>
</arguments>
</compile>

<compile if:true="${binding.opencl}">
<arguments>
<arg value="-I${src.include.rel}/opencl"/>
Expand Down
8 changes: 8 additions & 0 deletions config/windows/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ License terms: http://lwjgl.org/license.php
</arguments>
</cl>

<cl if:true="${binding.nanovg}">
<arguments>
<arg value="/I${src.include}\nanovg"/>
<arg value="/I${src.include}\stb"/>
<fileset dir="." includes="${src.generated.native}/nanovg/*.c"/>
</arguments>
</cl>

<cl if:true="${binding.opencl}">
<arguments>
<arg value="/I${src.include}\opencl"/>
Expand Down
Loading

0 comments on commit ce86fc8

Please sign in to comment.