コード例 #1
0
ファイル: main.c プロジェクト: moon-watcher/Shattering_jaws
static void handleInput()
{
    u16 value;

    value = JOY_readJoypad(JOY_1);

    if (value & BUTTON_A)
    {
        if (value & BUTTON_UP)
        {
            if (numpartic < MAX_PARTIC)
            {
                if (numpartic == 1) numpartic += 9;
                else numpartic += 10;
                if (numpartic > MAX_PARTIC) numpartic = MAX_PARTIC;
            }
        }
        if (value & BUTTON_DOWN)
        {
            if (numpartic > 1)
            {
                if (numpartic == MAX_PARTIC) numpartic -= 9;
                else numpartic -= 10;
                if (numpartic < 1) numpartic = 1;
            }
        }
    }
    else if (value & BUTTON_B)
    {
        if (value & BUTTON_UP)
        {
            if (gravity > FIX16(0.1)) gravity -= FIX16(0.02);
        }
        if (value & BUTTON_DOWN)
        {
            if (gravity < FIX16(1.0)) gravity += FIX16(0.02);
        }
    }
    else
    {
        if (value & BUTTON_UP)
        {
            if (baseposy < intToFix16(BMP_HEIGHT - 10)) baseposy += FIX16(5.0);
        }
        if (value & BUTTON_DOWN)
        {
            if (baseposy > intToFix16(10)) baseposy -= FIX16(5.0);
        }
        if (value & BUTTON_LEFT)
        {
            if (baseposx > intToFix16(10)) baseposx -= FIX16(3.5);
        }
        if (value & BUTTON_RIGHT)
        {
            if (baseposx < intToFix16(BMP_WIDTH - 10)) baseposx += FIX16(3.5);
        }
    }
}
コード例 #2
0
ファイル: game_player.c プロジェクト: z88dk/z88dk
void player_reset( )
{
	currentStep = STEP_INIT;

#ifdef	TARGET_GG
	shipPosition.x = FIX16( SPRITE_X(8*((20-3)/2)) ); //middle
#else
	shipPosition.x = FIX16( 8*((32-4)/2) ); //middle
#endif

	shipPosition.y = MAX_Y; //below down screen

	shipVelocity.x = 0;
	shipVelocity.y = PLAYER_SPEED_Y;

	shipSprite.x = fix16ToRoundedInt(shipPosition.x);
	shipSprite.y = fix16ToRoundedInt(shipPosition.y);

}
コード例 #3
0
ファイル: main.c プロジェクト: moon-watcher/Shattering_jaws
int main()
{
    char col;

    JOY_setEventHandler(joyEvent);

    VDP_setScreenWidth256();
    VDP_setHInterrupt(0);
    VDP_setHilightShadow(0);

    BMP_init(TRUE, PLAN_A, PAL0, FALSE);

    paused = 0;
    col = 0xFF;

    /* Initialise particules */
    baseposx = intToFix16(BMP_WIDTH / 2);
    baseposy = intToFix16(BMP_HEIGHT / 2);
    gravity = FIX16(0.4);

    initPartic(100);

    /* Do main job here */
    while(1)
    {
        char str[8];

        handleInput();

        if (!paused)
        {
            // calculates particules physic
            updatePartic(partics, numpartic);

            // ensure previous flip buffer request has been started
            BMP_waitWhileFlipRequestPending();

            // can now draw text
            BMP_showFPS(0);

            // display particul number
            intToStr(numpartic, str, 1);
            BMP_clearText(1, 3, 4);
            BMP_drawText(str, 1, 3);

            // display gravity
            fix16ToStr(gravity, str, 2);
            BMP_clearText(1, 4, 5);
            BMP_drawText(str, 1, 4);

            // clear bitmap
            BMP_clear();
            // draw particules
            drawPartic(partics, numpartic, col);

            // swap buffer
            BMP_flip(1);
        }
        else
        {
            BMP_drawText("PAUSE", 1, 4);
        }
    }
}
コード例 #4
0
#include "genesis.h"

