예제 #1
0
bool SetRenderTargetProperty( JSContext *cx, Handle<JSObject *> object, Handle<jsid> id, bool, MutableHandle<Value> value)
{
    RootedValue val(cx); JS_IdToValue( cx, id, MutableHandleValue(&val) );
    JSString *propertyString = val.toString(); const char *propertyName=JS_EncodeString(cx, propertyString);    
    //printf("SetRenderTargetProperty: %s\n", propertyName ); 

    RenderTarget *target=(RenderTarget *) JS_GetPrivate( object );

    if ( !strcmp( propertyName, "w" ) ) {
        target->w=value.toInt32();
    } else
    if ( !strcmp( propertyName, "h" ) ) {
        target->h=value.toInt32();
    } else
    if ( !strcmp( propertyName, "autoResize" ) ) {
        target->autoResize=value.toBoolean();
    } else
    if ( !strcmp( propertyName, "main" ) ) {
        target->main=value.toBoolean();
    }

    return true;
}