Archived

This topic is now archived and is closed to further replies.

SSJGaz

Win 32 Vs Console (C++)

Recommended Posts

I''v stared to write a game in console but i think that it may be a waste of time if i can just skip console and go stright into Win32. What are the differences of the code? could i use what i allready have and transfare it across to a Win32 platform with minimal tweaks or would i have to completely start over? Thx in advance

Share this post


Link to post
Share on other sites
I thought the same thing...but I went and got a taste of Win32 and it isn't so hard. Everything goes around C++ mainly...learn the basics in a Console App and then move on... ;-)

And do like I am...never start a project and not finish it...im still playing with this TicTacToe game. I need to figure out a way to get the AI working correctly...

[edited by - DarkWhoppy on July 27, 2003 5:25:53 PM]

Share this post


Link to post
Share on other sites
Hehe, you sound like me...once I start something I don''t wanna peel myself away from the PC until its finished. I have had about 6 hrs sleep and still can''t get this Tic-Tac-Toe AI to work correctly. But Win32 is way different than a Console. Win32 is for programming a Windows environment.

Example of how they are different:

WinMain --for Win32

main() --for a console

Go to this site and look at their tutorials...
www.gametutorials.com

Share this post


Link to post
Share on other sites
Before moving on to anything, be sure that you know structures, pointers etc...
quote:

Example of how they are different:

WinMain --for Win32

main() --for a console


You can''t fairly say that console and windows programming is in any way similar.

Share this post


Link to post
Share on other sites
The console that you see in windows is not actually dos, it's just a 32-bit text shell for windows. While it may not look like it, a console application under (modern) windows is actually still a Win32 application.

[edited by - SysOp_1101 on July 27, 2003 11:14:20 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Ekim_Gram
You need a lot more to make a simple "Hello, world!" program in Win32 than in C++



There''s no town drunk here, we all take turns.
Velocity Gaming Force
Not really...
Console:

#include <iostream>
int main()
{
std::cout << "Hello world!" << endl;
return 0;
}


Win32 GUI:

#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(0, "Hello world!", "Hi there!", MB_OK);
return 0;
}


It''s just some extra arguments to WinMain, compared to main.



"For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!"

"If anyone sees a suspicious, camouflaged factory being carried across the desert, they should report it immediately."

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Valderman, it''s even easier! just override the entry point to be main and then you don''t even need WinMain.

Share this post


Link to post
Share on other sites
quote:
Original post by Valderman
quote:
Original post by Ekim_Gram
You need a lot more to make a simple "Hello, world!" program in Win32 than in C++


Not really...
Console:
It's just some extra arguments to WinMain, compared to main.

That's not a fair example though, because you wouldn't want to make a whole text based game by using message boxes. You'd probably use GDI, or something like that, I'd think which is definitely more complicated (but not altogether difficult)



[edited by - Peon on July 28, 2003 2:29:21 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Village Specialton
Differences:
1. You will be using the Windows 32 library.


You can do that in a console app too:

#include <windows.h>

int main()
{
MessageBox(0, "Hello world!", "Hi there!", MB_OK);
}


quote:

2. You will be using a window instead of the console.


The console is a window.

Share this post


Link to post
Share on other sites
in general:
you don''t have to port special "inner code", like calculations, your AI and something like that - but you have probably to convert the (visual) output of your game to make it fitting to the (already?) used Win32 model.
and yes, a console app is a win32 app, but only with a less complex construction and overhead of programming.

Share this post


Link to post
Share on other sites
quote:
That''s not a fair example though, because you wouldn''t want to make a whole text based game by using message boxes.
YodaTheCoda made one.


"For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!"
"If anyone sees a suspicious, camouflaged factory being carried across the desert, they should report it immediately."

Share this post


Link to post
Share on other sites