/* grid_cube_small.obj */
/* List of vertices */
const Vect3D_f16 vb_grid_cube_small_vertex_pos[20] =
{
	{FIX16(-5.900219083928085),	FIX16(-5.511336103603647),	FIX16(-5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(5.511336455280305),	FIX16(-5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(-0.02985819879262088),	FIX16(-5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(-5.511336103603647),	FIX16(5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(-5.511336103603647),	FIX16(-5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(5.511336455280305),	FIX16(-5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(5.511336455280305),	FIX16(5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(-0.02985819879262088),	FIX16(5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(-0.02985819879262088),	FIX16(-5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(-5.511336103603647),	FIX16(5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(5.511336455280305),	FIX16(5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(-0.02985819879262088),	FIX16(5.900219083928085)},
	{FIX16(0.0),	FIX16(-5.511336103603647),	FIX16(5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(-5.511336103603647),	FIX16(-0.0)},
	{FIX16(0.0),	FIX16(-5.511336103603647),	FIX16(-5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(-5.511336103603647),	FIX16(-0.0)},
	{FIX16(0.0),	FIX16(5.511336455280305),	FIX16(-5.900219083928085)},
	{FIX16(-5.900219083928085),	FIX16(5.511336455280305),	FIX16(-0.0)},
	{FIX16(0.0),	FIX16(5.511336455280305),	FIX16(5.900219083928085)},
	{FIX16(5.900219083928085),	FIX16(5.511336455280305),	FIX16(-0.0)},
};
コード例 #5
0
ファイル: main.c プロジェクト: kubilus1/SGDK
int main()
{
    char str[16];

    VDP_setScreenWidth256();
    VDP_setHInterrupt(0);
    VDP_setHilightShadow(0);

    // speed up controller checking
    JOY_setSupport(PORT_1, JOY_SUPPORT_6BTN);
    JOY_setSupport(PORT_2, JOY_SUPPORT_OFF);

    JOY_setEventHandler(handleJoyEvent);

    BMP_init(TRUE, PAL0, FALSE);

    camdist = FIX16(15);

    M3D_reset();
    M3D_setCamDistance(camdist);
    M3D_setLightEnabled(1);
    M3D_setLightXYZ(FIX16(0.9), FIX16(0.9), FIX16(-0.9));

    // allocate translation and rotation structure
    M3D_setTransform(&transformation, &translation, &rotation);
    M3D_setTranslation(&transformation, FIX16(0), FIX16(0), FIX16(20));
    M3D_setRotation(&transformation, FIX16(0), FIX16(0), FIX16(0));

    flatDrawing = 0;

    while (1)
    {
        doActionJoy(JOY_1, JOY_readJoypad(JOY_1));

        M3D_setCamDistance(camdist);

        // do work here
        rotation.x += rotstep.x;
        rotation.y += rotstep.y;
        rotation.z += rotstep.z;
        transformation.rebuildMat = 1;

        updatePointsPos();

        // ensure previous flip buffer request has been started
        BMP_waitWhileFlipRequestPending();
        BMP_showFPS(1);

        BMP_clear();

        drawPoints(0xFF);

        BMP_drawText("trans z:", 0, 2);
        fix16ToStr(translation.z, str, 2);
        BMP_drawText(str, 10, 2);
        BMP_drawText("cam dist:", 0, 3);
        fix16ToStr(camdist, str, 2);
        BMP_drawText(str, 11, 3);

        BMP_flip(1);
    }
}
コード例 #6
0
ファイル: meshs.c プロジェクト: ehaliewicz/SGDK
#include "genesis.h"


//    CUBE
//
//    6----7
//   /|   /|
//  2-+--4 |
//  | |  | |
//  | 3--+-5
//  |/   |/
//  0----1

const Vect3D_f16 cube_coord[8] =
{
    {FIX16(-1), FIX16(-1), FIX16(-1)},
    {FIX16(1), FIX16(-1), FIX16(-1)},
    {FIX16(-1), FIX16(1), FIX16(-1)},
    {FIX16(-1), FIX16(-1), FIX16(1)},
    {FIX16(1), FIX16(1), FIX16(-1)},
    {FIX16(1), FIX16(-1), FIX16(1)},
    {FIX16(-1), FIX16(1), FIX16(1)},
    {FIX16(1), FIX16(1), FIX16(1)}
};

const u16 cube_poly_ind[6 * 4] =
{
    6, 3, 5, 7,
    0, 2, 4, 1,
    2, 6, 7, 4,
    3, 0, 1, 5,
コード例 #7
0
ファイル: SWIFTEXT.CPP プロジェクト: dprotopopov/DES
FIX4( LETTER ) "%n\0";

const char LETTER5[] =
FIX5( LETTER ) "%n\0";

const char LETTER7[] =
FIX7( LETTER ) "%n\0";

const char LETTER8[] =
FIX8( LETTER ) "%n\0";

const char LETTER9[] =
FIX9( LETTER ) "%n\0";

const char LETTER16[] =
FIX16( LETTER ) "%n\0";

///////////////////////////////////////////////////////////////////////////

const char LETTERDIGIT1[] =
"%*1" LETTERDIGIT "%n\0";

const char LETTERDIGIT2[] =
FIX2( LETTERDIGIT ) "%n\0";

const char LETTERDIGIT3[] =
FIX3( LETTERDIGIT ) "%n\0";

const char LETTERDIGIT5[] =
FIX5( LETTERDIGIT ) "%n\0";