2D Game Dev – Part 14.4 – Deploying our Allegro 5 Game in Visual Studio 2010

This post is a portion of Part 14 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.

Time to build our game! In this video I show you how to use Visual Studio 2010 to build a custom installer for your game. Using this installer, you can send your game out and have people enjoy the fruits of your labor. Isn’t that what it’s all about?

 

Posted in 2D Game Dev, Allegro, C++, Code, Game Dev, Part 14, Tutorial
12 Comments » for 2D Game Dev – Part 14.4 – Deploying our Allegro 5 Game in Visual Studio 2010
  1. Aksel says:

    Is there any way to do this in the Express version? It doesn’t seem to have any of those templates.

  2. binks says:

    Which Visual Studio version of 2010 do you use?

  3. sparksplur says:

    Could u possibly do a tutorial on user text input in a allegro 2d game, like for example asking the ”player” his/her name at the start and storing it to use later like when the scored is displayed?

    • JoaoFaria says:

      //the following code show how to do a basic player name input (THIS IS NOT A FULL CODE)

      ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue();

      al_register_event_source(event_queue, al_get_keyboard_event_source());

      string player_name=”";

      //draw function

      bool done=false;
      bool maius=false;//this tells you wen your pressing Shift
      while(!done)
      {
      ALLEGRO_EVENT ev;
      al_wait_for_event(event_queue, &ev);
      if(ev.type == ALLEGRO_EVENT_KEY_DOWN)
      {
      switch (ev.keyboard.keycode)
      {
      case 215:
      maius=true;
      break;
      case ALLEGRO_KEY_ENTER:
      if (player_name.length() > 0)
      {
      //the code you want then you press enter
      //done=true;//uncomment if u want the input to end here
      break;
      }
      else break;
      case ALLEGRO_KEY_SPACE:
      if (palyer_name.length() > 0 && palyer_name.length() < name_limit)//in this case the name can't have more than 15 charecters
      {
      string algo;
      ostringstream convert;
      convert < 0)
      {
      palyer_name.erase(player_name.end()-1);
      //draw function
      break;
      }
      else break;

      default:
      if (player_name.length() < name_limit && ev.keyboard.keycode = 1)
      {
      string algo;
      ostringstream convert;
      if (maius == true)
      {
      convert << (char (ev.keyboard.keycode+64));
      }
      else
      {
      convert << (char (ev.keyboard.keycode+96));
      }
      algo = convert.str();
      const char *outro = algo.c_str();
      plyer_name.append (outro);
      //draw function
      break;
      }
      else break;
      }
      else if(ev.type == ALLEGRO_EVENT_KEY_UP)
      {
      if(ev.keyboard.keycode == 215)
      {
      maius= false;
      }
      }
      }

      al_destroy_event_queue(envent_queue);

      From this code you will probably want to add a mouse input that do something like.. when you press the text box (you must make one inside your draw function) you will change a variable done_with_name to false and all the above code should be inside a while(!done_with_name), that way only when u press the textbox, you can type the player's name.

      warning: Your draw function will need to recive the player_name string.

      If you need other charecters than leters, just type after the if(ev.type == ALLEGRO_EVENT_KEY_DOWN), "cout << ev.keyboard.keycode<<endl;", then go to a ASCII code table and look for the key you pressed. after that its all about (char (ev.keyboard.keycode + correction)) where correction is the increment/decrement that you need to make, so that part correspond to the ASCII code you want :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Error: Twitter did not respond. Please wait a few minutes and refresh this page.