|
-
Nov 28th, 2001, 05:42 PM
#1
Thread Starter
Addicted Member
C++ gaming
i'm a newbie with C++ and i would like to ask something...
is it possible to program games in C++??
cause i can only program in that black window that only displays
words...
-
Nov 28th, 2001, 06:09 PM
#2
Frenzied Member
Yes, it most certainly is. C or C++ are the languages of choice for most game developers.
I guess you are talking about the console window that you can use for input and output in your Win32 Console Application projects. They are really useful when you only need a very simple interface for your app, like command-line stuff. They are also very good when you are learning the language because it keeps the interface nice and simple and allows you to concentrate on the code you write to go behind the interface - the main application logic.
If you want to write games that use an interface other than the command line, you need to learn about the API of another style of interface for your game. That can be:
- Win32 APIs - this is fairly simple to learn (not that simple for anyone new to programming though) but is also pretty slow compared to other APIs. Good for stuff which isn't pushing the limits of your computer's performance when you want simple code.
- X Windows APIs - this is basically the same as the Win32 APIs but for X Windows, which is the most common Linux/Unix windowing system. Good if you're not using Windows
- DirectX APIs - this is Windows-specific and is more complicated than the standard Win32 APIs. It's also much lower level and faster. Contains many different APIs for input, graphics, sound, networking and so on.
- OpenGL - this is an open-standard, well-established graphics API. Performance-wise and complexity-wise it's basically the same as DirectX Graphics. It has the benefit of being platform-independant.
For games programming advice (especially in C/C++) you might want to try www.gamedev.net or www.flipcode.com .
Harry.
"From one thing, know ten thousand things."
-
Nov 29th, 2001, 03:04 PM
#3
Thread Starter
Addicted Member
HarryW,
thanx for the reply,
yeah i was talking about the console window
but how do you add pictures to C++ like you do in VB?
or do you have to open it from the file?
-
Nov 29th, 2001, 03:22 PM
#4
Hyperactive Member
Whoa whoa, you obvious have the wrong idea. Visual Basic was written in C++. If you want to draw a picture on the screen you need to use special header files that call APIs that will in turn draw pixels etc. You don't build GUI's visually in C++. You have to map out all the coordinates, width, etc. then render them on the screen through code.
C++ is all code. There is no drag and drop, or insert image options.
-
Nov 29th, 2001, 03:33 PM
#5
Monday Morning Lunatic
Well, you can use CreateWindow to get a button, fairly simple.
It's not as low level as all that.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 29th, 2001, 03:35 PM
#6
Hyperactive Member
It isn't hardly low level, but maybe I'm talking too much about game programming, which I thought was the topic. For gaming you need to get low level to get bettter performance. However, windows API isn't nearly that difficult, but you still need to provide it's functions, etc. with the appropriate arguments.
-
Nov 29th, 2001, 03:38 PM
#7
Monday Morning Lunatic
Originally posted by JaredM
It isn't hardly low level, but maybe I'm talking too much about game programming, which I thought was the topic. For gaming you need to get low level to get bettter performance. However, windows API isn't nearly that difficult, but you still need to provide it's functions, etc. with the appropriate arguments.
Maybe. But for a lot of game programming, by its very nature the final output method is abstracted away.
Just talk to kedaman about device independence
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 29th, 2001, 03:40 PM
#8
Hyperactive Member
-
Nov 29th, 2001, 04:33 PM
#9
Addicted Member
Is the windows API hard to learn?
-
Nov 29th, 2001, 04:33 PM
#10
transcendental analytic
Good thing about C++
Is that it supports Generic Programming, You don't need to get down dirty to lowlevel and do **** and screw all paradigm just because of some small performance gain. C++ is the language where you build layers upon layers of interfaces which you can model into a code that is totally device independent, the timecritical blocks will be safely behind bottomlevel layers and no paradigm polution will prevent you from building your software empire, fast with safe reusable and easy OOP and highly reusable and efficient Generic Programming.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 29th, 2001, 04:35 PM
#11
transcendental analytic
Originally posted by [praetorian]
Is the windows API hard to learn?
No, but it takes a lot of time and worst thing is it's functional style. I'm working on a easy to use OOP version of it with a little help from parksie
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 29th, 2001, 04:38 PM
#12
Monday Morning Lunatic
Definitely a little 
Although its functional style is a necessary by-product of the fact that it is the lowest layer, as far as your programs are concerned. Even people who program in asm call on the Win32 API.
So, what I'm supposed to be doing is converting the API declarations into a slightly more generic-friendly interface, while ked does the real thinking
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 29th, 2001, 04:48 PM
#13
Addicted Member
I'm just about to decide whether to buy Petzold's Programming Windows with the API or to get Programming windows with the MFC by Jeff Proise, I posted that question today in a new thread:
http://www.vbforums.com/showthread.p...hreadid=123176
The problem is thou, that I do not know so much C, but I know c++, is it possible for me to understand that book despite this?
And be able to write programs that use API after having read that book?
thanx!
-
Nov 29th, 2001, 05:37 PM
#14
Hehe, here is something I KNOW =).
As kedaman said, abstraction layers are fun. At the moment, my engine has places where the abstraction goes 8 levels deep to actually get to a rendering API (Direct3D in this case), spanning 2 DLLs. I use a time tested method for combating dangling pointers, HANDLEs. You get a HANDLE for each object. You pass the HANDLE to a DLL function, which attempts to get an object. The function it tries to get an object from checks the handle, and gives out the pointer if the handle is correct, etc, etc.
The abstraction hides all of the evil implementation stuff away from me (i hardly touch anything closer then 3 levels up from the bottom).
The only problem with this is that it is more intuitive to create a C like interface. I then will have to wrap that up into classes (there is another layer).
It is fairly easy to program games, or other graphical applications using C++. You just have to understand a couple of API things. I started DX in VB, then learned how to create a window... and VB went out the window. C++ is far cleaner to use, in my opinion.
Z.
-
Nov 29th, 2001, 05:49 PM
#15
Monday Morning Lunatic
That's not what we meant.
The idea is that you use templates, so all the abstraction is at compile-time (i.e. minimal or no performance penalty).
For example, you have constant types that resolve to an int, but you can't combine them (the compiler complains). Basically it's to stop you from being an idiot, and hopefully cut down on debugging time.
Kedaman - was that a good enough understanding of your quest for global domination?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 29th, 2001, 06:57 PM
#16
transcendental analytic
pretty good but the power of the crystal clear paradigm of OOP is still in my head that is waiting for it's release; where objects are parameterized from interconnective units to dimensions and as nested modifier streams for further parameters and not to forget parameterization for purpose as functors to compact all activity into safe types. And then it will be borkification, a revolution for us all 
Zaei, polymorphism is good, just don't let it become an overhead in time critical procedures, whenever possible whenever you don't need to change layers at runtime you can use pseudo polymorphism using templates
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 29th, 2001, 07:06 PM
#17
It's pretty fast. All rendering is done inside of one DLL, the same one where the objects are stored. This allows quick access directly into a vector with only a single HANDLE check. All Objects have a Render() function, so When I call RenderObject() the handle is pushed onto a stack, and when the scene is finished, everything is drawn in one go. I have ~0ms render time, with several thousand triangles (my card isnt so good, so thats a good number =).
Oh, and the Handle Check is inline.
Z.
-
Nov 29th, 2001, 07:16 PM
#18
transcendental analytic
Do as you wish There's avoidable cpu cycles in the virtual function calls
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 30th, 2001, 10:40 AM
#19
Virtual functions are my friend =).
Z.
-
Nov 30th, 2001, 10:41 AM
#20
Hyperactive Member
Virtual function?
-
Nov 29th, 2002, 02:46 PM
#21
Fanatic Member
There is a MUCH easier way to make windows with C++:
MFC!!! (Microsoft Foundation Class)
The MFC "Hides" all the rough code.
And in Visual C++ 6 you can make a window almost exactly the way you do it in Visual Basic.
-
Nov 29th, 2002, 03:03 PM
#22
Monday Morning Lunatic
MFC? Ugh.
/slap
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 30th, 2002, 12:32 PM
#23
Frenzied Member
-
Nov 30th, 2002, 12:33 PM
#24
Fanatic Member
What???? MFC is easy!
Do you make windows the hard way?
-
Nov 30th, 2002, 02:34 PM
#25
Monday Morning Lunatic
API was easier for me when I still used Windows, yeah.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 1st, 2002, 12:42 AM
#26
Frenzied Member
Look, Ive never posted in this thread before! o.O
MFC, a wonderful example of the sacrifice of speed, size and flexibility for ease of use.
Z.
-
Dec 1st, 2002, 01:05 AM
#27
Frenzied Member
just might be easier to use vb in that case
-
Dec 1st, 2002, 05:56 PM
#28
Originally posted by kedaman
No, but it takes a lot of time and worst thing is it's functional style. I'm working on a easy to use OOP version of it with a little help from parksie
Really? I thought you've given up that project in favor of squirrel?!
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2002, 05:57 PM
#29
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2002, 06:01 PM
#30
I like MFC, yet I would never dare to recommend it to a programming newbie.
MFC is somewhere in-between VB and pure API. Not as bloated as VB and faster, with the full power of C++ behind its back, but not as clean, small and fast as pure API. But it's harder to learn than VB, and even though you can use it without knowing the API doing so will sooner or later result in problems. I'd be terribly lost by know had I never learnt the API, even though I mostly use MFC for app development.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2002, 07:05 PM
#31
transcendental analytic
Originally posted by kedaman
worst thing is it's functional style
I can't believe i'm saying this 
wait a minute, when did I post this?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 1st, 2002, 07:23 PM
#32
Monday Morning Lunatic
A long time ago.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 2nd, 2002, 03:09 AM
#33
transcendental analytic
its all coming back now.. memories, hehe this was even before i came up with the generic expression templates
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 2nd, 2002, 06:35 AM
#34
Yes, only later realized how old this thread is...
Who brought this back to the front? Zaei?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 2nd, 2002, 06:47 AM
#35
Monday Morning Lunatic
petrus.
Probably the result of a search, that's how most of them happen. Over at the antionline forums, they have a feature whereby the dates are wrapped in <blink> tags if they're older than a set period, which is quite nice.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 2nd, 2002, 07:22 AM
#36
We should recommend that over at Galahtech, it might be useful in a few months...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 2nd, 2002, 12:39 PM
#37
Fanatic Member
Yeah I searched for something and found this one...
-
Dec 2nd, 2002, 01:45 PM
#38
PowerPoster
Originally posted by parksie
petrus.
Probably the result of a search, that's how most of them happen. Over at the antionline forums, they have a feature whereby the dates are wrapped in <blink> tags if they're older than a set period, which is quite nice.
<blink> tags don't do anything for me... maybe it should be put in a <marquee> tag.
-
Dec 2nd, 2002, 04:24 PM
#39
Frenzied Member
Originally posted by CornedBee
Yes, only later realized how old this thread is...
Who brought this back to the front? Zaei?
Ive enough to do without bringing up old topics! =)
Z.
-
Dec 2nd, 2002, 04:36 PM
#40
Don't know, I just looked which post had the least connection with the others. I deemed it unlikely that you would really have done it, but stranger things have happened.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|