Study Notes: Visual C ++ game development technology and examples (1)

Source: Internet
Author: User

I went to Yangjiang Book Purchasing Center the day before yesterday and wanted to buy some books related to directx9. I couldn't find a suitable book for the whole bookstore. There are several books about game development. After I removed a few books about the game, I chose two books, one of which is what I am reading now, and the title is the title. Another one is 2D programming in direct3d, but it is based on dx8.0, and it is about 2D in a lot of space. In fact, it is also good. 2d is also the basis of 3D.

Yesterday, I read chapter 1 of Visual C ++ game development technology and examples (later referred to as V), mainly about some background knowledge, such as game development history and windows programming. Although I have also read the relevant information about the development history of games before, I have gained a lot this time, but the first thing in history is different from what I have seen before, there may be no authoritative unified information for the moment. Forget it. You don't have to pay too much attention to it now.

I am also a veteran of the game. When I was in elementary school in Year 12, I got in touch with the arcade. At that time, I was criticized by my parents and teachers (I think so now ), so every time I go to the game console, I am as timid as doing bad things. I am always worried that I will be seen by my classmates. At that time, my students were so obedient that I would report to my class teacher when I saw my classmates go to the game console, I have very few friends. I have one or two neighbors, which are very naughty. My dad often tells me not to play with them, but the game machine is too attractive, there is only one or two yuan in the pocket, and most of them will run to the game room. Remember to Miss Arcade and other arcade games (most names are forgotten ). Later, I finally got my home game machine FC, which is the Nintendo classic red and white machine. At that time (93 years), I thought it was the latest game machine in the world. After reading the V book, I realized that FC was an annual output of 83 years. After many years, it became popular in China, but it's not that popular for long. My FC was quickly replaced by the learning machine of the Overlord. Finally, I sold the FC to my classmates for less than 100 RMB (it should be saved for a souvenir ). Well, I have been in touch with computers for over two or three years since then, and have been with computer games for eight years.

Let's talk about the content of the book. The second half of Chapter 1 briefly introduces some basic Windows programming knowledge, such as message mechanism, GDI, timer, callback mechanism, multithreading, and dynamic link library, com, sound, and MFC knowledge. In fact, these things are familiar with a little bit before, but cannot be proficient, because after reading the V book, the understanding of these things goes further. Let's talk about the message mechanism first. The 16-bit host has only one message queue, so every message in the system must wait for the message to be processed before obtaining control. Well, this kind of operating system is called a collaborative multi-task system. After entering the 32-bit message queue, that is, after Windows 98, each program has its own message queue, which corresponds to each process and can customize its own message processing function, therefore, on Windows 98 and later operating systems, we can run multiple programs at the same time. Well, the book says this kind of operating system is a preemptible multitasking system.

The difference between getmessage and peekmessage is also known. Unless there is a message in the queue, getmessage does not return control to the program. Peekmessage is different. It peek into the message queue at intervals. If a message exists, true is returned. If no message exists, false is returned. Here we will talk about the two rendering times of the game. Some games are rendered after receiving the wm_paint message, while some are when the queue is idle (that is, when the peekmessage returns false) rendering, but I still don't know what the difference between the two paintings is.

You don't need to talk about it much. It seems that it is just some functions. You just need to know how to create and use it. Well, HDC seems to run through all operations of GDI.

The main achievement is to understand the role of the timer. The main function of the timer was to send the wm_timer message. The settimer function is used to set the timer, and the killtimer function is used to stop the timer. You can also send the wm_timer message to your defined message processing function.

The callback mechanism is not mentioned. Multithreading is not much to talk about. It is mainly about how to implement synchronization and mutex. No more DLL. Com is too complicated, so I won't talk about it anymore.

There are two main types of sound-related APIs in Windows: top-level APIs with the prefix of wavein and waveout, and low-level APIs with the prefix of midiin and midiout. There are also some interfaces prefixed with MCI (MCI, media control interface ).

The book says that MFC can also develop games, but it is intended for small games. Developing Large Games requires a lot of windows APIs. The encapsulation of APIS by MFC makes it not suitable for compiling some underlying software. Start with winmain.

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.