Simple Question?
I''ve looked at the source to as many simple games as I could find in C but one major thing seems to be uncommented in them, how exactly do you draw something simple on the screen, like a box, and move it round with the keyboard? Is there anywhere where I could find something like this, not a full game, just that part?
Thank You
Hate to have to tell you this but... that''s not a very simple question.
First off we need to know what operating system and API''s you''re using. Then we can give you an idea, but it''s going to be something to the effect of "In DirectX, first make primary and backbuffer drawing surface, then draw a rectangle on the backbuffer, flip it to front, then use windows message handlers to catch the DInput messages from your keyboard, then redraw your rectangle on your back buffer and flip it to the front accordingly".
I would suggest picking your API, then getting a book that can step you through basic drawing and basic input routines, because there''s a lot of stuff to know. If you''re going with DirectX I suggest Tricks of the Windows Game Programming Gurus by Andre LaMothe, or if you want to use DX8, the docs that come with it. If you''re not, I''m sure we can come up with another suggestion.
-fel
First off we need to know what operating system and API''s you''re using. Then we can give you an idea, but it''s going to be something to the effect of "In DirectX, first make primary and backbuffer drawing surface, then draw a rectangle on the backbuffer, flip it to front, then use windows message handlers to catch the DInput messages from your keyboard, then redraw your rectangle on your back buffer and flip it to the front accordingly".
I would suggest picking your API, then getting a book that can step you through basic drawing and basic input routines, because there''s a lot of stuff to know. If you''re going with DirectX I suggest Tricks of the Windows Game Programming Gurus by Andre LaMothe, or if you want to use DX8, the docs that come with it. If you''re not, I''m sure we can come up with another suggestion.
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Well - you could get a wide variety of answers to that one
Basically, you need to program some form of drawing capabilities. You could use DirectDraw, some other graphics library like Allegro, or go at it the hard way and program the VGA directly via DOS (probably not your best option).
If you take a look at DirectX, it has probably the easiest 2D feature set, at least it did when I used DX7, I hear they''ve integrated DDraw with D3D in DX8, but thats something else...
So, essentially you need to get together your graphics initialisation code, and set up your screen, then you could probably draw directly to the video buffer - it may not be very fast or efficient, but it would let you play around with stuff.
When you move into keyboard control you can get complex quickly, or you can stick with simple windows messages for keypresses.
I don''t really have any great web links for this kind of thing off hand, not because there arn''t any but because I just don''t remember them
You could try getting a decent book if you can afford it - Tricks Of The Windows Game Programming Guru''s seems to be favoured, even though it is becoming dated, it is still a good starting point.
Hope that helped some, I''ll update later if I find any good references for you.
-Mezz
Basically, you need to program some form of drawing capabilities. You could use DirectDraw, some other graphics library like Allegro, or go at it the hard way and program the VGA directly via DOS (probably not your best option).
If you take a look at DirectX, it has probably the easiest 2D feature set, at least it did when I used DX7, I hear they''ve integrated DDraw with D3D in DX8, but thats something else...
So, essentially you need to get together your graphics initialisation code, and set up your screen, then you could probably draw directly to the video buffer - it may not be very fast or efficient, but it would let you play around with stuff.
When you move into keyboard control you can get complex quickly, or you can stick with simple windows messages for keypresses.
I don''t really have any great web links for this kind of thing off hand, not because there arn''t any but because I just don''t remember them
You could try getting a decent book if you can afford it - Tricks Of The Windows Game Programming Guru''s seems to be favoured, even though it is becoming dated, it is still a good starting point.
Hope that helped some, I''ll update later if I find any good references for you.
-Mezz
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement