Reputation: 20 Tradesman
- Active Posts:
- 55 (0.06 per day)
- 19-June 12
- Profile Views:
- Last Active:
- Jan 30 2015 01:52 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
19 Jan 2015 - 21:07
20 Apr 2014 - 07:50
18 Apr 2014 - 10:45
03 Mar 2014 - 10:06
01 Mar 2014 - 21:22
06 Jan 2014 - 11:03
22 Jan 2013 - 00:32
21 Jan 2013 - 11:18
24 Oct 2012 - 13:30
20 Oct 2012 - 05:55
Posts I've Made
Posted 27 Jan 2015Then I would advocate avoiding the initial pitfall of trying to build a game from scratch and go use an existing engine to get the lay of the land first. I am a fan of Unity.
Thanks for this (as I think) well-intended advice, but actually building a game from scratch has quite a big appeal with me. Maybe I am bit naive, but I'd really like to develop a game without Unity or similar. Also to train my C++ skills. />
If you just want to make a game without having to do a hell of a lot of programming, go for something like Unity, as modi123_1 suggested.
If you do want to write everything from scratch (which is a good way to learn about game programming and rendering etc.) then my recommendation is to go with SFML or SDL first, as they're very easy to get set up and start working with. They also both focus on 2D rendering, which allows you to start learning some of the basics without any knowledge of 3D maths.
Then, once you've started to make some progress with those, and perhaps made a couple of simple games (or cloned some popular ones like Tetris and Space Invaders), start looking at learning DirectX and/or OpenGL and writing some 3D rendering code, and try making a game with that.
Posted 27 Jan 2015Can you provide some context?
What are you trying to use perspective projection for?
Do you already have some code that you're starting with?
What tools are you using?
Essentially, 3D projection is the name given to the process of taking some 3D geometry and representing it in 2D (i.e. on the screen, which is flat and 2D). Perspective projection is doing exactly that, in a particular way so that the result represents the geometry in a perspective manner (i.e. things further away appear smaller).
The standard method of doing this is to take the geometry and transform it with a series of matrices (the exact combination depends on the geometry that you're using).
Usually this consists of transforming a point from World space to View space (space relative to the eye/camera) using a view matrix, then from View space to Projection space (the 2D space relative to the viewport) using a projection matrix. Then finally, in most cases in 3D graphics this is usually translated to pixel space by mapping the projection space to the pixels (e.g. the buffer for the screen, or texture acting as the render target).
Often, the vertex will begin in "local" space (relative to the model's own origin), and so must be transformed into World space using a world matrix.
To be honest, I recommend just searching on Google for this. If you're using any common tools (DirectX, OpenGL, XNA, etc.) you'll find plenty of code and tutorials. Plus, most of the info you'll find will also include good diagrams and more detailed descriptions of how to create each of the different matrices.
Posted 18 Jan 2015Your problem is that you're calling apply_surface(box[index].x, 0, redPiece, screen); within the input function only when the mouse button is pressed.
You should move it to be called just after you've rendered your background.
Posted 13 Jan 2015My initial guess is that you're possibly calling piece.show(); in the wrong place or perhaps there's something else slightly wrong in the logic of your code.
Please could you post your updated source code so we can take a look and provide a proper answer?
Posted 11 Jan 2015So if you want to display anything put it in a loop and use SDL_FillRect to refresh the screen?
In the long-term, and in larger games, it's sometimes the case that you may need to do something a little more sophisticated, like render certain parts to a texture to apply effects or render different components at different times.
But, for the most part, a "render pass" will consist of clearing the render target (i.e. the buffer that will be presented to the screen) and rendering all of your content.
Using SDL_FillRect with black just draws full black over the previous content, effectively clearing it. Then over that you render everything.
- Member Title:
- D.I.C Head
- 22 years old
- October 14, 1992
- Full Name:
- Years Programming:
- Programming Languages:
- Website URL: