예제 #1
0
psSlotManager::psSlotManager()
{
    isDragging = false;
    isPlacing = false;
    isRotating = false;

    // Initialize event shortcuts
    MouseMove = csevMouseMove (psengine->GetEventNameRegistry(), 0);
    MouseDown = csevMouseDown (psengine->GetEventNameRegistry(), 0);
}
예제 #2
0
psSlotManager::psSlotManager()
{
    isDragging = false;
    isPlacing = false;
    isRotating = false;
    draggingSlot.stackCount = 0;
    last_count = -1;

    // Initialize event shortcuts
    MouseMove = csevMouseMove (psengine->GetEventNameRegistry(), 0);
    MouseDown = csevMouseDown (psengine->GetEventNameRegistry(), 0);
    MouseUp = csevMouseUp (psengine->GetEventNameRegistry(), 0);
    KeyDown = csevKeyboardDown (psengine->GetEventNameRegistry());
    KeyUp = csevKeyboardUp (psengine->GetEventNameRegistry());
}
예제 #3
0
psMovementManager::psMovementManager(iEventNameRegistry* eventname_reg, psControlManager* controls)
{
    CS_ASSERT(eventname_reg);
    event_frame = csevFrame(eventname_reg);
    event_mousemove = csevMouseMove(eventname_reg,0);

    actor = NULL;
    this->controls = controls;

    ready = false;
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVEINFO);
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVELOCK);
    psengine->GetMsgHandler()->Subscribe(this,MSGTYPE_MOVEMOD);

    defaultmode = NULL;
    actormode = NULL;

    onGround = true;
    locked = false;
    activeMoves = 0;

    autoMove = false;
    toggleRun = false;
    mouseAutoMove = false;
    mouseLook = false;
    mouseLookCanAct = false;
    mouseZoom = false;
    mouseMove = false;
    sneaking = false;
    runToMarkerID = 0;
    lastDist = 0.0f;
    runToDiff = csVector3(0.0f);
    lastDeltaX = 0.0f;
    lastDeltaY = 0.0f;

    sensY = 1.0f;
    sensX = 1.0f;
    invertedMouse = true;
    
    activeModType = psMoveModMsg::NONE;

    forward = NULL;
    backward = NULL;
    run = NULL;
    walk = NULL;

    kbdRotate = 0;
}
예제 #4
0
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
PawsManager::PawsManager(iObjectRegistry* object, const char* skin, const char* skinBase,
                         const char* pawsConfigFile) : render2texture(false)
{
    objectReg = object;
    pawsConfig = pawsConfigFile;

    graphics2D = csQueryRegistry<iGraphics2D > ( objectReg );
    graphics3D = csQueryRegistry<iGraphics3D > ( objectReg );
    soundloader =  csQueryRegistry<iSndSysLoader > ( objectReg);
    soundrenderer =  csQueryRegistry<iSndSysRenderer > ( objectReg);
    nameRegistry = csEventNameRegistry::GetRegistry (objectReg);

    // Initialize event shortcuts
    MouseMove = csevMouseMove (nameRegistry, 0);
    MouseDown = csevMouseDown (nameRegistry, 0);
    MouseDoubleClick = csevMouseDoubleClick (nameRegistry, 0);
    MouseUp = csevMouseUp (nameRegistry, 0);
    KeyboardDown = csevKeyboardDown (objectReg);
    KeyboardUp = csevKeyboardUp (objectReg);

    vfs =  csQueryRegistry<iVFS > ( objectReg);
    xml = csPtr<iDocumentSystem>(new csTinyDocumentSystem);
    csRef<iConfigManager> cfg =  csQueryRegistry<iConfigManager> (objectReg);

    float screenWidth = cfg->GetFloat( "Video.ScreenWidth", 800.0f );
    float screenHeight = cfg->GetFloat( "Video.ScreenHeight", 600.0f );
    fontFactor = min(( screenWidth  / 800.0f ), ( screenHeight /  600.0f ));

    RegisterFactories();

    mainWidget = new pawsMainWidget();

    textureManager = new pawsTextureManager( objectReg );

    prefs = new pawsPrefManager();

    csString prefsFile = cfg->GetStr("PlaneShift.GUI.PrefsFile", "/this/data/prefs.xml");
    csString borderFile = cfg->GetStr("PlaneShift.GUI.BorderFile", "/this/data/gui/borderlist.xml");

    styles = new pawsStyles( objectReg );

    if(!LoadSkinDefinition(skin))
    {
        Error2("Failed to load skin %s!", skin);
        exit(1);
    }

    // now load standard styles for anything else
    if (!styles->LoadStyles("/this/data/gui/styles.xml"))
    {
        Error1("Failed to load PAWS styles, all style application attempts will be ignored");
        delete styles;
        styles = NULL;
    }

    // Mount base skin to satisfy unskinned elements
    if(skinBase)
    {
        if(!LoadSkinDefinition(skinBase))
        {
            Error2("Couldn't load base skin '%s'!\n", skinBase);
        }
    }

    if ( !prefs->LoadPrefFile( prefsFile ) )
        Error2("Failed to load prefsFile '%s'", prefsFile.GetData());
    if ( !prefs->LoadBorderFile( borderFile ) )
        Error2("Failed to load borderFile '%s'", borderFile.GetData());


    mouse = new pawsMouse();
    mouse->ChangeImage("Standard Mouse Pointer");

    resizeImg = textureManager->GetPawsImage("ResizeBox");

    graphics2D->SetMouseCursor( csmcNone );

    currentFocusedWidget = mainWidget;
    movingWidget         = 0;
    focusOverridesControls = false;

    resizingWidget       = 0;
    resizingFlags        = 0;

    modalWidget = 0;
    mouseoverWidget = 0;
    lastfadeWidget = 0;

    assert(cfg);
    csString lang = cfg->GetStr("PlaneShift.GUI.Language", "");
    localization = new psLocalization();
    localization->Initialize(objectReg);
    localization->SetLanguage(lang);

    tipDelay = cfg->GetInt("PlaneShift.GUI.ToolTipDelay", 250);

    hadKeyDown = false;
    dragDropWidget = NULL;
    useSounds = true;
    volume = 1.0;

    soundStatus = false;
    timeOver = 0;

    // Init render texture.
    csRef<iTextureManager> texman = graphics3D->GetTextureManager();
    guiTexture = texman->CreateTexture(graphics3D->GetWidth(), graphics3D->GetHeight(),
      csimg2D, "rgba8", 0x9);
    if(guiTexture.IsValid())
        guiTexture->SetAlphaType (csAlphaMode::alphaBinary);
    else
	render2texture = false;
}