Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Sep 2011
Offline Last Active Jun 18 2013 11:15 PM

Posts I've Made

In Topic: C++ % Operator Problem

12 October 2012 - 11:02 PM

I believe the modulus operator (%) only works with integer types. You'll have to convert fn and sn to integer if you want to use it.

Or...a quick search on google and I stumbled upon "fmod". Used like so:
fmod(5.5, 3.5) // takes numerator and denominator
Note: I've never used this function before, so no promises. Though I believe you need to include the math header file to use fmod.

In Topic: Allegro moving rectangle help

06 October 2011 - 08:15 AM

There are many ways to make updates to the screen. One simple way is to redraw everything every frame. This way is very easy. Doing like you are trying to do, drawing the background over the previous location of the paddle, should work fine in this simple case with single coloured background and non overlapping objects.

You should call this before updating y1 and y2.

Also get rid of the calls to rest here. I don't see why you have them here. You know what rest do, do you? It waits the number of milliseconds. This might explain why you get "flicking black". If you want to call rest do that somewhere else once per frame instead.

Your approach is probably faster than redrawing everything every frame but the question is how much? Does it really matter? I have never used Allegro so I don't know.

I have the rest to actually control how fast the box moves. When I take the rest out, you see a quick flicker of white, and the box is way gone out of the picture.

In Topic: Beginning Game Programming

24 September 2011 - 04:43 PM

Hi everyone! I've been reading the forums for a few days now and finally broke down and made an account to see if I could get your opinions...

To start off, yes I have been teaching myself C++ for awhile now, and I got most of the basics down, and learning more advanced such as objects and classes, etc...

Simply speaking though, I am wanting to get into game programming, whereas right now I am solely doing programming. What would be the best option (and/or tool) for me to add gaming to my programming list? Obviously since I have no prior experience in the gaming programming field, I want to start off very basic, such as 2D. I've read about Allegro and seen it to be a good starting position, though I was unsure of how good of quality you can make with it alone.

And yes I've read through other posts, I've seen other engines and such, and I know this question has been asked a million times before. I just want to know where my best start would be with C++, as I've been getting various answers everywhere...so I want real programmer's opinions.

Any and all advice will be greatly appreciated, please feel free to throw anything you have out here, even if it's the most basic of all programming. I just want a place to start, and possibly something I could grow into a larger field.

Thanks for reading!

First, my biggest advice would be not to start with C++, but then, nobody ever listens to that one bit of advice for whatever reason...

If you are indeed going to go ahead with C++ I put together this link that contains tool, book and library recommendations for learning C++ for game programming. Also, I am doing a longer tutorial series on writing a game in C++ using SFML. It goes into a lot more depth than most tutorials and hopefully will make you a better C++ programmer as a result. Most tutorials focus on a specific feature or are simply bad code, leading to a very bad foundation for new programmers to start with, hopefully this series of tutorials results in some slightly better beginner code. :) Still a WIP though, so not complete yet.

I recently read that on this site and wished I would have seen this BEFORE getting a good deal into C++. I own the C++ for Dummies Reference all-one-book (and I'm not sure how you guys feel about dummies books, so don't make fun :P) and am about 300 pages in. I guess technically I could switch to a different language, though I am far into it (or so I think) and in my eyes it seems like I should just stay with it...however, if you feel a different one, such as C# would be better, even at this point then let me know before I drag myself deeper!

I do appreciate it though, I will check out the links and tutorials you gave. On another note, if I do stay with C++, shall I continue learning it completely (ie; finish the book first) before attempting to fiddle with the gaming side? Or go ahead and start messing with gaming programming?