Beispiel #1
0
static void Key2(int key, int x, int y)
{

    switch (key) {
      case GLUT_KEY_LEFT:
	yRotation -= 0.5;
	autoRotate = GL_FALSE;
	ReInit();
	break;
      case GLUT_KEY_RIGHT:
	yRotation += 0.5;
	autoRotate = GL_FALSE;
	ReInit();
	break;
      case GLUT_KEY_UP:
	xRotation -= 0.5;
	autoRotate = GL_FALSE;
	ReInit();
	break;
      case GLUT_KEY_DOWN:
	xRotation += 0.5;
	autoRotate = GL_FALSE;
	ReInit();
	break;
      default:
	return;
    }
    glutPostRedisplay();
}
Beispiel #2
0
void SpecialKey(int key, int x, int y)
{

    switch (key) {
      case GLUT_KEY_LEFT:
	yRotation -= 0.5;
	autoRotate = FALSE;
	ReInit();
	glutPostRedisplay();
	break;
      case GLUT_KEY_RIGHT:
	yRotation += 0.5;
	autoRotate = FALSE;
	glutPostRedisplay();
	ReInit();
	break;
      case GLUT_KEY_UP:
	xRotation -= 0.5;
	autoRotate = FALSE;
	ReInit();
	glutPostRedisplay();
	break;
      case GLUT_KEY_DOWN:
	xRotation += 0.5;
	autoRotate = FALSE;
	ReInit();
	glutPostRedisplay();
	break;
    }
}
bool C4LandscapeRenderClassic::Init(int32_t iWidth, int32_t iHeight, C4TextureMap *pTexs, C4GroupSet *pGraphics)
{
	// Init proc
	if (!ReInit(iWidth, iHeight)) return false;
	this->pTexs = pTexs;
	return true;
}
Beispiel #4
0
void Reshape(int width, int height)
{

    W = width;
    H = height;
    ReInit();
}
Beispiel #5
0
_BOOLEAN
CPaCommon::Write(CVector < short >&psData)
{
    if (device_changed)
        ReInit();

    if (stream==NULL)
        return TRUE;

    size_t bytes = psData.Size() * sizeof(short);

    //cout << "Write: got " << bytes << " can put " << PaUtil_GetRingBufferWriteAvailable(&ringBuffer) << endl;
    if (PaUtil_GetRingBufferWriteAvailable(&ringBuffer) < int(bytes))
        return FALSE;			/* TODO use newer data in preference to draining old */

    PaUtil_WriteRingBuffer(&ringBuffer, &psData[0], bytes);
    if (Pa_IsStreamStopped( stream ))
    {
        int err = Pa_StartStream(stream);
        if (err != paNoError) {
            //throw string("PortAudio error: ") + Pa_GetErrorText(err);
		}
    }
    if (xruns==0)
        return FALSE;
    else
        cout << "underrun" << endl;
    xruns = 0;
    return TRUE;
}
Beispiel #6
0
_BOOLEAN
CPaCommon::Read(CVector < short >&psData)
{
    if (device_changed)
        ReInit();

    if (stream==NULL)
        return TRUE;

    size_t bytes = psData.Size() * sizeof(short);

    while (PaUtil_GetRingBufferReadAvailable(&ringBuffer)<int(bytes))
    {
        //cout << "Read: want " << bytes << " avail " << PaUtil_GetRingBufferReadAvailable(&ringBuffer) << endl;
        Pa_Sleep(10);
    }

    PaUtil_ReadRingBuffer(&ringBuffer, &psData[0], bytes);
    if (xruns==0)
        return FALSE;
    else
        cout << "overrun" << endl;
    xruns = 0;
    return TRUE;
}
Beispiel #7
0
void cElHJaArrangt::TestPolygoneSimple
     (
          const std::vector<Pt2dr> & aPolyg,
          const std::vector<int> &   aVSelect
     )
{
     ReInit(aPolyg);
     INT aNb = (int) aPolyg.size();
     for (INT aK=0 ; aK<aNb ; aK++)
     {
         if (aVSelect[aK])
         {
             SegComp aSeg(aPolyg[aK],aPolyg[(aK+1)%aNb]);

             cElHJaPlan3D * aPl = AddPlan
                                  (
	                               cElPlan3D
	                               (
                                          PFromSeg(aSeg,0,0),
                                          PFromSeg(aSeg,1,0),
                                          PFromSeg(aSeg,1,1)
	                               )
                                  );
            aPl->SetSegOblig(aSeg);
         }
     }
}
Beispiel #8
0
/**
 * Initialization of variance options with specific parameter.
 *
 * @param oc 			Boolean which (de)activates the overlap complexity/variance calculation
 *
 * @param improve 		Boolean which (de)activates the improvement of the patternset.
 *
 * @param quiet			Boolean which (de)activates just a short output of the improvement
 * 
 * @param silent 		Boolean which (de)activates std::output on commandline (exclusive errors)
 *
 * @param randpatleng	Boolean which (de)activates random generated pattern lengths
 *
 * @param outFile 		Char array which contains name and path to outputfile (commandline parameter)
 */
void variance::Init(bool oc, bool improve, bool quiet, bool silent, bool random_leng, const char *outFile){
	if(!initialized){
		this->oc = oc;
		this->improve = improve;
		this->quiet = quiet;
		this->silent = silent;
		this->outFile = outFile;
		this->random_leng = random_leng;
		best_silent = false;
		impro_silent = false;
		loops = 1;
		if(outFile != NULL && outFile[0] != '\0'){
			isOutFile = true;
		}
		else{
			isOutFile = false;
		}
		if(oc){
			outvar = "overlap-complexity\t\t= ";
		}
		else{
			outvar = "variance\t\t\t= ";
		}
		if(silent){
			quiet = true;
		}
		ReInit();
	}
}
Beispiel #9
0
void GenTestCase(int no)
{
  Node *n1, *n2;
  unsigned v0;
  printf("void test%d(void)\n{\n", no);
  printf("  printf(\"-- Test %d (seed: %u) --\\n\");\n", no, mySeed);
  printf("  {\n");
  printf("    int failed = 0;\n");
  ReInit();
  n1 = GenCommaExpr();
  PrintDecls(n1);
  printf("    unsigned v0 = (");
  PrintExpr(n1);
  printf(");\n");
  n2 = DupExpr(n1);
  v0 = Eval(n2);
  CheckVars(n2);
  printf("    if (v0 != %uu) ", v0);
  printf("{ failed = 1; printf(\"v0 != %uu\\n\"); }\n", v0);
  printf("    if (failed)\n      printf(\"Test %d failed\\n\");\n", no);
  printf("    errors += failed;\n");
  printf("  }\n");
  printf("  printf(\"\\n\");\n");
  printf("}\n\n");
  DelNode(n1);
  DelNode(n2);
}
void C4ConsoleQtDefinitionListModel::EnsureInit()
{
	// Init if not already done
	if (!root.get() || root->items.empty())
		if (::Definitions.GetDefCount())
			ReInit();
}
void C4ConsoleQtDefinitionListModel::OnItemRemoved(C4Def *p)
{
	for (auto idx : this->persistentIndexList())
		if (idx.internalPointer() == p)
			this->changePersistentIndex(idx, QModelIndex());
	ReInit();
}
Beispiel #12
0
// Initialise a TCP socket
void W5500Socket::Init(SocketNumber skt, Port serverPort, NetworkProtocol p)
{
	socketNum = skt;
	localPort = serverPort;
	protocol = p;
	ReInit();
}
Beispiel #13
0
void Water::SetNum(int i, TimeValue t, BOOL init) { 
	count = i;
	waves.SetCount(count); 
	waves.Resize(count);
//	pblock->SetValue(PB_NUM, t, i);
	pblock->SetValue(water_num, t, i);
	if (init) ReInit();
	}
