Example #1
0
void systemWriteDataToSoundBuffer()
{
  if (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)
  {
    SDL_PauseAudio(0);
  }

  bool bWait = true;
  while (bWait && ! speedup && GUI()->iGetThrottle() == 0)
  {
    SDL_mutexP(pstSoundMutex);
    if (iSoundLen < iSoundTotalLen)
    {
      bWait = false;
    }
    SDL_mutexV(pstSoundMutex);
  }

  int iLen = soundBufferLen;
  int iCopied = 0;
  if (iSoundLen + iLen >= iSoundTotalLen)
  {
    iCopied = iSoundTotalLen - iSoundLen;
    memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, iCopied);

    iSoundLen = iSoundTotalLen;
    SDL_CondSignal(pstSoundCond);

    bWait = true;
    if (! speedup && GUI()->iGetThrottle() == 0)
    {
      while(bWait)
      {
        SDL_mutexP(pstSoundMutex);
        if (iSoundLen < iSoundTotalLen)
        {
          bWait = false;
        }
        SDL_mutexV(pstSoundMutex);
      }

      memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied,
             soundBufferLen - iCopied);

      iSoundLen = soundBufferLen - iCopied;
    }
    else
    {
      memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied,
             soundBufferLen);
    }
  }
  else
  {
    memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, soundBufferLen);
    iSoundLen += soundBufferLen;
  }
}
Example #2
0
std::string FileManager::chooseGame(std::string dir, std::string extension){
    glob_t globbuf;
    int err = glob((dir + "*" + extension).c_str(), 0, NULL, &globbuf);

    if (err != 0){
        throw;
    }

    std::vector<std::string> options;

    for (size_t i = 0; i < globbuf.gl_pathc; i++){
        options.push_back(globbuf.gl_pathv[i]);
        options[i].erase(0, dir.size());
        options[i].erase(options[i].size() - extension.size(), extension.size());
    }

    globfree(&globbuf);

    int n = GUI(options, 24, true).run();

    if (n == -1){
        return "NULL";
    }

    return options[n];
}
Example #3
0
void systemShowSpeed(int _iSpeed)
{
  systemFPS = systemRenderedFrames;
  systemRenderedFrames = 0;

  GUI()->vShowSpeed(_iSpeed);
}
Example #4
0
int main(){
  int i,newdata;
  
  if (Graphics) GUI();

  init();
  while (!done){
    if (Graphics){
      Events(newdata);
      GetGraphics();
      DrawGraphs();
    } else {done=1;Pause=0;}
    if (!Pause||sstep){
      sstep=0;
      newdata=1;
      for (i=0;i<Repeat;i++){
	iterations++;
	circleBC();
	iteration();
	iterationColloid();
	TotMomentum();
	analysis(iterations);
      }
    } else sleep(1);
  }
  return 0;
}
MainWindow::MainWindow(QWidget* parent)
    :QMainWindow(parent)
{
    GUI();
    Buttons();
    outGraph();
    matrixSize = 0;
}
Example #6
0
void systemMessage(int _iId, const char * _csFormat, ...)
{
  va_list args;
  va_start(args, _csFormat);

  GUI()->vPopupErrorV(_(_csFormat), args);

  va_end(args);
}
Example #7
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    isAdmin = true;
    connecting = new connectDtabase();
    dialHall = new dialogHallType();
    dialBldg = new dialogBldg();
    dialShow = new dialogShow();
    dialTimes = new dialogTimes();
    dialMap = new dialogMap();
    dialZone = new dialogZone();
    dialTicket = new dialogTicket();
    GUI();
    buttons();
    validateConnect();
}
Example #8
0
int main(){
  int i;
  init();
  GUI();
  while (!done){
    Events(1); /* Whenever there are new data the argument of 
		  Events() should be nonzero. This will set the
		  requests for data so that you can calculate them
		  on demand only. For this simple program you can
		  always set it to one. */
    DrawGraphs();
    if (!pause || sstep){
      sstep=0;
      for (i=0;i<Repeat;i++) iterate();
    } else {
      sleep(1);/*when the program is waiting it returns the 
		 CPU time to the operating system */
    }
  }
  return 0;
}
Example #9
0
void PIAEngine::run(int argc, char *argv[]) {
    std::thread sendThread(&SendSocket::run, &sendTemp);
    sendThread.detach();

    std::thread receivingThread(&ReceivingSocket::run, &receiveTemp);
    receivingThread.detach();

    std::thread announceThread(&Announcement::run, &announcement);
    announceThread.detach();

    GUIController guiControl(argc, argv, &queueController, &routingTable, settings, &chatHistory);
    std::thread GUI(&GUIController::startGui, guiControl);

    std::thread queueControllerThread(&QueueController::run, &queueController);
    queueControllerThread.detach();

    // Wait for the GUI to be joinable
    if (GUI.joinable()) {
        GUI.join();
    }
    std::cout << "CLOSING" << std::endl;
}
Example #10
0
static void vSoundCallback(void * _pvUserData, u8 * _puiStream, int _iLen)
{
  if (! emulating)
  {
    return;
  }

  SDL_mutexP(pstSoundMutex);
  if (! speedup && GUI()->iGetThrottle() == 0)
  {
    while (iSoundLen < iSoundTotalLen && emulating)
    {
      SDL_CondWait(pstSoundCond, pstSoundMutex);
    }
  }
  if (emulating)
  {
    memcpy(_puiStream, auiSoundBuffer, _iLen);
  }
  iSoundLen = 0;
  SDL_mutexV(pstSoundMutex);
}
Example #11
0
void systemDrawScreen()
{
    GUI()
        ->vDrawScreen();
}
Example #12
0
dialogHallType::dialogHallType(QWidget *parent) :
    QDialog(parent)
{
    countAdd = 0;
    GUI();
}
Example #13
0
void StateLevelGenTest::Init()
{

	PhoenixEngine::GetWindow()->setMouseCursorVisible(false);


	if(playIntro==true){
		currentPic = 0;
		picTimer = 0;
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_1.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_2.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_3.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_4.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_5.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_6.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_7.jpg", false, false, false)));
		introPics.push_back( sf::Sprite(*ImageManager::RequestTexture("Assets/Img/CutScene/Intro_8.jpg", false, false, false)));
		

	}

	cursor.setTexture(*ImageManager::RequestTexture("Assets/Img/CursorSight.png", false, false, false));
	cursor.setOrigin(32,32);
	drawCursor = true;

	wasPaused = false;

	pauseMeny = new PauseMenuState();
	gameOverScreen = new GameOverScreen();
	winScreen = new WinScreen(MapNum);
	allObjects = nullptr;
	enemies = nullptr;
	projectiles = new std::vector<Projectile*>();
	//MapManager::MAPDATA Map = MapManager::ReadMap(Path);

	if(bossMap==false){
		MapManager::MAPDATA Map = MapManager::ReadMap(Util::BuildString("Assets/Maps/%s.mlf", MapList[MapNum].c_str()));
		bool b = MapManager::ParseMapdata(Map, &allObjects, &enemies, &projectiles, &Camera, &m_Player, &Foreground);
		mapEndX = Map.MiddleX -1024;
	}else{
		//--------------------------
		mapEndX = 999999;

		allObjects = new std::vector<GameObject*>();
		Camera = new sf::View();
		enemies = new std::vector<Enemy*>();
		projectiles = new std::vector<Projectile*>();
		Foreground = new Parallax();
		m_Player = new Player(allObjects, enemies);

		(m_Player)->setCamera(Camera);
		(m_Player)->m_Sprite.setPosition(0, 500);
		(m_Player)->setProjectileVector(projectiles);
		(Camera)->reset(sf::FloatRect(0.0f,0.0f,1920.0f,1080.0f));

		ImageManager::RequestTexture("Assets/Img/EnemySprite01.png", true, false, true);

		Parallax* m_Backgrounds = new Parallax();
		std::vector<Obstacle*> m_Middlegrounds;
		m_Backgrounds->setCamera(Camera);
		(Foreground)->setCamera(Camera);

		m_Backgrounds->setCoefficient(Definitions::SPEEDBG);
		(Foreground)->setCoefficient(Definitions::SPEEDFG);

		sf::Sprite* Bg = new sf::Sprite(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Backgrounds/BossBackground.png", false, false, false));
		sf::Sprite* Bg2 = new sf::Sprite(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Backgrounds/BossBackground.png", false, false, false));
		m_Backgrounds->AddImage(Bg);
		m_Backgrounds->AddImage(Bg2);
		allObjects->push_back(m_Backgrounds);
		//------------------------------

		FlyNest* KingNest_1 = new FlyNest(m_Player, projectiles, enemies);
		KingNest_1->setCamera(Camera);
		KingNest_1->m_Sprite.setPosition(1100, -400);
		allObjects->push_back(KingNest_1);
		
		FlyNest* KingNest_2 = new FlyNest(m_Player, projectiles, enemies);
		KingNest_2->setCamera(Camera);
		KingNest_2->m_Sprite.setPosition(3900, -400);
		allObjects->push_back(KingNest_2);

		KingFrog = new BullFrog(m_Player, enemies, KingNest_1, KingNest_2);
		KingFrog->m_Sprite.setPosition(2970, 1040.0f);
		KingFrog->setCamera(Camera);
		enemies->push_back(KingFrog);
		

		Obstacle* KingLandObst = new Obstacle();
		KingLandObst->m_Sprite.setTexture(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Middlegrounds/MiddleGround_2.png", false, false, false, "Assets/Img/LevelAssets/Middlegrounds/MiddleGround_2_Cdata.png"));
		KingLandObst->m_Sprite.setTextureRect(sf::IntRect(0,3070,4096,786));
		KingLandObst->m_Sprite.setPosition(-288, 2048-786-340 );
		allObjects->push_back(KingLandObst);


		Obstacle* obst_1 = new Obstacle();
		obst_1->m_Sprite.setTexture(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Middlegrounds/MiddleGround_2.png", false, false, false, "Assets/Img/LevelAssets/Middlegrounds/MiddleGround_2_Cdata.png"));
		obst_1->m_Sprite.setTextureRect(sf::IntRect(0,1570,4096,760));
		obst_1->m_Sprite.setPosition(-4384, 2048-778-340 );
		allObjects->push_back(obst_1);


		Obstacle* obst_2 = new Obstacle();
		obst_2->m_Sprite.setTexture(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Middlegrounds/MiddleGround_3.png", false, false, false, "Assets/Img/LevelAssets/Middlegrounds/MiddleGround_3_Cdata.png"));
		obst_2->m_Sprite.setTextureRect(sf::IntRect(0,0,4096,2048));
		obst_2->m_Sprite.setPosition(3808, -356 );
		allObjects->push_back(obst_2);


		blanket = new Blanket();
		blanket->setCamera(Camera);
		blanket->m_Sprite.setPosition(5900, 775);
		allObjects->push_back(blanket);

		

		
		//------------------------------
	}


	ParaTestBg = new Parallax();
	ParaTestBg->setCamera(Camera);
	sf::Sprite* Bg_2 = new sf::Sprite(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Backgrounds/LoD/BehindBackground1.png", false, false, true));
	sf::Sprite* Bg2_2 = new sf::Sprite(*ImageManager::RequestTexture("Assets/Img/LevelAssets/Backgrounds/LoD/Background1NEW.png", false, false, true));
	ParaTestBg->AddImage(Bg_2);
	ParaTestBg->AddImage(Bg2_2);
	ParaTestBg->setCoefficient(sf::Vector2f(0.05f, 0.05f));


	playNormalSong = true;

	CameraBounds = sf::FloatRect(200, 200, 400, 500);
	CameraYLimit = sf::Vector2f(0, 2048);
	Win = false;
	gui = GUI();

	winScreen->setCurrentLevel(MapNum);

	if(playIntro==false){
		if(bossMap==true){
			AudioManager::fadeInMusic("Assets/Audio/Music/BossTheme.wav", 2000);
		}else{
			
			AudioManager::fadeInMusic("Assets/Audio/Music/alphaSong.wav", 2000);
			AudioManager::fadeInMusic("Assets/Audio/Sfx/ambienceForest.wav", 2000);
		}
	}else{
		AudioManager::fadeInMusic("Assets/Audio/Music/introSong.wav", 1000);
	}

	shader_blur_x = new sf::Shader();
	shader_blur_x->loadFromFile("Assets/Shader/blur_x.glsl", sf::Shader::Fragment);
	shader_blur_x->setParameter("blurSize", 0.0f);// 1.0f/256.0f);
	shader_blur_y = new sf::Shader();
	shader_blur_y->loadFromFile("Assets/Shader/blur_y.glsl", sf::Shader::Fragment);
	shader_blur_y->setParameter("blurSize", 0.0f);// 1.0f/256.0f);
	blur_time = 2000;
	blur_counter = 0;
	blur_size = 1.0f/512.0f;
}
Example #14
0
// Contructor
Application::Application()
{
	GUI();
	setConnections();
	showisotog();
}
Example #15
0
int main(int argc, char** argv)
{
	GUI g = GUI();
	g.start(argc, argv);
	return 0;
}
Example #16
0
u32 systemReadJoypad(int)
{
  return GUI()->uiReadJoypad();
}
int main()
{
    OpenConsole();

    Screen::setScreenSize(Vector2(1280, 720));

    sf::RenderWindow renderWindow(sf::VideoMode(Screen::getScreenSize().x, Screen::getScreenSize().y, 32), "RayMarch Renderer", sf::Style::Titlebar | sf::Style::Close);
    renderWindow.setActive();

    GUI gui = GUI(&renderWindow);

    renderWindow.resetGLStates();

    //Graphics::setImageSize(Vector2(1280, 720));
    Graphics::Init();

    Camera camera = Camera(Vector3(0, 4, -6), Vector3(0, -3, 6).normalized(), Graphics::getImageSize().x / Graphics::getImageSize().y, PI / 4);

    int samples = 128;
    int currentSample = 0;

    int gridWidth = 4;
    int gridHeight = 4;

    int chunkWidth = Graphics::getImageSize().x / gridWidth;
    int chunkHeight = Graphics::getImageSize().y / gridHeight;

    int x = ceil((float)gridWidth / 2.0) - 1;
    int y = ceil((float)gridHeight / 2.0) - 1;
    Vector2 dir = Vector2(-1, 0);

    int squaresPassed = 0;
    int lastSquaresPassed = 0;
    int distCount = 0;

    bool willSave = false;

    bool wasRendering = false;
    bool rendering = false;

    bool sDown = false;
    bool wasSDown = false;

    double renderStartTime = 0;
    double renderEndTime = 0;

    double oldTime = 0;
    double newTime = 0;
    clock_t t = clock();
    while (renderWindow.isOpen())
    {
        sf::Event windowEvent;
        while (renderWindow.pollEvent(windowEvent))
        {
            gui.handleEvent(windowEvent);
            switch (windowEvent.type)
            {
            case sf::Event::Closed:
                renderWindow.close();
                break;
            }
        }

        sDown = sf::Keyboard::isKeyPressed(sf::Keyboard::S);

        rendering = gui.getRendering();

        if (gui.getReload())
        {
            // Reload
            samples = gui.getSamples();
            currentSample = 0;

            gridWidth = gui.getGridSize().x;
            gridHeight = gui.getGridSize().y;

            chunkWidth = Graphics::getImageSize().x / gridWidth;
            chunkHeight = Graphics::getImageSize().y / gridHeight;

            x = ceil((float)gridWidth / 2.0) - 1;
            y = ceil((float)gridHeight / 2.0) - 1;
            dir = Vector2(-1, 0);

            squaresPassed = 0;
            lastSquaresPassed = 0;
            distCount = 0;

            Graphics::Reload();

            camera.setAspect(Graphics::getImageSize().x / Graphics::getImageSize().y);
            camera.calculateRays();

            renderStartTime = (double)(clock() - t) / (double)CLOCKS_PER_SEC;
            renderEndTime = 0;
        }

        if (rendering)
        {
            if (samples == 0)
            {
                if (squaresPassed < gridWidth * gridHeight)
                {
                    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                    {
                        rendering = false;
                        renderEndTime = (double)(clock() - t) / (double)CLOCKS_PER_SEC;
                        std::cout << "Render Time: " << renderEndTime - renderStartTime << std::endl;
                        gui.stopRendering();
                    }

                    Vector2 min = Vector2(x * chunkWidth, y * chunkHeight);
                    Vector2 max = Vector2((x + 1) * chunkWidth, (y + 1) * chunkHeight);

                    Graphics::Render(newTime, min, max, currentSample);

                    std::cout << currentSample << std::endl;

                    x -= gridWidth / 2;
                    y -= gridHeight / 2;

                    if (distCount * 2 == squaresPassed - lastSquaresPassed)
                    {
                        distCount++;
                        lastSquaresPassed = squaresPassed;
                        dir = Vector2(dir.y, -dir.x);
                    }
                    else if (distCount == squaresPassed - lastSquaresPassed)
                    {
                        dir = Vector2(dir.y, -dir.x);
                    }
                    squaresPassed++;

                    x += dir.x;
                    y += dir.y;

                    x += gridWidth / 2;
                    y += gridHeight / 2;
                }
                else
                {
                    x = ceil((float)gridWidth / 2.0) - 1;
                    y = ceil((float)gridHeight / 2.0) - 1;
                    dir = Vector2(-1, 0);

                    squaresPassed = 0;
                    lastSquaresPassed = 0;
                    distCount = 0;

                    currentSample++;
                }
            }
            else
            {
                if (squaresPassed < gridWidth * gridHeight)
                {
                    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                    {
                        rendering = false;
                        renderEndTime = (double)(clock() - t) / (double)CLOCKS_PER_SEC;
                        std::cout << "Render Time: " << renderEndTime - renderStartTime << std::endl;
                        gui.stopRendering();
                    }

                    if (currentSample < samples)
                    {
                        Vector2 min = Vector2(x * chunkWidth, y * chunkHeight);
                        Vector2 max = Vector2((x + 1) * chunkWidth, (y + 1) * chunkHeight);

                        Graphics::Render(newTime, min, max, currentSample);

                        currentSample++;

                        //std::cout << currentSample << "/" << samples << std::endl;
                    }
                    else
                    {
                        x -= gridWidth / 2;
                        y -= gridHeight / 2;

                        if (distCount * 2 == squaresPassed - lastSquaresPassed)
                        {
                            distCount++;
                            lastSquaresPassed = squaresPassed;
                            dir = Vector2(dir.y, -dir.x);
                        }
                        else if (distCount == squaresPassed - lastSquaresPassed)
                        {
                            dir = Vector2(dir.y, -dir.x);
                        }
                        squaresPassed++;

                        x += dir.x;
                        y += dir.y;

                        x += gridWidth / 2;
                        y += gridHeight / 2;

                        currentSample = 0;
                    }
                }
                else
                {
                    if (willSave)
                    {
                        save();
                        willSave = false;
                    }

                    rendering = false;
                    renderEndTime = (double)(clock() - t) / (double)CLOCKS_PER_SEC;
                    std::cout << "Render Time: " << renderEndTime - renderStartTime << std::endl;
                    gui.stopRendering();
                }
            }
        }
        else
        {
            if (sDown && !wasSDown)
            {
                save();
            }
        }
        //*/

        gui.update(newTime);

        renderWindow.clear();
        gui.display(renderWindow);
        renderWindow.display();

        wasSDown = sDown;

        oldTime = newTime;
        newTime = (double)(clock() - t) / (double)CLOCKS_PER_SEC;
        Screen::setDeltaTime(newTime - oldTime);
    }

    //Graphics::Cleanup();
}
Example #18
0
void systemSetTitle(const char* _csTitle)
{
    GUI()
        ->set_title(_csTitle);
}

const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
  KEYMAP( /* 0: mostly letters */
    Q,   W,         E,         R,         T,   					   /*|,, |*/         Y,              U,         I,   	          O,    P,    \
    A,   S,         D,         F,         G,   					   /*|,, |*/         H,              J,         K,   	          L,    COMM, \
		Z,   X,         C,         V,         B,               /*|,, |*/         N,              M,         COMM,           DOT,  KP_SLASH, \
    ESC, TAPT(3),   OSM(LGUI), OSM(LSFT), MK(LCTL,BSPC), TAPT(1), TAPT(2),   MK(LALT,SPC),   TACK(TAB), TACSK(SLSH), SH(2), ENT
  ),
  KEYMAP( /* layer one is mostly for programming and shell. lots of idea shortcute on left, not sure how much i will use them.*/
    ACK(7),  CTRL(W),    NO_AE,      SH(F10),     ACSK(L),                     SH(NO_ACNT), RA(7), RA(0), NO_OE,   SH(1), \
    NO_AA,   ACK(LEFT),  CSK(ENT),   ACK(RIGHT),  ALT(INS),                    0,           SH(8), SH(9), NO_PIPE, RA(4), \
    CSK(A),  CSK(F),     ACSK(T),    ALT(V),      CTRL(F9),                    SH(NO_BSLS), RA(8), RA(9), SH(6),   RA(NO_ACNT), \
    ESC,     TRNS,       OSM(LGUI),  OSM(LSFT),   TRNS,    TRNS,    TRNS,      SPC,         OFF(1),RA(2), NO_QUOTE,KP_EQUAL
  ),
  KEYMAP( /* hold space brings up move pad and numpad */
    INS,      HOME,   UP  ,      END  ,     PGUP,                          SH(5),         7     , 8  , 9, SH(NO_QUOTE),     \
    DEL,      LEFT,   DOWN,      RIGHT,     PGDN,                          NO_MINS,       4     , 5  , 6, NO_PLUS, \
    GUI(1),   GUI(2), GUI(3),    GUI(4),    GUI(5),                        RA(4),         1     , 2  , 3, NO_BSLS,      \
    ACK(DEL), TRNS, OSM(LGUI), OSM(LSFT),   GUI(D) , TRNS, TRNS,           MK(LALT,SPC),  OFF(1), DOT, 0, KP_EQUAL
  ),
  KEYMAP( /* hold tab to have fpad and mouse */
    F1,     F2,    F3,        F4,         F5,                             WH_D ,           BTN1   ,  MS_U ,         BTN2 ,      SH(3) , \
    F6,     F7,    F8,        F9,         F10,                            WH_U ,           MS_L   ,  MS_D ,         MS_R ,      BTN3 , \
    F11,    F12,   F13,       F14,        BOOT,                           NO   ,           ACL0   ,  NO_LT,         SH(NO_LT) , BTN4 , \
    BOOT, TRNS,   OSM(LGUI), OSM(LSFT),   MK(LCTL,BSPC), TRNS, TRNS,      MK(LALT,SPC),    TACK(TAB),TACSK(MINS) , SH(NO_BSLS), KP_EQUAL
  ),


};
Example #20
0
int _tmain(int argc, _TCHAR* argv[]) {
	cout << "Opening servo controller serial port... ";
	PololuServoController servos = PololuServoController();
	cout << " Done" << endl;
	cout << "Opening MFTech Receiver interface... ";
	MFTechReceiver mftech = MFTechReceiver();
	cout << " Done" << endl;
	cout << "Starting up Wiimote thread... ";
	Wiimote remote = Wiimote();
	cout << " Done" << endl;
	cout << "Starting up GPS thread... ";
	GPSReceiver gps = GPSReceiver();
	cout << " Done" << endl;
	cout << "Starting camera reading thread... ";
	Camera camera = Camera();
	cout << " Done" << endl;
	cout << "Starting GUI... ";
	GUI gui = GUI();
	cout << "Done" << endl;

	for(;;) {
		unsigned int the_time = clock();
		cout << "Time " << the_time << endl;
		if( remote.connected() ) {
			gui.set_wiimote(true);
			cout.precision(3);
			cout.setf(ios::fixed,ios::floatfield);
			cout << "X  " << remote.accel_X() << "\tY  " << remote.accel_Y() << "\tZ  " << remote.accel_Z() << endl;
		} else {
			cout << "No wiimote connected" << endl;
		}
		if( gps.has_lock() ) {
			gui.set_gps(true);
			cout.precision(5);
			cout.setf(ios::fixed,ios::floatfield);
			GPSpos pos = gps.get_pos();
			GPStime time = gps.get_time();
			cout << "Lat " << pos.lat_degrees << "° " << pos.lat_minutes << "' " << pos.lat_direction << endl;
			cout << "Lon " << pos.lon_degrees << "° " << pos.lon_minutes << "' " << pos.lon_direction << endl;
			cout << gps.get_speed_mph() << "mph" << endl;
			cout << time.year << "-" << time.month << "-" << time.day << " " << time.hours << ":" << time.minutes << ":" << time.seconds << "." << time.milliseconds << endl;
		} else {
			cout << endl << endl << "No GPS lock" << endl << endl;
		}
		if( mftech.joystick_available() ) {
			gui.set_mftech(true);
			cout.precision(3);
			cout.setf(ios::fixed,ios::floatfield);
			cout << "Throttle " << mftech.throttle() << endl;
			cout << "Steering " << mftech.steering() << endl;
			cout << "Mode Select " << mftech.modeselect() << endl;
		} else {
			cout << endl << "No controller found" << endl << endl;
		}
		if( servos.connected() ) {
			gui.set_servo(true);
			if(mftech.joystick_available()) {
				double throttle = mftech.throttle();
				double steering = mftech.steering();
				throttle /= 65535.0;
				steering /= 65535.0;
				throttle *= 5000.0;
				steering *= 5000.0;
				throttle += 500.0;
				steering += 500.0;
				servos.set_position_abs(0, (unsigned short)steering);
				servos.set_position_abs(1, (unsigned short)throttle);
				cout << "Sent new servo positions to controller" << endl;
			}
		} else {
			cout << "Pololu servo controller not connected" << endl;
		}
		if( camera.connected() ) {
			gui.set_camera(true);
		} else {
			cout << "No camera found" << endl;
		}
		
		cout << endl;
		
		if( gui.close ) {
			camera.release();
			Sleep(100);
			exit(0);
		}

		Sleep(30);
	}
}
Example #21
0
void systemShowSpeed(int _iSpeed)
{
    GUI()
        ->vShowSpeed(_iSpeed);
}
Example #22
0
void systemSaveOldest()
{
  GUI()->vOnSaveGameOldest();
}
Example #23
0
void system10Frames(int _iRate)
{
    GUI()
        ->vComputeFrameskip(_iRate);
}
Example #24
0
void systemDrawScreen()
{
  GUI()->vDrawScreen();
  systemRenderedFrames++;
}
Example #25
0
void systemScreenCapture(int _iNum)
{
    GUI()
        ->vCaptureScreen(_iNum);
}
Example #26
0
/* bjartek atreus layout for norwegian keyboard
 * - all the mods are oneshot. see here for information about this. https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md
 * - layer one has norwegian special characters at AEO positions
 * - needs us mac keyboard layout
 */

const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(
Q       , W        , E        , R        , T          ,                       Y         , U         , I       , O         , P        , \
A       , S        , D        , F        , G          ,                       H         , J         , K       , L         , SCLN     , \
Z       , X        , C        , V        , B          ,                       N         , M         , COMM    , DOT       , SLSH     , \
ESC     , OSM(RALT), OSM(LCTL), OSM(LSFT), TAP(1,BSPC), OSM(LGUI), OSM(LALT), TAP(2,SPC), TAP(3,TAB), MINS    , QUOT      , ENT     ),

KEYMAP(
AGK(F7) , GUI(F12) , RA(QUOT) , ACK(R)   , AGSK(L)    ,                       SH(6)     , SH(LBRC)  , SH(RBRC), RA(O)     , SH(1)    , \
RA(A)   , GUI(LBRC), CSK(ENT) , GUI(RBRC), GSK(T)     ,                       0         , SH(9)     , SH(0)   , SH(BSLS)  , SH(4)    , \
GSK(A)  , GSK(F)   , CTRL(T)  , ALT(V)   , GUI(F9)    ,                       GRAVE     , LBRC      , RBRC    , SH(7)     , SH(GRAVE), \
GA      , OSM(RALT), OSM(LCTL), OSM(LSFT), TRNS       , OSM(LGUI), OSM(LALT), CTRL(F2)  , OFF(1)    , SH(2)   , QUOT      , OSM(LGUI)),

KEYMAP(
INS     , HOME     , UP       , END      , PGUP       ,                       SH(5)     , 7         , 8       , 9         , SH(8)    , \
DEL     , LEFT     , DOWN     , RIGHT    , PGDN       ,                       MINS      , 4         , 5       , 6         , SH(EQUAL), \
VOLU    , MPRV     , MPLY     , MNXT     , GCK(Q)     ,                       SH(4)     , 1         , 2       , 3         , BSLS     , \
VOLD    , MUTE     , OSM(LCTL), OSM(LSFT), CSK(SPC)   , OSM(LGUI), OSM(LALT), TRNS      , OFF(1)    , DOT     , 0         , KP_EQUAL),

KEYMAP(
F1      , F2       , F3       , F4       , F5         ,                       WH_D      , BTN1      , MS_U    , BTN2      , SH(3)    , \
F6      , F7       , F8       , F9       , F10        ,                       WH_U      , MS_L      , MS_D    , MS_R      , BTN3     , \
F11     , F12      , F13      , F14      , BOOT       ,                       NO        , ACL0      , NO      , NO        , NO       , \
GA      , OSM(RALT), OSM(LCTL), OSM(LSFT), GS         , OSM(LGUI), OSM(LALT), SPC       , TRNS      , MINS    , SH(BSLS)  , KP_EQUAL)
Example #27
0
void PrefInterface::getData(Preferences * pref) {
	requires_restart = false;
	language_changed = false;
	iconset_changed = false;
	gui_changed = false;
	style_changed = false;
	recents_changed = false;

	if (pref->language != language()) {
		pref->language = language();
		language_changed = true;
		qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data());
	}

	if (pref->iconset != iconSet()) {
		pref->iconset = iconSet();
		iconset_changed = true;
	}

	if (pref->gui != GUI()) {
		pref->gui = GUI();
		gui_changed = true;
	}

	pref->resize_method = resizeMethod();
	pref->save_window_size_on_exit = saveSize();

#ifdef SINGLE_INSTANCE
	pref->use_single_instance = useSingleInstance();
#endif

	if (pref->history_recents->maxItems() != recentsMaxItems()) {
		pref->history_recents->setMaxItems( recentsMaxItems() );
		recents_changed = true;
	}

	pref->seeking1 = seeking1();
	pref->seeking2 = seeking2();
	pref->seeking3 = seeking3();
	pref->seeking4 = seeking4();

	pref->update_while_seeking = updateWhileDragging();
	pref->relative_seeking= relativeSeeking();
	pref->precise_seeking = preciseSeeking();

	pref->default_font = defaultFont();

	pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles();

#if STYLE_SWITCHING
    if ( pref->style != style() ) {
        pref->style = style();
		style_changed = true;
	}
#endif

	pref->floating_control_animated = floatingAnimated();
	pref->floating_control_width = floatingWidth();
	pref->floating_control_margin = floatingMargin();
	pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
#ifndef Q_OS_WIN
	pref->bypass_window_manager = floatingBypassWindowManager();
#endif
}
Example #28
0
// Never change if not neccesary
int main(int argc, char *argv[]){
  int n, newdata = 0;

  time_t BEGIN_T;
  char name[256], hname[128];
  FILE *out;
 
  srand(time(NULL));

  //printf("%d\n", argc);
  if(argc < 1) {
    printf("Usage: %s [GUI 1 or 0]\n", argv[0]);
  }
  else {
    //PARAM = atof(argv[1]);
    
    if (argc == 2)
      graphics = atoi(argv[1]);
  }

  if (graphics)
    GUI();
  
  if (!graphics)
    printf("Running PARAM = %f on %dx%d Lattice with %d iterations\n",PARAM,XMAX,YMAX,iteration_max);

  if (!graphics) Pause = 0;
  
  Init(); 

   //test for speed
  BEGIN_T = time(NULL);
  for (n=0;n<10;n++)
    iteration1();

  if (!graphics)
    printf("sec/iteration: %s\n", wtime_string( (double)(time(NULL)-BEGIN_T)/10) );

  Init();

  //Just reset
  sprintf(name,"data-%f.txt",PARAM);
  out = fopen(name,"w+");

 //Write some information
  gethostname(hname,(size_t)sizeof(hname));

  fprintf(out,"#Size: %dx%d\n#PARAM: %f\n#itertions: %d\n#Repeat: %d\n#sec/iteration: %s\n#Host: %s\n#PID: %d\n#---BEGIN DATA---\n\n\n",XMAX,YMAX,PARAM,iteration_max,repeat,wtime_string( (double)(time(NULL)-BEGIN_T)/10 ), hname, getpid() );

  fclose(out);  

  //Now start simulation
  BEGIN_T = time(NULL);

  while ( (iterations<iteration_max)&&(!done) ){//Begin Main Loop
    if (graphics) {
      Events(newdata);
      GetGraphics();
      DrawGraphs();
    } else {
      //done=1;
      //Pause=0;
    }

    if (!Pause||singlestep) {
      singlestep = 0;
      newdata = 1;
      
      for (n=0;n<repeat;n++) {
	iterations++;
	iteration1();
      }
      //analysis();
      
      if (!graphics)
	repeat *= 1.1;

      if (!graphics)
	printf("ETA: %s\n", wtime_string( (double)(time(NULL)-BEGIN_T)*(iteration_max-iterations)/iterations) );

      if (repeat==0) 
	Init();
    }
    else 
      sleep(1);

  }//End Main Loop

  return 0;
}
Example #29
0
void FileManager::start(){
    selection = GUI(startOptions).run();

    if (selection == -1){
        return;
    }

    switch (selection){
        case(0):
            //Arcade games. Run MAME
            std::cout << "MAME" << std::endl;

            try{
                system(mameCommand.c_str());
            }
            catch(...){
                std::cout << "System command failed." << std::endl;
            }

            break;
        case(1):
            //NES Games. Run MESS.
            std::cout << "MESS" << std::endl;

            gameSelection = chooseGame(nesDir, nesExtension);

            if (gameSelection == "NULL"){
                start();
                return;
            }

            rom = gameSelection + nesExtension;

            try{
                system((messCommand + '"' + rom + '"').c_str());
            }
            catch(...){
                std::cout << "System command failed." << std::endl;
            }

            break;
        case(2):
            //GBC Games. Run Gambatte.
            std::cout << "Gambatte" << std::endl;

            gameSelection = chooseGame(gbcDir, gbcExtension);

            if (gameSelection == "NULL"){
                start();
                return;
            }

            rom = gbcDir + gameSelection + gbcExtension;

            try{
                system((gambatteCommand + '"' + rom + '"').c_str());
            }
            catch(...){
                std::cout << "System command failed." << std::endl;
            }

            break;
        case(3):
            //Mega Drive Games. Run PicoDrive.
            std::cout << "PicoDrive" << std::endl;

            try{
                system((picoCommand).c_str());
            }
            catch(...){
                std::cout << "System command failed." << std::endl;
            }

            break;
        case(4):
            std::cout << "Shut Down" << std::endl;
            system(shutdownCommand.c_str());
            break;
    }

    start();
}
Example #30
0
void systemLoadRecent()
{
  GUI()->vOnLoadGameMostRecent();
}