Ejemplo n.º 1
0
bool GPG_Application::startWindow(
        STR_String& title,
        int windowLeft,
        int windowTop,
        int windowWidth,
        int windowHeight,
        const bool stereoVisual,
        const int stereoMode,
        const GHOST_TUns16 samples)
{
	bool success;
	// Create the main window
	//STR_String title ("Blender Player - GHOST");
	m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal,
	                                     GHOST_kDrawingContextTypeOpenGL, stereoVisual, false, samples);
	if (!m_mainWindow) {
		printf("error: could not create main window\n");
		exit(-1);
	}

	/* Check the size of the client rectangle of the window and resize the window
	 * so that the client rectangle has the size requested.
	 */
	m_mainWindow->setClientSize(windowWidth, windowHeight);
	m_mainWindow->setCursorVisibility(false);

	success = initEngine(m_mainWindow, stereoMode);
	if (success) {
		success = startEngine();
	}
	return success;
}
Ejemplo n.º 2
0
bool GPG_Application::startFullScreen(
        int width,
        int height,
        int bpp,int frequency,
        const bool stereoVisual,
        const int stereoMode,
        const GHOST_TUns16 samples,
        bool useDesktop)
{
	bool success;
	GHOST_TUns32 sysWidth=0, sysHeight=0;
	fSystem->getMainDisplayDimensions(sysWidth, sysHeight);
	// Create the main window
	GHOST_DisplaySetting setting;
	setting.xPixels = (useDesktop) ? sysWidth : width;
	setting.yPixels = (useDesktop) ? sysHeight : height;
	setting.bpp = bpp;
	setting.frequency = frequency;

	fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual, samples);
	m_mainWindow->setCursorVisibility(false);
	/* note that X11 ignores this (it uses a window internally for fullscreen) */
	m_mainWindow->setState(GHOST_kWindowStateFullScreen);

	success = initEngine(m_mainWindow, stereoMode);
	if (success) {
		success = startEngine();
	}
	return success;
}
Ejemplo n.º 3
0
bool GPG_Application::startEmbeddedWindow(
        STR_String& title,
        const GHOST_TEmbedderWindowID parentWindow,
        const bool stereoVisual,
        const int stereoMode,
        const GHOST_TUns16 samples)
{
	GHOST_TWindowState state = GHOST_kWindowStateNormal;
	if (parentWindow != 0)
		state = GHOST_kWindowStateEmbedded;
	m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, state,
	                                     GHOST_kDrawingContextTypeOpenGL, stereoVisual, false, samples, parentWindow);

	if (!m_mainWindow) {
		printf("error: could not create main window\n");
		exit(-1);
	}
	m_isEmbedded = true;

	bool success = initEngine(m_mainWindow, stereoMode);
	if (success) {
		success = startEngine();
	}
	return success;
}
Ejemplo n.º 4
0
bool GPG_Application::startFullScreen(
		int width,
		int height,
		int bpp,int frequency,
		const bool stereoVisual,
		const int stereoMode,
		const GHOST_TUns16 samples)
{
	bool success;
	// Create the main window
	GHOST_DisplaySetting setting;
	setting.xPixels = width;
	setting.yPixels = height;
	setting.bpp = bpp;
	setting.frequency = frequency;

	fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual);
	m_mainWindow->setCursorVisibility(false);
	m_mainWindow->setState(GHOST_kWindowStateFullScreen);

	success = initEngine(m_mainWindow, stereoMode);
	if (success) {
		success = startEngine();
	}
	return success;
}
Ejemplo n.º 5
0
EngineGL::EngineGL()
{
	DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Starting OpenGL engine\n");
	m_screen = NULL;

    SDL_ShowCursor(0);
	doResize(m_width, m_height);

	if(!m_screen)
		// looks like GL is not supported -- dont attempt anything else
		return;

	glictGlobals.drawPartialOut = true;
	glictGlobals.clippingMode = GLICT_SCISSORTEST;

    Sprite*a,*b;

	m_sysfont->SetFontParam(new YATCFont("Tibia.pic", 2, a=createSprite("Tibia.pic", 2)));
	m_minifont->SetFontParam(new YATCFont("Tibia.pic", 5, createSprite("Tibia.pic", 5)));
	m_aafont->SetFontParam(new YATCFont("Tibia.pic", 7, b=createSprite("Tibia.pic", 7)));
	m_gamefont->SetFontParam(new YATCFont("Tibia.pic", 4, createSprite("Tibia.pic", 4)));

	a->addColor(.75,.75,.75);
	b->addColor(.75,.75,.75);

    m_ui = createSprite("Tibia.pic", 3);
	m_light = createSprite("Tibia.pic", 6);
    m_cursorBasic = m_ui->createCursor(290,12,11,19, 1, 1);
    m_cursorUse = m_ui->createCursor(310,12,19,19, 9, 9);
    SDL_ShowCursor(1);
    SDL_SetCursor(m_cursorBasic);

	initEngine();
}
Ejemplo n.º 6
0
void initComponentGeneral()
{
    static bool first = true;
    if (first)
    {
        first = false;
    }

    initValidation();
    initExporter();
    initEngine();
    initGraphComponent();
    initTopologyMapping();
    initBoundaryCondition();
    initUserInteraction();
    initConstraint();
    initHaptics();
    initDenseSolver();
#ifdef SOFA_HAVE_CSPARSE
    initSparseSolver();
#endif
    initPreconditioner();
    initOpenGLVisual();

}
Ejemplo n.º 7
0
int CGameEngine::run()
{
	initGame();
	initEngine();

	float lastTime = 0.f;
	m_clock.stop();

	while (m_isRunning)
    {
		float currentTime = m_clock.getTick();
		float elapsedtime = currentTime-lastTime;

		lastTime = currentTime;

		do
		{
			float reducedTime = std::min(0.033f, elapsedtime);
			assert(reducedTime >= 0 && reducedTime <= 0.033f);
			elapsedtime -= 0.033f;

			update(reducedTime);
		
			m_eventEngine->onFrame(reducedTime);

			if(!m_stateStack.empty())
				m_stateStack.top()->update(reducedTime);
		}while(elapsedtime > 0);
    }

	return 0;
}
Ejemplo n.º 8
0
int Game::start(void(*buildFunc)(), void(*destructFunc)())
{
	if (game == nullptr)
		return EXIT_FAILURE;

	this->destructFunc = destructFunc;

	if (!InitMainWindow())
	{
		delete game;
		return EXIT_FAILURE;
	}

	if (!InitDirect3D())
	{
		delete game;
		return EXIT_FAILURE;
	}

	deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	initEngine();

	buildFunc();

	NetworkManager::networkManager->Initialize(2);
	NetworkManager::networkManager->AssignTask([]() { NetworkManager::networkManager->startClient(); });

	MSG msg = { 0 };

	while (msg.message != WM_QUIT)
	{
		// Peek at the next message (and remove it from the queue)
		if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			// Handle this message
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else if (!minimized) // No message to handle
		{
			if (Input::wasControlPressed("quit"))
				PostQuitMessage(0);

			// Update the timer for this frame
			UpdateTimer();

			// Standard game loop type stuff
			CalculateFrameStats();
			update(deltaTime, totalTime);

			draw();// (deltaTime, totalTime);
			Input::updateControlStates();
		}
	}

	delete game;
	
	return (int)msg.wParam;
}
Ejemplo n.º 9
0
int startGame()
{
	int i=1;
	int number = -1;
	hint Hint = { -1, -1, -1, -1 };
	engine* Engine = createEngeine();
	histroyRecorder* HistoryManager = createHistroyRecorder();

	printf("\n []  Start Game!\n");
	if (ERR_NULL_POINTER == initEngine(Engine))
	{
		printf("Init Engine failed!\n");
		exit(1);
	}

	if (ERR_NULL_POINTER == initHistoryRecorder(HistoryManager))
	{
		printf("Init HistoryManager failed! - File open failed!\n");
		exit(1);
	}

	Engine->generateNumber();

	while (Hint.answer != 1)
	{
		printf("Guess Number('0' for exit game) : ");
		scanfForAnswer(&number);
		Hint = Engine->checkAnswer(number);

		switch (number)
		{
			case 0:
				exitGame();
				showMenu();
				break;
			case ERR_INVALID_PARAMETER:
				printf("[Error] Invalid value selected!\n");
				break;
			default:
				break;
		}

		if (number > 0 && Hint.answer != 1)
		{
			if (ERR_FILE_OPEN_FAIL == HistoryManager->record(Hint))
			{
				printf("Record error! - File open failed!\n");
				exit(1);
			}
			HistoryManager->print();
			i++;
		}
	}
	printf("\nCorrect!!\n", number);
	printf("Answer : %d\n\n", number);
	printf("Trying count : %d\n\n", i);
	showMenu();
	return 0;
}
Ejemplo n.º 10
0
VerySimpleExample::Parser::Parser(SimpleLexer::Lexer *lexer)
{
    mTable->fillTable(SymbolCounter, TokenCounter, &mError);
    mTable->fillSymbol(Start, &mEmpty);
    mTable->setSpecialCase(Start, LBrace, &mStart);
    initTokens(TokenCounter);
    initEngine(lexer);
}
bool GPG_Application::startScreenSaverPreview(
	HWND parentWindow,
	const bool stereoVisual,
	const int stereoMode,
	const GHOST_TUns16 samples)
{
	bool success = false;

	RECT rc;
	if (GetWindowRect(parentWindow, &rc))
	{
		int windowWidth = rc.right - rc.left;
		int windowHeight = rc.bottom - rc.top;
		STR_String title = "";
		GHOST_GLSettings glSettings = {0};

		if (stereoVisual) {
			glSettings.flags |= GHOST_glStereoVisual;
		}
		glSettings.numOfAASamples = samples;

		m_mainWindow = fSystem->createWindow(title, 0, 0, windowWidth, windowHeight, GHOST_kWindowStateMinimized,
		                                     GHOST_kDrawingContextTypeOpenGL, glSettings);
		if (!m_mainWindow) {
			printf("error: could not create main window\n");
			exit(-1);
		}

		HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow);
		if (!ghost_hwnd) {
			printf("error: could find main window\n");
			exit(-1);
		}

		SetParent(ghost_hwnd, parentWindow);
		LONG_PTR style = GetWindowLongPtr(ghost_hwnd, GWL_STYLE);
		LONG_PTR exstyle = GetWindowLongPtr(ghost_hwnd, GWL_EXSTYLE);

		RECT adjrc = { 0, 0, windowWidth, windowHeight };
		AdjustWindowRectEx(&adjrc, style, false, exstyle);

		style = (style & (~(WS_POPUP|WS_OVERLAPPEDWINDOW|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_TILEDWINDOW ))) | WS_CHILD;
		SetWindowLongPtr(ghost_hwnd, GWL_STYLE, style);
		SetWindowPos(ghost_hwnd, NULL, adjrc.left, adjrc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);

		/* Check the size of the client rectangle of the window and resize the window
		 * so that the client rectangle has the size requested.
		 */
		m_mainWindow->setClientSize(windowWidth, windowHeight);

		success = initEngine(m_mainWindow, stereoMode);
		if (success) {
			success = startEngine();
		}

	}
	return success;
}
Ejemplo n.º 12
0
bool GPG_Application::StartGameEngine(int stereoMode)
{
	bool success = initEngine(m_mainWindow, stereoMode);
	
	if (success)
		success = startEngine();

	return success;
}
Ejemplo n.º 13
0
int main(int argc, char *args[]) {
    int eaten = 0;


    srand (time(NULL));
    printf("Start test...\n");

    initEngine(0, 0, boardwidth, boardlength, color(255,255,255), fps, &renderBoard);
    init_snake();

    newapple();
    registerKey(&keydown);

    while(stepEngine() && end == false){
        for(int i = 1; i < snake.digit+1; i++){
            snake.xpos[i] = snake.xpos[i - 1]-(snake.xdir[i - 1]) * blockwidth;
            snake.ypos[i] = snake.ypos[i - 1]-(snake.ydir[i - 1]) * blocklength;
        }
        if(snake.xdir[head] != snake.xdir[head+1] || snake.ydir[head] != snake.ydir[head+1]){ 
            for(int i = 1; i < snake.digit+1; i++){
                snake.xdir[i] = snake.xdir[i - 1];
                snake.ydir[i] = snake.ydir[i - 1];
            }
        }

        snake.xpos[head] = snake.xpos[head] + (snake.xdir[head])*vel;
        snake.ypos[head] = snake.ypos[head] + (snake.ydir[head])*vel;


        if(iswall()){
            stop();
        }
        if(eatapple()){
            newapple();
            addtosnake();
            eaten++;
        } 


        //        printf("snake.digit:%d\n",snake.digit);
        printf("head.xpos   %d  head.ypos:  %d\n",snake.xpos[head],snake.ypos[head]);
        for(int i = 1; i < snake.digit+1; i++){
            printf("digit(%d).xpos: %d  digit(%d).ypos: %d  xdir: %d  ydir: %d\n",i,snake.xpos[i],i,snake.ypos[i],snake.xdir[i],snake.ydir[i]);
        }
    }

    printf("Eaten: %d\n", eaten);
    printf("Closing program...\n");
    obliterate();

    return 0;
}
Ejemplo n.º 14
0
int main(int argc, char** argv) {

    struct Engine *e;
    if((e = initEngine(argc, argv)) == NULL){
        releaseEngine(e); //OK if called twice by NULL check
        return(EXIT_FAILURE);
    }
        
    engineRun(e);
    
    releaseEngine(e);
    return (EXIT_SUCCESS);
}
Ejemplo n.º 15
0
ComputerPlayer::ComputerPlayer()
    : tt(15), pd(tt),
      book(false)
{
    initEngine();
    et = Evaluate::getEvalHashTables();
    minTimeMillis = 10000;
    maxTimeMillis = 10000;
    maxDepth = 100;
    maxNodes = -1;
    verbose = true;
    bookEnabled = true;
    currentSearch = nullptr;
}
Ejemplo n.º 16
0
bool init()
{
	if (SDL_Init(SDL_INIT_VIDEO) < 0)
	{
		printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
		return false;
	}

	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

	// Create window
	gWindow = SDL_CreateWindow("BasicTest", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
	if (!gWindow)
	{
		printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
		return false;
	}

	// Create context
	gContext = SDL_GL_CreateContext(gWindow);
	if (!gContext)
	{
		printf("OpenGL context could not be created! SDL Error: %s\n", SDL_GetError());
		return false;
	}

	// Use Vsync
	if (SDL_GL_SetSwapInterval(1) < 0)
	{
		printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
		return false;
	}

	initEngine();
	initLights();
	initCharacter();
	initWeapon();
	initRide();
	initGround();

	return true;
}
Ejemplo n.º 17
0
QObject* CuteNews::createQmlObject(const QString &fileName) {
    initEngine();
    QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext());
    QDeclarativeComponent *component = new QDeclarativeComponent(m_engine, fileName, this);
    
    if (QObject *obj = component->create(context)) {
        context->setParent(obj);
        return obj;
    }

    if (component->isError()) {
        foreach (const QDeclarativeError &error, component->errors()) {
            Logger::log("CuteNews::createQmlObject(). Error: " + error.toString());
        }        
    }
Ejemplo n.º 18
0
int main(int argc, char** argv)
{
  initEngine(argc, argv, "Engine Test");

  setKeyboardFunc(keyboard);//To catch key events
  //setAditionalDisplayFunc(mydisplay);//To draw extra object

  //Create a fog
  GLfloat fogColor[4] = {0.5f,0.5f,0.5f,1.0f};   // Fog Color
  activateFog(fogColor, 0.009, 0.0, 1.0);
  //deactivateFog();

  startEngineLoop();
  return 0;
}
Ejemplo n.º 19
0
  bool EditorApplication::loadProject(const QString& projectFilePath)
  {
    DataProxy projectConfig;
    if(!mProjectManager->loadProject(projectFilePath, projectConfig))
    {
      return false;
    }

    QFileInfo projectFileInfo(projectFilePath);
    QString gameConfig(projectConfig.get("configPath", "gameConfig.json").c_str());
    QString resourcePath(projectFileInfo.absolutePath().append(QDir::separator()).append("resources"));
    mConfigOverride.put("render", mConfig.get<DataProxy>("render", DataProxy()));

    initEngine("renderWindow", gameConfig, resourcePath);
    return true;
  }
Ejemplo n.º 20
0
int main(int argc, char *args[]) {
    printf("Start test...\n");

    initEngine(0, 0, boardwidth, boardlength, color(255,255,255), fps, &renderBoard);

    registerKey(&keydown);
    while(stepEngine()){
        time += 1;
//        time = time/60;
        printf("time: %1d  xpos: %1d  ypos: %1d  velocity: %1d\n",time,xpos,ypos,velocity);
    }


    printf("Closing program...\n");
    obliterate();

    return 0;
}
Ejemplo n.º 21
0
void QQuickTextNode::addTextDocument(const QPointF &position, QTextDocument *textDocument,
                                     const QColor &textColor,
                                     QQuickText::TextStyle style, const QColor &styleColor,
                                     const QColor &anchorColor,
                                     const QColor &selectionColor, const QColor &selectedTextColor,
                                     int selectionStart, int selectionEnd)
{
    initEngine(textColor, selectedTextColor, selectionColor, anchorColor);

    QList<QTextFrame *> frames;
    frames.append(textDocument->rootFrame());
    while (!frames.isEmpty()) {
        QTextFrame *textFrame = frames.takeFirst();
        frames.append(textFrame->childFrames());

        m_engine->addFrameDecorations(textDocument, textFrame);

        if (textFrame->firstPosition() > textFrame->lastPosition()
                && textFrame->frameFormat().position() != QTextFrameFormat::InFlow) {
            const int pos = textFrame->firstPosition() - 1;
            ProtectedLayoutAccessor *a = static_cast<ProtectedLayoutAccessor *>(textDocument->documentLayout());
            QTextCharFormat format = a->formatAccessor(pos);
            QRectF rect = a->frameBoundingRect(textFrame);

            QTextBlock block = textFrame->firstCursorPosition().block();
            m_engine->setCurrentLine(block.layout()->lineForTextPosition(pos - block.position()));
            m_engine->addTextObject(rect.topLeft(), format, QQuickTextNodeEngine::Unselected, textDocument,
                                    pos, textFrame->frameFormat().position());
        } else {
            QTextFrame::iterator it = textFrame->begin();

            while (!it.atEnd()) {
                Q_ASSERT(!m_engine->currentLine().isValid());

                QTextBlock block = it.currentBlock();
                m_engine->addTextBlock(textDocument, block, position, textColor, anchorColor, selectionStart, selectionEnd);
                ++it;
            }
        }
    }

    m_engine->addToSceneGraph(this, style, styleColor);
}
Ejemplo n.º 22
0
void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color,
                                   QQuickText::TextStyle style, const QColor &styleColor,
                                   const QColor &anchorColor,
                                   const QColor &selectionColor, const QColor &selectedTextColor,
                                   int selectionStart, int selectionEnd,
                                   int lineStart, int lineCount)
{
    initEngine(color, selectedTextColor, selectionColor, anchorColor, position);

#ifndef QT_NO_IM
    int preeditLength = textLayout->preeditAreaText().length();
    int preeditPosition = textLayout->preeditAreaPosition();
#endif

    QVarLengthArray<QTextLayout::FormatRange> colorChanges;
    m_engine->mergeFormats(textLayout, &colorChanges);

    lineCount = lineCount >= 0
                ? qMin(lineStart + lineCount, textLayout->lineCount())
                : textLayout->lineCount();

    for (int i=lineStart; i<lineCount; ++i) {
        QTextLine line = textLayout->lineAt(i);

        int start = line.textStart();
        int length = line.textLength();
        int end = start + length;

#ifndef QT_NO_IM
        if (preeditPosition >= 0
                && preeditPosition >= start
                && preeditPosition < end) {
            end += preeditLength;
        }
#endif

        m_engine->setCurrentLine(line);
        m_engine->addGlyphsForRanges(colorChanges, start, end, selectionStart, selectionEnd);
    }

    m_engine->addToSceneGraph(this, style, styleColor);
}
Ejemplo n.º 23
0
bool FlamesApp::OnInit()
{
	//  bool recompileShaders;
	wxString configFileName;

	setlocale(LC_NUMERIC, "C");
	/* Déclaration des handlers pour la gestion des formats d'image */
	wxImage::AddHandler(new wxPNGHandler);
	wxImage::AddHandler(new wxJPEGHandler);

	wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED);

	if (argc == 2)
		configFileName = wxString(argv[1]);
	else
		configFileName = _("params/param.ini");

	if ( !wxFile::Exists(configFileName) )
	{
		cerr << "File " << configFileName.fn_str() << " doesn't exist." << endl << "Exiting..." << endl;
		return false;
	}

	initEngine();
	// Plus utilisé, était nécessaire avec Cg, ne l'est plus avec GLSL
	//  recompileShaders = areShadersCompiled();

	/* Teste s'il est nécessaire de recompiler les shaders */
	FlamesFrame *frame = new FlamesFrame( 	_("Real-time Animation of small Flames - ")+configFileName,
																						wxDefaultPosition,
																						wxDefaultSize,
																						configFileName );

	wxToolTip::Enable(true);

	frame->Show(TRUE);

	SetTopWindow(frame);
	frame->InitGLBuffer();

	return true;
}
Ejemplo n.º 24
0
EditorView::EditorView(QWidget * parent)
    : KGLView(parent),
      m_engine(0),
      m_selectedItem(0),
      m_moving(false),
      m_grid(true),
      m_gridSize(1)
{
    grabMouse();
    setMouseTracking(true);

    QRect screenDim = QApplication::desktop()->screenGeometry();
    m_ratio = (double)screenDim.width()/screenDim.height();

    m_engine= new KGLPhysicsEngine;
    setEngine(m_engine);
    m_wallPaperItem = new KGLBoxItem(20*m_ratio, 20);
    m_groundItem = new KGLPhysicsItem;
    initEngine();
}
Ejemplo n.º 25
0
SimpleDesk::SimpleDesk(QWidget* parent, Doc* doc)
    : QWidget(parent)
    , m_engine(new SimpleDeskEngine(doc))
    , m_doc(doc)
    , m_currentUniverse(0)
    , m_channelsPerPage(DEFAULT_PAGE_CHANNELS)
    , m_selectedPlayback(UINT_MAX)
    , m_playbacksPerPage(DEFAULT_PAGE_PLAYBACKS)
    , m_speedDials(NULL)
{
    qDebug() << Q_FUNC_INFO;
    Q_ASSERT(s_instance == NULL);
    s_instance = this;

    Q_ASSERT(doc != NULL);

    QSettings settings;
    QVariant var = settings.value(SETTINGS_PAGE_CHANNELS);
    if (var.isValid() == true)
        m_channelsPerPage = var.toUInt();

    var = settings.value(SETTINGS_PAGE_PLAYBACKS);
    if (var.isValid() == true)
        m_playbacksPerPage = var.toUInt();

    // default all the universes pages to 1
    for (quint32 i = 0; i < m_doc->outputMap()->universes(); i++)
        m_universesPage.append(1);

    initEngine();
    initView();
    initUniverseSliders();
    initUniversePager();
    initPlaybackSliders();
    initCueStack();

    slotSelectPlayback(0);

    connect(m_doc->outputMap(), SIGNAL(universesWritten(const QByteArray&)),
            this, SLOT(slotUniversesWritten(const QByteArray&)));
}
Ejemplo n.º 26
0
void initComponentCommon()
{
    static bool first = true;
    if (first)
    {
        first = false;
    }

    initLoader();
    initEngine();
/*
    initRigid();
    initDeformable();
    initSimpleFEM();
    initObjectInteraction();
    initMeshCollision();
    initExplicitODESolver();
    initImplicitODESolver();
    initEigen2Solver();
*/
}
Ejemplo n.º 27
0
/*************************************************
 * \brief 引擎初始化 
 * \param void 
 * \return 
 ************************************************/
