diff --git a/examples/demo.nim b/examples/demo.nim index 1a3698a..0511d94 100644 --- a/examples/demo.nim +++ b/examples/demo.nim @@ -22,15 +22,20 @@ proc main = fps = newGraph(RenderStyle.FPS, "Frame Time") cpuGraph = newGraph(RenderStyle.MS, "CPU Time") - discard glfw.init() initHint(CONTEXT_VERSION_MAJOR, 3) initHint(CONTEXT_VERSION_MINOR, 2) when defined(macosx): initHint(OPENGL_FORWARD_COMPAT, 1) - initHint(OPENGL_PROFILE, OPENGL_COMPAT_PROFILE) - else: - initHint(OPENGL_PROFILE, OPENGL_CORE_PROFILE) + initHint(OPENGL_PROFILE, OPENGL_CORE_PROFILE) + + discard glfw.init() + + windowHint(CONTEXT_VERSION_MAJOR, 3) + windowHint(CONTEXT_VERSION_MINOR, 2) + when defined(macosx): + windowHint(OPENGL_FORWARD_COMPAT, 1) + windowHint(OPENGL_PROFILE, OPENGL_CORE_PROFILE) var w = createWindow(800, 600, "Minimal Nim-GLFW Example", nil, nil) w.makeContextCurrent() diff --git a/examples/demo_sdl2.nim b/examples/demo_sdl2.nim index 6731365..412023c 100644 --- a/examples/demo_sdl2.nim +++ b/examples/demo_sdl2.nim @@ -73,6 +73,7 @@ proc main() = discard glew.init() let vg = nanovg.newContext() vg.loadFont(currentSourceDir()/"resources"/"Roboto-Regular.ttf", "sans") + vg.loadFont(currentSourceDir()/"resources"/"umeboshi.ttf", "umeboshi") vg.loadFont(currentSourceDir()/"resources"/"Roboto-Bold.ttf", "sans-bold") vg.loadFont(currentSourceDir()/"resources"/"fa.ttf", "fa") vg.loadFont(currentSourceDir()/"resources"/"entypo.ttf", "icons") @@ -87,6 +88,7 @@ proc main() = glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT) vg.withFrame(window): + vg.setFont("umeboshi") vg.text("Some仮名thing is up", 100, 100, 100) vg.drawWindow("Title", 50, 50, 300, 400) vg.drawLabel("Hello!", 10, 10, 280, 20) @@ -116,4 +118,4 @@ proc main() = img.quit() sdl.quit() -main() \ No newline at end of file +main() diff --git a/nanovg.nimble b/nanovg.nimble index a12f56f..8667e07 100644 --- a/nanovg.nimble +++ b/nanovg.nimble @@ -1,6 +1,6 @@ # Package -version = "0.1.0" +version = "0.2.0" author = "Joey Yakimowich-Payne" description = "A wrapper around nanovg" license = "MIT" @@ -10,11 +10,10 @@ srcDir = "src" requires "nim >= 1.0.6", "https://github.com/jyapayne/nimterop#367ec05", - "regex >= 0.14.1", "opengl >= 1.2.6", "sdl2#head", - "https://github.com/jyapayne/nim-glew#15383cf", - "https://github.com/jyapayne/nim-glfw#22bbdf6" + "https://github.com/jyapayne/nim-glew#c6a3e51", + "https://github.com/jyapayne/nim-glfw#8414225" import os diff --git a/src/nanovg.nim b/src/nanovg.nim index 20867ee..81b27e9 100644 --- a/src/nanovg.nim +++ b/src/nanovg.nim @@ -2,7 +2,7 @@ import macros import sequtils import strutils import strformat -import nanovg/wrapper +import nanovg/nanovg converter intToCuchar*(source: uint8 | int): cuchar = return source.cuchar @@ -470,25 +470,25 @@ proc `globalAlpha=`*(context: Context, alpha: float) = # Transforms proc resetTransform*(context: Context) {.inline.} = - wrapper.resetTransform(context) + nanovg.resetTransform(context) proc transform*(context: Context, a, b, c, d, e, f: float) = - wrapper.transform(context, a, b, c, d, e, f) + nanovg.transform(context, a, b, c, d, e, f) proc translate*(context: Context, x, y: float) {.inline.} = - wrapper.translate(context, x, y) + nanovg.translate(context, x, y) proc rotate*(context: Context, angle: float) {.inline.} = - wrapper.rotate(context, angle) + nanovg.rotate(context, angle) proc skewX*(context: Context, angle: float) {.inline.} = - wrapper.skewX(context, angle) + nanovg.skewX(context, angle) proc skewY*(context: Context, angle: float) {.inline.} = - wrapper.skewY(context, angle) + nanovg.skewY(context, angle) proc scale*(context: Context, x, y: float) {.inline.} = - wrapper.scale(context, x, y) + nanovg.scale(context, x, y) proc copyArray[T, U](src: T): U = for i in 0.. 0 and m.group(0).len > 0: - return s[m.group(0)[0]].toLowerAscii - - # Symbol renaming examples - proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = - # Get rid of leading and trailing underscores - sym.name = sym.name.strip(chars = {'_'}) - - # Remove prefixes or suffixes from procs - if sym.kind == nskProc: - for rep in replacements: - sym.name = sym.name.replace(rep, firstLetterLower) +cPluginPath(symbolPluginPath) # Finally import wrapped header file. Recurse if #include files should also # be wrapped. Set dynlib if binding to dynamic library.