コード例 #1
0
ファイル: CausticsRender.cpp プロジェクト: miffysora/Shader
CausticsRender::CausticsRender()
  :m_far(100.0f)
	,m_fovy(30.0f)
	, m_debug(false)
	, m_Mouse(&mRotate)
{

	loadIniFile();
	
}
コード例 #2
0
ファイル: mpeClientTCP.cpp プロジェクト: Hebali/ItpResidency
//--------------------------------------------------------------
void mpeClientTCP::setup(string _fileString, mpeClientListener* _parent, bool _autoMode) {
    parent   = _parent;
    autoMode = _autoMode;
    
    loadIniFile(_fileString);
    ofSetWindowShape(lWidth, lHeight);
    
    if (autoMode) {
        ofAddListener(ofEvents.draw, this, &mpeClientTCP::_draw);
    }
}
コード例 #3
0
//--------------------------------------------------------------
void mpeClientTCP::setup(string _fileString, bool updateOnMainThread) {

	useMainThread = updateOnMainThread;

	fps = 0;
    loadIniFile(_fileString);
	frameCount = 0;
	shouldReset = false;
	heartbeatInterval = 0;
	timeOfNextHeartbeat = ofGetElapsedTimef();
}
コード例 #4
0
void initMainGameSettings(char *filename) {
  char *fname;
  char *home;

  game2 = &main_game2;
  game = &main_game;
  game->settings = (Settings*) malloc(sizeof(Settings));
  initSettingData(filename);

  /* initialize some struct members */

  game2->input.mouse1 = 0;
  game2->input.mouse2 = 0;
  game2->input.mousex = 0;
  game2->input.mousey = 0;
  game2->network.status = 0;

  /* initialize defaults, then load modifications from file */
  initDefaultSettings();

  /* go for .gltronrc (or whatever is defined in RC_NAME) */

  home = getenv("HOME"); /* find homedir */
  if(home == NULL) {
    fname = malloc(strlen(CURRENT_DIR) + strlen(RC_NAME) + 2);
    sprintf(fname, "%s%c%s", CURRENT_DIR, SEPERATOR, RC_NAME);
  } else {
    fname = malloc(strlen(home) + strlen(RC_NAME) + 2);
    sprintf(fname, "%s%c%s", home, SEPERATOR, RC_NAME);
  }

  loadIniFile(fname);
  free(fname);

  /* sanity check: speed, grid_size */
  if(game->settings->current_speed <= 0) {
    fprintf(stderr, "[gltron] sanity check failed: speed = %.2ff\n",
	    game->settings->current_speed);
    game->settings->current_speed = 6.0;
    fprintf(stderr, "[gltron] reset speed: speed = %.2f\n",
	    game->settings->current_speed);
  }
  if(game->settings->grid_size % 8) {
    fprintf(stderr, "[gltron] sanity check failed: grid_size %% 8 != 0: "
	    "grid_size = %d\n", game->settings->grid_size);
    game->settings->grid_size = 240;
    fprintf(stderr, "[gltron] reset grid_size: grid_size = %d\n",
	    game->settings->grid_size);
  }

}
コード例 #5
0
ファイル: artpack.c プロジェクト: BackupTheBerlios/gltron-svn
void loadArt() {
    char buf[120];
    char *path;

    game->screen->artpack.path = artpack_list[artpack_index];

    getArtPath("artpack.ini", buf);
    path = getFullPath(buf);
    if(path != NULL) {
        loadIniFile(path);
        free(path);
    }

    initTexture(game->screen);
    initFonts();
}
コード例 #6
0
ファイル: TOP_ACE.cpp プロジェクト: SHIYUENING/topace
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	Initthread_LoadData();
	loadIniFile();
	InitWindow( hInstance,  hPrevInstance,  lpCmdLine,  nCmdShow);
	InitGL ();

	InitJoyStict(glutGetWindowData());
	bool tmpb=SetPriorityClass(GetCurrentProcess() , HIGH_PRIORITY_CLASS);

	Initthread_DataFream();

	
	glutDisplayFunc     ( display );  // Matching Earlier Functions To Their Counterparts
	glutReshapeFunc     ( reshape );
	glutKeyboardFunc    ( keyboard );
	glutSpecialFunc     ( arrow_keys );
	glutIdleFunc		  ( display );
	glutMainLoop        ( );          // Initialize The Main Loop
	

	return 0;
}
コード例 #7
0
//--------------------------------------------------------------
void ofxTCPSyncClient::setup(string _fileString, ofxTCPSyncClientListener* _parent, bool _autoMode) {
  
	parent   = _parent;
    autoMode = _autoMode;
    loadIniFile(_fileString);
}
コード例 #8
0
ファイル: IniFile.cpp プロジェクト: sophiacode/Robit-Homework
void IniFile::createIniFile(const char * filename)
{
	_FileName = filename;
	loadIniFile();
	createMap();
}
コード例 #9
0
ファイル: IniFile.cpp プロジェクト: sophiacode/Robit-Homework
void IniFile::setStringValue(const char * section, const char * key, const char * value)
{
	int sec_start, sec_end, key_start, key_end, value_start, value_end;
	std::string sec(section);
	std::string k(key);
	std::string val(value);

	loadIniFile();

	sec_start = 0;
	int leftbrace, rightbrace, lastnewline, nextnewline;
	do {
		sec_start = _FileContainer.find(section, sec_start + 1);
		while (isInComment(sec_start))
		{
			sec_start = _FileContainer.find(section, sec_start + 1);
		}
		if (sec_start == std::string::npos)
			break;
		leftbrace = _FileContainer.rfind('[', sec_start);
		rightbrace = _FileContainer.find(']', sec_start);
		lastnewline = _FileContainer.rfind('\n', sec_start);
		nextnewline = _FileContainer.find('\n', sec_start);
		if (rightbrace == std::string::npos)
		{
			sec_start = std::string::npos;
			break;
		}
		if (nextnewline == std::string::npos)
			nextnewline = _FileContainer.size();
	} while (leftbrace < lastnewline || rightbrace > nextnewline);
	
	/* not find the section */
	if (sec_start == std::string::npos)
	{
		_FileContainer += "\n[" + sec + "]\n" + k + "=" + val + "\n";

		_FileMap.insert(std::map<std::string, std::string>::value_type(sec + "|" + k, val));
	}
	else{
		sec_end = sec_start + strlen(section);

		int bound = _FileContainer.find('[', sec_start);
		key_start = _FileContainer.find(key, sec_end);
		while (isInComment(key_start))
		{
			key_start = _FileContainer.find(key, key_start + 1);
		}

		/* not find the key */
		if (key_start == std::string::npos || (bound > std::string::npos && key_start > bound))
		{
			int pos = _FileContainer.find('\n', sec_end) + 1;
			_FileContainer.insert(pos, key);
			pos += strlen(key);
			_FileContainer.insert(pos, "=");
			pos++;
			_FileContainer.insert(pos, value);
			pos += strlen(value);
			_FileContainer.insert(pos, "\n");

			_FileMap.insert(std::map<std::string, std::string>::value_type(sec + "|" + k, val));
		}

		else {
			key_end = key_start + strlen(key);
			value_start = _FileContainer.find('=', key_end) + 1;
			while (_FileContainer[value_start] == ' ')
				value_start++;
			value_end = _FileContainer.find('\n', value_start) - 1;
			if (value_end == std::string::npos)
				value_end = _FileContainer.size() - 1;
			while (_FileContainer[value_end] == ' ')
				value_end--;

			_FileContainer.replace(value_start, value_end - value_start + 1, value);

			auto iter = _FileMap.find(sec + "|" + k);
			iter->second = val;
		}
	}

	std::fstream file(_FileName.c_str(), std::ios::out);
	file << _FileContainer;
}