Пример #1
0
void method_pic_add_callee(struct object_heap* oh, struct CompiledMethod* callerMethod, struct MethodDefinition* def,
                           word_t arity, struct Object* args[]) {
  word_t i;
  word_t arraySize = array_size(callerMethod->calleeCount);
  word_t entryStart = method_pic_hash(oh, callerMethod, arity, args);

#if 0
  if (callerMethod->calleeCount->elements[i+PIC_CALLEE] == oh->cached.nil) {
    Pinned<struct OopArray> pinArray(oh);
    pinArray = callerMethod->calleeCount;
    method_pic_insert(oh, callerMethod->calleeCount, &callerMethod->calleeCount->elements[i], def, arity, args);
    Pinned<struct CompiledMethod> defMethod(oh);
    defMethod = (struct CompiledMethod*) def->method;
    method_pic_add_callee_backreference(oh, callerMethod, (struct CompiledMethod*) defMethod);
    return;
  }

 /*this old slow code will fill up the hash table instead of only looking at the entry where the hash lands us*/
#else
  for (i = entryStart; i < arraySize; i+= CALLER_PIC_ENTRY_SIZE) {
    /* if it's nil, we need to insert it*/
    if (callerMethod->calleeCount->elements[i+PIC_CALLEE] == oh->cached.nil) {
      Pinned<struct OopArray> pinArray(oh);
      pinArray = callerMethod->calleeCount;
      method_pic_insert(oh, callerMethod->calleeCount, &callerMethod->calleeCount->elements[i], def, arity, args);
      Pinned<struct CompiledMethod> defMethod(oh);
      defMethod = (struct CompiledMethod*) def->method;
      method_pic_add_callee_backreference(oh, callerMethod, (struct CompiledMethod*) defMethod);
      return;
    }
  }
  for (i = 0; i < entryStart; i+= CALLER_PIC_ENTRY_SIZE) {
    /*MUST be same as first loop*/
    if (callerMethod->calleeCount->elements[i+PIC_CALLEE] == oh->cached.nil) {
      method_pic_insert(oh, callerMethod->calleeCount, &callerMethod->calleeCount->elements[i], def, arity, args);
      Pinned<struct CompiledMethod> defMethod(oh);
      defMethod = (struct CompiledMethod*) def->method;
      method_pic_add_callee_backreference(oh, callerMethod, (struct CompiledMethod*)defMethod);
      return;
    }
  }
#endif
}
Пример #2
0
void defineShape()
{
   VALUE cShape = defClass<Shape>("Shape", "Drawable");
   defMethod(cShape, "setColor", Shape_setColor, -1);
   defMethod(cShape, "setGradient", Shape_setGradient, 1);
   defMethod(cShape, "getColors", Shape_getColors, 0);
   defMethod(cShape, "getColor", Shape_getColor, 0);
   defMethod(cShape, "getColorsNumber", Shape_getColorsNumber, 0);
   
   VALUE cFillableShape = defClass<FillableShape>("FillableShape", "Shape");
   defMethod(cFillableShape, "toggleFilled", FillableShape_toggleFilled, 0);
   defMethod(cFillableShape, "filled", FillablleShape_filled, 0);
   defMethod(cFillableShape, "filled=", FillableShape_setFilled, 1);

   defAlias(cShape, "setColor", "color=");
   defAlias(cShape, "setGradient", "gradient=");
   defAlias(cShape, "getColors", "colors");
   defAlias(cShape, "getColor", "color");
   defAlias(cShape, "getColorsNumber", "colorsNumber");
}
Пример #3
0
void defineParticles()
{
   VALUE cPart = defClass<Particles>("Particles", "Drawable");
   defMethod(cPart, "setFile", Particles_setFile, 1);
   defMethod(cPart, "setParam", Particles_setParam, 4);
   defMethod(cPart, "addParticles", Particles_addParticles, 2);
   defMethod(cPart, "getTime", Particles_getTime, 0);
   defMethod(cPart, "getSpeed", Particles_getSpeed, 0);
   defMethod(cPart, "getGravity", Particles_getGravity, 0);
   defMethod(cPart, "getMinSpeed", Particles_getMinSpeed, 0);

   defAlias(cPart, "setFile", "file=");
   defAlias(cPart, "getTime", "time");
   defAlias(cPart, "getSpeed", "speed");
   defAlias(cPart, "getGravity", "gravity");
   defAlias(cPart, "getMinSpeed", "minSpeed");
}
Пример #4
0
void defineScrolling()
{
   VALUE cScroll = defClass<Scrolling>("Scrolling", "Drawable");
   defMethod(cScroll, "initialize", Scrolling_initialize, -1);

   defMethod(cScroll, "setSprite", Scrolling_setSprite, 1);
   defMethod(cScroll, "setDir", Scrolling_setDir, 1);
   defMethod(cScroll, "setSpeed", Scrolling_setSpeed, 1);
   defMethod(cScroll, "dir", Scrolling_dir, 0);
   defMethod(cScroll, "speed", Scrolling_speed, 0); 
   defMethod(cScroll, "play", Scrolling_play, 0);

   defAlias(cScroll, "setSprite", "sprite=");
   defAlias(cScroll, "setDir", "dir=");
   defAlias(cScroll, "dir", "direction");
   defAlias(cScroll, "setDir", "direction=");
   defAlias(cScroll, "setSpeed", "speed=");

   defConst(cScroll, "LEFT", INT2FIX(Sprite::LEFT));
   defConst(cScroll, "RIGHT", INT2FIX(Sprite::RIGHT));
   defConst(cScroll, "UP", INT2FIX(Sprite::UP));
   defConst(cScroll, "DOWN", INT2FIX(Sprite::DOWN));
}
Пример #5
0
void defineGameMap()
{
   VALUE cCollisionType = defClass<CollisionType>("CollisionType");
   defMethod(cCollisionType, "initialize", CollisionType_initialize, -1);

   defMethod(cCollisionType, "left", CollisionType_left, 0);
   defMethod(cCollisionType, "right", CollisionType_right, 0);
   defMethod(cCollisionType, "up", CollisionType_up, 0);
   defMethod(cCollisionType, "down", CollisionType_down, 0);
   defMethod(cCollisionType, "content", CollisionType_content, 0);

   defMethod(cCollisionType, "left=", CollisionType_setLeft, 1);
   defMethod(cCollisionType, "right=", CollisionType_setRight, 1);
   defMethod(cCollisionType, "up=", CollisionType_setUp, 1);
   defMethod(cCollisionType, "down=", CollisionType_setDown, 1);
   defMethod(cCollisionType, "content=", CollisionType_setContent, 1);
   
   VALUE cTile = defClass<GameMap::Tile>("Tile");
   defMethod(cTile, "initialize", GameMap_Tile_initialize, -1);

   defMethod(cTile, "x", Tile_x, 0);
   defMethod(cTile, "y", Tile_y, 0);
   defMethod(cTile, "tileset", Tile_tileset, 0);
   defMethod(cTile, "tileX", Tile_tileX, 0);
   defMethod(cTile, "tileY", Tile_tileY, 0);
   defMethod(cTile, "type", Tile_type, 0);

   defMethod(cTile, "x=", Tile_setX, 1);
   defMethod(cTile, "y=", Tile_setY, 1);
   defMethod(cTile, "tileset=", Tile_setTileset, 1);
   defMethod(cTile, "tileX=", Tile_setTileX, 1);
   defMethod(cTile, "tileY=", Tile_setTileY, 1);
   defMethod(cTile, "type=", Tile_setType, 1);
 
   VALUE cMap = defClass<GameMap>("GameMap", "Drawable");
   defMethod(cMap, "initialize", GameMap_initialize, -1);

   defMethod(cMap, "addTileset", GameMap_addTileset, 1);
   defMethod(cMap, "setTileSize", GameMap_setTileSize, 2);
   defMethod(cMap, "tileWidth", GameMap_tileWidth, 0);
   defMethod(cMap, "tileHeight", GameMap_tileHeight, 0);
   defMethod(cMap, "collisionH=", GameMap_setCollisionH, 1);
   defMethod(cMap, "collisionH", GameMap_collisionH, 0);
   defMethod(cMap, "absToRel", GameMap_absToRel, 2);
   defMethod(cMap, "relToAbs", GameMap_relToAbs, 2);
   defMethod(cMap, "centerOn", GameMap_centerOn, 2);
   defMethod(cMap, "addElem", GameMap_addElem, -1);
   defMethod(cMap, "<<", GameMap_push, 1);
   defMethod(cMap, "clear", GameMap_clear, 0);
   defMethod(cMap, "clearTiles", GameMap_clearTiles, 0);
   defMethod(cMap, "clear_between", GameMap_clearBetween, 0);
   defMethod(cMap, "tiles", GameMap_tiles, 0);
   defMethod(cMap, "tilesets", GameMap_tilesets, 0);
   defMethod(cMap, "each_tile", GameMap_each_tile, 0);
   defMethod(cMap, "each_tileset", GameMap_each_tileset, 0);
   defMethod(cMap, "reject_tiles", GameMap_reject_tiles, 0);
   defMethod(cMap, "addBetween", GameMap_addBetween, 1);

   defAlias(cMap, "addTileset", "add_tileset");
   defAlias(cMap, "setTileSize", "set_tile_size");
   defAlias(cMap, "tileWidth", "tile_width");
   defAlias(cMap, "tileHeight", "tile_height");
   defAlias(cMap, "collisionH", "collision_h");
   defAlias(cMap, "collisionH=", "collision_h=");
   defAlias(cMap, "absToRel", "abs2rel");
   defAlias(cMap, "relToAbs", "rel2abs");
   defAlias(cMap, "centerOn", "center_on");
   defAlias(cMap, "addElem", "add_elem");
   defAlias(cMap, "clearTiles", "clear_tiles");

   CollisionType full(true, false, false, false, false);
   CollisionType left(false, true, false, false, false);
   CollisionType right(false, false, true, false, false);
   CollisionType up(false, false, false, true, false);
   CollisionType down(false, false, false, false, true);
   CollisionType no(false, false, false, false, false);
   CollisionType left_right(false, true, true, false, false);
   CollisionType left_up(false, true, false, true, false);
   CollisionType left_down(false, true, false, false, true);
   CollisionType right_up(false, false, true, true, false);
   CollisionType right_down(false, false, true, false, true);
   CollisionType up_down(false, false, false, true, true);

   /*
     Document-const: COL_FULL
     Joyau::CollisionType.new(true, false, false, false, false): Collision with
     everything.
   */

   /*
     Document-const: COL_LEFT
     Joyau::CollisionType.new(false, true, false, false, false): Collision with
     the left side.
   */

   /*
     Document-const: COL_RIGHT
     Joyau::CollisionType.new(false, false, true, false, false): Collision with
     the right side.
   */

   /*
     Document-const: COL_UP
     Joyau::CollisionType.new(false, false, false, true, false): Collision with
     the upper side.
   */

   /*
     Document-const: COL_DOWN
     Joyau::CollisionType.new(false, false, false, false, true): Collision with
     the downer side.
   */

   /*
     Document-const: COL_NO
     Joyau::CollisionType.new(false, false, false, false, false): Collision 
     with nothing.
   */

   /*
     Document-const: COL_LEFT_RIGHT
     Joyau::CollisionType.new(false, true, true, false, false): Collision with
     the left and right sides.
   */

   /*
     Document-const: COL_LEFT_UP
     Joyau::CollisionType.new(false, true, false, true, false): Collision with
     the left and the upper sides.
   */

   /*
     Document-const: COL_LEFT_DOWN
     Joyau::CollisionType.new(false, true, false, false, true): Collision with
     the left and the downer sides.
   */

   /*
     Document-const: COL_RIGHT_UP
     Joyau::CollisionType.new(false, false, true, true, false): Collision with
     the right and the upper sides.
   */

   /*
     Document-const: COL_RIGHT_DOWN
     Joyau::CollisionType.new(false, false, true, false, true): Collision with
     the right and the downer sides.
   */

   /*
     Document-const: COL_UP_DOWN
     Joyau::CollisionType.new(false, false, false, true, true): Collision with
     the upper and the downer sides.
   */


   defConst(cMap, "COL_FULL", createObject(cCollisionType, full));
   defConst(cMap, "COL_LEFT", createObject(cCollisionType, left));
   defConst(cMap, "COL_RIGHT", createObject(cCollisionType, right));
   defConst(cMap, "COL_UP", createObject(cCollisionType, up));
   defConst(cMap, "COL_DOWN", createObject(cCollisionType, down));
   defConst(cMap, "COL_NO", createObject(cCollisionType, no));
   defConst(cMap, "COL_LEFT_RIGHT", createObject(cCollisionType, left_right));
   defConst(cMap, "COL_LEFT_UP", createObject(cCollisionType, left_up));
   defConst(cMap, "COL_LEFT_DOWN", createObject(cCollisionType, left_down));
   defConst(cMap, "COL_RIGHT_UP", createObject(cCollisionType, right_up));
   defConst(cMap, "COL_RIGHT_DOWN", createObject(cCollisionType, right_down));
   defConst(cMap, "COL_UP_DOWN", createObject(cCollisionType, up_down));
}
Пример #6
0
void defineDrawable()
{
   VALUE cPoint = defClass<Point>("Point");
   defMethod(cPoint, "x", Point_getX, 0);
   defMethod(cPoint, "y", Point_getY, 0);

   defMethod(cPoint, "x=", Point_setX, 1);
   defMethod(cPoint, "y=", Point_setY, 1);

   defMethod(cPoint, "+", Point_add, 1);
   defMethod(cPoint, "-", Point_sub, 1);
   defMethod(cPoint, "==", Point_eq, 1);

   VALUE cRect = defClass<Rect>("Rect");
   defMethod(cRect, "x", Rect_getX, 0);
   defMethod(cRect, "y", Rect_getY, 0);
   defMethod(cRect, "w", Rect_getW, 0);
   defMethod(cRect, "h", Rect_getH, 0);
   
   defMethod(cRect, "x=", Rect_setX, 1);
   defMethod(cRect, "y=", Rect_setY, 1);
   defMethod(cRect, "w=", Rect_setW, 1);
   defMethod(cRect, "h=", Rect_setH, 1);

   VALUE cDrawable = defClass<Drawable>("Drawable");
   defMethod(cDrawable, "boundingRect", Drawable_boundingRect, 0);
   defMethod(cDrawable, "collide", Drawable_collide, 1);
   defMethod(cDrawable, "isOn", Drawable_isOn, 2);

   defMethod(cDrawable, "getX", Drawable_getX, 0);
   defMethod(cDrawable, "getY", Drawable_getY, 0);

   defMethod(cDrawable, "x=", Drawable_setX, 1);
   defMethod(cDrawable, "y=", Drawable_setY, 1);

   defMethod(cDrawable, "movedX", Drawable_movedX, 0);
   defMethod(cDrawable, "movedY", Drawable_movedY, 0);

   defMethod(cDrawable, "getW", Drawable_getW, 0);
   defMethod(cDrawable, "getH", Drawable_getH, 0);

   defMethod(cDrawable, "setPos", Drawable_setPos, 2);
   defMethod(cDrawable, "pos=", Drawable_setPoint, 1);

   defMethod(cDrawable, "move", Drawable_move, 2);
   defMethod(cDrawable, "cancelMove", Drawable_cancelMove, 0);
   defMethod(cDrawable, "clearMove", Drawable_clearMove, 0);

   defMethod(cDrawable, "draw", Drawable_draw, 0);

   defMethod(cDrawable, "to_buf", Drawable_to_buf, 0);
   
   defAlias(cDrawable, "getX", "x");
   defAlias(cDrawable, "getY", "y");
   defAlias(cDrawable, "getW", "w");
   defAlias(cDrawable, "getH", "h");

   defAlias(cDrawable, "collide", "collide?");
   defAlias(cDrawable, "isOn", "is_on?");
   defAlias(cDrawable, "boundingRect", "bounding_rect");
   defAlias(cDrawable, "movedX", "moved_x");
   defAlias(cDrawable, "movedY", "moved_y");
   defAlias(cDrawable, "cancelMove", "cancel_move");
   defAlias(cDrawable, "clearMove", "clear_move");
}
Пример #7
0
void defineMsgConfig()
{
   VALUE cMsgConfig = defClass<MsgConfig>("MsgConfig");
   defMethod(cMsgConfig, "image", MsgConfig_image, 0);
   defMethod(cMsgConfig, "image=", MsgConfig_setImage, 1);

   defMethod(cMsgConfig, "bg", MsgConfig_bg, 0);
   defMethod(cMsgConfig, "bg=", MsgConfig_setBg, 1);

   defMethod(cMsgConfig, "titleColor", MsgConfig_titleColor, 0);
   defMethod(cMsgConfig, "titleColor=", MsgConfig_setTitleColor, 1);

   defMethod(cMsgConfig, "textColor", MsgConfig_textColor, 0);
   defMethod(cMsgConfig, "textColor=", MsgConfig_setTextColor, 1);

   defMethod(cMsgConfig, "bgColor", MsgConfig_bgColor, 0);
   defMethod(cMsgConfig, "bgColor=", MsgConfig_setBgColor, 1);

   defMethod(cMsgConfig, "borderColor", MsgConfig_borderColor, 0);
   defMethod(cMsgConfig, "borderColor=", MsgConfig_setBorderColor, 1);

   defMethod(cMsgConfig, "textFont", MsgConfig_textFont, 0);
   defMethod(cMsgConfig, "textFont=", MsgConfig_setTextFont, 1);

   defMethod(cMsgConfig, "titleFont", MsgConfig_titleFont, 0);
   defMethod(cMsgConfig, "titleFont=", MsgConfig_setTitleFont, 1);
}
Пример #8
0
void defineBuffer() {
   VALUE cBuffer = defClass<Buffer>("Buffer");
   
   /* 
      Document-const: PF_4444      
      PF_4444: Pixel format for 8 bits colors.
   */
   
   /*
      Document-const: PF_5650   
      PF_5650: Pixel format for 16 bits colors.
   */
   
   /*
      Document-const: PF_8888   
      PF_8888: Pixel format for 32 bits colors.
   */

   defConst(cBuffer, "PF_4444", INT2FIX(OSL_PF_4444));
   defConst(cBuffer, "PF_5650", INT2FIX(OSL_PF_5650));
   defConst(cBuffer, "PF_8888", INT2FIX(OSL_PF_8888));
   
   defMethod(cBuffer, "initialize", Buffer_initialize, -1);

   defMethod(cBuffer, "set_actual", Buffer_setActual, 0);
   defMethod(cBuffer, "draw", Buffer_draw, -1);
   defMethod(cBuffer, "clear", Buffer_clear, 1);
   defMethod(cBuffer, "x", Buffer_getX, 0);
   defMethod(cBuffer, "y", Buffer_getY, 0);
   defMethod(cBuffer, "w", Buffer_getW, 0);
   defMethod(cBuffer, "h", Buffer_getH, 0);
   defMethod(cBuffer, "x=", Buffer_setX, 1);
   defMethod(cBuffer, "y=", Buffer_setY, 1);
   defMethod(cBuffer, "setPos", Buffer_setPos, -1);
   defMethod(cBuffer, "move", Buffer_move, 2);
   defMethod(cBuffer, "resize", Buffer_resize, 2);
   defMethod(cBuffer, "zoom", Buffer_zoom, 1);
   defMethod(cBuffer, "rotate", Buffer_rotate, 1);
   defMethod(cBuffer, "lock", Buffer_lock, -1);
   defMethod(cBuffer, "unlock", Buffer_unlock, 0);
   defMethod(cBuffer, "[]", Buffer_getPixel, 2);
   defMethod(cBuffer, "[]=", Buffer_setPixel, 3);
   defMethod(cBuffer, "save", Buffer_save, 1);
   defMethod(cBuffer, "to_sprite", Buffer_to_sprite, 0);
   
   defClassMethod(cBuffer, "screen", Buffer_getScreen, 0);
   defClassMethod(cBuffer, "default", Buffer_getDefault, 0);
   defClassMethod(cBuffer, "actual", Buffer_getActual, 0);

   defClassMethod(cBuffer, "[]", Buffer_find, -1);
   
   defAlias(cBuffer, "setPos", "pos=");

   VALUE cPainter = defClass<Painter>("Painter");
   defMethod(cPainter, "initialize", Painter_initialize, 1);

   defMethod(cPainter, "drawLine", Painter_drawLine, -1);
   defMethod(cPainter, "drawFillRect", Painter_drawFillRect, -1);
   defMethod(cPainter, "drawRect", Painter_drawRect, -1);
   defMethod(cPainter, "drawPoint", Painter_drawPoint, 3);
   defMethod(cPainter, "drawCircle", Painter_drawCircle, 4);
   defMethod(cPainter, "drawFillCircle", Painter_drawFillCircle, 4);
   defMethod(cPainter, "drawTriangle", Painter_drawTriangle, -1);
   defMethod(cPainter, "drawBuffer", Painter_drawBuffer, 3);
 
   defMethod(cPainter, "clear", Painter_clear, 1);
   
   VALUE joyau = JOYAU_MOD;
   defModFunc(joyau, "draw", Joyau_draw, -1);
}
Пример #9
0
void defineKeys()
{
   VALUE keys = rb_hash_new();
   rb_gv_set("$keys", keys);

   VALUE joyau = JOYAU_MOD;
   defModFunc(joyau, "readKeys", checkKeys, 0);
   defModFunc(joyau, "gets", Joyau_gets, 0);

   VALUE mPad = defModule("Pad");
   defModFunc(mPad, "update", Pad_update, 0);
   defModFunc(mPad, "held?", Pad_held, 1);
   defModFunc(mPad, "pressed?", Pad_pressed, 1);
   defModFunc(mPad, "released?", Pad_released, 1);
   defModFunc(mPad, "stickX", Pad_stickX, 0);
   defModFunc(mPad, "stickY", Pad_stickY, 0);

   defConst(mPad, "SELECT", INT2FIX(PSP_CTRL_SELECT));
   defConst(mPad, "START", INT2FIX(PSP_CTRL_START));

   defConst(mPad, "L", INT2FIX(PSP_CTRL_LTRIGGER));
   defConst(mPad, "R", INT2FIX(PSP_CTRL_RTRIGGER));

   defConst(mPad, "CROSS", INT2FIX(PSP_CTRL_CROSS));
   defConst(mPad, "SQUARE", INT2FIX(PSP_CTRL_SQUARE));
   defConst(mPad, "TRIANGLE", INT2FIX(PSP_CTRL_TRIANGLE));
   defConst(mPad, "CIRCLE", INT2FIX(PSP_CTRL_CIRCLE));

   defConst(mPad, "UP", INT2FIX(PSP_CTRL_UP));
   defConst(mPad, "DOWN", INT2FIX(PSP_CTRL_DOWN));
   defConst(mPad, "LEFT", INT2FIX(PSP_CTRL_LEFT));
   defConst(mPad, "RIGHT", INT2FIX(PSP_CTRL_RIGHT));

   defConst(mPad, "HOLD", INT2FIX(PSP_CTRL_HOLD));

   /*
     Document-class: Joyau::OSK

     There is a built-in keyboard in your firmware, which can be used by your
     program easily through this class. Notice Joyau.gets is a simpliefied
     version of this module, which can handle more advanced settings.

     You can, by using its constants, specify what has to be input.
     you can indicated the used language:

     1. DEFAULT
     2. JAPANESE
     3. ENGLISH
     4. FRENCH
     5. SPANISH
     6. GERMAN
     7. ITALIAN
     8. DUTCH
     9. PORTUGESE
     10. RUSSIAN
     11. KOREAN

     As well as the caracters to input:
     
     1. ALL
     2. LATIN_SYMBOL
     3. LATIN_LOWERCASE
     4. LATIN_UPPERCASE
     5. LATIN_DIGIT
     6. JAPANESE_DIGIT
     7. JAPANESE_SYMBOL
     8. JAPANESE_LOWERCASE
     9. JAPANESE_UPPERCASE
     10. JAPANESE_HIRAGANA
     11. JAPANASE_HALF_KATAKANA
     12. JAPANESE_KATAKANA
     13. JAPANESE_LOWERCASE
     14. RUSSIAN_LOWERCASE
     15. RUSSIAN_UPPERCASE
     16. IT_KOREAN
     17. URL

     You can also set the default text and the description, and give a block
     telling what to draw under the keyboard (if nothing were drawn, there'd
     be graphical glitches).
   */
   VALUE mOSK = defModule("OSK");
   defModFunc(mOSK, "run", Osk_run, 5);
   
   defConst(mOSK, "DEFAULT", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_DEFAULT));
   defConst(mOSK, "JAPANESE", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_JAPANESE));
   defConst(mOSK, "ENGLISH", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_ENGLISH));
   defConst(mOSK, "FRENCH", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_SPANISH));
   defConst(mOSK, "SPANISH", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_SPANISH));
   defConst(mOSK, "GERMAN", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_GERMAN));
   defConst(mOSK, "ITALIAN", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_ITALIAN));
   defConst(mOSK, "PORTUGESE", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_PORTUGESE));
   defConst(mOSK, "RUSSIAN", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_RUSSIAN));
   defConst(mOSK, "KOREAN", INT2FIX(PSP_UTILITY_OSK_LANGUAGE_KOREAN));
   
   defConst(mOSK, "ALL", INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_ALL));
   defConst(mOSK, "LATIN_DIGIT", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT));
   defConst(mOSK, "LATIN_SYMBOL", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_LATIN_SYMBOL));
   defConst(mOSK, "LATIN_LOWERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_LATIN_LOWERCASE));
   defConst(mOSK, "LATIN_UPPERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_LATIN_UPPERCASE));
   defConst(mOSK, "JAPANESE_DIGIT", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_DIGIT));
   defConst(mOSK, "JAPANESE_SYMBOL", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_SYMBOL));
   defConst(mOSK, "JAPANESE_LOWERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_LOWERCASE));
   defConst(mOSK, "JAPANESE_UPPERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_UPPERCASE));
   defConst(mOSK, "JAPANESE_HIRAGANA", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_HIRAGANA));
   defConst(mOSK, "JAPANASE_HALF_KATAKANA", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_HALF_KATAKANA));
   defConst(mOSK, "JAPANESE_KATAKANA", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_KATAKANA));
   defConst(mOSK, "RUSSIAN_LOWERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_JAPANESE_LOWERCASE));
   defConst(mOSK, "RUSSIAN_UPPERCASE", 
	    INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_RUSSIAN_UPPERCASE));
   defConst(mOSK, "IT_KOREAN", INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_KOREAN));
   defConst(mOSK, "URL", INT2FIX(PSP_UTILITY_OSK_INPUTTYPE_URL));

   VALUE cCursor = defClass<Cursor>("Cursor", "Sprite");
   defMethod(cCursor, "updatePos", Cursor_updatePos, 0);

   defMethod(cCursor, "setSensibility", Cursor_setSensibility, 1);
   defMethod(cCursor, "sensibility", Cursor_sensibility, 0);

   defMethod(cCursor, "rect=", Cursor_setRect, 1);
   defMethod(cCursor, "rect", Cursor_rect, 0);

   defAlias(cCursor, "setSensibility", "sensibility=");
   defAlias(cCursor, "updatePos", "update_pos");
}
Пример #10
0
void defineAudio()
{
   VALUE cVector3f = defClass<Vector3f>("Vector3f");
   defMethod(cVector3f, "x=", Vector3f_setX, 1);
   defMethod(cVector3f, "y=", Vector3f_setY, 1);
   defMethod(cVector3f, "z=", Vector3f_setZ, 1);

   defMethod(cVector3f, "x", Vector3f_x, 0);
   defMethod(cVector3f, "y", Vector3f_y, 0);
   defMethod(cVector3f, "z", Vector3f_z, 0);

   defMethod(cVector3f, "+", Vector3f_add, 1);
   defMethod(cVector3f, "-", Vector3f_sub, 1);
   defMethod(cVector3f, "==", Vector3f_eq, 1);

   VALUE cAudioObject = defClass<AudioObject>("AudioObject");
   defMethod(cAudioObject, "setPos", AudioObject_setPos, 3);
   defMethod(cAudioObject, "setDirection", AudioObject_setDirection, 3);
   defMethod(cAudioObject, "setVelocity", AudioObject_setVelocity, 3);
   
   defMethod(cAudioObject, "pos=", AudioObject_setPosVector, 1);
   defMethod(cAudioObject, "direction=", AudioObject_setDirectionVector, 1);
   defMethod(cAudioObject, "velocity=", AudioObject_setVelocityVector, 1);

   defMethod(cAudioObject, "playing?", AudioObject_playing, 0);

   VALUE cSound = defClass<Sound>("Sound", "AudioObject");
   defMethod(cSound, "loadWav", Sound_loadWav, 1);
   defMethod(cSound, "play", Sound_play, 0);
   defMethod(cSound, "pause", Sound_play, 0);
   defMethod(cSound, "stop", Sound_stop, 0);

   defAlias(cSound, "loadWav", "load_wav");

   VALUE cStream = defClass<Stream>("Stream", "AudioObject");
   defMethod(cStream, "loadOgg", Stream_loadOgg, 1);
   defMethod(cStream, "play", Stream_play, 0);
   defMethod(cStream, "update", Stream_update, 0);
   defMethod(cStream, "pause", Stream_play, 0);
   defMethod(cStream, "stop", Stream_stop, 0);

   defAlias(cStream, "loadOgg", "load_ogg");

   VALUE mListener = defModule("Listener");
   defModFunc(mListener, "setPos", Listener_setPos, 3);
   defModFunc(mListener, "setDirection", Listener_setDirection, 3);
   defModFunc(mListener, "setVelocity", Listener_setVelocity, 3);
   defModFunc(mListener, "pos=", Listener_posOp, 1);
   defModFunc(mListener, "direction=", Listener_directionOp, 1);
   defModFunc(mListener, "velocity=", Listener_velocityOp, 1);
   defModFunc(mListener, "setOrientation", Listener_setOrientation, 6);

   VALUE joyau = JOYAU_MOD;
   defModFunc(joyau, "initAudio", Audio_init, 0);
   defModFunc(joyau, "stopAudio", Audio_stop, 0);
}