MCPcopy Create free account
hub / github.com/creationix/node-sdl / Load

Method Load

src/sdl.cc:882–901  ·  view source on GitHub ↗

TODO: make an async version so this can be used in loops or parallel load images

Source from the content-addressed store, hash-verified

880
881// TODO: make an async version so this can be used in loops or parallel load images
882static Handle<Value> sdl::IMG::Load(const Arguments& args) {
883 HandleScope scope;
884
885 if (!(args.Length() == 1 && args[0]->IsString())) {
886 return ThrowException(Exception::TypeError(String::New("Invalid arguments: Expected IMG::Load(String)")));
887 }
888
889 String::Utf8Value file(args[0]);
890
891 SDL_Surface *image;
892 image=IMG_Load(*file);
893 if(!image) {
894 return ThrowException(Exception::Error(String::Concat(
895 String::New("IMG::Load: "),
896 String::New(IMG_GetError())
897 )));
898 }
899
900 return scope.Close(WrapSurface(image));
901}
902
903static Handle<Value> sdl::WM::SetCaption(const Arguments& args) {
904 HandleScope scope;

Callers

nothing calls this directly

Calls 1

WrapSurfaceFunction · 0.85

Tested by

no test coverage detected