예제 #1
0
void mini_osd_interface::init(running_machine &machine)
{
	int gamRot=0;

	osd_interface::init(machine);
	our_target = machine.render().target_alloc();

	initInput(machine);

	write_log("machine screen orientation: %s \n", (
		machine.system().flags & ORIENTATION_SWAP_XY) ? "VERTICAL" : "HORIZONTAL"
	);

        orient  = (machine.system().flags & ORIENTATION_MASK);
	vertical = (machine.system().flags & ORIENTATION_SWAP_XY);
        
        gamRot = (ROT270 == orient) ? 1 : gamRot;
        gamRot = (ROT180 == orient) ? 2 : gamRot;
        gamRot = (ROT90  == orient) ? 3 : gamRot;
        
	//prep_retro_rotation(gamRot);
	our_target->compute_minimum_size(rtwi, rthe);
	topw=rtwi;
	//Equivalent to rtaspect=our_target->view_by_index((our_target->view()))->effective_aspect(render_layer_config layer_config())
	int width,height;
	our_target->compute_visible_area(1000,1000,1,ROT0,width,height);
	rtaspect=(float)width/(float)height;
	write_log("W:%d H:%d , aspect ratio %d/%d=%f\n",rtwi,rthe,width,height,rtaspect);
	NEWGAME_FROM_OSD=1;
	write_log("osd init done\n");
	co_switch(mainThread);
}
예제 #2
0
파일: Game.cpp 프로젝트: adasm/frail-htn
bool Game::init(const mkString& cmd_line)
{
    rtti::TypeManager::getInstance().finishTypeRegistration();

    m_presetMgr = new rtti::PresetMgr;
    m_presetMgr->init();

    parseCmdLine(cmd_line);
    initRendering();
    initInput();
    initPhysics();

#ifdef ENABLE_BULLET_DEBUG_DRAW
    g_debugPhysicsDrawer = new BtOgre::DebugDrawer(m_ogreSceneMgr->getRootSceneNode(), m_physicsWorld);
    m_physicsWorld->setDebugDrawer(g_debugPhysicsDrawer);
#endif

    m_actorControllerFactory = new ActorControllerFactory;

    m_level = new Level();
    if (!m_level->load("data/levels/" + m_levelName + ".json"))
        return false;

    m_freelook = m_startWithFreelook;

	//Set Player conflict side to Neutral
	m_level->getPlayer()->setConflictSide(EConflictSide::Unknown);
    return true;
}
예제 #3
0
void MainWindow::newPosition(const char* p)
{
    QString s(p);
    _board->setState(s);
    qDebug("Got new position from network...");
    initInput();
}
예제 #4
0
bool ModelViewer::init()
{
    if ( !Scene::init() )
        return false;

	initCamera();
	_vm = ViewMode::create(*this, *(_camera.get()), ViewModeType::Normal);

	auto animFileData = DataHandler::deserializeFromFile("config.json");
	if (animFileData != nullptr)
	{
		//ui layer
		_uiPage = UiPage::create(*this);
		addChild(_uiPage);

		//3d model layer
		_modelLayer = Layer::create();
		addChild(_modelLayer);

		//TODO: Should not init model data by viewer
		loadModel(*animFileData);
	}

	initInput();

    return true;
}
예제 #5
0
void TestGame::newPosition(const char* p)
{
    QString s(p);
    b.setState(s);
    qDebug("Got new position from network...");
    initInput();
}
int SC_TerminalClient::run(int argc, char** argv)
{
	Options& opt = mOptions;

	if (!parseOptions(argc, argv, opt)) {
		return mReturnCode;
	}

	// finish argv processing
	const char* codeFile = 0;

	if (argc > 0) {
		codeFile = argv[0];
		opt.mDaemon = true;
		argv++; argc--;
	}

	opt.mArgc = argc;
	opt.mArgv = argv;

	// read library configuration file
	if (opt.mLibraryConfigFile) {
		int argLength = strlen(opt.mLibraryConfigFile);
		SC_LanguageConfig::readLibraryConfigYAML(opt.mLibraryConfigFile);
	} else
		SC_LanguageConfig::readDefaultLibraryConfig();

	// initialize runtime
	initRuntime(opt);

	// startup library
	mShouldBeRunning = true;
	compileLibrary();

	// enter main loop
	if (codeFile) executeFile(codeFile);
	if (opt.mCallRun) runMain();

	if (opt.mDaemon) {
		daemonLoop();
	}
	else {
		initInput();
		if( shouldBeRunning() ) startInput();
		if( shouldBeRunning() ) commandLoop();
		endInput();
		cleanupInput();
	}

	if (opt.mCallStop) stopMain();

	// shutdown library
	shutdownLibrary();
	flush();

	shutdownRuntime();

	return mReturnCode;
}
예제 #7
0
void TestGame::draw(Move& m)
{
    if (m.isValid()) {
	b.playMove(m);
	if (_n) _n->broadcast(&b);
    }
    initInput();
}
예제 #8
0
void MainWindow::draw(Move& m)
{
    if (m.isValid()) {
	_board->playMove(m);
	if (_network) _network->broadcast(_board);
    }
    initInput();
}
예제 #9
0
void MainWindow::draw()
{
    if (_moveToDraw.isValid()) {
	_board->playMove(_moveToDraw);
	if (_network) _network->broadcast(_board);
    }
    initInput();
}
예제 #10
0
파일: lexan.cpp 프로젝트: evandar/PJP-mila2
int initLexan ( char *fileName )
{
    if ( ! initInput ( fileName ) )
        return 0;

    readInput ( );
    return 1;
}
예제 #11
0
void TestGame::startOnEmpty()
{
    if (b.isValid()) return;

    b.begin(Board::color1);
    if (_n) _n->broadcast(&b);
    initInput();
}
예제 #12
0
파일: game.c 프로젝트: idr77/SnakeGame
bool playGame(Affichage A, Damier *map, Snake *snake, Sound sound)
{
	int end = 0;
	bool win = FALSE;
	Position newPos = initPosition();
	Input input = initInput();
	Chrono chrono = initChrono();
	Timer timer = initTimer();
	
	
	setProiesToMap(map);
	
	drawTile(A, TILE_TITLE);
	drawTextChrono(chrono, A);
	drawMap(A, *map, newPosition(MAXCASES/2 + 3,MAXCASES/2), *snake);

	startChrono(&chrono);
	while (1)
	{
		
		setTimer(&timer);
		newPos = updatePositions(map, snake, &input);
		
		if (input.end)
			break;

		if (testPosMap(newPos))
		{
			end = addPositionSnake(map, snake, newPos, sound);
			if (end)
			{
				win = FALSE;
				break;
			}
		}
		
		setPositionsToMap(map, snake);
		drawChrono(chrono, A);
		drawMap(A, *map, newPos, *snake);
		
		if(endChrono(chrono))
		{
			win = FALSE;
			break;
		}
		
		if (endGame(map))
		{
			win = TRUE;
			break;
		}
		
		reguleFPS(&timer);
	}
	
	deleteChrono(&chrono);
	return win;
}
예제 #13
0
파일: runner.c 프로젝트: wukefe/Ostrich2
 int main(int argc, char* argv[]){
    if(argc!=2) {
        fprintf(stderr, "usage: runner <scale>\n");
        exit(99);
    }
    int scale = atoi(argv[1]);
    initInput(scale);
    return 0;
 }
