Is there a main function?

Get help with installing and running the Cafu Engine here. This forum is also for general questions and discussion of all aspects regarding the Cafu Engine.
Post Reply
alansalexer
Posts:11
Joined:2012-04-30, 09:00
Is there a main function?

Post by alansalexer » 2012-05-03, 20:16

I'm new to game development, and I'm developing my first 3D game with Cafu.
I've been reading documents and exploring code for several days. Just feel a little confused, is there a main function or something like that? Where does the game(if we see it as an ordinary program)start? I can't find any main or winmain functions......
Another problem is that , my mates and I have been used to writing codes with IDEs, although I know that it's not so good for us students to depend on IDEs too much. I just wanna know if I can import all the codes into some IDE such as VS or Code:Blocks and take advantage of "auto-complete", "Open declaration", "Go to definition".,etc. If I can't, is there any way to raise efficiency?I've ever used some opensource libraries to do some work, it's very convenient and helpful to refer to the definition of a function or class with a click-on. But now, I can just open files one by one, and it's often hard to find where a function's definition is from so many directories.
Can you give me some suggestions on that? What kind of tools do you use to raise the efficiency of developing Cafu and finishing all the codes?
User avatar
Haimi
Posts:85
Joined:2011-11-23, 09:28

Re: Is there a main function?

Post by Haimi » 2012-05-03, 23:06

For the general Problem: The main function is in Ca3DE/CaFU.*pp and the mod itself has none. When you inspect the Sconscript and set the linker paths in your IDE (HELL of work, I can tell you!) you got the right autocorrects and inclusions.
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Is there a main function?

Post by Carsten » 2012-05-03, 23:20

Hi alansalexer,
alansalexer wrote:I've been reading documents and exploring code for several days. Just feel a little confused, is there a main function or something like that? Where does the game(if we see it as an ordinary program)start? I can't find any main or winmain functions......
Well, Both Cafu as well as CaWE are wxWidgets-based programs. Like any modern graphical program, they implement an event loop that forwards events to other parts of the application.

WinMain() is inside wxWidgets -- we never need direct access to it ourselves.
Our programs "begin" in our overrides of the wxApp::OnInit() method, see http://trac.cafu.de/browser/cafu/trunk/ ... ppCafu.hpp and/or http://trac.cafu.de/browser/cafu/trunk/CaWE/AppCaWE.hpp and related files.

A few pages with related info:
http://en.wikipedia.org/wiki/Message_lo ... ft_Windows
http://www.cplusplus.com/forum/windows/31963/
http://docs.wxwidgets.org/trunk/page_topics.html
http://docs.wxwidgets.org/trunk/overview_events.html
http://www.wxwidgets.org/docs/tutorials.htm

Another problem is that , my mates and I have been used to writing codes with IDEs, although I know that it's not so good for us students to depend on IDEs too much. I just wanna know if I can import all the codes into some IDE such as VS or Code:Blocks
Yes, sure, I don't see why not.

and take advantage of "auto-complete", "Open declaration", "Go to definition".,etc.
Ahh! I've always been wondering what these IDE's were good for. ;-)

If I can't, is there any way to raise efficiency? [...]
Can you give me some suggestions on that? What kind of tools do you use to raise the efficiency of developing Cafu and finishing all the codes?
We use UltraEdit here, which seems to have all the features that we deem important:
  • Can run Scons (or any other external program), capture the output, and jump to the proper place in the code if we double-click on an error message.
  • Search (and replace) in files (very conveniently and powerfully implemented).
  • Manage/group files in "projects".
  • Lots more.
UltraEdit is a very powerful text editor that I find very efficient to use, and in fact it's so good that I never experienced a wish to switch to an IDE. Even for the advanced features, I (can) use UltraEdit completely via the keyboard, which is very convenient and fast.

Personally and historically, I disliked IDE's because they typically cluttered my project directories with IDE files that I don't want and don't care about, and that don't agree well with version control systems, and because IDE's are typically specific to a single platform: Under Windows, Visual Studio is the obvious and natural candidate, but under Linux, you need something else. And if you (attempt to) use the IDE not only for editing but also for building the software, matters get worse (from a cross-platform point of view).

Nevertheless, as IDE support is so frequently requested, I'm not totally against it: I've started to explore a Premake solution as an alternative (which is not yet usable however) to SCons, and if you start using Cafu with any IDE of your choice, I'd be very interested in learning your experiences. ;-) (And btw., I've always been planning but never got around to trying Eclipse...)

In fact, I think that Visual Studio can even be configured to use SCons for buildling the software, but I've never tried that myself and can only refer you to Google (and one of the threads below) for the job. It's probably easier though than attempting to have Visual Studio build Cafu from scratch. Before you attempt that, better try Premake first...

Finally, these two threads may provide you with additional information:
http://www.cafu.de/forum/viewtopic.php?f=8&t=765
http://www.cafu.de/forum/viewtopic.php?f=8&t=779

I'm open to any improvements in these regards... so please let me know what you think and if you find any. :up:
Best regards,
Carsten
alansalexer
Posts:11
Joined:2012-04-30, 09:00

Re: Is there a main function?

Post by alansalexer » 2012-05-04, 06:42

Haimi wrote:For the general Problem: The main function is in Ca3DE/CaFU.*pp and the mod itself has none. When you inspect the Sconscript and set the linker paths in your IDE (HELL of work, I can tell you!) you got the right autocorrects and inclusions.
Yeah, I've ever tried to set the linker paths according to Sconscript......but I gave up. I think I'll try to see if UltraEdit works.
alansalexer
Posts:11
Joined:2012-04-30, 09:00

Re: Is there a main function?

Post by alansalexer » 2012-05-04, 07:09

Carsten wrote:We use UltraEdit here, which seems to have all the features that we deem important:
Can run Scons (or any other external program), capture the output, and jump to the proper place in the code if we double-click on an error message.
Search (and replace) in files (very conveniently and powerfully implemented).
Manage/group files in "projects".
Lots more.
Aha,I'll try UltraEdit right away. In fact, I've found another editor called "Geany" yesterday, it seems to work fine,too. Besides, I finally know why many programmers won't use IDEs. I don't know much about compiling and linking things yet, so I'd better follow your suggestions and explore the codes with UltraEdit or Geany right now. I'll get to learn something about Scons, Premake and IDE configurations after I finish my project later.
Thanks for your reply,Carsten. It seems that I definitely have a lot to learn and try. 8)
Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests