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...
Printable View
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...
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 .
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?
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.
Well, you can use CreateWindow to get a button, fairly simple.
It's not as low level as all that.
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.Quote:
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.
Just talk to kedaman about device independence ;)
Yep.
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.
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 ;)Quote:
Originally posted by [praetorian]
Is the windows API hard to learn?
Definitely a little :p
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 :D
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!
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.
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? :)
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 :D
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 :)
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.
Do as you wish :) There's avoidable cpu cycles in the virtual function calls ;)
Virtual functions are my friend =).
Z.
Virtual function? :confused:
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.
MFC? Ugh.
/slap
:)
*double slap*
What???? MFC is easy!
Do you make windows the hard way?
API was easier for me when I still used Windows, yeah.
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.
just might be easier to use vb in that case
Really? I thought you've given up that project in favor of squirrel?!Quote:
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 ;)
*BANG* (head explodes...) :DQuote:
Originally posted by kedaman
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 :D
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.
I can't believe i'm saying this :eek:Quote:
Originally posted by kedaman
worst thing is it's functional style
wait a minute, when did I post this?
A long time ago. :D
its all coming back now.. memories, hehe this was even before i came up with the generic expression templates :D
Yes, only later realized how old this thread is...
Who brought this back to the front? Zaei?
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.
We should recommend that over at Galahtech, it might be useful in a few months...
Yeah I searched for something and found this one...
<blink> tags don't do anything for me... :p maybe it should be put in a <marquee> tag. :DQuote:
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.
:confused: Ive enough to do without bringing up old topics! =)Quote:
Originally posted by CornedBee
Yes, only later realized how old this thread is...
Who brought this back to the front? Zaei?
Z.
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.