Example #1
0
  //
  // Set the cursor to be the active cursor
  // Specifying 0 will use the system default cursor
  //
  Bool Set(U32 id)
  {
    ASSERT(sysInit);

    // If id is 0 use the default cursor
    if (id == 0)
    {
      id = standardCrs[0];
    }

    Base *crs = cursors.Find(id);

    if (crs != NULL)
    {
      if (crs != current)
      {
        // Shutdown current
        if (current)
        {
          current->Notify(Base::CN_DEACTIVATE);
        }

        // Start the cursor
        current = crs;
        current->Notify(Base::CN_ACTIVATE);
      }
      return (TRUE);
    }
    else
    {
      return (FALSE);
    }
  }
Example #2
0
    ///////////////////////////////////////////////////////////////////////////////
    //
    // Quake::CmdHandler
    //
    void CmdHandler(U32 pathCrc)
    {
      switch (pathCrc)
      {
      case 0x3860F45E: // "quake.active"
        if (*active)
        {
          effect->StopByEffect();
          effect->Play2D(Sound::Digital::DEFAULT_VOLUME, Sound::Digital::NO_OWNER, F32_MAX, 0);
          soundoff = FALSE;
          quakeAnim.SetFrame(0);
        }
        else
        {
          effect->StopByEffect();
          soundoff = TRUE;
        }
        break;

      case 0x030664FD: // "quake.type"
      {
        Type * t = typeList.Find( Crc::CalcStr( *typeVar));
        if (t)
        {
          SetCurrent( t);
        }
        break;
      }

      case 0x44327F38: // "quake.listtypes"
      {
        char *s = NULL;
        Console::GetArgString(1, s);

        U32 len = 0;
        if (s)
        {
          len = strlen(s);
        }

        // Registered quake types
        CON_DIAG(("[Quake Types]"))

        BinTree<Type>::Iterator i(&typeList);
        for (!i; *i; i++)
        {
          if (!s || !Utils::Strnicmp( (*i)->name.str, s, len))
	    	  {
    			  Console::Message("%s", (*i)->name.str);
          }
        }
        break;
      }
      //
      }   // switch( pathCrc)
    }
Example #3
0
  //
  // Process a CreateCursor scope
  //
  void ProcessCreateCursor(FScope *fScope)
  {
    // Cursor name is first argument
    const char *name = fScope->NextArgString();

    // Cursor class is second argument
    const char *cls  = fScope->NextArgString();

    // Create the cursor
    Base *newCrs = NULL;
    U32 key = Crc::CalcStr(cls);

    switch (key)
    {
      case 0x5B2A0A5F: // "Null"
        newCrs = new Base;
        break;

      case 0xE04B5BBC: // "Bitmap"
        newCrs = new Bmp;
        break;

      case 0xE5A51519: // "Geometric"
        newCrs = new Geometric;
        break;

      default:
      {
        Base *derived;

        if ((derived = cursors.Find(key)) != NULL)
        {
          newCrs = new Derived(derived);
        }
        else
        {
          LOG_ERR(("Unknown Cursor Class [%s]", cls));
          return;
        }
        break;
      }
    }

    // Configure the cursor
    newCrs->Configure(fScope);

    // Add it to the list
    cursors.Add(Crc::CalcStr(name), newCrs);
  }
Example #4
0
  //
  // Find a cursor by name
  //
  U32 FindByName(const char *name)
  {
    U32 id = Crc::CalcStr(name);

    // Ensure the cursor exists
    if (cursors.Find(id))
    {
      return (id);
    }
    else
    {
      LOG_ERR(("Cursor [%s] not found", name));
      return (0);
    }
  }