Exemplo n.º 1
0
// absolutely ugly, need a better way
const char* CLuaClassDefs::GetEntityClass ( CClientEntity* pEntity )
{
    assert ( pEntity );
    switch ( pEntity->GetType () )
    {
        case CCLIENTCAMERA: return NULL;
        case CCLIENTPLAYER: return "Player";
        case CCLIENTVEHICLE: return "Vehicle";
        case CCLIENTRADARMARKER: return "Blip";
        case CCLIENTOBJECT: return "Object";
        case CCLIENTPICKUP: return "Pickup";
        case CCLIENTRADARAREA: return "RadarArea";
        case CCLIENTMARKER: return "Marker";
        case CCLIENTTEAM: return "Team";
        case CCLIENTPED: return "Ped";
        case CCLIENTPROJECTILE: return "Projectile";
        case CCLIENTGUI:
        {
            CClientGUIElement* pGUIElement = reinterpret_cast < CClientGUIElement* > ( pEntity );
            if ( pGUIElement )
            {
                switch ( pGUIElement->GetCGUIType () )
                {
                    case CGUI_BUTTON: return "GuiButton";
                    case CGUI_CHECKBOX: return "GuiCheckBox";
                    case CGUI_EDIT: return "GuiEdit";
                    case CGUI_GRIDLIST: return "GuiGridList";
                    case CGUI_LABEL: return "GuiLabel";
                    case CGUI_MEMO: return "GuiMemo";
                    case CGUI_PROGRESSBAR: return "GuiProgressBar";
                    case CGUI_RADIOBUTTON: return "GuiButton";
                    case CGUI_STATICIMAGE: return "GuiImage";
                    case CGUI_TAB: return "GuiTab";
                    case CGUI_TABPANEL: return "GuiTabPanel";
                    case CGUI_WINDOW: return "GuiWindow";
                    case CGUI_SCROLLPANE: return "GuiScrollPane";
                    case CGUI_SCROLLBAR: return "GuiScrollBar";
                    case CGUI_COMBOBOX: return "GuiComboBox";
                }
                return "GuiElement";
            }
            break;
        }
        case CCLIENTCOLSHAPE: return "ColShape";
        case SCRIPTFILE: return "File";
        case CCLIENTDFF: return NULL;
        case CCLIENTCOL: return NULL;
        case CCLIENTTXD: return NULL;
        case CCLIENTSOUND: return "Sound";
        case CCLIENTWATER: return "Water";
        case CCLIENTDXFONT: return NULL;
        case CCLIENTGUIFONT: return NULL;
        case CCLIENTTEXTURE: return NULL;
        case CCLIENTSHADER: return NULL;
        case CCLIENTWEAPON: return "Weapon";
        case CCLIENTEFFECT: return "Effect";
    }
    return "Element";
}
Exemplo n.º 2
0
//
// Change call propagation behaviour (overrides CClientEntity::SetCallPropagationEnabled)
void CClientGUIElement::SetCallPropagationEnabled ( bool bEnabled )
{
    CClientEntity::SetCallPropagationEnabled ( bEnabled );

    for ( CFastList<CClientEntity*>::iterator iter = m_Children.begin (); iter != m_Children.end (); ++iter )
    {
        if ( (*iter)->GetType () == CCLIENTGUI )
        {
            CClientGUIElement* pGUIElement = static_cast < CClientGUIElement* > ( *iter );
            pGUIElement->GetCGUIElement()->SetInheritsAlpha ( bEnabled );
        }
    }
}
Exemplo n.º 3
0
bool CClientGUIElement::_CallbackEvent2 ( CGUIElement* pCGUIElement )
{
    CLuaArguments Arg;
    if ( pCGUIElement )
    {
        CClientGUIElement* pElement = m_pGUIManager->Get ( pCGUIElement );
        if ( pElement )
        {
            Arg.PushElement ( pElement );
            pElement->CallEvent ( _strCallbackFunc2, Arg, true );
            return true;
        }
    }
    return false;
}
Exemplo n.º 4
0
void CClientGUIManager::FlushQueuedUpdates()
{
    map<ElementID, bool>::iterator iter = m_QueuedGridListUpdates.begin();
    for (; iter != m_QueuedGridListUpdates.end(); ++iter)
    {
        CClientEntity* pEntity = CElementIDs::GetElement(iter->first);
        if (pEntity && !pEntity->IsBeingDeleted() && pEntity->GetType() == CCLIENTGUI)
        {
            CClientGUIElement* pGUIElement = static_cast<CClientGUIElement*>(pEntity);
            if (pGUIElement && IS_CGUIELEMENT_GRIDLIST(pGUIElement))
            {
                CGUIGridList* pGUIGridList = static_cast<CGUIGridList*>(pGUIElement->GetCGUIElement());
                pGUIGridList->ForceUpdate();
            }
        }
    }
    m_QueuedGridListUpdates.clear();
}
int CLuaFunctionDefs::GUIGetBrowser ( lua_State* luaVM ) // Or rather guiGetBrowserBrowser?
{
//  webbrowser guiGetBrowser ( gui-webbrowser browser )
    CClientGUIElement* pGUIElement;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData < CGUIWebBrowser > ( pGUIElement );

    if ( !argStream.HasErrors () )
    {
        if ( IS_GUI ( pGUIElement ) && pGUIElement->GetCGUIType () == CGUI_WEBBROWSER )
        {
            CClientGUIWebBrowser* pGUIBrowser = static_cast < CClientGUIWebBrowser* > ( pGUIElement );
            lua_pushelement ( luaVM, pGUIBrowser->GetBrowser () );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 6
0
// absolutely ugly, need a better way
const char* CLuaClassDefs::GetEntityClass ( CClientEntity* pEntity )
{
    assert ( pEntity );
    switch ( pEntity->GetType () )
    {
        case CCLIENTCAMERA: return "Camera";
        case CCLIENTPLAYER: return "Player";
        case CCLIENTVEHICLE: return "Vehicle";
        case CCLIENTRADARMARKER: return "Blip";
        case CCLIENTOBJECT: return "Object";
        case CCLIENTPICKUP: return "Pickup";
        case CCLIENTRADARAREA: return "RadarArea";
        case CCLIENTMARKER: return "Marker";
        case CCLIENTTEAM: return "Team";
        case CCLIENTPED: return "Ped";
        case CCLIENTPROJECTILE: return "Projectile";
        case CCLIENTGUI:
        {
            CClientGUIElement* pGUIElement = reinterpret_cast < CClientGUIElement* > ( pEntity );
            if ( pGUIElement )
            {
                switch ( pGUIElement->GetCGUIType () )
                {
                    case CGUI_BUTTON: return "GuiButton";
                    case CGUI_CHECKBOX: return "GuiCheckBox";
                    case CGUI_EDIT: return "GuiEdit";
                    case CGUI_GRIDLIST: return "GuiGridList";
                    case CGUI_LABEL: return "GuiLabel";
                    case CGUI_MEMO: return "GuiMemo";
                    case CGUI_PROGRESSBAR: return "GuiProgressBar";
                    case CGUI_RADIOBUTTON: return "GuiRadioButton";
                    case CGUI_STATICIMAGE: return "GuiStaticImage";
                    case CGUI_TAB: return "GuiTab";
                    case CGUI_TABPANEL: return "GuiTabPanel";
                    case CGUI_WINDOW: return "GuiWindow";
                    case CGUI_SCROLLPANE: return "GuiScrollPane";
                    case CGUI_SCROLLBAR: return "GuiScrollBar";
                    case CGUI_COMBOBOX: return "GuiComboBox";
                    case CGUI_WEBBROWSER: return "GuiBrowser";
                }
                return "GuiElement";
            }
            break;
        }
        case CCLIENTCOLSHAPE: return "ColShape";
        case SCRIPTFILE: return "File";
        case CCLIENTDFF: return "EngineDFF";
        case CCLIENTCOL: return "EngineCOL";
        case CCLIENTTXD: return "EngineTXD";
        case CCLIENTSOUND: return static_cast<CClientSound*>( pEntity )->IsSound3D() ? "Sound3D" : "Sound";
        case CCLIENTWATER: return "Water";
        case CCLIENTDXFONT: return "DxFont";
        case CCLIENTGUIFONT: return "GuiFont";
        case CCLIENTTEXTURE: return "DxTexture";
        case CCLIENTSHADER: return "DxShader";
        case CCLIENTWEAPON: return "Weapon";
        case CCLIENTEFFECT: return "Effect";
        case CCLIENTPOINTLIGHTS: return "Light";
        case CCLIENTSCREENSOURCE: return "DxScreenSource";
        case CCLIENTRENDERTARGET: return "DxRenderTarget";
        case CCLIENTBROWSER: return "Browser";
    }
    return "Element";
}