rm constructors
This commit is contained in:
@@ -17,14 +17,14 @@ var png = use('/Users/john/work/cell-image/png')
|
||||
var time = use('time')
|
||||
|
||||
// Create window
|
||||
var win = new video.window({
|
||||
var win = video.window({
|
||||
title: "Lenna - WASD to move",
|
||||
width: 640,
|
||||
height: 480
|
||||
})
|
||||
|
||||
// Create renderer
|
||||
var renderer = new render(win)
|
||||
var renderer = render(win)
|
||||
|
||||
renderer.win = win
|
||||
|
||||
@@ -45,7 +45,7 @@ if (!img) {
|
||||
log.console("Image loaded: " + text(img.width) + "x" + text(img.height))
|
||||
|
||||
// Create SDL surface from image data
|
||||
var surf = new surface({
|
||||
var surf = surface({
|
||||
width: img.width,
|
||||
height: img.height,
|
||||
format: "rgba32",
|
||||
|
||||
22
gpu.c
22
gpu.c
@@ -1784,34 +1784,30 @@ CELL_USE_INIT(
|
||||
QJSCLASSPREP_NO_FUNCS(SDL_GPUShader)
|
||||
|
||||
// Create GPU constructor
|
||||
JSValue gpu_ctor = JS_NewCFunction2(js, js_gpu_constructor, "gpu", 1, JS_CFUNC_constructor, 0);
|
||||
|
||||
// Set prototype on constructor
|
||||
JS_SetConstructor(js, gpu_ctor, SDL_GPUDevice_proto);
|
||||
|
||||
// Set constructor in exports
|
||||
JSValue gpu_ctor = JS_NewCFunction2(js, js_gpu_constructor, "gpu", 1, JS_CFUNC_generic, 0);
|
||||
|
||||
JS_SetPropertyStr(js, ret, "gpu", gpu_ctor);
|
||||
|
||||
// Add GPU object constructors
|
||||
JSValue sampler_ctor = JS_NewCFunction2(js, js_gpu_sampler_constructor, "sampler", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue sampler_ctor = JS_NewCFunction2(js, js_gpu_sampler_constructor, "sampler", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "sampler", sampler_ctor);
|
||||
|
||||
JSValue shader_ctor = JS_NewCFunction2(js, js_gpu_shader_constructor, "shader", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue shader_ctor = JS_NewCFunction2(js, js_gpu_shader_constructor, "shader", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "shader", shader_ctor);
|
||||
|
||||
JSValue graphics_pipeline_ctor = JS_NewCFunction2(js, js_gpu_graphics_pipeline_constructor, "graphics_pipeline", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue graphics_pipeline_ctor = JS_NewCFunction2(js, js_gpu_graphics_pipeline_constructor, "graphics_pipeline", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "graphics_pipeline", graphics_pipeline_ctor);
|
||||
|
||||
JSValue compute_pipeline_ctor = JS_NewCFunction2(js, js_gpu_compute_pipeline_constructor, "compute_pipeline", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue compute_pipeline_ctor = JS_NewCFunction2(js, js_gpu_compute_pipeline_constructor, "compute_pipeline", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "compute_pipeline", compute_pipeline_ctor);
|
||||
|
||||
JSValue buffer_ctor = JS_NewCFunction2(js, js_gpu_buffer_constructor, "buffer", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue buffer_ctor = JS_NewCFunction2(js, js_gpu_buffer_constructor, "buffer", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "buffer", buffer_ctor);
|
||||
|
||||
JSValue transfer_buffer_ctor = JS_NewCFunction2(js, js_gpu_transfer_buffer_constructor, "transfer_buffer", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue transfer_buffer_ctor = JS_NewCFunction2(js, js_gpu_transfer_buffer_constructor, "transfer_buffer", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "transfer_buffer", transfer_buffer_ctor);
|
||||
|
||||
JSValue texture_ctor = JS_NewCFunction2(js, js_gpu_texture_constructor, "texture", 2, JS_CFUNC_constructor, 0);
|
||||
JSValue texture_ctor = JS_NewCFunction2(js, js_gpu_texture_constructor, "texture", 2, JS_CFUNC_generic, 0);
|
||||
JS_SetPropertyStr(js, ret, "texture", texture_ctor);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1083,11 +1083,7 @@ CELL_USE_INIT(
|
||||
QJSCLASSPREP_FUNCS(SDL_Surface)
|
||||
|
||||
// Add the surface constructor
|
||||
JSValue ctor = JS_NewCFunction2(js, js_surface_constructor, "surface", 1, JS_CFUNC_constructor, 0);
|
||||
|
||||
JSValue proto = JS_GetClassProto(js, js_SDL_Surface_id);
|
||||
JS_SetConstructor(js, ctor, proto);
|
||||
JS_FreeValue(js, proto);
|
||||
JSValue ctor = JS_NewCFunction2(js, js_surface_constructor, "surface", 1, JS_CFUNC_generic, 0);
|
||||
|
||||
// Add the generic convert function as a property on the constructor
|
||||
JS_SetPropertyStr(js, ctor, "convert", JS_NewCFunction(js, js_surface_convert_generic, "convert", 2));
|
||||
|
||||
1
video.c
1
video.c
@@ -749,6 +749,7 @@ CELL_USE_INIT(
|
||||
|
||||
QJSCLASSPREP_NO_FUNCS(SDL_Cursor);
|
||||
|
||||
|
||||
// Add cursor functions
|
||||
JS_SetPropertyStr(js, ret, "createCursor", JS_NewCFunction(js, js_sdl_create_cursor, "createCursor", 2));
|
||||
JS_SetPropertyStr(js, ret, "setCursor", JS_NewCFunction(js, js_sdl_set_cursor, "setCursor", 1));
|
||||
|
||||
Reference in New Issue
Block a user