Exemple #1
0
/**
 * Initialize the game state
 */
Common::ErrorCode MortevielleEngine::initialize() {
	// Initialize graphics mode
	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true);

	// Set debug channels
	DebugMan.addDebugChannel(kMortevielleCore, "core", "Core debugging");
	DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging");

	// Set up an intermediate screen surface
	_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());

	_txxFileFl = false;
	// Load texts from TXX files
	loadTexts();

	// Load the mort.dat resource
	Common::ErrorCode result = loadMortDat();
	if (result != Common::kNoError) {
		_screenSurface.free();
		return result;
	}

	// Load some error messages (was previously in chartex())
	_hintPctMessage = getString(580);  // You should have noticed %d hints

	// Set default EGA palette
	_paletteManager.setDefaultPalette();

	// Setup the mouse cursor
	initMouse();

	loadPalette();
	loadCFIPH();
	loadCFIEC();
	decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
	_x26KeyCount = 1;
	initMaxAnswer();
	initMouse();

	loadPlaces();
	_soundOff = false;
	_largestClearScreen = false;

	testKeyboard();
	showConfigScreen();
	testKeyboard();
	clearScreen();

	_soundManager.loadNoise();
	_soundManager.loadAmbiantSounds();

	return Common::kNoError;
}
bool CGameApplication::init()
{
    if (!initWindow())
        return false;
    if (!initGraphics())
        return false;
    if (!initInput())
        return false;
    if (!initGame())
        return false;
    return true;
}
Exemple #3
0
void ZVision::initScreen() {
    uint16 workingWindowWidth = (getGameId() == GID_NEMESIS) ? ZNM_WORKING_WINDOW_WIDTH : ZGI_WORKING_WINDOW_WIDTH;
    uint16 workingWindowHeight = (getGameId() == GID_NEMESIS) ? ZNM_WORKING_WINDOW_HEIGHT : ZGI_WORKING_WINDOW_HEIGHT;
    _workingWindow = Common::Rect(
                         (WINDOW_WIDTH  -  workingWindowWidth) / 2,
                         (WINDOW_HEIGHT - workingWindowHeight) / 2,
                         ((WINDOW_WIDTH  -  workingWindowWidth) / 2) + workingWindowWidth,
                         ((WINDOW_HEIGHT - workingWindowHeight) / 2) + workingWindowHeight
                     );

    initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_screenPixelFormat);
}
Exemple #4
0
int main(int argc, char *argv[])
{

    argc = argc;
    argv = argv;

    if (!initGraphics())
    {
        fprintf(stderr, "Graphics initialization failed.\n");
        return EXIT_FAILURE;
    }

    appInit();

    while (gAppAlive)
    {
        struct timeval timeNow;

        while (XPending(sDisplay))
        {
            XEvent ev;
            XNextEvent(sDisplay, &ev);
            switch (ev.type)
            {
            case KeyPress:
                {
                    unsigned int keycode, keysym;
                    keycode = ((XKeyEvent *)&ev)->keycode;
                    keysym = XKeycodeToKeysym(sDisplay, keycode, 0);
                    if (keysym == XK_Return || keysym == XK_Escape)
                        gAppAlive = 0;
                }
                break;
            }
        }

        if (gAppAlive)
        {
            gettimeofday(&timeNow, NULL);
            appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
                      sWindowWidth, sWindowHeight);
            checkGLErrors();
            eglSwapBuffers(sEglDisplay, sEglSurface);
            checkEGLErrors();
        }
    }

    appDeinit();
    deinitGraphics();

    return EXIT_SUCCESS;
}
Exemple #5
0
/******************************************************************************
 Main function.
******************************************************************************/
int main(int argc, char* argv[])
{
    HDErrorInfo error;

    printf("Starting application\n");
    
    atexit(exitHandler);

    // Initialize the device.  This needs to be called before any other
    // actions on the device are performed.
    ghHD = hdInitDevice(HD_DEFAULT_DEVICE);
    if (HD_DEVICE_ERROR(error = hdGetError()))
    {
        hduPrintError(stderr, &error, "Failed to initialize haptic device");
        fprintf(stderr, "\nPress any key to quit.\n");
        getchar();
        exit(-1);
    }

    printf("Found device %s\n",hdGetString(HD_DEVICE_MODEL_TYPE));
    
    hdEnable(HD_FORCE_OUTPUT);
    hdEnable(HD_MAX_FORCE_CLAMPING);

    hdStartScheduler();
    if (HD_DEVICE_ERROR(error = hdGetError()))
    {
        hduPrintError(stderr, &error, "Failed to start scheduler");
        fprintf(stderr, "\nPress any key to quit.\n");
        getchar();
        exit(-1);
    }
    
    initGlut(argc, argv);

    // Get the workspace dimensions.
    HDdouble maxWorkspace[6];
    hdGetDoublev(HD_MAX_WORKSPACE_DIMENSIONS, maxWorkspace);

    // Low/left/back point of device workspace.
    hduVector3Dd LLB(maxWorkspace[0], maxWorkspace[1], maxWorkspace[2]);
    // Top/right/front point of device workspace.
    hduVector3Dd TRF(maxWorkspace[3], maxWorkspace[4], maxWorkspace[5]);
    initGraphics(LLB, TRF);

    // Application loop.
    CoulombForceField();

    printf("Done\n");
    return 0;
}
Exemple #6
0
/**
 * Plays an animated cutscene.
 * @param id the id of the file
 */