Beispiel #14
0
int CClock::ReStart(struct timeval sTime)
{
	CAutoLock lock(&m_cs);
	
	if (ReInit() < 0) return -1;
	if (start(sTime) < 0) return -1;

	return 0;
}
Beispiel #15
0
/**
 * Standard Reinitialization of variance options, with a new patternset.
 */
void variance::ReInit(){
	if(isInFile){
		pattern_set = patternset(inFile, true);
	}
	else{	
		pattern_set = patternset(size, weight, min_dontcare, max_dontcare, true);
	}
	pattern_set.Init(random_leng);
	ReInit(pattern_set);
}
Beispiel #16
0
static void Reshape(int width, int height)
{
    W = width;
    H = height;
    ReInit();
    glViewport( 0, 0, width, height );  /*new*/
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-0.2, 0.2, -0.2, 0.2, 0.15, 9.0);
    glMatrixMode(GL_MODELVIEW);
}
Beispiel #17
0
void Key(unsigned char key, int x, int y)
{

    switch (key) {
      case ' ' :
	ReInit();
	break;
      case 27:
	exit(0);
    }
}
ArcBallCameraController::ArcBallCameraController(CameraComponent* pCamera)
	: ICameraController(pCamera)
{
	m_fInputTurnRate = 0.5f;
	m_fInputDisplacementRate = 2.0f;

	m_fInputDistanceRate = 4.0f;
	m_bRecomputeViewMatrix = true;

	ReInit();
}
Beispiel #19
0
MediaBuffer* AudioStream::GetBuffer() {
    LockHolder lock(this);

    if(_freeBuffers.empty()) {
        return new (nothrow) MediaBuffer(this);
    }else{
        auto res = _freeBuffers.front();
        _freeBuffers.pop();
        res->ReInit();
        return res;
    }
}
Beispiel #20
0
void GameState::DoInit(void)
{
  // First call our base class implementation
  IState::DoInit();

  // Load all assets now
  mApp.mAssetManager.LoadAllAssets();

  // Assign our background image sprite texture
#if (SFML_VERSION_MAJOR < 2)
  mBackgroundSprite.SetImage(mBackground.GetAsset());
#else
  mBackgroundSprite.setTexture(mBackground.GetAsset());
#endif

#if (SFML_VERSION_MAJOR < 2)
  mRedGainSound.SetBuffer(mRedGain.GetAsset());
  mRedGainSound.SetVolume(25.0f);
  mRedWinSound.SetBuffer(mRedWin.GetAsset());
  mBlueGainSound.SetBuffer(mBlueGain.GetAsset());
  mBlueGainSound.SetVolume(25.0f);
  mBlueWinSound.SetBuffer(mBlueWin.GetAsset());
  mLightsaberSound.SetBuffer(mLightsaber.GetAsset());
  mLightsaberSound.SetVolume(10.0f);
#else
  mRedGainSound.setBuffer(mRedGain.GetAsset());
  mRedGainSound.setVolume(25.0f);
  mRedWinSound.setBuffer(mRedWin.GetAsset());
  mBlueGainSound.setBuffer(mBlueGain.GetAsset());
  mBlueGainSound.setVolume(25.0f);
  mBlueWinSound.setBuffer(mBlueWin.GetAsset());
  mLightsaberSound.setBuffer(mLightsaber.GetAsset());
  mLightsaberSound.setVolume(10.0f);
#endif

#if (SFML_VERSION_MAJOR < 2)
  // Setup winner text color as Yellow
  mWinnerText = new sf::String("", mWinFont.GetAsset(), 30);
  mWinnerText->SetColor(sf::Color::Yellow);
#else
  // Setup winner text color as Yellow
  mWinnerText = new sf::Text("", mWinFont.GetAsset(), 30);
  mWinnerText->setColor(sf::Color::Yellow);
#endif

  // Call ReInit to reset the board
  ReInit();

  // Make sure our update loop is only called 30 times per second
  mApp.SetUpdateRate(30.0f);
}
Beispiel #21
0
void	CTheme::ThemeChanged(HWND hWnd)
{
	if (m_bLibLoaded)
	{
		if (m_hTheme)
		{
			zCloseThemeData(m_hTheme);
			ReInit();
		}
	}

	Init();

	OpenTheme(hWnd);
}
Beispiel #22
0
// This method is called before rendering begins to allow the plug-in 
// to evaluate anything prior to the render so it can store this information.
void Water::Update(TimeValue t, Interval& ivalid) {		
	if (!texValidity.InInterval(t)) {
		texValidity.SetInfinite();
		xyzGen->Update(t, texValidity);
//		pblock->GetValue(PB_COL1, t, col[0], texValidity);
		pblock->GetValue(water_color1, t, col[0], texValidity);
		col[0].ClampMinMax();
//		pblock->GetValue(PB_COL2, t, col[1], texValidity);
		pblock->GetValue(water_color2, t, col[1], texValidity);
		col[1].ClampMinMax();
//		pblock->GetValue(PB_NUM, t, count, texValidity);
		pblock->GetValue(water_num, t, count, texValidity);
		ClampInt(count, (int) MIN_NUM, (int) MAX_NUM);
//		pblock->GetValue(PB_SIZE, t, size, texValidity);
		pblock->GetValue(water_size, t, size, texValidity);
		ClampFloat(size, MIN_SIZE, MAX_SIZE);
//		pblock->GetValue(PB_LEN_MIN, t, minperiod, texValidity);
		pblock->GetValue(water_len_min, t, minperiod, texValidity);
		ClampFloat(minperiod, MIN_LEN_MIN, MAX_LEN_MIN);	// > 6/11/02 - 2:42pm --MQM-- typo, was MIN_LEN_MIN, MAX_LEN_MAX
//		pblock->GetValue(PB_LEN_MAX, t, maxperiod, texValidity);
		pblock->GetValue(water_len_max, t, maxperiod, texValidity);
		ClampFloat(maxperiod, MIN_LEN_MAX, MAX_LEN_MAX);
//		pblock->GetValue(PB_AMP, t, amp, texValidity);
		pblock->GetValue(water_amp, t, amp, texValidity);
		ClampFloat(amp, MIN_AMP, MAX_AMP);
//		pblock->GetValue(PB_PHASE, t, phase, texValidity);
//		pblock->GetValue(PB_TYPE, t, type, texValidity);
		pblock->GetValue(water_phase, t, phase, texValidity);
		pblock->GetValue(water_type, t, type, texValidity);
		for (int i = 0; i < NUM_SUB_TEXMAPS; i++) {
			if (subTex[i]) 
				subTex[i]->Update(t, texValidity);
//		pblock->GetValue(PB_SEED, t, randSeed, texValidity);
		pblock->GetValue(water_seed, t, randSeed, texValidity);

		pblock->GetValue(water_mapon1, t, mapOn[0], texValidity);
		pblock->GetValue(water_mapon2, t, mapOn[1], texValidity);

		ReInit();
		}
	}
	ivalid &= texValidity;
}
Beispiel #23
0
// This method is called to reset the texmap back to its default values.
void Water::Init() {
	// Reset the XYZGen or allocate a new one
	if (xyzGen) 
		xyzGen->Reset();
	else 
		ReplaceReference(0, GetNewDefaultXYZGen());	

	// This replaces the reference to the previous parameter block with
	// a new one.  Note that the previous one is automatically deleted
	// because when the last reference to an item is deleted, MAX deletes
	// the item itself.
//	ReplaceReference(1, CreateParameterBlock(pbdesc, 
//		PB_LENGTH, WATER_PB_VERSION));

//	if (paramDlg) 
//		paramDlg->pmap->SetParamBlock(pblock);

	// Set the inital parameters
	SetColor(0, DEFAULT_COLOR1, TimeValue(0));
	SetColor(1, DEFAULT_COLOR2, TimeValue(0));
	SetRandSeed(0x75cf);
	SetNum(DEFAULT_NUM_WAVESETS, TimeValue(0));
    RegisterDistanceDefault(_T("Wave Params"), _T("Size"), DEFAULT_WAVE_RADIUS, IN_TO_M(DEFAULT_WAVE_RADIUS));
    float size = GetDistanceDefault(_T("Wave Params"), _T("Size"));
    SetSize(size, TimeValue(0));

    RegisterDistanceDefault(_T("Wave Params"), _T("Len Min"), DEFAULT_WAVE_LEN_MIN, IN_TO_M(DEFAULT_WAVE_LEN_MIN));
    float lenMin = GetDistanceDefault(_T("Wave Params"), _T("Len Min"));
	SetLenMin(lenMin, TimeValue(0));

    RegisterDistanceDefault(_T("Wave Params"), _T("Len Max"), DEFAULT_WAVE_LEN_MAX, IN_TO_M(DEFAULT_WAVE_LEN_MAX));
    float lenMax = GetDistanceDefault(_T("Wave Params"), _T("Len Max"));
	SetLenMax(lenMax, TimeValue(0));

	SetAmp(1.0f, TimeValue(0));
	SetPhase(0.0f, TimeValue(0));

	ReInit();

	type = 0;
	// Set the validity interval of the texture to empty
	texValidity.SetEmpty();
}
Beispiel #24
0
void GameState::HandleEvents(sf::Event theEvent)
{
  // Exit program if Escape key is pressed
#if (SFML_VERSION_MAJOR < 2)
  if((theEvent.Type == sf::Event::KeyReleased) && (theEvent.Key.Code == sf::Key::Escape))
#else
    if((theEvent.type == sf::Event::KeyReleased) && (theEvent.key.code == sf::Keyboard::Escape))
#endif
    {
      // Signal the application to exit
      mApp.Quit(GQE::StatusAppOK);
    }

  // Update selected edge if mouse moved
#if (SFML_VERSION_MAJOR < 2)
  if(theEvent.Type == sf::Event::MouseMoved)
#else
    if(theEvent.type == sf::Event::MouseMoved)
#endif
    {
      UpdateSelected(theEvent);
    }

#if (SFML_VERSION_MAJOR < 2)
  if(theEvent.Type == sf::Event::MouseButtonReleased)
#else
    if(theEvent.type == sf::Event::MouseButtonReleased)
#endif
    {
      // If current player is 0 then the last game ended, start a new game
      if(0 == mCurrentPlayer)
      {
        // Reinitialize the board and start a new game
        ReInit();
      }
      else
      {
        // Player has selected an edge
        SelectEdge();
      }
    }
}
Beispiel #25
0
/* buffer_size is in samples - frames would be better */
_BOOLEAN
CPaCommon::Init(int iSampleRate, int iNewBufferSize, _BOOLEAN bNewBlocking)
{
    if (device_changed == false && double(iSampleRate) == samplerate)
        return FALSE;

    unsigned long channels=2;

    samplerate = double(iSampleRate);

    if (is_capture)
        framesPerBuffer = iNewBufferSize / channels;
    else
        framesPerBuffer = 256;

    blocking = bNewBlocking; /* TODO honour this */
    iBufferSize = iNewBufferSize;

    ReInit();

    if (stream)
    {
        const PaStreamInfo* info = Pa_GetStreamInfo( stream );
        if (is_capture)
            cout << "init capture ";
        else
            cout << "init play ";
        cout << iNewBufferSize;
        if (info)
            cout << " latency " << info->outputLatency;
        else
            cout << " can't read latency";
        cout << endl;
    }
    else
    {
        cerr << "portaudio can't open stream" << endl;
        //throw "portaudio open error";
    }

    return TRUE;
}
Beispiel #26
0
void DlgController::SelectFile (SourceType type)
{
	FileGetter browser;
	browser.SetFilter (GetFileFilter (type));
	if (browser.GetExistingFile (_hWnd, "Select a source file"))
	{
		char const * path = browser.GetPath ();
		_currentDir.Change (browser.GetDirectory ());
		ListCurrentDir ();
		_editFile.SetText (browser.GetFileName ());
		_painter.SetSource (type, path);
	}
	else
	{
		_wave.UnCheck ();
		_image.UnCheck ();
		_mike.Check ();
		_painter.SetSource (SRC_MIKE);
	}
	ReInit ();
}
Beispiel #27
0
int main(int argc, char **argv)
{
    GLenum type;

    glutInit(&argc, argv);
    Args(argc, argv);

    type = GLUT_DEPTH;
    type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
    type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
    glutInitDisplayMode(type);
    glutInitWindowSize(300, 300);
    glutCreateWindow("Olympic");

    Init();
    ReInit();

    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(DrawScene);
    glutMainLoop();
}
void CCarCtrlHack::ReInitHack()
{
	ReInit();
	LastTimeFireTruckCreated = 0;
	LastTimeAmbulanceCreated = 0;
}
Beispiel #29
0
FileAnalysis::FileAnalysis(const wxString& FileName)
{
  ReInit(FileName);
}
// Called by the parser startElement() handler.
void CPrefElement::startElement(const char* name, const char** atts)
{
  // These are the elements we know how to handle:
  if (stricmp(name, "PREF") == 0)
  {

    m_bPrefOpen = TRUE;
    ReInit();

    // Process the list of attribute/value pairs.
    int i = 0;
    while(atts[i])
    {
      const char* attrName = atts[i++];
      const char* attrVal = atts[i++];

      if (stricmp(attrName, "uiname") == 0)
        m_strUIName = attrVal;
      else if (stricmp(attrName, "prefname") == 0)
        m_strPrefName = attrVal;
      else if (stricmp(attrName, "type") == 0)
        m_strType = attrVal;
      else if (stricmp(attrName, "default") == 0)
        m_strDefaultValue = attrVal;
      else if (stricmp(attrName, "lockable") == 0)
        m_bLockable = (stricmp(attrVal, "true") == 0);
      else if (stricmp(attrName, "description") == 0)
        m_strDescription = attrVal;
      else if (stricmp(attrName, "useradded") == 0)
        m_bUserAdded = (stricmp(attrVal, "true") == 0);
    }

  }
  else if (stricmp(name, "CHOICES") == 0)
  {
    if (!m_bPrefOpen)
      return;

  }
  else if (stricmp(name, "CHOICE") == 0)
  {
    if (!m_bPrefOpen)
      return;

    // Process the list of attribute/value pairs.
    // There must be exactly 2 attributes: a uiname
    // and a value.
    ASSERT(atts[0] && atts[1] && atts[2] && atts[3] && !atts[4]);

    // If you get this assertion, you have too many <CHOICE> elements inside
    // a <CHOICES> element. Boost MAX_CHOICES in prefselement.h.
    ASSERT( m_iChoices < MAX_CHOICES);

    int i = 0;
    while(atts[i])
    {
      const char* attrName = atts[i++];
      const char* attrVal = atts[i++];

      if (stricmp(attrName, "uiname") == 0)
        m_astrChoiceName[m_iChoices] = attrVal;

      else if (stricmp(attrName, "value") == 0)
        m_astrChoiceVal[m_iChoices] = attrVal;
    }
    m_iChoices++;

  }
  else if (stricmp(name, "VALUE") == 0)
  {
    if (!m_bPrefOpen)
      return;

  }
  else if (stricmp(name, "LOCKED") == 0)
  {
    if (!m_bPrefOpen)
      return;

  }
  else if (stricmp(name, "REMOTEADMIN") == 0)
  {
    if (!m_bPrefOpen)
      return;

  }
  else
  {
    return;
  }


  // Save the tag we are handling.
  m_strCurrentTag = name;

}