Jump to content
  • Advertisement

nathan.morgan

Member
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

215 Neutral

About nathan.morgan

  • Rank
    Newbie

Personal Information

  • Role
    Programmer
  • Interests
    Programming

Recent Profile Visitors

792 profile views
  1. nathan.morgan

    General advises on conception of a game engine

    Software development is an iterative process. You need to constantly refactor and evovle. So don't be afraid to do that.   Personally, I spend a great deal of time writing down all that I wish to include in my engine. I then break them up into small modules. I always have a game in mind when I'm writing an engine. I run the game through (in my mind) the modules that I've written down and see if I've missed anything.   Have a clear picture of what kind of games you wish to develop with your engine. Think up a few full fledged demo that you would like to write once your engine is done. Once again, this is an iterative process. When you've run your simulations a few times, you will slowly see new relationships and modules emerge. Add them to your list and do the simulations again. When you reach a point where you're not adding anything new, stop, get out of the loop and start writing.   I would recommend this book: http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 Code examples are mostly in C++, but the general idea carries over to all OO languages.   It's okay to have forgotten or missed something. Write code to be reusable and as decoupled as possible. This will allow you to add new modules easily.   While difficult to learn, I would strongly recommend you look into TDD: http://en.wikipedia.org/wiki/Test-driven_development This will help you catch bugs early on and TDD will force you to write decoupled code.     Edit: Forgot to add. I'm fairly new to game programming. But not new to software development in general.
  2. nathan.morgan

    Rotating point around point in 2D

    What Álvaro said.   You need to convert to radians.   You also need to translate to the origin, rotate and then translate back.   Here is your rotate method, this should probably work: void Rotate(sf::Vector2f & p, double angle, sf::Vector2f r) { double pi = 3.14159; float rad = angle*pi/180.0f; float s = sin(rad); float c = cos(rad); float rx = r.x; float ry = r.y; r.x -= p.x; r.y -= p.y; p.x = rx + r.x * c - r.y * s; p.y = ry + r.x * s + r.y * c; }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!