示例#1
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);
}
示例#2
0
void defineGraphics()
{
    VALUE joyau = JOYAU_MOD;
    defModFunc(joyau, "swizzle", setAutoSwizzle, 0);

    defModFunc(joyau, "mayPlay", Graphics_mayPlay, 0);

    defModFunc(joyau, "startDraw", Graphics_startDraw, 0);
    defModFunc(joyau, "endDraw", Graphics_endDraw, 0);
    defModFunc(joyau, "sync", Graphics_sync, 0);

    defModFunc(joyau, "frameskip", Graphics_frameskip, 2);

    defModFunc(joyau, "color", Graphics_color, -1);

    defModFunc(joyau, "drawLine", Graphics_drawLine, 5);
    defModFunc(joyau, "drawRect", Graphics_drawRect, 5);
    defModFunc(joyau, "drawFillRect", Graphics_drawFillRect, 5);
    defModFunc(joyau, "drawTriangle", Graphics_drawTriangle, 9);
    defModFunc(joyau, "drawCircle", Graphics_drawCircle, 4);
    defModFunc(joyau, "drawFillCircle", Graphics_drawFillCircle, 4);

    defModFunc(joyau, "screenshot", Graphics_screenshot, 1);
    defModFunc(joyau, "fade", Graphics_fade, 0);

    defModFunc(joyau, "setFont", setTextFont, 1);
    defModFunc(joyau, "getLength", getTextSize, 1);
    defModFunc(joyau, "setTextBackground", setTextBackground,1);
    defModFunc(joyau, "setTextColor", setTextColor, 1);
    defModFunc(joyau, "drawText", drawText, 3);
    defModFunc(joyau, "drawScripted", drawScripted, 3);
    defModFunc(joyau, "drawStirringText", drawStirringText, 3);

    defModFunc(joyau, "clearScreen", Graphics_clear, 0);

    defModFunc(joyau, "initGfx", Graphics_init, 0);
    defModFunc(joyau, "initLib", lib_start, 0);
    defModFunc(joyau, "stopLib", lib_stop, 0);
    defModFunc(joyau, "stopGfx", Graphics_stop, 0);
}
示例#3
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);
}
示例#4
0
文件: Keys.cpp 项目: bruni68510/Joyau
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");
}