koffi 0.9.15 → 0.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -66,7 +66,7 @@ This section assumes you know how to build C shared libraries.
66
66
  This examples illustrates how to use Koffi with a Raylib shared library:
67
67
 
68
68
  ```js
69
- const koffi = require('build/koffi.node');
69
+ const koffi = require('koffi');
70
70
 
71
71
  const Color = koffi.struct('Color', {
72
72
  r: 'uchar',
@@ -120,20 +120,20 @@ const Font = koffi.struct('Font', {
120
120
  glyphs: koffi.pointer(GlyphInfo)
121
121
  });
122
122
 
123
- // Fix the path to Raylib DLL
124
- let lib = koffi.load('Raylib.dll');
125
-
126
- const InitWindow = lib.func('InitWindow', ['void', ['int', 'int', 'string']]);
127
- const SetTargetFPS = lib.func('SetTargetFPS', ['void', ['int']]);
128
- const GetScreenWidth = lib.func('GetScreenWidth', ['int', []]);
129
- const GetScreenHeight = lib.func('GetScreenHeight', ['int', []]);
130
- const ClearBackground = lib.func('ClearBackground', ['void', [Color]]);
131
- const BeginDrawing = lib.func('BeginDrawing', ['void', []]);
132
- const EndDrawing = lib.func('EndDrawing', ['void', []]);
133
- const WindowShouldClose = lib.func('WindowShouldClose', ['bool', []]);
134
- const GetFontDefault = lib.func('GetFontDefault', [Font, []]);
135
- const MeasureTextEx = lib.func('MeasureTextEx', [Vector2, [Font, 'string', 'float', 'float']]);
136
- const DrawTextEx = lib.func('DrawTextEx', ['void', [Font, 'string', Vector2, 'float', 'float', Color]]);
123
+ // Fix the path to Raylib DLL if needed
124
+ let lib = koffi.load('build/raylib' + (process.platform == 'win32' ? '.dll' : '.so'));
125
+
126
+ const InitWindow = lib.func('InitWindow', 'void', ['int', 'int', 'string']);
127
+ const SetTargetFPS = lib.func('SetTargetFPS', 'void', ['int']);
128
+ const GetScreenWidth = lib.func('GetScreenWidth', 'int', []);
129
+ const GetScreenHeight = lib.func('GetScreenHeight', 'int', []);
130
+ const ClearBackground = lib.func('ClearBackground', 'void', [Color]);
131
+ const BeginDrawing = lib.func('BeginDrawing', 'void', []);
132
+ const EndDrawing = lib.func('EndDrawing', 'void', []);
133
+ const WindowShouldClose = lib.func('WindowShouldClose', 'bool', []);
134
+ const GetFontDefault = lib.func('GetFontDefault', Font, []);
135
+ const MeasureTextEx = lib.func('MeasureTextEx', Vector2, [Font, 'string', 'float', 'float']);
136
+ const DrawTextEx = lib.func('DrawTextEx', 'void', [Font, 'string', Vector2, 'float', 'float', Color]);
137
137
 
138
138
  InitWindow(800, 600, 'Test Raylib');
139
139
  SetTargetFPS(60);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
4
4
  "description": "Fast and simple FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",