예제 #14
0
// Initialise the Ogre3D rendering system
bool TutorialApplication::go()
{
#ifdef _DEBUG
	mResourcesCfg = "resources_d.cfg";
	mPluginsCfg = "plugins_d.cfg";
#else
	mResourcesCfg = "resources.cfg";
	mPluginsCfg = "plugins.cfg";
#endif

	mRoot = new Ogre::Root(mPluginsCfg);

	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);

	Ogre::String name, locType;

	Ogre::ConfigFile::SectionIterator secIt = cf.getSectionIterator();

	while (secIt.hasMoreElements())
	{
		Ogre::ConfigFile::SettingsMultiMap* settings = secIt.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator it;
		for (it = settings->begin(); it != settings->end(); ++it)
		{
			locType = it->first;
			name = it->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(name, locType);
		}
	}

	///if(!(mRoot->restoreConfig() || mRoot->showConfigDialog()))
	//	return false;
	mRoot->showConfigDialog();


	mWindow = mRoot->initialise(true, "TutorialApplication Render Window");

	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	// Create and Initialise the scene
	createScene();

	// Initialise OIS
	initInput();

	//Register as a Window listener
	Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

	mRoot->addFrameListener(this);

	mRoot->startRendering();

	return true;
}
예제 #15
0
파일: Input.cpp 프로젝트: zachangold/Cobalt
Input::Input( void )
{
	dInput = nullptr;
	keyboard = nullptr;
	mouse = nullptr;

	sensitivity = 0.003f;

	initInput();
};
예제 #16
0
파일: Input.cpp 프로젝트: zachangold/Cobalt
void Input::init( Window& window )
{
	deleteKeyboard();
	deleteMouse();
	deleteInput();

	initInput();
	initKeyboard( window );
	initMouse( window );
};
예제 #17
0
파일: init.c 프로젝트: Zoxc/gltron
void initSubsystems(int argc, const char *argv[]) {
	initFilesystem(argc, argv);
	initScripting();
	init_c_interface();
	initConfiguration(argc, argv);
	initGame();
	initVideo();
	initAudio();
	initInput();
}
예제 #18
0
파일: btserver.c 프로젝트: lanixXx/scratch
int main(int argc, char **argv){
	struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
	char buf[1] = { 0 };
	int s, client, bytes_read;
	socklen_t opt = sizeof(rem_addr);
	sdp_session_t *sdp_session;

	//register the service an acquire the session
	sdp_session = register_service();
	
	for(;;){
		// allocate socket
		s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

		// bind socket to port 1 of the first available 
		// local bluetooth adapter
		loc_addr.rc_family = AF_BLUETOOTH;
		loc_addr.rc_bdaddr = *BDADDR_ANY;
		loc_addr.rc_channel = (uint8_t) SVC_CHANNEL;
	

		bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr));

		// put socket into listening mode
		fprintf(stderr, "listening\n");
		listen(s, 1);

		// accept one connection
		fprintf(stderr, "accepting\n");
		client = accept(s, (struct sockaddr *)&rem_addr, &opt);

		ba2str( &rem_addr.rc_bdaddr, buf );
		fprintf(stderr, "accepted connection from %s\n", buf);
		memset(buf, 0, sizeof(buf));

		// read data from the client
	
		initInput();
		bytes_read = 1;
		while(bytes_read > 0){
			bytes_read = read(client, buf, sizeof(buf));
			scroll(buf[0]);
			printf("received %d\n", buf[0]);
		}	
		deinitInput();

		// close connection
		close(client);
		close(s);		
	}
	
	//close sdp session	
	sdp_close(sdp_session);
	return 0;
}
bool CGameApplication::init()
{
    if (!initWindow())
        return false;
    if (!initGraphics())
        return false;
    if (!initInput())
        return false;
    if (!initGame())
        return false;
    return true;
}
예제 #20
0
void DynProgProb::setInput (
size_t dimInputProb_, 
const double *inputProb_) // array of input states : d_inputProb_p [0...dimStateProb - 1]
{
    if (dimInputProb_ != getDimInputProb ()) 
    {
        freeInput ();
        initInput (dimInputProb_);
    }

    if (getDimInputProb () > 0) MemUtil::memCpy (d_inputProb_p, inputProb_, sizeof (double) * getDimInputProb ());
}
예제 #21
0
int main (void)
{
	InitUart();	//Init uart
	initInput(); //Init interrupt to start button, stop button and speed sensor	
	initMotorPWM(); //Init Fast PWM on Timer 0 (Pin PE1)
	initSpeedTimer(); //Init Timer 1 (16bit normal mode)
	initCurrentADC(); //Init ADC on PC5
	
	
	//Init speed array
	for (int i = 0; i<(SPEED_ARRAY_SIZE); i++)
	{
		speedArray[i]=65535;
	}
	
	while (1)
	{
		//Switch to stop state if something is rotten
		Protection(&Sm_State, &speed);
		
		switch (Sm_State)
		{
			case STATE_STOP:
			Stop(&motor);
			break;
				
			case STATE_RAMP_INIT:
			RampInit(&Sm_State, &motor);
			break;
				
			case STATE_RAMP_SEARCH:
			RampSearch(&Sm_State, &motor, &speed, &lastSpeed);
			break;
				
			case STATE_ACC:
			Acc(&Sm_State,&motor, speedArray);
			break;
				
			case STATE_COAST:
			Coast(&Sm_State, &motor, &speed);
			break;
				
			default:
			Sm_State = STATE_STOP;
			break;
		}
		
	}

}
예제 #22
0
bool BareOgre::go(void) 
{
  mLog = new Ogre::LogManager;
  mLog->createLog("Ogre.log");

#ifdef _DEBUG
  mResourcesCfg = "resources_d.cfg";
  mPluginsCfg = "plugins_d.cfg";
#else
  mResourcesCfg = "resources.cfg";
  mPluginsCfg = "plugins.cfg";
#endif

  mRoot = new Ogre::Root(mPluginsCfg);

  // Load resource paths from resources config file.
  setupResources();

  // Configure dialog.
  if (!( mRoot->restoreConfig() || mRoot->showConfigDialog() )) {
    return false;
  }

  // Create RenderWindow.
  mWindow = mRoot->initialise(true, "BareOgre Render Window");

  // Set default mipmap level.
  Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
  // Initialize all resource groups.
  Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

  // Create scene.
  createScene();

  // Initialize input. (OIS)
  initInput();

  // Set initial mouse clipping size.
  windowResized(mWindow);

  // Register as a Window listener.
  Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

  // Render loop.
  mRoot->addFrameListener(this);
  mRoot->startRendering();

  return true;
}
예제 #23
0
Game::Game() : _window(sf::VideoMode::getFullscreenModes()[0],"dhfgsadhkf", sf::Style::Close | sf::Style::Fullscreen) {
    _window.setFramerateLimit(FRAMERATE);
    _window.setKeyRepeatEnabled(false);

    _lastScene = nullptr;
    _currentScene = nullptr;

    initInput();
    Resources::load();
    SoundManager::load();

    SoundManager::setGlobalSoundVolumen(100.0f);
    SoundManager::setGlobalMusicVolumen(100.0f);
    SoundManager::playMusic("music");
    SoundManager::setLoop(true, "music");
}
예제 #24
0
파일: main.cpp 프로젝트: Tiger21820/GameYob
int main(int argc, char* argv[])
{
    REG_POWERCNT = POWER_ALL & ~(POWER_MATRIX | POWER_3D_CORE); // don't need 3D
    consoleDebugInit(DebugDevice_CONSOLE);

    defaultExceptionHandler();

    time(&rawTime);
    lastRawTime = rawTime;
    timerStart(0, ClockDivider_1024, TIMER_FREQ_1024(1), clockUpdater);

    /* Reset the EZ3in1 if present */
    if (!__dsimode) {
        sysSetCartOwner(BUS_OWNER_ARM9);

        GBA_BUS[0x0000] = 0xF0;
        GBA_BUS[0x1000] = 0xF0;
    }

    fifoSetValue32Handler(FIFO_USER_02, fifoValue32Handler, NULL);

    sharedData = (SharedData*)memUncached(malloc(sizeof(SharedData)));
    sharedData->scalingOn = false;
    // It might make more sense to use "fifoSendAddress" here.
    // However there may have been something wrong with it in dsi mode.
    fifoSendValue32(FIFO_USER_03, ((u32)sharedData)&0x00ffffff);

    consoleOn = true;
    initConsole();
    initInput();
    readConfigFile();

    if (argc >= 2) {
        char* filename = argv[1];
        loadProgram(filename);
        initializeGameboyFirstTime();
    }
    else {
        selectRom();
    }
    consoleOn = false;
    updateScreens();

    runEmul();

    return 0;
}
예제 #25
0
bool DxFw::initAll(const DxParam& parm,HWND hwnd,HINSTANCE hist,bool exclusive)
{
	if (!initDx(parm))
	{
		return false;
	}

	if (!initInput(hwnd,hist,exclusive))
	{
		return false;
	}

	mParticleSystemMgr = getParticleSystemManager()->getSingletonPtr();
	mParticleSystemMgr->initOnce(this);

	return true;
}
예제 #26
0
CoreManager::CoreManager()
: top_input_processor(NULL), io_input_channel(NULL), io_input_channel_id(0)
, resize_channel(NULL), resize_channel_id(0), pipe_valid(false), tk(NULL)
, utf8(false), gmainloop(NULL), redraw_pending(false), resize_pending(false)
{
  initInput();

  /**
   * @todo Check the return value. Throw an exception if we can't init curses.
   */
  Curses::init_screen();

  // create the main loop
  gmainloop = g_main_loop_new(NULL, FALSE);

  declareBindables();
}
예제 #27
0
파일: GOAP.cpp 프로젝트: OrangeKnife/NBE
	GOAPapp::GOAPapp(HINSTANCE h) :currentMapIdx(0),
		m_timer(NBETimer()),
		m_nextUpdateTime(0),
		m_startFrameTime(0),
		root(nullptr)
	{
		RenderInfo* rdinfo = loadRenderInfo(TEXT("config.ini"));

		switch (rdinfo->type)
		{
		case 0:
			m_pRenderer.reset(createGL(rdinfo, h));
			break;
		case 1:
			m_pRenderer.reset(createDX11(rdinfo, h));
			break;
		}

		textureMgr = TextureManager::getInstancePtr();
		textureMgr->initialize(m_pRenderer.get());
		textureMgr->LoadFromFile(TEXT("default-alpha.png"), TEXT("Default"));
		shaderMgr = ShaderManager::getInstancePtr();
		shaderMgr->initialize(m_pRenderer.get());



		root = new Node("root", vec3f(), Matrix4f::Identity());

		currentState = INGAME;



		initCamera(static_cast<float>(rdinfo->width) / rdinfo->height);

		initInput();

		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('W', NEvent_Key::KEY_DOWN), this, (void*)('W'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('A', NEvent_Key::KEY_DOWN), this, (void*)('A'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('S', NEvent_Key::KEY_DOWN), this, (void*)('S'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('D', NEvent_Key::KEY_DOWN), this, (void*)('D'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('C', NEvent_Key::KEY_DOWN), this, (void*)('C'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key(VK_SPACE, NEvent_Key::KEY_DOWN), this, (void*)(VK_SPACE));


	}
예제 #28
0
파일: main.cpp 프로젝트: Drenn1/GameYob
int main(int argc, char* argv[])
{
	if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
		return 1;

	SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
	SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
	SDL_ShowCursor(SDL_DISABLE);

	screen = SDL_SetVideoMode(160*scale, 144*scale, 32, SDL_SWSURFACE | SDL_OPENGL);// | SDL_FULLSCREEN);
	if (screen == NULL)
		return 1;
	

	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));

	SDL_WM_SetCaption("GameYob", NULL);

    mgr_init();

	initInput();
    setMenuDefaults();
    readConfigFile();
    initGFX();

    if (argc >= 2) {
        char* filename = argv[1];
        mgr_loadRom(filename);
    }
    else {
        printf("Give me a gameboy rom pls\n");
        return 1;
    }

    for (;;) {
        mgr_runFrame();
        mgr_updateVBlank();
    }

	return 0;
}
예제 #29
0
파일: Game.cpp 프로젝트: kaitokidi/Base
Game::Game() : _window(sf::VideoMode::getFullscreenModes()[0],"TOPKeK", sf::Style::Close | sf::Style::Fullscreen) {
    _window.setFramerateLimit(FRAMERATE);
    //_window.setMouseCursorVisible(false);

    _lastScene = nullptr;
    _currentScene = nullptr;

    initInput();
    Resources::load();
    DataManager::load();
    SoundManager::load();
    TextBoxManager::load();

    SoundManager::setGlobalSoundVolumen(100.0f);
    SoundManager::setGlobalMusicVolumen(100.0f);
    //SoundManager::playMusic("overWorld");
    //SoundManager::setLoop(true, "overWorld");

}
예제 #30
0
int main()
{
usb_workaround(); // because the arduino bootloader is a piece of shit

    init_controller(&SControl);

    blinky();

// zero the motor
    for (int i = 0; i < 945; i++)
    {
        advance_motor(&(SControl.MControl), UP);
        _delay_us(3000);
    }
    SControl.MControl.current_pos = 0;

    initInput();
    sei();


    while (true)
    {
        controller_thread(&SControl);
        input_thread(&SControl);
    }

/*
    while (true)
    {
        set_gauge_target(&SControl, (315<<4));
        while (SControl.MControl.current_pos != SControl.target_pos) controller_thread(&SControl);
        set_gauge_target(&SControl, (0));
        while (SControl.MControl.current_pos != SControl.target_pos) controller_thread(&SControl);
        platform_toggle_status_led();
    }
*/

    return 0;
}