Sign in to follow this  
King of the Boneheads

I'd like to make a C++ game

Recommended Posts

Hello people of GameDev.net (This is my first forum thread)

So I'm fairly new to C++ and I've made basic things and I'm working on a Text Adventure right now but once I do make a game, I've hit one bump in the road.
When I code something in C++, it runs it in what looks like Command Prompt.
Confused...
I'd assume it's because C++ won't come with anything super-fancy and I guess I'm fine with it but my real question is:
How do you turn your C++ .exe file look like a regular old program/game on Windows?
I believe it has something to do with .txt files and collecting files from your computer, but I just need to know [b]HOW [/b]to do it.

Thanks in Advance.

Regards, King of the Boneheads.

Share this post


Link to post
Share on other sites
alh420    5995
Your program need to use the windows api:s to create a window, and define a message loop that handles the messages the windowing system generates for user input and redraws and such. And then respond in a sensible way to some of them.

That you don't have to write yourself though, the easiest is to use a library like SDL to handle the gritty details of the windows api.
It will let you easily create a window and define how it draws itself and handle user input.

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='King of the Boneheads' timestamp='1349855369' post='4988634']
Hello people of GameDev.net (This is my first forum thread)

So I'm fairly new to C++ and I've made basic things and I'm working on a Text Adventure right now but once I do make a game, I've hit one bump in the road.
When I code something in C++, it runs it in what looks like Command Prompt.
Confused...
I'd assume it's because C++ won't come with anything super-fancy and I guess I'm fine with it but my real question is:
How do you turn your C++ .exe file look like a regular old program/game on Windows?
I believe it has something to do with .txt files and collecting files from your computer, but I just need to know [b]HOW [/b]to do it.

Thanks in Advance.

Regards, King of the Boneheads.
[/quote]

C++ doesn't have any concept of Windows etc so you have to use the OS API (Win32 for Windows), or a library that wraps it, (SFML is nice for games, QT or wxWidgets are nice for desktop applications). (Google SFML tutorials to get started) Edited by SimonForsman

Share this post


Link to post
Share on other sites
kidman171    498
[quote name='King of the Boneheads' timestamp='1349855369' post='4988634']
Hello people of GameDev.net (This is my first forum thread)

So I'm fairly new to C++ and I've made basic things and I'm working on a Text Adventure right now but once I do make a game, I've hit one bump in the road.
When I code something in C++, it runs it in what looks like Command Prompt.
Confused...
I'd assume it's because C++ won't come with anything super-fancy and I guess I'm fine with it but my real question is:
How do you turn your C++ .exe file look like a regular old program/game on Windows?
I believe it has something to do with .txt files and collecting files from your computer, but I just need to know [b]HOW [/b]to do it.

Thanks in Advance.

Regards, King of the Boneheads.
[/quote]

King of the Boneheads:
When you use a standard library function such as [code]std::cout[/code], your program will output the results to the default standard output which is a console window. If you want to output the results of your program to your own graphical window ( commonly referred to as a gui (pronounced "gooey") ), you need to create one. One option is to use the Win32 API, but it is not that beginner-friendly. What you might want to do is check out some of the great GUI libraries available, such as the ones mentioned above. Edited by kidman171

Share this post


Link to post
Share on other sites
ByteTroll    3035
[quote]I'd assume it's because C++ won't come with anything super-fancy[/quote]
C++ is a programming language, not an API. API's are created with programming languages.

[quote]How do you turn your C++ .exe file look like a regular old program/game on Windows?[/quote]
If you want to create a graphical GUI under Windows you are going to need to use the Win32 API. Here is a start http://www.winprog.org/tutorial/

Share this post


Link to post
Share on other sites
menyo    972
Are you aware that you picked the most difficult and harsh programming language out there?

Yes C++ gives you control over everything especially the memory usage to create state of the art games because you can make things run very efficient. But what is your goal here? Creating games i assume? My guess is you would be better off with another language, at least for the time being. You will notice that most languages use fairly same syntax so jumping over to another should not give you much trouble.

There are several option here, i personally like C# + XNA, while still fully in control of what you create XNA lets you jump right into drawing sprites on the screen and coding behavior. Even with XNA a finished game takes a long time to make but all the back end is done for you. You can see XNA as SFML for C++, but visual studio c# is a much user friendly environment.

Java and Python are also good options to explore.

You could also go for a game engine like [url="http://www.unrealengine.com/en/udk/"]UDK[/url] or [url="http://unity3d.com/create-games/"]Unity[/url]. Both are 3D engines that can be used right away to import assets. UDK is amazing if you want to make somekind of 1st or 3th person view game. It requires no coding to still make something very unique but does allow you to input code in the form of unreal script (much like C++). I never tried unity i believe it gives you a bit more freedom on the type of game you want and works with C#, C++ and Javascript.

If you really want to save yourself from coding, which i doubt since you started in C++, you could take a look at RPG maker or game creator.

-edit-
Whats with the down voting? I am giving more pointers then you haters ever give. C++ is the most difficult language out there and the guy is a beginner so i give him choices. Up to him what he chooses. Edited by menyo

Share this post


Link to post
Share on other sites
[QUOTE]When I code something in C++, it runs it in what looks like Command Prompt.[/QUOTE]

Because your build target is set to a console/terminal command-line window(in Windows this is DOS-style command-prompt).

It is text-based only - no images or graphics(unless they're made with character symbols or ASCII art).

There are a few options you have here, and quite some understanding that would help you out here.

Windows graphic-based applications on Windows OS run through software known as DirectX or DirectDraw for windowed graphics, and use the Windows API to manage the controls for the windows(GDI/GDI+ are used as well).

This stuff is a complete different implementation on command-prompt windows.

There are libraries that offer "wrapping" for this to avoid directly interfacing with this stuff for development if you find Windows API and DirectX to be hard(which many do find them to be).

As mentioned, SDL will "wrap" around the lower-level abstractions necessary for window management and graphics(such as DirectX and WinAPI). What this does is gives you an interface that will get you things done faster and easier than with Windows API/DirectX directly.

SFML will do the same, and so will many other libraries providing abstraction from the lower-levels of user-space software rendering of the operating system.

Aside from what the C++ disliker above is saying, SDL or Allegro is probably what you should be working on and studying now:

[url="http://lazyfoo.net/SDL_tutorials/index.php"]http://lazyfoo.net/S...rials/index.php[/url]

[url="http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial"]http://wiki.allegro....egro_5_Tutorial[/url]

All of the lower-level abstractions come with more programming experience. The Windows API is the lowest-level API that controls all window structuring and management on all Windows OSes so far, to note. It works alongside with DirectX for optimum software rendering. Learning them both can be ideal and useful, but at this point it would be a little farfetched.

[QUOTE]I believe it has something to do with .txt files[/QUOTE]

Absolutely nothing to do with text files. Edited by Pointer2APointer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this