Esempio n. 1
0
void ExampleInit()
{
    IW_PROFILE_INIT();

    // Initialise
    IwGxInit();

    // Set screen clear colour
    IwGxSetColClear(0x40, 0x40, 0x40, 0x00);

    // Turn all lighting off
    IwGxLightingOff();

    // Set field of view
    IwGxSetPerspMul(0xa0);

    // Set near and far planes
    IwGxSetFarZNearZ(0x1000, 0x10);

    // Set the view matrix along the -ve z axis
    CIwMat view = CIwMat::g_Identity;
    view.t.z = -0x200;
    IwGxSetViewMatrix(&view);
    //IwGxSetScreenOrient(IW_GX_ORIENT_NONE);

    s_Accelerometer = (S3E_RESULT_SUCCESS == s3eAccelerometerStart());

    m_pAnimator = new CSplineAnimator();
    m_pAnimator->Init();

    m_pSplinePoly2Tri = new CSplinePoly2Tri(m_pAnimator->GetCurrentSpline());

    // ball
    m_pBall = new CBall();
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
void HexMapTest::Init()
{
	zoom = 1.0f;
	rotation = 0.0f;
	screenTranslationX = 0;
	screenTranslationY = 0;

	// Initialise the input system
	g_Input.Init();

    // Initialise vectors
    s_left      =  CIwVec3::g_AxisX;
    s_up        = -CIwVec3::g_AxisY;
    s_Angles = CIwSVec3::g_Zero;
    s_cameraPos =  CIwVec3(0, 0, -0x80);

    // Initialise view matrix
    s_viewMatrix = CIwMat::g_Identity;

    s_viewMatrix.SetTrans(s_cameraPos);
    s_viewMatrix.LookAt(
        s_viewMatrix.GetTrans(),
         CIwVec3::g_Zero,
        -CIwVec3::g_AxisY);

	// Initialise
    IwGxInit();
	IwResManagerInit();
    // Set screen clear colour
    IwGxSetColClear(0x40, 0x40, 0x40, 0x00);

    // Turn all lighting off
    IwGxLightingOff();

    // Set field of view
    IwGxSetPerspMul(0xa0);

    // Set near and far planes
    IwGxSetFarZNearZ(0x1000, 0x10);

    // Create empty texture object
    s_BitMapTexture = new CIwTexture;

    // Load image data from disk into texture
    s_BitMapTexture->LoadFromFile("./textures/testTexture_8bit.bmp");

    // "Upload" texture to VRAM
    s_BitMapTexture->Upload();


    // Set the view matrix along the -ve z axis
    CIwMat view = CIwMat::g_Identity;
    view.t.z = -0x100;
    IwGxSetViewMatrix(&view);
	IwGetResManager()->LoadGroup("TileRes.group"); 
	pGroup = IwGetResManager()->GetGroupNamed("TileRes");
	hexGrid = new HexGrid(hexGridMaxX, hexGridMaxY, textureMaxX, textureMaxY);
	hexGrid->setTexture(IW_TEXTURE(pGroup,"grid"),textureMaxX,textureMaxY);
	s_ModelMatrix.SetIdentity();
}
Esempio n. 3
0
void CameraViewInit()
{
    // Camera field of view
	IwGxSetPerspMul((float) IwGxGetScreenWidth() / 1.3);
    IwGxSetFarZNearZ(0x2000,0x10);

	ghost_Model = NULL;
	ghostCollision = NULL;
	ghost_Skin = NULL;
	ghost_Skel = NULL;
	for (int i = 0; i < 5; i++) {
		ghost_Anims[i] = NULL;
	}
	ghostMatrix = NULL;
	ghost_Player = NULL;

	// Initiate collision builder before loading models
	IW_CLASS_REGISTER(GhostCollision);

#ifdef IW_BUILD_RESOURCES
	IwGetModelBuilder()->SetPostBuildFn(&BuildCollision);
#endif

	LoadSkelman();
	LoadViking();

    // Set up camera capture
    if (s3eCameraAvailable())
    {
        // Register callback to receive camera frames
        s3eCameraRegister(S3E_CAMERA_UPDATE_STREAMING, frameReceived, NULL);

        // Request medium sized image (for decent frame rate) with a platform independent format
		s3eCameraStart(S3E_CAMERA_STREAMING_SIZE_HINT_MEDIUM, S3E_CAMERA_PIXEL_TYPE_RGB565_CONVERTED, 
			S3E_CAMERA_STREAMING_QUALITY_HINT_MED);
    }
    else
    {
        s3eDebugTraceLine("Camera Extension not available!");
    }

	tutorialView->setTutorial(getFightTutorial());
}