Created
October 17, 2012 19:23
-
-
Save cpetzold/3907563 to your computer and use it in GitHub Desktop.
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
#include "basics.h" | |
namespace basics { | |
void init(Handle<Object> target) { | |
NODE_SET_METHOD(target, "init", Init); | |
} | |
Handle<Value> Init(const Arguments& args) { | |
HandleScope scope; | |
if (!(args.Length() == 1 && args[0]->IsNumber())) { | |
return ThrowException(Exception::TypeError(String::New("Invalid arguments: Expected init(flags)"))); | |
} | |
if (SDL_Init(args[0]->Int32Value()) < 0) { | |
return ThrowException(Exception::Error(String::New(SDL_GetError()))); | |
} | |
return Undefined(); | |
} | |
} |
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
#ifndef BASICS_H | |
#define BASICS_H | |
#include "includes.h" | |
#include <SDL2/SDL.h> | |
namespace basics { | |
static void init(Handle<Object> target); | |
static Handle<Value> Init(const Arguments& args); | |
} | |
#endif |
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
c++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' -I/Users/conner/.node-gyp/0.8.9/src -I/Users/conner/.node-gyp/0.8.9/deps/uv/include -I/Users/conner/.node-gyp/0.8.9/deps/v8/include -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/sdl2/src/sdl.o.d.raw -c -o Release/obj.target/sdl2/src/sdl.o ../src/sdl.cc | |
In file included from ../src/sdl.cc:5: | |
../src/basics.h:11:24: warning: unused function 'Init' | |
[-Wunused-function] | |
static Handle<Value> Init(const Arguments& args); | |
^ | |
../src/basics.h:9:15: warning: function 'basics::init' has | |
internal linkage but is not defined | |
static void init(Handle<Object> target); | |
^ | |
../src/sdl.cc:14:11: note: used here | |
basics::init(target); | |
^ | |
2 warnings generated. | |
c++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' -I/Users/conner/.node-gyp/0.8.9/src -I/Users/conner/.node-gyp/0.8.9/deps/uv/include -I/Users/conner/.node-gyp/0.8.9/deps/v8/include -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/sdl2/src/basics.o.d.raw -c -o Release/obj.target/sdl2/src/basics.o ../src/basics.cc | |
../src/basics.cc:5:8: warning: unused function 'init' | |
[-Wunused-function] | |
void init(Handle<Object> target) { | |
^ | |
1 warning generated. | |
./gyp-mac-tool flock ./Release/linker.lock c++ -shared -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -install_name @loader_path/sdl2.node -o Release/sdl2.node Release/obj.target/sdl2/src/sdl.o Release/obj.target/sdl2/src/basics.o -undefined dynamic_lookup -framework SDL2 | |
SOLINK_MODULE(target) Release/sdl2.node: Finished |
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
#include <SDL2/SDL.h> | |
#include <node.h> | |
using namespace node; | |
#include <v8.h> | |
using namespace v8; |
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
#define BUILDING_NODE_EXTENSION | |
#include "includes.h" | |
#include "basics.h" | |
#include "events.h" | |
#include "video.h" | |
#include "audio.h" | |
#include "threads.h" | |
#include "timers.h" | |
#include "files.h" | |
extern "C" void init(Handle<Object> target) { | |
basics::init(target); | |
// events::init(target); | |
// video::init(target); | |
// audio::init(target); | |
// threads::init(target); | |
// timers::init(target); | |
// files::init(target); | |
} | |
NODE_MODULE(sdl2, init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment