Cfree can also be used for game programming!

Source: Internet
Author: User

According to a C ++ introductory book, Visual C ++ has almost become the only choice for C ++ programmers on Windows platforms. But have you ever thought of this? Visual c ++ is too big. Sometimes we have to install a software with over 1 GB of memory on a very slow computer to change a small feature of the game and perform tests. I think you must be very anxious and anxious about the installation process. I think it would be nice to have an IDE that is very small but can complete basic editing, compilation, and connection operations. I have actually learned C ++ for a long time and won't use make files. Whether it is nmake or cmake. I still like the intuition that IDE brings to me. A year ago, someone recommended the cfree integrated development environment to me.
C ++ is still used to it, so I didn't care at the time. After the computer re-installed the system, I had to go online to find the resources of visual studio2005, and then download it. Why don't I use cfree first? Don't throw a tree. Then I installed cfree. However, cfree is not suitable for the first time. At first, I didn't know some of its commands and mingw compiler packages. The more I learned about it, the more I felt that cfree did not have the features of Visual C ++. Some are not easy to use. However, with my continuous exploration, I have finally been able to successfully compile my previous DX Code in cfree and run smoothly. Facts show that cfree can also program games!

Now I will introduce you to the points you should pay attention to when using cfree for game programming.

Download the software from the place where the software is downloaded. It is only about 14 Mb after compression. The following is a picture of the software.

Double-click:

After setting the installation path, the following page appears:

The default font is ugly. I still like the font I used in vs2005, so let's do this. Open editor options:

In the displayed dialog box, follow the instructions. The font I selected here is terminal.

Note that the font size is 9. If the font size is 10, Chinese characters cannot be displayed. The Japanese Katakana is displayed. I don't like the effects of italics, so I need to comment out the italics. Next, I will create a DirectX project.

First, create a project, and then create a window program. after entering the file name and the specified path, enter the Select Type dialog box. Here, select an empty project, I just need to convert the code I wrote to my existing project. For example:

I copied my previous code to the project folder, and added the source file and header file in cfree. For example:

In order to correctly compile and run the DX program we have written, the following steps are necessary to understand!

Select "project> Settings ". For example:


Set the header file and library file according to the settings as shown in. Note that because the minggw contains d3d9. h and d3dx9. H, we need to advance the path of the header file in the dxsdk to avoid using the wrong header file.

I used d3d in this project, so I need to connect d3d9. lib, used to load the texture, so we need to connect d3dx9. lib, dinput is used, so you need to connect dinput8.lib and dxguid. lib, error handling is used, so you need to connect to dxerr9.lib. In cfree, because the use of mingw, # pragma comment (Lib, XXX. Lib) has expired, We must manually link the library file. For example:

If these libraries are not linked, the following link error occurs. In fact, the specific implementation of the function is missing.

After linking these libraries, the demo effect of the program is as follows:

Summary: If you have a certain understanding of C ++ programming, you can understand this software when you are familiar with Visual Studio. The software is relatively small and comes with debugging functions, so it can be used quickly. I will try this software in the future development process. In a word, cfree can also program games!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.