示例#1
0
文件: FilePath.cpp 项目: 8l/oovcde
int FilePathComparePaths(OovStringRef const path1,
                         OovStringRef const path2)
{
#ifdef __linux__
    return strcmp(path1, path2);
#else
    return StringCompareNoCase(path1, path2);
#endif
}
示例#2
0
bool KeyVals::GetKeyVal(const char *_key, obUserData &_ud) const
{
	for(int i = 0; i < MaxArgs; ++i)
	{
		if(!StringCompareNoCase(m_Key[i],_key))
		{
			_ud = m_Value[i];
			return true;
		}
	}
	return false;
}
示例#3
0
bool KeyVals::SetKeyVal(const char *_key, const obUserData &_ud)
{
	if(!_key)
		return false;

	int ifree = -1;
	for(int i = 0; i < MaxArgs; ++i)
	{
		if(ifree == -1 && m_Key[i][0]==0)
			ifree = i;
		if(!StringCompareNoCase(m_Key[i],_key))
		{
			m_Value[i] = _ud;
			return true;
		}
	}
	if(ifree != -1)
	{
		Omnibot_strncpy(&m_Key[ifree][0],_key,MaxArgLength-1);
		m_Value[ifree] = _ud;
		return true;
	}
	return false;
}
示例#4
0
int main()
{
  if(!ALLEGRO5_INIT) allegro5_init();
  
  short int      option;
  char           options_list[][50] =
                 {
                   "Start",
                   "Exit",
                   "Help",
                   "-"
                 };
  
  volatile int       i = 0;
  long int           life = 100;
  char               key_char[50];
  bool               terminou = false,
                     redraw   = true;
  LifeBar            lifeBar;
  Font               global_font;
  ALLEGRO_EVENT      ev;
  
  lifeBar.open(200, 0, 0, SCREEN_W/2, 50, "resource\\LifeBars\\001.bmp", INVISIBLE);
  
  global_font.open("resource\\Font\\impressedMetal.ttf", 32, 0, WHITE);
  log.append("Font...OK");
  
  Loading(global_font);
  
  option = StartGame(
    "resource\\StartGame\\Sprites\\intro.bmp", 
    "resource\\StartGame\\Snd\\background.wav", 
    "resource\\StartGame\\Sprites\\csr.bmp", 
    "resource\\StartGame\\Snd\\csr.wav", 
    "resource\\Font\\impressedMetal.ttf", 
    options_list);
  
  log.append("\t\tLoop principal");
    
  al_start_timer(global_timer);
  
  al_clear_to_color(BLACK);
  al_flip_display();
  
  while(!terminou)
  {
    al_wait_for_event(eventos_globais, &ev);
    
    switch(ev.type)
    {
      case ALLEGRO_EVENT_DISPLAY_CLOSE:
        terminou = true;
        break;
        
      case ALLEGRO_EVENT_TIMER:
        if(ev.timer.source == global_timer)
          redraw = true;
        break;
        
      case KEY_DOWN:
        strcpy(key_char, al_keycode_to_name(ev.keyboard.keycode));
        
        if( StringCompareNoCase(key_char, "escape") ) terminou = true;
        
        else if( StringCompareNoCase(key_char, "down") ){ }
          
        else if( StringCompareNoCase(key_char, "up") ){ }
        
        else if( StringCompareNoCase(key_char, "right") ){ }
          
        else if( StringCompareNoCase(key_char, "left") ){ }
        
      break;
      
      /**************************
          Soltou uma tecla
      ***************************/
      case KEY_UP:
        strcpy(key_char, al_keycode_to_name(ev.keyboard.keycode));
        break;
    }
    
    if(redraw && al_is_event_queue_empty(eventos_globais) && !terminou)
    {
      redraw = false;

      al_set_target_bitmap(al_get_backbuffer(display));
      
      lifeBar.print(life);
      if(life > 0)life--;
      else
        life = 200;
      global_font.print(0, SCREEN_H/2, "Teste");

      al_flip_display();
      al_clear_to_color(BLACK);
    }
  }
  
  al_stop_samples();
  
  Fim("resource\\Font\\Resident_Evil_Large.ttf");
  
  al_destroy_display(display);
  al_destroy_event_queue(eventos_globais);
  al_destroy_timer(global_timer);
  
  log.append("\t\tLoop principal...OK");
  log.append("[FIM]");
  log.close();
}