Esempio n. 1
0
Bool RPGGame::OnInitialize()
{
    // Initialize everything
    _CreateActions();

    GraphicsManager::Create();
    GraphicsFn->Initialize();
    _CreateLightsMaterials();
    _CreateBitmaps();
    _CreateTextures();
    _CreateInstancedGeometry();

    EntityManager::Create();
    EntityFn->Initialize();

    AnimationManager::Create();
    AnimationFn->Initialize();

    GameplayManager::Create();
    GameplayFn->Initialize();
    _CreateWorld();

    InterfaceManager::Create();
    InterfaceFn->Initialize();

    // Load player character
    PCharacter * pPlayer = (PCharacter*)( GameplayFn->GetCharacter(TEXT("Shiki")) );
    pPlayer->AddSkill( SKILLID_MAGE_FIREBOLT );
    pPlayer->AddSkill( SKILLID_MAGE_ICENOVA );

	// Debug
    WorldFn->ToggleDebugDraw( true );

    GPU2DColor hDebugTextColor = Color4::White;
    m_pDebugTextBrush = New GPU2DSolidColorBrush( RenderingFn->GetScreen2DContext() );
    m_pDebugTextBrush->SetColor( &hDebugTextColor );
    m_pDebugTextBrush->Bind();

    m_pDebugTextFormat = New GPU2DTextFormat();
    m_pDebugTextFormat->Bind( LOCALENAME_EN_US, GPU2DFONTFAMILY_ARIAL, GPU2DFONT_WEIGHT_NORMAL, GPU2DFONT_STYLE_NORMAL, GPU2DFONT_STRETCH_NORMAL, 10.0f );
    m_pDebugTextFormat->SetTextAlignment( GPU2DTEXT_ALIGNMENT_LEADING );
    m_pDebugTextFormat->SetParagraphAlignment( GPU2DTEXT_PARAGRAPHALIGNMENT_CENTER );

    // Done
    return true;
}
Bool EngineTests::OnInitialize()
{
    // Initialize everything
    _CreateActions();
    _CreateEffects();
    _CreateInstancedGeometry();
    _CreateWorld();

    m_pBackboardModel = New TestBackboardModel( this );
    GUIFn->SetBackboardModel( m_pBackboardModel );

    // Debug
    WorldFn->ToggleDebugDraw( true );

    GPU2DColor hDebugTextColor = Color4::White;
    m_pDebugTextBrush = New GPU2DSolidColorBrush( RenderingFn->GetScreen2DContext() );
    m_pDebugTextBrush->SetColor( &hDebugTextColor );
    m_pDebugTextBrush->Bind();

    m_pDebugTextFormat = New GPU2DTextFormat();
    m_pDebugTextFormat->Bind( LOCALENAME_EN_US, GPU2DFONTFAMILY_ARIAL, GPU2DFONT_WEIGHT_NORMAL, GPU2DFONT_STYLE_NORMAL, GPU2DFONT_STRETCH_NORMAL, 10.0f );
    m_pDebugTextFormat->SetTextAlignment( GPU2DTEXT_ALIGNMENT_LEADING );
    m_pDebugTextFormat->SetParagraphAlignment( GPU2DTEXT_PARAGRAPHALIGNMENT_CENTER );

    m_pFloor->SetDebugFlags( WORLD_DEBUGDRAW_GIZMOS | WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );
    m_pCharacter->SetDebugFlags( WORLD_DEBUGDRAW_GIZMOS | WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );

    for( UInt i = 0; i < ENGINE_TEST_STACK_SIZE; ++i ) {
        if ( m_arrBallStack[i] != NULL )
            m_arrBallStack[i]->SetDebugFlags( WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );
        if ( m_arrBoxStack[i] != NULL )
            m_arrBoxStack[i]->SetDebugFlags( WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );
    }

    if ( m_pFixedObject != NULL )
        m_pFixedObject->SetDebugFlags( WORLD_DEBUGDRAW_GIZMOS | WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );
    if ( m_pObjectA != NULL )
        m_pObjectA->SetDebugFlags( WORLD_DEBUGDRAW_GIZMOS | WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );
    if ( m_pObjectB != NULL )
        m_pObjectB->SetDebugFlags( WORLD_DEBUGDRAW_GIZMOS | WORLD_DEBUGDRAW_PROXIES | WORLD_DEBUGDRAW_JOINTS | WORLD_DEBUGDRAW_CONTACTS | WORLD_DEBUGDRAW_CONTACTPOINTS );

    // Done
    return true;
}