Example #1
0
bool GLWrapper::initialize()
{
	logOutput(std::string("GL Renderer: ")+UTILS::tostr(glGetString(GL_RENDERER)));
	logOutput(std::string("GL Vendor: ")+UTILS::tostr(glGetString(GL_VENDOR)));
	logOutput(std::string("GL Version: ")+UTILS::tostr(glGetString(GL_VERSION)));

	GLenum glew_err = glewInit();
	if (glew_err != GLEW_OK)
	{
		logError(std::string("GLEW failed to initialize: ")+UTILS::tostr(glewGetErrorString(glew_err)));
		return false;
	}
	else
		logOutput(std::string("Initialized GLEW ")+UTILS::tostr(glewGetString(GLEW_VERSION)));

	// Check through all OpenGL versions to determine the highest supported OpenGL version.
	bool supportsRequiredVersion = glewIsSupported(REQUIRED_GL_VERSION);

	if (!supportsRequiredVersion)
	{
		logError(std::string("Graphics card or driver does not support required ")+REQUIRED_GL_VERSION);
		return false;
	}

	return ERROR_CHECK;
}
Example #2
0
void Widget::on_send_button_clicked()
{
    QString message = "\nFrom: ";
    message += myself.getName();
    message += "\nWhen: ";
    message += QTime::currentTime().toString();
    message += " ";
    message += QDate::currentDate().toString();
    message += "\nText:\n";
    message += (this->ui->message_input->toPlainText());
    messageOutput(message);
    this->ui->message_input->setPlainText("");
    this->ui->message_input->setFocus();

    // connecor->bind(QHostAddress::LocalHost, connecor->getPort());
    connector->sendMessage(message.toLocal8Bit());
    if (!client_or_server)
    {
        logOutput(" server_tcp->sendMessageToAllClients(message.toLocal8Bit());");
        server_tcp->sendMessageToAllClients(message.toLocal8Bit());
    }
    else
    {
        logOutput("client_tcp->writeMessage(message.toLocal8Bit());");
        client_tcp->writeMessage(message.toLocal8Bit());
    }
}
void UnityProjectBuilder::saveProject (const File& introjucerAppFile)
{
    if (! (introjucerAppFile.exists() || unityProjectFile.existsAsFile()))
        return;
    
    logOutput("Resaving Introjucer project...");
    StringArray args;
    args.add (getExeFromApp (introjucerAppFile).getFullPathName());
    args.add ("--resave");
    args.add (unityProjectFile.getFullPathName());

    ChildProcess introjucerProcess;
    introjucerProcess.start (args);
    logOutput (introjucerProcess.readAllProcessOutput());
}
Example #4
0
void Widget::on_pushButton_connect_clicked()
{

    /*for ( int i=0 ; i < 50; i++ )
    {
        logOutput( QString( "Search server...   " ) );
        if ( client_tcp->connectToHostPort() )
        {
            client_or_server = false;
            break;
        }
        logOutput( QString ( "Search clients...   "));
        if ( server_tcp->listenHostPort() )
        {
            client_or_server = true;
            break;
        }
    }*/
    logOutput( QString( "Search server...   " ) );
    if ( client_tcp->connectToHostPort() )
    {

    }
    client_or_server = true;


    // client_or_server = true;
    // connector->joinMulticastGroup(connector->getHostAdress());
}
Example #5
0
void eDebugImpl(int flags, const char* fmt, ...)
{
	char buf[1024];
	int pos = 0;

	if (! (flags & _DBGFLG_NOTIME)) {
		struct timespec tp;
		clock_gettime(CLOCK_MONOTONIC, &tp);
		pos = snprintf(buf, sizeof(buf), "<%6lu.%03lu> ", tp.tv_sec, tp.tv_nsec/1000000);
	}

	va_list ap;
	va_start(ap, fmt);
	pos += vsnprintf(buf + pos, sizeof(buf) - pos, fmt, ap);
	va_end(ap);

	if (!(flags & _DBGFLG_NONEWLINE)) {
		/* buf will still be null-terminated here, so it is always safe
		 * to do this. The remainder of this function does not rely
		 * on buf being null terminated. */
		buf[pos++] = '\n';
	}

	logOutput(buf, pos);

	if (logOutputConsole)
		::write(2, buf, pos);

	if (flags & _DBGFLG_FATAL)
		bsodFatal("enigma2");
}
void UnityProjectBuilder::updateBuildDirectories()
{
    if (buildDir.isEmpty())
        return;
    
    ValueTree exportsTree (project.getChildWithName (Ids::exportFormats));
    
    if (! exportsTree.isValid())
        return;
    
    const int numExports = exportsTree.getNumChildren();
    
    for (int i = 0; i < numExports; ++i)
    {
        ValueTree exporter (exportsTree.getChild (i));
        
        if (exporter.hasProperty (Ids::targetFolderProp))
        {
            logOutput ("Updating exporter " + exporter.getType().toString());
            const String oldTarget (exporter.getProperty (Ids::targetFolderProp).toString());
            String newTarget (buildDir);
            
            if (oldTarget.containsChar ('/'))
                 newTarget << oldTarget.fromLastOccurrenceOf ("/", true, false);
                
            exporter.setProperty (Ids::targetFolderProp, newTarget, nullptr);
        }
    }
}
Example #7
0
void HTML5::syncFiles() {
	logOutput("sync files");
	EM_ASM(
		FS.syncfs(function(error) {
			if (error) { console.log("Error while syncing", error); }
			console.log('finished syncing..');
		});
Example #8
0
void Widget::on_listen_button_clicked()
{

    logOutput( QString ( "Search clients...   "));
    if ( server_tcp->listenHostPort() )
    {

    }
    client_or_server = false;
}
Example #9
0
void Windows::exit (const std::string& reason, int errorCode)
{
	if (errorCode != 0) {
		logError(reason);
		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", reason.c_str(), nullptr);
	} else {
		logOutput(reason);
	}
	ExitProcess(errorCode);
}
Example #10
0
void mprStaticError(MPR_LOC_DEC(ctx, loc), const char *fmt, ...)
{
	va_list		args;
	int			len;
	char		buf[MPR_MAX_STRING];

	va_start(args, fmt);
	len = mprVsprintf(buf, sizeof(buf), fmt, args);
	va_end(args);

	logOutput(MPR_LOC_PASS(ctx, loc), MPR_ERROR_MSG | MPR_ERROR_SRC, 0, buf);
}
Example #11
0
void mprRawLog(MprCtx ctx, const char *fmt, ...)
{
	va_list		args;
	char		*buf;
	int			len;

	va_start(args, fmt);
	len = mprAllocVsprintf(MPR_LOC_ARGS(ctx), &buf, 0, fmt, args);
	va_end(args);
	
	logOutput(MPR_LOC_ARGS(ctx), MPR_RAW, 0, buf);
	mprFree(buf);
}
void UnityProjectBuilder::parseFile (ValueTree file, const File& sourceDir)
{
    const String path (file.getProperty (Ids::fileProp).toString());
    const File sourceFile (projectFile.getSiblingFile (path));
    const bool compile = bool (file.getProperty (Ids::compileProp));
    
    if (compile && isValidSourceFile (sourceFile))
    {
        file.setProperty (Ids::compileProp, false, nullptr);
        filesToAdd.add (sourceFile.getRelativePathFrom (sourceDir));
        logOutput ("Adding file \"" + path + "\"...");
    }
}
Example #13
0
void mprError(MPR_LOC_DEC(ctx, loc), const char *fmt, ...)
{
	va_list		args;
	char		*buf;
	int			len;

	va_start(args, fmt);
	len = mprAllocVsprintf(MPR_LOC_ARGS(ctx), &buf, 0, fmt, args);
	va_end(args);
	
	logOutput(MPR_LOC_PASS(ctx, loc), MPR_ERROR_MSG | MPR_ERROR_SRC, 0, buf);

	mprFree(buf);
}
Example #14
0
void Logger::log(const std::string& pText, const Type pType, const Output pOutput)
{
	bool outputText(true);
	Type logType(type_);
	Output logOutput(output_);
	
	// Check for non-defaults.
	if (pType != LOG_TYPE_DEFAULT)
		logType = pType;
		
	if (pOutput != LOG_OUTPUT_DEFAULT)
		logOutput = pOutput;
		
	if (LOG_OUTPUT_SILENT == logOutput) // if we're not going to output this, might as well leave now.
		return;
		
	// Check if we are actually going to output this.
	switch (logType) {
		case LOG_TYPE_DEBUG:
			#if !defined(DEBUG)
				outputText = false;
			#endif
			break;
		case LOG_TYPE_INFO:
		case LOG_TYPE_ERROR:
			outputText = true;
			break;
		default:
			log("Logger: Unknown log type! Tried to Log - " + pText, LOG_TYPE_ERROR);
	}
	
	if (false == outputText)// if we're not going to output this, might as well leave now.
		return;
		
	// See where we're going to output this.
	switch (logOutput) {
		case LOG_OUTPUT_FILE:
			logToFile(pText, logType);
			break;
		case LOG_OUTPUT_FILE_AND_TERMINAL:
			logToFile(pText, logType);
			logToTerm(pText, logType);
			break;
		case LOG_OUTPUT_TERMINAL:
			logToTerm(pText, logType);
			break;
		default:
			log("Logger: Unknown log output! Tried to Log - " + pText, LOG_TYPE_ERROR, LOG_OUTPUT_FILE_AND_TERMINAL);
	}
}
File UnityProjectBuilder::buildUnityCpp (const File& destDir, int unityNum, const Range<int> fileRange)
{
    const File cppFile (destDir.getChildFile (unityName + String (unityNum)).withFileExtension (".cpp"));
    logOutput ("Building Unity cpp file \"" + cppFile.getFullPathName() + "\"...");
    
    if (cppFile.existsAsFile())
        cppFile.deleteFile();
    
    FileOutputStream s (cppFile);
    
    for (int i = fileRange.getStart(); i < fileRange.getEnd(); ++i)
        s << "#include \"" << filesToAdd[i] << "\"" << newLine;
    
    return cppFile;
}
//==============================================================================
void UnityProjectBuilder::recurseGroup (ValueTree group, const File& sourceDir)
{
    logOutput ("Recursing group \"" + group.getProperty (Ids::nameProp).toString() + "\"...");

    const int numChildren = group.getNumChildren();
    
    for (int i = 0; i < numChildren; ++i)
    {
        ValueTree child (group.getChild (i));
        
        if (child.hasType (Ids::group))
            recurseGroup (child, sourceDir);
        else if (child.hasType (Ids::file))
            parseFile (child, sourceDir);
    }
}
Example #17
0
void mprLog(MprCtx ctx, int level, const char *fmt, ...)
{
	va_list		args;
	char		*buf;

	if (level > mprGetLogLevel(ctx)) {
		return;
	}

	va_start(args, fmt);
	mprAllocVsprintf(MPR_LOC_ARGS(ctx), &buf, 0, fmt, args);
	va_end(args);

	logOutput(MPR_LOC_ARGS(ctx), MPR_LOG_SRC, level, buf);

	va_end(args);
	mprFree(buf);
}
Example #18
0
void mprFatalError(MPR_LOC_DEC(ctx, loc), const char *fmt, ...)
{
	va_list		args;
	char		*buf;
	int			len;

	va_start(args, fmt);
	len = mprAllocVsprintf(MPR_LOC_ARGS(ctx), &buf, 0, fmt, args);
	va_end(args);
	
	logOutput(MPR_LOC_PASS(ctx, loc), MPR_USER_MSG | MPR_FATAL_SRC, 0, buf);

	mprFree(buf);

#if BREW
	mprSignalExit(ctx);
#else
	exit(2);
#endif
}
Example #19
0
void Widget::serverFounded()
{
    logOutput("Server founded");
}
bool UnityProjectBuilder::run()
{
    logOutput ("Starting parse of \"" + projectFile.getFullPathName() + "\"...");
    project = readValueTreeFromFile (projectFile);

    if (! project.hasType (Ids::jucerProject))
    {
        logOutput ("ERROR: Invalid project, exiting");
        return false;
    }
    
    logOutput ("Valid project found...");
    ValueTree mainGroupTree (project.getChildWithName (Ids::mainGroup));
    
    if (! mainGroupTree.isValid())
    {
        logOutput ("ERROR: Empty project, exiting");
        return false;
    }
    
    updateBuildDirectories();
    
    File sourceDir (projectFile.getSiblingFile ("Source"));
    
    logOutput (newLine);
    recurseGroup (mainGroupTree, sourceDir);
    
    const Array<File> cppFiles (buildUnityCpp (sourceDir));
    
    // add unity files
    ValueTree unityGroup (Ids::group);
    unityGroup.setProperty (Ids::idProp, createAlphaNumericUID(), nullptr);
    unityGroup.setProperty (Ids::nameProp, "Unity", nullptr);
    mainGroupTree.addChild (unityGroup, -1, nullptr);
    
    for (int i = 0; i < cppFiles.size(); ++i)
    {
        File cppFile (cppFiles[i]);
        
        if (cppFile.exists())
        {
            ValueTree cppTree (Ids::file);
            cppTree.setProperty (Ids::idProp, createAlphaNumericUID(), nullptr);
            cppTree.setProperty (Ids::nameProp, cppFile.getFileName(), nullptr);
            cppTree.setProperty (Ids::compileProp, true, nullptr);
            cppTree.setProperty (Ids::resourceProp, false, nullptr);
            cppTree.setProperty (Ids::fileProp, cppFile.getRelativePathFrom (projectFile), nullptr);
            unityGroup.addChild (cppTree, -1, nullptr);
        }
    }
    
    // write unity Introjucer project
    unityProjectFile = projectFile.getSiblingFile (projectFile.getFileNameWithoutExtension() + unityName + projectFile.getFileExtension());
    
    if (unityProjectFile.existsAsFile())
        unityProjectFile.deleteFile();
    
    writeValueTreeToFile (project, unityProjectFile);
    
    logOutput ("Completed successfully!");
    
    return true;
}
Example #21
0
/**
 * @fn setLogOutput
 */
void QueuedProcess::setLogOutput(const QString &)
{
    setStandardOutputFile(logOutput(), QIODevice::Append);
}
Example #22
0
void Widget::clientConnected()
{
    logOutput("client Connected");
}
Example #23
0
void mprAssertError(MPR_LOC_DEC(ctx, loc), const char *msg)
{
	logOutput(MPR_LOC_PASS(ctx, loc), MPR_ASSERT_MSG | MPR_ASSERT_SRC, 0, msg);
}