コード例 #1
0
int main(int argc, char *argv[])
{
  int done;
  eolLine fps;
  int i;
  for(i = 1;i < argc;i++)
  {
    if(strcmp(argv[i],"-fs")== 0)
    {
    }
    if(strcmp(argv[i],"-wm")== 0)
    {
    }
  }
  Init_All(argv[0]);
  Setup_All();
  done = 0;
  do
  {
    eol_input_update();
    eol_mouse_update();

    eol_level_update_active();

    eol_entity_think_all();
    eol_entity_update_all();

    eol_particle_update_all();
    eol_camera_update();
    eol_window_update_all();

    eol_graphics_frame_begin();
    {
      eol_window_draw_all();
      eol_mouse_draw();
    }

    sprintf(fps,"FPS: %f",eol_graphics_get_FPS());
    eol_font_draw_text_justify(
      fps,
      640,
      0,
      eol_vec3d(1,0,0),
      1,
      2,
      eolJustifyRight);

    eol_graphics_frame_end();

    
    if((eol_input_quit_check()) ||
      ((eol_input_is_key_released(SDLK_F4)) && (eol_input_is_mod_held(KMOD_ALT))) ||
      ((eol_input_is_key_released(SDLK_q)) && (eol_input_is_mod_held(KMOD_ALT))))
    {
      eol_dialog_quit();
    }
  }while(!done);
  exit(0);
  return 0;
}
コード例 #2
0
ファイル: game.c プロジェクト: engineerOfLies/garden
int main(int argc, char *argv[])
{
  int done = 0;
  int i,sx,sy;
  Uint8 *keys;
  Init_All();
  gamesounds[0] = LoadSound("sounds/victory.wav",MIX_MAX_VOLUME/2);
  gamesounds[1] = LoadSound("sounds/failure.wav",MIX_MAX_VOLUME/2);
  GameOptions(&DeadGame,0);
  GiveInfo();
  do
  {
    ResetBuffer();
    SDL_PumpEvents();
    Update_ALL();
    Think_ALL();
    keys = SDL_GetKeyState(NULL);    
    if(keys[SDLK_ESCAPE] == 1)done = 1;
    if(keys[SDLK_F1] == 1)GameOptions(&DeadGame,1);
    Draw_ALL();
    if(keys[SDLK_b] == 1)SDL_SaveBMP(screen,"screen0.bmp");
   // ItsRaining(IndexColor(LightRed),10,200,-0.2);
    NextFrame();
  }while(!done);
    
  exit(0);
  return 0;
}
コード例 #3
0
ファイル: game.c プロジェクト: ljg6/MyGame2D
/**
 * @brief Main function for the game.
 * @param argc count of arguments provided to the game.
 * @param argv an array of the arguments provided to the game.
 * @return always 0.
 */
int main(int argc, char *argv[])
{	
  Init_All();
  done = 0;
  do
  {
	if(gameState == 0)
	{
		  main_menu();
	 }
	else if(gameState == 1)
	{
		levelOne();
	}
	else if(gameState == 2)
	{
		levelTwo();
	}
	else if(gameState ==3)
	{

	}
  }while(!done);
  
  slog("got here");
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  SDL_DestroyTexture(bullet_Texture);
  return 1;
}
コード例 #4
0
ファイル: main.c プロジェクト: RobinN7/Swiffer
int main(int argc, char** argv) {
    Init_All(0);

    while (1) // boucle principale
    {
        PWM_Moteurs((speed+diff)/2,(speed-diff)/2);
    }
}
コード例 #5
0
ファイル: enet_lwip.c プロジェクト: dondai/EMBController
//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>Ethernet with lwIP (enet_lwip)</h1>
//!
//! This example application demonstrates the operation of the Stellaris
//! Ethernet controller using the lwIP TCP/IP Stack.  DHCP is used to obtain
//! an Ethernet address.  If DHCP times out without obtaining an address,
//! AutoIP will be used to obtain a link-local address.  The address that is
//! selected will be shown on the UART.
//!
//! UART0, connected to the FTDI virtual COM port and running at 115,200,
//! 8-N-1, is used to display messages from this application.
//!
//! For additional details on lwIP, refer to the lwIP web page at:
//! http://savannah.nongnu.org/projects/lwip/
//
//*****************************************************************************
//*****************************************************************************
//
// This example demonstrates the use of the Ethernet Controller.
//
//*****************************************************************************
int
main(void)
{
	Init_All();
    //
    // Loop forever.  All the work is done in interrupt handlers.
    //
    while(1)
    {
		my_main();
    }
}
コード例 #6
0
ファイル: game.c プロジェクト: jc429/276game
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
	
	debuginputs = 1,bsize = 5;

	/*defaults for placeholder reasons*/
	c1 = DEBUG;
	c2 = DEBUG;
	stage = ST_PLATFORM;
	/**/
	pause = 0;
	pausequeue = 0;
	fpress = 0;

	Init_All();
