diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2019-10-27 11:28:56 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2019-10-27 11:28:56 +0200 |
| commit | 53978c1878176ae21856e6b111d76dd1a80ecbca (patch) | |
| tree | cc2b5921ecd761b1af92726a3cc93ad672d8477c | |
| parent | ae63588509363363f0da4c156ee4bc59f2902a10 (diff) | |
| download | nimraylib-53978c1878176ae21856e6b111d76dd1a80ecbca.tar.gz nimraylib-53978c1878176ae21856e6b111d76dd1a80ecbca.zip | |
Make it work and add an example
| -rw-r--r-- | examples/hello.nim | 14 | ||||
| -rw-r--r-- | raylib.cfg | 64 | ||||
| -rw-r--r-- | raylib.nimble | 17 |
3 files changed, 78 insertions, 17 deletions
diff --git a/examples/hello.nim b/examples/hello.nim new file mode 100644 index 0000000..e1c8d54 --- /dev/null +++ b/examples/hello.nim @@ -0,0 +1,14 @@ +import raylib/raylib + +InitWindow(800, 600, "basic example") + +SetTargetFPS(60) + +while not WindowShouldClose(): + BeginDrawing() + + ClearBackground(White) + + DrawText("Hello World!", 100, 100, 20, Black) + + EndDrawing() @@ -9,5 +9,67 @@ execute-lin = "tar -C raylib --strip-components=1 -x -f raylib/raylib-2.5.0-Linu raylib/include [raylib.h] -dynlib-lin = lib/libraylib.so +dynlib-lin = "${output}/lib/libraylib.so" + preprocess = true +defines = true + +search.tracelogcallback = "typedef void (*TraceLogCallback)(int logType, const char *text, va_list args);" +prepend.tracelogcallback = "//" + +search.settracelogcallback = "RLAPI void SetTraceLogCallback" +prepend.settracelogcallback = "//" + +[raylib.nim] +search.header = "/include/.h" +replace.header = "/include/raylib.h" + +search.music = "Music* = ptr MusicData" +prepend.music = """MusicData* = object + """ + +search.bool = "_Bool" +replace.bool = "bool" + +append = """ + +template initColor*(rr, gg, bb, aa: int): Color = + Color(r: rr.cuchar, g: gg.cuchar, b: bb.cuchar, a: aa.cuchar) + +# Some Basic Colors +# NOTE: Custom raylib color palette for amazing visuals on WHITE background +const LIGHTGRAY* = initColor( 200, 200, 200, 255 ) ## Light Gray +const GRAY* = initColor( 130, 130, 130, 255 ) ## Gray +const DARKGRAY* = initColor( 80, 80, 80, 255 ) ## Dark Gray +const YELLOW* = initColor( 253, 249, 0, 255 ) ## Yellow +const GOLD* = initColor( 255, 203, 0, 255 ) ## Gold +const ORANGE* = initColor( 255, 161, 0, 255 ) ## Orange +const PINK* = initColor( 255, 109, 194, 255 ) ## Pink +const RED* = initColor( 230, 41, 55, 255 ) ## Red +const MAROON* = initColor( 190, 33, 55, 255 ) ## Maroon +const GREEN* = initColor( 0, 228, 48, 255 ) ## Green +const LIME* = initColor( 0, 158, 47, 255 ) ## Lime +const DARKGREEN* = initColor( 0, 117, 44, 255 ) ## Dark Green +const SKYBLUE* = initColor( 102, 191, 255, 255 ) ## Sky Blue +const BLUE* = initColor( 0, 121, 241, 255 ) ## Blue +const DARKBLUE* = initColor( 0, 82, 172, 255 ) ## Dark Blue +const PURPLE* = initColor( 200, 122, 255, 255 ) ## Purple +const VIOLET* = initColor( 135, 60, 190, 255 ) ## Violet +const DARKPURPLE* = initColor( 112, 31, 126, 255 ) ## Dark Purple +const BEIGE* = initColor( 211, 176, 131, 255 ) ## Beige +const BROWN* = initColor( 127, 106, 79, 255 ) ## Brown +const DARKBROWN* = initColor( 76, 63, 47, 255 ) ## Dark Brown + +const WHITE* = initColor( 255, 255, 255, 255 ) ## White +const BLACK* = initColor( 0, 0, 0, 255 ) ## Black +const BLANK* = initColor( 0, 0, 0, 0 ) ## Blank (Transparent) +const MAGENTA* = initColor( 255, 0, 255, 255 ) ## Magenta +const RAYWHITE* = initColor( 245, 245, 245, 255 ) ## My own White (raylib logo) + +const LOC_MAP_DIFFUSE* = LOC_MAP_ALBEDO +const LOC_MAP_SPECULAR* = LOC_MAP_METALNESS + +const MAP_DIFFUSE* = MAP_ALBEDO +const MAP_SPECULAR* = MAP_METALNESS + +""" diff --git a/raylib.nimble b/raylib.nimble index efff637..bff40ad 100644 --- a/raylib.nimble +++ b/raylib.nimble @@ -1,26 +1,16 @@ -# Package - version = "0.1.0" author = "Oskari Timperi" description = "A new awesome nimble package" license = "Zlib" - - -# Dependencies - requires "nim >= 1.0.2" requires "nimgen >= 0.5.1" var name = "raylib" cmd = when defined(Windows): "cmd /c " else: "" - ext = when defined(Windows): ".exe" else: "" - ldpath = when defined(Linux): "LD_LIBRARY_PATH=x64 " else: "" - -# mkDir(name) -task setup, "Checkout and generate": +task setup, "Generate wrapper with nimgen": if gorgeEx(cmd & "nimgen").exitCode != 0: withDir(".."): exec "nimble install nimgen -y" @@ -28,8 +18,3 @@ task setup, "Checkout and generate": before install: setupTask() - -# task test, "Test nimbass": -# exec "nim c -d:nimDebugDlOpen tests/basstest.nim" -# withDir("nimbass"): -# exec ldpath & "../tests/basstest" & ext |
