C++ Tip – Shorthand Struct

March 22nd, 2010 by Tim Jones 1 comment »

Here’s a quick helpful tip that people often overlook. You can quickly initialize the values of a struct using shorthand notation:

struct SEntity {
    int X;
    int Y;
};

SEntity Player = {0, 0}; //Coordinates X , Y

Please note you can only do this when you create your struct object. This will not work:

struct SEntity {
    int X;
    int Y;
};
 
SEntity Player = {0, 0}; //Coordinates X , Y
 
Player = {10, 10}; //Error!

You can even nest:

struct SCoords {
    int X;
    int Y;
};
 
struct SEntity {
    SCoords Pos;
 
    int Speed;
};
 
SEntity Player = {{0, 0}, 0}; //Coordinates X , Y, and Speed

Shot of Jaq

March 22nd, 2010 by Tim Jones No comments »

My brother-in-law introduced me to a very interesting podcast today, called Shot of Jaq. These two guys basically pick a technology related topic, discuss, and then turn over the discussion to the community. The latest podcast talks about how can we interest this new generation to learn programming. I believe that SDL is one such technology to help bring in this new generation.

Check it out here.

Google Summer of Code 2010

March 22nd, 2010 by Tim Jones No comments »

Official SDL Announcement:

That’s right, we’re back again for Google Summer of Code 2010!

Thanks to Google and the great students we’ve had, we’re going around for another year!

The Google Summer of Code is a program in which students from all over the world are invited to apply to help out open source projects over the summer for a significant stipend. Even if you’re not interested in helping out SDL, there are lots of great projects to choose from!

Please check it out on the SDL website at:
http://www.libsdl.org/gsoc.php

Because we’ve had applicants with widely varying skill levels, this year I’m asking all prospective applicants to submit a sample patch for SDL 1.3. It doesn’t have to be big or even accepted, but it does have to show familiarity with the development process and good coding practices.

Happy Coding! :)

-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Tetris Clone Contest – Prize Update

March 19th, 2010 by Tim Jones No comments »

I’ve updated the prize to $20, just as a small incentive. I know it’s not much, but hey, it’s something right?

Check out the Contest here.

SDL Tip – CD Drives

March 19th, 2010 by Tim Jones 3 comments »

Did you know that SDL can control attached CD / DVD drives? You can query various information about them, open the drive, close the drive, and even play audio tracks.

SDL_Init(SDL_INIT_CDROM);

int NumDrives = SDL_CDNumDrives();

if(NumDrives <= 0) {
//No drives available
}

int Track = 1;
SDL_CD* CDDrive = SDL_CDOpen(0); //Open first Drive

if(CDDrive == NULL) {
//Bad drive
}

if(CD_INDRIVE(SDL_CDStatus(CDDrive))) {
    SDL_CDPlayTracks(CDDrive, Track, 0, Track+1, 0); //Play first track
}

while(SDL_CDStatus(CDDrive) == CD_PLAYING) {
    SDL_Delay(1000); //Wait
}

SDL_CDEject(CDDrive); //All done!
 

For more information on this visit the SDL docs here http://www.libsdl.org/docs/html/cdrom.html.

C++ Tip – Console Closes

March 19th, 2010 by Tim Jones 3 comments »

If you are having trouble with your C++ programs opening and closing really fast, here’s a quick fix. Add the following code to the end of your main function:

cin.get();
 

This will cause the console window to wait for input before it closes. I recommend people avoid the use of system(“PAUSE”) for several reasons. As for some explanation as to why, look at this website:

http://www.gidnetwork.com/b-61.html

Though this may seem like an obvious thing to do, many many beginners always ask me how to do this.

Attack of the Hover Cat

March 19th, 2010 by Tim Jones 2 comments »

Tetris Clone Contest Follow Up

March 19th, 2010 by Tim Jones No comments »

How’s everyone doing on the contest. Is anyone participating? I hope so. Here’s a bit of inspiration to keep you going:

I like how they added the ability to swap between two shapes, and how certain shapes group together.

The interesting thing about Pokemon Puzzle League is how the entire play area is really a cylinder that can rotate around.

Dr. Robotniks Mean Bean Machine is good in terms of multiplayer play.

DJSBX Music

March 18th, 2010 by Tim Jones 2 comments »