/*	SaveCFG(&f2,"res/test.txt");*/
	do
	{   
		UpdateMouse();
		if(pausequeue==1){
			pausequeue=0;
			GamePause();
		}
		pausetimer--;
		InputControl();
		if(GameState==VERSUS){
			DrawVersus();
			UpdateVersus();
		}else if(GameState==MAIN_MENU){
			DrawMainMenu();
			UpdateMenu();
		}else if(GameState==C_SELECT){
			DrawCharSel();
			UpdateCharSel();
		}else if(GameState==C_CREATOR){
			DrawCharCr();
			UpdateCharCr();
		}
		NextFrame();		
		if(endgame){
			done = 1;
		}
			
		ResetBuffer();
	}while(!done);
	exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
	return 0;
}
コード例 #7
0
ファイル: game.c プロジェクト: ajm27/IT276_Project_Final-2.0
int main(int argc, char *argv[])
{
	Init_All();

	do
	{
		if(currentstate == MAINMENU)
			main_mainmenu();
		if(currentstate ==  LEVELEDITOR)
			main_leveleditor();
		if(currentstate == DEATHMATCH)
			main_deathmatch();
	} while(gs_running);

	gs_running = 0;
	exit(0);
}
コード例 #8
0
ファイル: game.c プロジェクト: ljg6/gametest
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
  SDL_Surface *temp = NULL;
  int i;
  int done;
  int tx = 0,ty = 0;
  const Uint8 *keys;
  char imagepath[512];
  SDL_Rect srcRect={0,0,800,600};
  Init_All();

  temp = IMG_Load("images/bgtest.png");/*notice that the path is part of the filename*/

  //if(temp != NULL)
  //{
  //      for(i = 0;i < 12;i++)
  //      {
  //          drawSprite(tile,buffer,(i * tile->w) + tx,ty,0);
		//	SDL_FreeSurface(temp);
  //      }

  //}
  slog("got here");
  gt_graphics_render_surface_to_screen(temp,srcRect,0,0);
  SDL_FreeSurface(temp);
  slog("got here");
  done = 0;
  do
  {
    ResetBuffer();
    NextFrame();
    SDL_PumpEvents();
    keys = SDL_GetKeyboardState(NULL);
    if(keys[SDL_SCANCODE_ESCAPE])
    {
        done = 1;
    }
  }while(!done);
  slog("got here");
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  return 0;
}
コード例 #9
0
ファイル: game.c プロジェクト: cdc9/IT276_Final_Project
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
  SDL_Surface *temp = NULL;
  int done;
  int tx = 0,ty = 0;
  const Uint8 *keys;
  char imagepath[512];
  Sprite *sprite;
  SDL_Rect srcRect={0,0,800,600};
  Init_All();
  temp = IMG_Load("images/bgtest.png");/*notice that the path is part of the filename*/
  if(temp != NULL)
  {
      printf("temp image loaded successfully\n");
      SDL_BlitSurface(temp,NULL,buffer,NULL);
  }
  slog("got here");
  gt_graphics_render_surface_to_screen(temp,srcRect,0,0);
  SDL_FreeSurface(temp);
  slog("got here");
  done = 0;
  sprite = loadSprite("images/32_32_16_2sprite.png",32,32);
  do
  {
    ResetBuffer();
    drawSprite(sprite,5,vec2d(20,20));
    NextFrame();
    SDL_PumpEvents();
    keys = SDL_GetKeyboardState(NULL);
    if(keys[SDL_SCANCODE_ESCAPE])
    {
        done = 1;
    }
  }while(!done);
  slog("got here");
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  return 0;
}
コード例 #10
0
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
  SDL_Surface *temp = NULL;
  int done;
  int tx = 0,ty = 0;
  int i;
  const Uint8 *keys;
  char imagepath[512];
  SDL_Rect srcRect={0,0,SCREEN_WIDTH,SCREEN_HEIGHT};
  SDL_Event e;
  last_time = current_time = SDL_GetTicks();
  
  Init_All();
  slog("Finished Init All()");
  done = 0;
  do
  {
	   //render or draw functions go here
	//draw functions should go in order from background first to player draw calls last
    ResetBuffer();
    SDL_RenderClear(__gt_graphics_renderer);//clear screen
	tile_render();	
	player_draw();
	DrawMouse2();
	
	/*monster_spawn(Monster::grue);
	monster_spawn(Monster::spider01);
	monster_spawn(Monster::mino);		
	monster_spawn(Monster::orc);	
	support_spawn(Support::sara);	
	support_spawn(Support::healer);	
	support_spawn(Support::archer);
	
	*/
	entity_update_all();
	entity_think_all();
	entity_check_collision_all();
	particle_em_draw_all();
//	struct_update_all();
	

	G_MONSTER_SPAWN_TIMER -= 1;

	while(SDL_PollEvent(&e) != 0)
		player_move (&e);
    NextFrame();
	//end
    SDL_PumpEvents();
    keys = SDL_GetKeyboardState(NULL);
	//taken from lazyfoo
	//handles generally keyboard inputs	
	
	while( SDL_PollEvent( &e) != 0){
		if(e.type == SDL_QUIT)
			done = 1;
    	else
			player_move(&e);	
	}

		if(keys[SDL_SCANCODE_ESCAPE])
		{
			done = 1;
		}
		
	SDL_RenderPresent(__gt_graphics_renderer);
	last_time = current_time;
	current_time = SDL_GetTicks();
	delta = current_time - last_time;
  }while(!done);
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  return 0;
}
コード例 #11
0
ファイル: game.c プロジェクト: engineerOfLies/EngineOfLies
int main(int argc, char *argv[])
{
  int done;
  int i;
  float radius = 0.00001;

  eolVec3D point = {0,0,-5};
  eolLine fps;
  eolLight *light = NULL;
  for(i = 1;i < argc;i++)
  {
    if(strcmp(argv[i],"-fs")== 0)
    {
    }
    if(strcmp(argv[i],"-wm")== 0)
    {
    }
  }
  Init_All(argv[0]);
  eol_camera_config();
  eol_camera_set_height(30);
  eol_camera_init();
  done = 0;
  MakeTestWindow();
  eol_mouse_show();
  light = eol_light_area_new();
  eol_light_set_color(light,eol_vec3d(0.5,0.5,0.5));
  eol_light_set_radius(light,radius);
  eol_lighting_setup_rep_plot();
  srandom(SDL_GetTicks());
  CreateTestLevel();
  
  do
  {
    eol_light_move(light,point);
    eol_light_update(light);

    eol_input_update();
    eol_mouse_update();

    eol_level_update_active();

    eol_entity_think_all();
    eol_entity_update_all();

    eol_particle_update_all();
    eol_window_update_all();

    eol_graphics_frame_begin();
    eol_window_draw_all();

    sprintf(fps,"FPS: %f",eol_graphics_get_FPS());
    eol_font_draw_text_justify(
      fps,
      640,
      0,
      eol_vec3d(1,0,0),
      1,
      2,
      eolJustifyRight);

    eol_mouse_draw();
    eol_graphics_frame_end();

    if((eol_input_quit_check()) ||
      ((eol_input_is_key_pressed(SDLK_F4)) && (eol_input_is_mod_held(KMOD_ALT))))
    {
      eol_dialog_quit();
    }
  }while(!done);
  exit(0);
  return 0;
}