bool MoviePlayer::load(const char *name) {
	// This happens when quitting during the "eye" cutscene.
	if (_vm->shouldQuit())
		return false;

	if (_decoderType == kVideoDecoderDXA)
		_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(name);
	else
		_bgSoundStream = NULL;

	_textSurface = NULL;

	Common::String filename;
	switch (_decoderType) {
	case kVideoDecoderDXA:
		filename = Common::String::format("%s.dxa", name);
		break;
	case kVideoDecoderSMK:
		filename = Common::String::format("%s.smk", name);
		break;
	case kVideoDecoderPSX:
		filename = Common::String::format("%s.str", name);

		// Need to switch to true color
		initGraphics(640, 480, true, 0);

		// Need to load here in case it fails in which case we'd need
		// to go back to paletted mode
		if (_decoder->loadFile(filename)) {
			return true;
		} else {
			initGraphics(640, 480, true);
			return false;
		}
	}

	return _decoder->loadFile(filename.c_str());
}
Exemple #7
0
void GlkEngine::initGraphicsMode() {
	uint width = ConfMan.hasKey("width") ? ConfMan.getInt("width") : 640;
	uint height = ConfMan.hasKey("height") ? ConfMan.getInt("height") : 480;
	Common::List<Graphics::PixelFormat> formats = g_system->getSupportedFormats();
	Graphics::PixelFormat format = formats.front();

	for (Common::List<Graphics::PixelFormat>::iterator i = formats.begin(); i != formats.end(); ++i) {
		if ((*i).bytesPerPixel > 1) {
			format = *i;
			break;
		}
	}

	initGraphics(width, height, &format);
}
Exemple #8
0
GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) {
	initGraphics(640, 480, true);

	_frontScreen = new Graphics::Surface();
	_frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());

	_screenForInventory = new Graphics::Surface();
	_screenForInventory->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());

	_mapScreen = new Graphics::Surface();
	_mapScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());

	_shadowTable70 = (byte *)malloc(256);
	_shadowTable50 = (byte *)malloc(256);
}
Exemple #9
0
Common::Error LureEngine::init() {
	int_engine = this;
	_initialized = false;
	_saveLoadAllowed = false;

	initGraphics(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT, false);

	// Check the version of the lure.dat file
	Common::File f;
	VersionStructure version;
	if (!f.open(SUPPORT_FILENAME)) {
		GUIError("Could not locate Lure support file");
		return Common::kUnknownError;
	}

	f.seek(0xbf * 8);
	f.read(&version, sizeof(VersionStructure));
	f.close();

	if (READ_LE_UINT16(&version.id) != 0xffff) {
		GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME);
		return Common::kUnknownError;
	} else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) {
		GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d",
			SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR,
			version.vMajor, version.vMinor);
		return Common::kUnknownError;
	}

	_disk = new Disk();
	_resources = new Resources();
	_strings = new StringData();
	_screen = new Screen(*_system);
	_mouse = new Mouse();
	_events = new Events();
	_menu = new Menu();
	Surface::initialize();
	_room = new Room();
	_fights = new FightsManager();

	_gameToLoad = -1;
	_initialized = true;

	// Setup mixer
	syncSoundSettings();

	return Common::kNoError;
}
Exemple #10
0
int main(int argc, char** argv)
{
    if (argc < 2)
    {
        perror("Usage: ./drawer -f <init_file>");
        return (EXIT_FAILURE);
    }

    Network::DrawServer * drawer = Network::DrawServer::getInstance();
    drawer->init();

    //parse options
    int c;
    while( ( c = getopt( argc, argv, "f:")) != -1 )
    {
        switch( c )
        {
        case 'f':
        {
            DrawerParser l_parser;
            int l_res = 0;
            if ((l_res = l_parser.readFile(optarg, (void *)drawer )) == ENOENT)
            {
                printf("Error with parsing file: %s\n", argv[2]);
                return -1;
            }
            if (l_res < 0)
            {
                printf("Failed to parse file\n");
                return -1;
            }
            break;
        }

        default:
        {
            //DEBUGPRINT("Option parse error. Usage: ./drawer.bin -f <config_file>\n" );
            //return (EXIT_FAILURE);
            break;
        }
        }
    }


    initGraphics(argc, argv);

    return (EXIT_SUCCESS);
}
Exemple #11
0
void TattooEngine::initialize() {
	initGraphics(640, 480, true);

	// Initialize the base engine
	SherlockEngine::initialize();

	_flags.resize(100 * 8);

	// Add some more files to the cache
	_res->addToCache("walk.lib");

	// Starting scene
	_scene->_goToScene = STARTING_INTRO_SCENE;

	// Load an initial palette
	loadInitialPalette();
}
Exemple #12
0
Common::Error PinkEngine::init() {
	debugC(10, kPinkDebugGeneral, "PinkEngine init");
	initGraphics(640, 480);

	Common::PEResources exeResources;
	Common::String fileName = isPeril() ? "pptp.exe" : "hpp.exe";
	if (!exeResources.loadFromEXE(fileName)) {
		return Common::kNoGameDataFoundError;
	}

	_console = new Console(this);
	_director = new Director();

	initMenu(exeResources);

	Common::String orbName;
	Common::String broName;
	if (isPeril()) {
		orbName = "PPTP.ORB";
		broName = "PPTP.BRO";
		_bro = new BroFile;
	} else {
		orbName = "HPP.ORB";
	}

	if (!_orb.open(orbName) || (_bro && !_bro->open(broName) && _orb.getTimestamp() == _bro->getTimestamp()))
		return Common::kNoGameDataFoundError;

	if (!loadCursors(exeResources))
		return Common::kNoGameDataFoundError;

	setCursor(kLoadingCursor);

	_orb.loadGame(this);
	debugC(6, kPinkDebugGeneral, "Modules are loaded");

	syncSoundSettings();

	if (ConfMan.hasKey("save_slot"))
		loadGameState(ConfMan.getInt("save_slot"));
	else
		initModule(_modules[0]->getName(), "", nullptr);

	return Common::kNoError;
}
Exemple #13
0
static void initApp ()
{
printf("initApp \n");
  initGraphics();
  initShaders();
  /* Make sure we did everything right */
  CheckGL();
  chooseShader(0);
  
   Menu = glutCreateMenu(menuChoice);
  glutSetMenu(Menu);
  glutAddMenuEntry("Fragment shader", cmdToggleFragment);
  glutAddMenuEntry("Sphere", cmdSphere);
  glutAddMenuEntry("Teapot", cmdTeapot);
  glutAddMenuEntry("----", 0);
  glutAddMenuEntry("Exit", cmdExit);
  glutAttachMenu(GLUT_RIGHT_BUTTON);  
}
Exemple #14
0
void ClientRenderModule::run()
{
    Uint32 start,stop,interval;

//	printf("ClientRenderModule started\n");

    if ( client_data->has_GUI ) initGraphics();

    while ( client_data->state != GONE )
    {
        if ( client_data->has_GUI )
        {
            /* render frame */
            start = SDL_GetTicks();
            renderSingleFrame();

            /* handle user actions */
            if ( w.checkMessages() )
            {
                client_data->state = WAITING_LEAVE;
                break;
            }

            /* limit frames per second */
            stop = SDL_GetTicks();
            interval = stop - start;
            if ( interval < RENDER_DELAY ) SDL_Delay( RENDER_DELAY - interval );

            /* compute frames per second average */
            interval = SDL_GetTicks() - start;
            frame_render_interval = interval * ( 1 - client_data->fps_average_param )
                                    + frame_render_interval * client_data->fps_average_param;

        } else SDL_Delay(RENDER_DELAY);
    }

    /* wait for client to reach GONE state */
    SDL_LockMutex(client_data->term_mutex);
    while ( client_data->state != GONE )
        SDL_CondWait(client_data->term_cond, client_data->term_mutex);
    SDL_UnlockMutex(client_data->term_mutex);

    if ( client_data->has_GUI ) endGraphics();
}
Exemple #15
0
Game::Game(const std::string& aTitle, bool windowed)
	: myRunning(true)
	, mySlowMotion(false)
	, myVSync(true)
    , myWindowed(windowed)
	, myTitle(aTitle)
	, myWideScreen(false)
{
    allegro_init();
	
	Sound::init();
	Input::init();
	Resource::init();
	Music::init();
	Time::init();
	ScreenManager::init();
	
	initGraphics(windowed);
}
Exemple #16
0
void Main()
{
    Window::SetTitle(L"THUNDER #Siv3DGameJam");

    // 普段の描画先:最後にSCALE倍する
    RenderTexture render_texture{ SCREEN_SIZE, Palette::Black };

    initGraphics();

    FontAsset::Register(L"title", 14, L"Times New Roman", FontStyle::BitmapBoldItalic);
    FontAsset::Register(L"sys",    6, L"Arial",       FontStyle::BitmapBold);
    FontAsset::Register(L"over",  10, L"Verdana",     FontStyle::BitmapBold);
    FontAsset::Register(L"wave",   8, L"Arial Black", FontStyle::Bitmap);
    FontAsset::Register(L"clear",  8, L"Verdana",     FontStyle::BitmapBold);

    TextureAsset::Register(L"a", L"Asset/a.png");

    gSceneMgr.add(new SceneTitle());

	while (System::Update()) {
        #ifdef _DEBUG
        // デバッグ表示
        ClearPrint();
        PutText(Profiler::FPS()).at(10, 440);
        #endif // _DEBUG

        // シーンを更新
        gSceneMgr.update();

        // シーンがなくなったらプログラム終了
        if (gSceneMgr.empty()) { break; }

        // シーンを描画
        Graphics2D::SetRenderTarget(render_texture);
        gSceneMgr.draw();

        // 拡大表示
        Graphics2D::SetRenderTarget(Graphics::GetSwapChainTexture());
        render_texture.scale(SCALE).draw();

        gSceneMgr.postUpdate();
    }
}
Exemple #17
0
/***********************************************************************************
* Main routine - additions here also. Session manager and Point control objects
will be initialized and the callbacks assigned
***********************************************************************************/
int main(int argc,char *argv[]){

	//------------------ Context initializations go in here ------------------
	
	xn::EnumerationErrors errors;								
	rc = cxt.InitFromXmlFile(SAMPLE_XML_PATH,&errors);			//initialize the context from the xml file
	
	if(rc != XN_STATUS_OK){
		printf("Failed to open:%s", xnGetStatusString(rc));		//handle error in reading from XML
		return rc;
	}
	
	rc = cxt.FindExistingNode(XN_NODE_TYPE_DEPTH,depthGen);		//try to find the depth node from the context
	if(rc != XN_STATUS_OK){										//handle error if node is not found
		printf("Failed to open Depth node!");
		return rc;
	}

	//-------------------- Init Nite objects -----------------------
	sessionMgr = new XnVSessionManager();							//session manager is created
	rc = sessionMgr->Initialize(&cxt,"Click,Wave","RaiseHand");		//session manager is initialized 
	if(rc!= XN_STATUS_OK){											//check if this init operation was good
		printf("Session manager couldn't be initialized");
		return rc;
	}

	sessionMgr->RegisterSession(&cxt,sessionStart,sessionEnd);		//register the callbacks for the session manager

	pointCtrl = new XnVPointControl("Point Tracker");				//create the point control object
	pointCtrl->RegisterPrimaryPointCreate(&cxt,pointCreate);		//register the primary point created handler
	pointCtrl->RegisterPrimaryPointUpdate(&cxt,pointUpdate);		//register the primary point updated handler
	pointCtrl->RegisterPrimaryPointDestroy(&cxt,pointDestroy);		//register the primary point destroyed handler
	
	sessionMgr->AddListener(pointCtrl);								//make the session manager listen to the point control object
	nullifyHandPoint();												//initialize the global variable to track hand points

	//----------------- GL initializations go in here --------------
	initGraphics(argc,argv);										//init GL routine
	glutMainLoop();													//start the main loop for openGL
	return 0;
}
Exemple #18
0
int main(int argc, char *argv[]) {
	initLog();
	LOG("main", "Starting Where's Wally? ...");

	/* Initialize service */
	sef_startup();

	/* Enable IO-sensitive operations for ourselves */
	sys_enable_iop(SELF);

	printf("Starting \"Where's Wally?\" ....\n");

	initGraphics(MODE_1280_1024);

	WallyNIX* wally = (WallyNIX*) startWallyNIX();
	while (!wally->exit) {
		updateWallyNIX(wally);

		if (!wally->exit) {
			if (wally->timerFPS->ticked) {
				wally->timerFPS->ticked = 0;
				drawWallyNIX(wally);

				copyToMouseBuffer();
				if (getMouse()->draw) {
					drawMouse();
				}

				copyToVideoMem();
			}
		}
	}
	stopWallyNIX(wally);

	exitGraphics();

	LOG("main", "Terminated Where's Wally? ...");
	printf("\"Where's Wally?\" exited successfully.\n");

	return EXIT_SUCCESS;
}
Exemple #19
0
Common::Error DMEngine::run() {
	initConstants();

	// scummvm/engine specific
	initGraphics(320, 200, false);
	_console = new Console(this);
	_displayMan = new DisplayMan(this);
	_dungeonMan = new DungeonMan(this);
	_eventMan = new EventManager(this);
	_menuMan = new MenuMan(this);
	_championMan = new ChampionMan(this);
	_objectMan = new ObjectMan(this);
	_inventoryMan = new InventoryMan(this);
	_textMan = new TextMan(this);
	_moveSens = new MovesensMan(this);
	_groupMan = new GroupMan(this);
	_timeline = new Timeline(this);
	_projexpl = new ProjExpl(this);
	_dialog = new DialogMan(this);
	_sound = SoundMan::getSoundMan(this, _gameVersion);
	_displayMan->setUpScreens(320, 200);

	initializeGame();
	while (true) {
		gameloop();

		if (_engineShouldQuit)
			return Common::kNoError;

		if (_loadSaveSlotAtRuntime == -1)
			endGame(_championMan->_partyDead);
		else {
			loadGameState(_loadSaveSlotAtRuntime);
			_menuMan->drawEnabledMenus();
			_displayMan->updateScreen();
			_loadSaveSlotAtRuntime = -1;
		}
	}

	return Common::kNoError;
}
Exemple #20
0
Common::Error CGEEngine::run() {
	debugC(1, kCGEDebugEngine, "CGEEngine::run()");

	if (_gameDescription->flags & ADGF_DEMO) {
		warning("Demos of Soltys are not supported.\nPlease get a free version on ScummVM download page");
		return Common::kUnsupportedGameidError;
	}

	// Initialize graphics using following:
	initGraphics(320, 200, false);

	// Setup necessary game objects
	init();
	// Run the game
	cge_main();

	// Remove game objects
	deinit();

	return Common::kNoError;
}
Exemple #21
0
void CineEngine::showSplashScreen() {
	Common::File file;
	if (!file.open("sony.lbm"))
		return;

	Image::IFFDecoder decoder;
	if (!decoder.loadStream(file))
		return;

	const Graphics::Surface *surface = decoder.getSurface();
	if (surface->getWidth() == 640 && surface->getHeight() == 480) {
		initGraphics(640, 480, true);

		const byte *palette = decoder.getPalette();
		int paletteColorCount = decoder.getPaletteColorCount();
		g_system->getPaletteManager()->setPalette(palette, 0, paletteColorCount);

		g_system->copyRectToScreen(surface->getPixels(), 640, 0, 0, 640, 480);
		g_system->updateScreen();

		Common::EventManager *eventMan = g_system->getEventManager();

		bool done = false;
		uint32 now = g_system->getMillis();

		while (!done && g_system->getMillis() - now < 2000) {
			Common::Event event;
			while (eventMan->pollEvent(event)) {
				if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
					done = true;
					break;
				}
				if (shouldQuit())
					done = true;
			}
		}
	}

	decoder.destroy();
}
Exemple #22
0
static void *
xrayswarm_init (Display *d, Window w)
{
  struct state *st = (struct state *) calloc (1, sizeof(*st));
  int i;

  st->dpy = d;
  st->win = w;

  st->dt = 0.3;
  st->targetVel = 0.03;
  st->targetAcc = 0.02;
  st->maxVel = 0.05;
  st->maxAcc = 0.03;
  st->noise = 0.01;
  st->minVelMultiplier = 0.5;

  st->nbugs = -1;
  st->ntargets = -1;
  st->trailLen = -1;

  st->colorScheme = /* -1 */  2;
  st->changeProb = 0.08;

  if (!initGraphics(st)) abort();

  computeConstants(st);
  initBugs(st);
  initTime(st);
  computeColorIndices(st);

  if (st->changeProb > 0) {
    for (i = random()%5+5; i >= 0; i--) {
      randomSmallChange(st);
    }
  }

  return st;
}
Exemple #23
0
int main() 
{
	//call psp stuff
	pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();
    
	char bafer[200];
	
	//Image definido no graphics.h
    Image* nossaImage;
	
	//joga caminho no bafer
	sprintf(bafer, "media/prince_ascii.png");
	nossaImage = loadImage(bafer);
    
    	//checar se imagem existe!!
    	if (!nossaImage) 
    	{
        	//Image load failed
        	printf("Ta lah nao! \n");
        } 
        else 
        {
        	
        	int x = 0;
            int y = 0;
            
            sceDisplayWaitVblankStart();
                      
           	blitAlphaImageToScreen(0 ,0 , 480, 272, nossaImage, x, y);
            
            flipScreen();
            
         } 
	
	sceKernelSleepThread();
    return 0;
}
Exemple #24
0
Common::Error Sword25Engine::appStart() {
	// Initialize the graphics mode to ARGB8888
	Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24);
	initGraphics(800, 600, true, &format);
	if (format != g_system->getScreenFormat())
		return Common::kUnsupportedColorMode;

	// Kernel initialization
	if (!Kernel::getInstance()->getInitSuccess()) {
		error("Kernel initialization failed.");
		return Common::kUnknownError;
	}

	// Load packages
	PackageManager *packageManagerPtr = Kernel::getInstance()->getPackage();
	if (getGameFlags() & GF_EXTRACTED) {
		if (!packageManagerPtr->loadDirectoryAsPackage(ConfMan.get("path"), "/"))
			return Common::kUnknownError;
	} else {
		if (!loadPackages())
			return Common::kUnknownError;
	}

	// Pass the command line to the script engine.
	ScriptEngine *scriptPtr = Kernel::getInstance()->getScript();
	if (!scriptPtr) {
		error("Script intialization failed.");
		return Common::kUnknownError;
	}

	// Set the game target for use in savegames
	setGameTarget(_targetName.c_str());

	Common::StringArray commandParameters;
	scriptPtr->setCommandLine(commandParameters);

	return Common::kNoError;
}
Exemple #25
0
int main (int argc, char * argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);

    glutInitWindowSize(500, 500);
    glutInitWindowPosition(100, 75);
    glutCreateWindow("Cube");

    initGraphics();

    glutDisplayFunc(display);
    glutReshapeFunc(resize);

    glutKeyboardFunc(asciiKey);
    glutSpecialFunc(specialKey);

    glutIdleFunc(spinDisplay);

    glutMainLoop();
    /* Should never get here, but keeps compiler happy */
    return 0;
}
Exemple #26
0
RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm) {
	_bitmapDecoder = new MohawkBitmap();

	// Give me the best you've got!
	initGraphics(608, 436, true, NULL);
	_pixelFormat = _vm->_system->getScreenFormat();

	if (_pixelFormat.bytesPerPixel == 1)
		error("Riven requires greater than 256 colors to run");

	// The actual game graphics only take up the first 392 rows. The inventory
	// occupies the rest of the screen and we don't use the buffer to hold that.
	_mainScreen = new Graphics::Surface();
	_mainScreen->create(608, 392, _pixelFormat);

	_updatesEnabled = true;
	_scheduledTransition = -1;	// no transition
	_dirtyScreen = false;
	_inventoryDrawn = false;

	_creditsImage = 302;
	_creditsPos = 0;
}
Exemple #27
0
Common::Error CruiseEngine::run() {
	// Initialize backend
	initGraphics(320, 200, false);

	if (!loadLanguageStrings()) {
		error("Could not setup language data for your version");
		return Common::kUnknownError;	// for compilers that don't support NORETURN
	}

	initialize();

	Cruise::changeCursor(Cruise::CURSOR_NORMAL);
	CursorMan.showMouse(true);

	lastTick = 0;
	lastTickDebug = 0;

	mainLoop();

	deinitialize();

	return Common::kNoError;
}
int main(int argc, char* argv[])
{
   glutInit(&argc, argv);
   if( stereo )
   {
      glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_STEREO);
   }
   else
   {
      glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
   }

   int winid = glutCreateWindow("Test");
   mFrameNum = 0;

   glutReshapeFunc(reshape);
   glutDisplayFunc(display);
   glutIdleFunc(display);
   glutMouseFunc(mouse);
   glutMotionFunc(motion);
   glutKeyboardFunc(keyboard);

   if (argc > 1)
   {
      std::cout << "ARG:" << argv[1] << std::endl;
   }
   if (argc > 1 && (0 == strcmp(argv[1], "-s")))
   {
      master = false;
      std::cout << "We are a slave" << std::endl;
   }
   initGraphics();

   glutMainLoop();

   return 0;
}
Exemple #29
0
void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut) {
	_leadOutFrame = _decoder->getFrameCount();
	if (_leadOutFrame > 60)
		_leadOutFrame -= 60;

	_movieTexts = movieTexts;
	_numMovieTexts = numMovieTexts;
	_currentMovieText = 0;
	_leadOut = leadOut;

	if (leadIn)
		_vm->_sound->playMovieSound(leadIn, kLeadInSound);

	if (_bgSoundStream)
		_snd->playStream(Audio::Mixer::kSFXSoundType, _bgSoundHandle, _bgSoundStream);

	bool terminated = false;

	terminated = !playVideo();

	closeTextObject(_currentMovieText, NULL, 0);

	if (terminated) {
		_snd->stopHandle(*_bgSoundHandle);
		_vm->_sound->stopMovieSounds();
		_vm->_sound->stopSpeech();
	}

	while (_snd->isSoundHandleActive(*_bgSoundHandle))
		_system->delayMillis(100);

	if (_decoderType == kVideoDecoderPSX) {
		// Need to jump back to paletted color
		initGraphics(640, 480, true);
	}
}
Exemple #30
0
Common::Error CineEngine::run() {
	if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD)) {
		showSplashScreen();
	}

	// Initialize backend
	initGraphics(320, 200, false);

	if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD))
		checkCD();

	if (getPlatform() == Common::kPlatformDOS) {
		g_sound = new PCSound(_mixer, this);
	} else {
		// Paula chipset for Amiga and Atari versions
		g_sound = new PaulaSound(_mixer, this);
	}

	_restartRequested = false;

	do {
		initialize();

		_restartRequested = false;

		CursorMan.showMouse(true);
		mainLoop(1);

		delete renderer;
		delete[] collisionPage;
	} while (_restartRequested);

	delete g_sound;

	return Common::kNoError;
}