I’ve been trying to catch up on some things on here, and on the forums – and I remembered that DJSBX mixes music. So, I decided to check his website again (http://www.djsbx.com/). I was surprised to find that he has two albums up that are pretty good. So, I wanted to give a big kudos out to him for his excellent work, and give him a quick plug on here. I encourage everyone to check his music out. “Kinetic Dream” is probably my favorite and “Did Your Phone Just Ring?” is just plain weird :) . I am in the middle of listening to his 2nd album on there, so I can’t say much on that one yet.

On another gaming music related note, everyone should also check out OverClocked ReMix (http://ocremix.org/). It’s a fairly large community with members that dedicate music to remixing video game music. I’ve downloaded my fair share of Final Fantasy mixes, Zelda mixes, and the like – and there’s a lot of good music on there. This may be useful when putting together some clones (like, maybe, for some Contest going on right now?) or putting some music on to your game. I don’t recommend using the music though if you plan to sell anything.

More Blog Like?

March 17th, 2010 by Tim Jones 2 comments »

Quick question for all you people out there:

Should I post on other related programming topics, to be more like a Blog?

View Results

Loading ... Loading ...

Edit:
Alright, I’ll give it a shot and see how it goes.

C++ Variables

March 17th, 2010 by Tim Jones 1 comment »

Congrats. You are one tutorial closer in the wonderful world of programming. Up to now, you should be somewhat comfortable with CodeBlocks, and have a very basic understanding of how a program works. In this tutorial we are going to look at something called variables.

» Read more: C++ Variables

New Contest

March 5th, 2010 by Tim Jones 11 comments »

Well, I’ve been on this overtime marathon again at work, so I haven’t had any time to do much on here. Well, lets fix that. I can’t really offer any prizes this time, but hopefully that doesn’t deter people.

The Goal: Make a Tetris-like game
The Inspiration: Tetris, Pokemon Puzzle League
The Rules: This contest is open to all game developers, with the following requirements and/or conditions:

  1. No more than 3 people per project
  2. You may submit as many projects as you like
  3. I prefer SDL / C/C++ (optionally can use OpenGL with SDL); SDL must be used. Other languages allowed: Delphi, VC++.NET, Java
  4. Project must compile/work on at least one major operating system (Windows, Mac OSX, *nix); extra bonus points for cross-platformy*
  5. You give SDLtutorials.com permission to use any and all submitted resources, code, and/or files for non-commercial use. Submitter retains the rights to his/her project. (SDLtutorials.com will most likely use the winning project as the basis for a tutorial)
  6. All code, resources, and/or files submitted must be the submitters original work, with the exception of use of 3rd party open-source libraries, and/or royalty free resources. No commercial libraries and/or resources are allowed, and will result in immediate disqualification.
  7. No plagiarism is allowed, with the exception of the “minor”** use of code from tutorials. Code used from tutorials cannot make up more than 20%** of a submitted project’s code. You may use the framework provided on this website without limitation.
  8. SDLtutorials.com has full discretion to accept/reject any projects submitted, and can cancel this contest at any time.

* No actual points are involved in the judging of entries.
** This, obviously, is hard to determine. Be fair, do your own work; if you use code from online, make it your own.

The Details:

  • The game should play / look like a Tetris clone
  • You must provide a completely working no time-limit game. (Meaning, there don’t have to be levels, bosses, etc.)
  • The game should at least be point based
  • You must provide a basic menu (Start, Exit at minimum)
  • The game may be 2D or 3D (using OpenGL), and may use scripting

The Prize:

  • $20.00 (PayPal)

The Deadline:
May 1, 2010

Once all entries are received, I will post 5 of the top projects received. The community will then be able to voice their opinion (which should help weed out any plagiarism). A week after the deadline, I will post who is the winner. If I cannot contact the winner within 30 days, the 2nd place project will become the winner (and so on).

You have plenty of time, make it as cool, and interesting as possible. I could probably make a straight Tetris clone in a day, and all you will have almost 2 months. The only thing I don’t necessarily want to see is something exactly like Tetris (not unless you put some crazy spin on it).

Please send all completed Projects to: tim [at] metacipher.com

You may send your project multiple times up to the deadline. The last project I receive before midnight is the one that I will use.

Good luck everyone!

Terms are subject to change at any time; I will give notice to such changes.

The following are some guidelines for when you submit projects. A real quick note first: by submitting your project multiple times up to the deadline, I can give you feedback and/or help. Please note, I will not give you any code, or any links to code. All I will simply do is point you in the right direction. This should even the playing field a bit for newbies.

  1. Please provide a project file and/or makefile for me to compile your code depending on the target platform.
  2. Please include any and all libraries involved with your project; already compiled. I don’t want to have to sit here for hours compiling libraries that are used in your project. Exceptions: if the library is easy to grab myself, simply let me know in a ReadMe.txt or something (i.e., being able to apt-get what I need, or simply download).
  3. Please compress your project into a single file, and email it to me with the subject: CONTEST – [My Project Name] ; remember, email to: tim [at] metacipher.com
  4. Though you can submit projects ahead of time for help, please do not submit your project more than once a week to me. I will provide help, but very limited; remember, this is a contest. I would only ask for help if you really need it; it’s very likely I’ll give more kudos to a project that asked for very little to no help, v. the person that asked every week.
  5. Please…. please! Comment your code. Please.

A Guide to Graphics with Sprig

February 9th, 2010 by Jonny D 3 comments »

The following tutorial was created by Blue Dino Code, for the purpose of helping people like you learn SDL. This tutorial, though not purposely a part of the SDLTutorials.com or created for the series, may be a branch or addition to the series. Please read notes by the author for any additional code and/or framework used by the author. SDLTutorials.com does not endorse or reject any of the coding practices outlined in the tutorial, and is not responsible for any code or files belonging to this tutorial that harms your computer.


A Guide to Graphics with SPriG

Prerequisites:
Some knowledge of SDL (see Installing SDL)

The SDL Primitive Generator, SPriG, is a quick and simple interface to making graphics on SDL surfaces. In this guide, I’ll be discussing the notable features of Sprig with usage examples. Not all of the functions are described here. There are plenty more to be found in the documentation once you get the hang of the stuff found here. I will, however, be describing the entire dirty rect interface.

» Read more: A Guide to Graphics with Sprig

SDL Per Pixel Collision

January 28th, 2010 by Jason Norris 6 comments »

Are bounding box and circle collisions just not cutting it? Well, now we’re going to dive right down into pixel precision!
» Read more: SDL Per Pixel Collision

New WordPress Theme

January 16th, 2010 by Tim Jones 4 comments »

We’re trying out a new wordpress theme in hopes that more content can fit on a page. In addition, I have turned on nested comments, comment pagination, and I am moving a bunch of things around. Let me know what you like, dislike, or just plain hate.

Also, I encourage people to register for an account as well.