void newEngine(void)
{
	if(GBOK != GBIsInited(&g_gbis))
	{
		LoadCData();

		// 初始化引擎
		initEngine();
		
	#if OPEN_CONFIG > 0
		//note : 加载产品和配置并设置一个默认的产品
		loadProduceConfig();
		loadRelationConfig();
		SetProductList(4);//设置一个默认的产品配置
	#else
		SetEngineConfig();
	#endif

		// 候选分页设置
		setPageOption();
	}
}
Ejemplo n.º 28
0
bool JavaScriptEnclosureRequest::getEnclosure(const QString &url, const QVariantMap &settings) {
    if (status() == Active) {
        return false;
    }
    
    initEngine();
    QScriptValue func = m_engine->globalObject().property("getEnclosure");

    if (func.isFunction()) {
        const QScriptValue result = func.call(QScriptValue(), QScriptValueList() << url
                                                                                 << m_engine->toScriptValue(settings));

        if (result.isError()) {
            const QString errorString = result.toString();
            Logger::log("JavaScriptEnclosureRequest::getEnclosure(). Error calling getEnclosure(): " + errorString);
            setErrorString(errorString);
            setResult(Enclosure());
            setStatus(Error);
            emit finished(this);
            return false;
        }

        if (result.toBool()) {
            setErrorString(QString());
            setStatus(Active);
            return true;
        }
    }
    else {
        Logger::log("JavaScriptEnclosureRequest::getEnclosure(). getEnclosure() function not defined");
        setErrorString(tr("getEnclosure() function not defined"));
        setResult(Enclosure());
        setStatus(Error);
        emit finished(this);
    }

    return false;
}
Ejemplo n.º 29
0
Renderer::Renderer()
  : controller_(nullptr),
    running_(true),
    camera_(glm::vec3(0.f), 5.f, 0.f, 45.f),
    resolution_(vec2Param("local.resolution")),
    timeMultiplier_(1.f),
    startTime_(Clock::now()),
    lastRender_(Clock::now()),
    mapSize_(0.f),
    nextEntityID_(STARTING_EID) {
  // TODO(zack): move this to a separate initialize function
  resolution_ = initEngine();

#ifdef USE_FMOD
  FMOD_RESULT result;
  FMOD::System *system_;

  result = FMOD::System_Create(&system_);		// Create the main system object.
  if (result != FMOD_OK)
  {
    printf("FMOD error! (%d)\n", result);
    exit(-1);
  }

  result = system_->init(50, FMOD_INIT_NORMAL, 0);	// Initialize FMOD.
  if (result != FMOD_OK)
  {
    printf("FMOD error! (%d)\n", result);
    exit(-1);
  }
#endif  // USE_FMOD
  // Initialize font manager, if necessary
  FontManager::get();

  effectManager_ = new EffectManager();
}
void init_engine() {
    initEngine();
}