Esempio n. 1
0
void EventLoop::processSystemEvents()
{
	sf::Event ev;
	EventPtr evtWrapper;
	while (m_system.m_appWindow.GetEvent(ev))  {
		switch (ev.Type)  {
		case sf::Event::Closed:
			handleEvent(CloseEvent(ev));
		break;
		case sf::Event::MouseButtonPressed:
			handleEvent(MouseDownEvent(ev));
		break;
		case sf::Event::MouseButtonReleased:
			handleEvent(MouseUpEvent(ev));
		break;
		case sf::Event::MouseWheelMoved:
			handleEvent(MouseWheelEvent(ev));
		break;
		case sf::Event::KeyPressed:
			handleEvent(KeyDownEvent(ev));
		break;
		case sf::Event::KeyReleased:
			handleEvent(KeyUpEvent(ev));
		break;
		}
	}
}
Esempio n. 2
0
unsigned char	MainWindow::MainMenuLoop()
{
  unsigned char	tmp;

  InitMenu();
  while (_mainWindow.isOpen())
    {
      while (_mainWindow.pollEvent(_event))
	{
	  if (CloseEvent() || 
	      (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num3)))
	    Close();
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num1))
	    {
	      tmp = GameListLoop();
	      if (tmp != 0)
		return tmp;
	    }
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num2))
	    CreditsLoop();
	}
      Clear();
      DrawAll();
      Display();      
    }
  return 0;
}
Esempio n. 3
0
RequestQueue::~RequestQueue()
{
  StopAllListeners();
  DeleteAllFragments();
  DeleteCriticalSection(&m_lock);
  CloseEvent();
  CloseQueueHandle();
}
Esempio n. 4
0
void COXEventManager::Destroy()
{
	CloseEvent();

	m_map_char.clear();
	m_map_attender.clear();
	m_vec_quiz.clear();

	SetStatus(OXEVENT_FINISH);
}
Esempio n. 5
0
/* メモリカード制御モジュールの終了 */
void StopMemCard(void)
{
	EnterCriticalSection();
	CloseEvent(ev0);
	CloseEvent(ev1);
	CloseEvent(ev2);
	CloseEvent(ev3);
	CloseEvent(ev10);
	CloseEvent(ev11);
	CloseEvent(ev12);
	CloseEvent(ev13);
	ExitCriticalSection();
#if 0
	StopCARD();
#endif
}
Esempio n. 6
0
int	MainWindow::CreditsLoop()
{
  while (_mainWindow.isOpen())
    {
      InitCredits();
      while (_mainWindow.pollEvent(_event))
	{
	  if (CloseEvent())
	    Close();
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num1))
	    return 0;
	}
      Clear();
      DrawAll();
      Display();
    }
  return 0;
}
Esempio n. 7
0
unsigned char  MainWindow::GameListLoop()
{
  while (_mainWindow.isOpen())
    {
      InitGameList();
      while (_mainWindow.pollEvent(_event))
	{
	  if (CloseEvent())
	    Close();
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num1))
	    return 1;
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num2))
	    return 2;
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num3))
	    return 3;
	  if (_event.type == sf::Event::KeyPressed && sf::Keyboard::isKeyPressed(sf::Keyboard::Num4))
	    return 0;
	}
      Clear();
      DrawAll();
      Display();
    }
  return 0;
}
Esempio n. 8
0
	Event::~Event()
	{
		CloseEvent();
	}
Esempio n. 9
0
main()
{
    long i,fd,ret,max;
    unsigned char *p;

    /* カードとコントローラの初期化 */
    /*他のライブラリとの同時運用ではChangeClearPAD()が必須*/
    /*また他のライブラリを先に初期するかResetCakkback()を最初に実行する*/
#ifdef GRAPHIC
    ResetCallback();
#endif
    cbuf[0][0] = cbuf[1][0] = 0xff;
    InitPAD(&cbuf[0][0],34,&cbuf[1][0],34);
    StartPAD();
    InitCARD(1);
    StartCARD();
    _bu_init();
#ifdef GRAPHIC
    ChangeClearPAD(0);
#endif
		
    /* イベントの初期化 */
    ev0 = OpenEvent(SwCARD, EvSpIOE, EvMdNOINTR, NULL);
    ev1 = OpenEvent(SwCARD, EvSpERROR, EvMdNOINTR, NULL);
    ev2 = OpenEvent(SwCARD, EvSpTIMOUT, EvMdNOINTR, NULL);
    ev3 = OpenEvent(SwCARD, EvSpNEW, EvMdNOINTR, NULL);
    EnableEvent(ev0);  EnableEvent(ev1);  EnableEvent(ev2);  EnableEvent(ev3);
	
    /* データの初期化 */
    for(i=0;i<SIZE*0x2000;i++) {
        data[i] = i/128;    buf[i] = 0xff;
    }

    /* ここのカードの存在とフォーマットテストを置くべき*/

    /* テスト用ファイルの消去 */
    delete(name);

    /* テスト用ファイルの生成 */
    fd = open(name,O_CREAT|SIZE<<16);
    close(fd);

    printf("write\n");
    /* ライト*/
#ifdef NOWAIT
    fd = open(name,O_WRONLY|O_NOWAIT);
    for(i=0,p=data;i<SIZE*0x2000/512;i++,p+=512) {
        _clear_event();
        while(write(fd,p,512)==0)
            ;
        if((ret = _card_event())==1)  break;
    }
    close(fd); max = i; printf("max:%d\n",max);
#else
    fd = open(name,O_WRONLY);
    write(fd,data,SIZE*0x2000);
    close(fd);
#endif

    printf("read\n");
    /* リード */
#ifdef NOWAIT
    fd = open(name,O_RDONLY|O_NOWAIT);
    for(i=0,p=buf;i<max;i++,p+=512) {
        _clear_event();
        while(read(fd,p,512)==0)
            ;
        if((ret = _card_event())==1)  break;
        lseek(fd,128,SEEK_CUR);                  /* バグ対策 */
    }
    close(fd);  max = i;  printf("max:%d\n",max);
#else
    fd = open(name,O_RDONLY);
    read(fd,buf,SIZE*0x2000);
    close(fd);
#endif

    /* 比較 */
    for(i=0;i<max*512;i++) {
        if(data[i]!=buf[i]) {
            printf("error\n");  break;
        }
/*      printf("(%04x:%02x:%02x)\n",i,data[i],buf[i]);*/
    }
    if(i>=max*512)  printf("correct\n");

    /* 後処理 */
eoj:
    CloseEvent(ev0);  CloseEvent(ev1);  CloseEvent(ev2);  CloseEvent(ev3);
    printf("end of test\n");
}