I'd like to make a C++ game

Started by
5 comments, last by Pointer2APointer 11 years, 6 months ago
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 HOW to do it.

Thanks in Advance.

Regards, King of the Boneheads.
A Noobie C++ Developer.

I use Code::Blocks with GNU GCC Compiler, and Allegro 5 Libraries.

I'm a W.I.P., please be patient with me!
Advertisement
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.

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 HOW to do it.

Thanks in Advance.

Regards, King of the Boneheads.


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)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

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 HOW to do it.

Thanks in Advance.

Regards, King of the Boneheads.


King of the Boneheads:
When you use a standard library function such as std::cout, 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.
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.

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/

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is objectively shit." - L. Spiro

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

"The 'friend' relationship in c++ is the tightest coupling you can give two objects. Friends can reach out and touch your privates." - frob

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 UDK or Unity. 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.
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:

http://lazyfoo.net/S...rials/index.php

http://wiki.allegro....egro_5_Tutorial

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.

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

Absolutely nothing to do with text files.
Yes, this is red text.

This topic is closed to new replies.

Advertisement