当前位置: 首页>>代码示例>>C++>>正文


C++ CVar::Set方法代码示例

本文整理汇总了C++中CVar::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ CVar::Set方法的具体用法?C++ CVar::Set怎么用?C++ CVar::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVar的用法示例。


在下文中一共展示了CVar::Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Arg

int BecherConfig::Arg(int argc, char *argv[])
{
	if (strcmp(argv[0],"-h") == 0)
	{
		ShowUsage("Becher [-conf] [-c <config>] [-d <root>]");
		m_continue = false;
		return argc;
	}

    if (strcmp(argv[0],"-conf") == 0)
    {
        m_showdlg = true;
        // nastaveni na konfig
        return 2;
    }

    if (strcmp(argv[0],"-c") == 0)
    {
        // nastaveni konfigu
        if (argc < 2)
        {
            HoeGame::BaseConsole::Printf("Config file requied.");
            return -1;
        }
        v_config.Set(argv[1]); 
        // nastaveni na konfig
        return 2;
    }

    if (strcmp(argv[0],"-d") == 0)
    {
        // nastaveni konfigu
        if (argc < 2)
        {
            HoeGame::BaseConsole::Printf("Directory requied.");
            return -1;
        }
        HoeGame::BaseConsole::Printf("Changing directory to '%s'", argv[1]);
        // nastaveni cesty
        HoeGame::SetRootDir(argv[1]);
        return 2;
    }
    
	// posledni
	if (argc == 1)
	{
		v_level.Set(argv[0]);
	}
	return 1;
}
开发者ID:HeimdallTeam,项目名称:Alcominance,代码行数:50,代码来源:config.cpp

示例2: OnIdle

void RabidEngine::OnIdle()
{
  g_timer.Update();
  const float dt = g_timer.GetTimeChange();

  g_console->Update(dt);




  Transformation view;
  view.Rotate().FromEulerXYZ(cl_camrotx.GetFloat(),
                             cl_camroty.GetFloat(),
                             cl_camrotz.GetFloat());

  // move
  const Vector3f forward = -view.Rotate().GetColumn(2);
  const Vector3f right   =  view.Rotate().GetColumn(0);

  const float vel = 50.0 * dt;
  if(keyState[B_FORWARD])
  {
    cl_camx.SetFloat(cl_camx.GetFloat() + forward.x * vel);
    cl_camy.SetFloat(cl_camy.GetFloat() + forward.y * vel);
    cl_camz.SetFloat(cl_camz.GetFloat() + forward.z * vel);
  }
  if(keyState[B_BACKWARD])
  {
    cl_camx.SetFloat(cl_camx.GetFloat() + -forward.x * vel);
    cl_camy.SetFloat(cl_camy.GetFloat() + -forward.y * vel);
    cl_camz.SetFloat(cl_camz.GetFloat() + -forward.z * vel);
  }
  if(keyState[B_RIGHT])
  {
    cl_camx.SetFloat(cl_camx.GetFloat() + right.x * vel);
    cl_camy.SetFloat(cl_camy.GetFloat() + right.y * vel);
    cl_camz.SetFloat(cl_camz.GetFloat() + right.z * vel);
  }
  if(keyState[B_LEFT])
  {
    cl_camx.SetFloat(cl_camx.GetFloat() + -right.x * vel);
    cl_camy.SetFloat(cl_camy.GetFloat() + -right.y * vel);
    cl_camz.SetFloat(cl_camz.GetFloat() + -right.z * vel);
  }
  if(keyState[B_RENDER])
  {
    done.Set("0");
    keyState[B_RENDER] = 0;
  }
  if(keyState[B_LIGHT_MODE])
  {
    if(r_resid.GetBool())
      r_resid.Set("0");
    else
      r_resid.Set("1");
    keyState[B_LIGHT_MODE] = 0;
  }
  if(keyState[B_TOGGLE_BRIGHTEST])
  {
    if(r_showbrightest.GetBool())
      r_showbrightest.Set("0");
    else
      r_showbrightest.Set("1");
    keyState[B_TOGGLE_BRIGHTEST] = 0;
  }






  static int pass;
  static int surf = -1;
  static int brightest;
  static int patches;
  if(done.GetBool())
  {
  }
  else
  {
    if(pass == 0)
    {
      // clear accumulation buffers
      for(unsigned int i = 0; i < surfaces.Size(); i++)
      {
//          if(surfaces[i]->GetType() != S_LIGHT)
//            surfaces[i]->ClearAccum();
      }
    }


    if(surf >= (int)surfaces.Size())
    {
      surf = -2;
      pass++;
      done.Set("1");
    }
    else if(surf == -1)
    {
      // Find Brightest Surface
//.........这里部分代码省略.........
开发者ID:mironside,项目名称:rabid,代码行数:101,代码来源:rabid.cpp

示例3: OnKeyPress

int Console::OnKeyPress(int key)
{
  if(key >= ' ' && key < 127)
  {
    if(lshift || rshift)
      cmd[cmdPos++] = (char)shiftTable[key-32];
    else
      cmd[cmdPos++] = (char)key;
  }
  else if(key == K_BACKSPACE)
  {
    cmdPos--;
    if(cmdPos < 2)
      cmdPos = 2;

    cmd[cmdPos] = 0;
  }
  else if(key == K_ENTER)
  {
    if(cmd[2] == 0)
      return true;

    //exec
    char lcmd[256];
    cmd[cmdPos] = '\0';
    strcpy(lcmd, &cmd[2]);
    char* name = strtok(lcmd, " ");
    char* args;
    if ( (&cmd[2])[strlen(name)] == 0 )
      args = NULL;
    else
      args = lcmd + strlen(name) + 1;
    if(!g_commandSystem->Execute(name, args))
    {
      CVar* cvar = g_cvarSystem->Find(name);
      // cvar
      if(args)
      {
        if(cvar)
          cvar->Set(args);
      }

      if(cvar)
        g_common->Print("%s = %s", name, cvar->GetString());
    }
    else
    {
    }

    memset(cmd, 0, 256);
    cmd[0] = '>';
    cmd[1] = ' ';
    cmdPos = 2;
  }

  else if(key == K_LSHIFT)
  {
    lshift = 1;
  }
  else if(key == K_RSHIFT)
  {
    rshift = 1;
  }
  else if(key == K_TAB)
  {
    const char* txt = 0;
    const char* cCmd  = g_commandSystem->Complete(&cmd[2]);
    const char* cCvar = g_cvarSystem->Complete(&cmd[2]);

    if(cCmd)
      txt = cCmd;
    else if(cCvar)
      txt = cCvar;

    if(txt)
    {
      memset(cmd, 0, 256);
      cmd[0] = '>';
      cmd[1] = ' ';

      strcpy(&cmd[2], txt);
      cmd[strlen(txt)+2] = ' ';
      cmdPos = (int)(strlen(txt)+3);
    }
  }

  // command cycling
  else if(key == K_UP)
  {
    cmdIdx--;
    if(cmdIdx < 0)
      cmdIdx = 0;
    
    memset(cmd, 0, 256);
    cmd[0] = '>';
    cmd[1] = ' ';
  }
  else if(key == K_DOWN)
  {
  }
//.........这里部分代码省略.........
开发者ID:mironside,项目名称:rabid,代码行数:101,代码来源:console.cpp


注:本文中的CVar::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。