=========== Diary ================
Found that the recent lazy, code a little bit longer than that, do not want to read. It's better to read a book.
Consider playing games, but the knowledge you have learned is not enough. The revolution has not yet succeeded, comrades still need to work hard AH
===========end Diary =============
Today is complete Full-screen animation, 1024x768, plus multi-layer rendering (the mouse position is not worth mentioning)
Think first about how we usually draw pictures. (should be a picture)
1 Prepare a piece of paper, this is for others to see (Primarysurface)
2 One pen (Draw method)
Then free to play on it (find coordinates, painting ...)
This is OK, your audience (the person sitting in front of the monitor) not only can see your drawing, but you can also see what you are drawing (maybe you're drawing with a sketch ...). Obviously, we do not want the audience to see the "graceful gesture" of our drawing. We want speed and effect, so slow is not called DirectDraw.
Programme 2
1 Prepare a piece of paper, this is for the audience to appreciate (Primarysurface)
2 Prepare a molded piece, such as the egg Leonardo had painted (Surface)
3 brushes, knives, glue
Maybe you know what I'm going to do, the way to paste is naturally faster than the stroke. However, the audience can still know that you are pasted up! When you show a piece of animation, it will always be pasted everywhere ...
Programme 3
1 Find a workbench, please sit down and take a look at the current image (Primarysurface)
2 Find another or more artboards on your own (Backsurface)
3 various tools, as long as it is convenient to use (Drawfast drawrect DrawText drawcircle ...)
4 Ask an assistant to help change the work of the workbench. (Primarysurface.flip)
So you can liberate yourself and never worry that your audience will see the process you are drawing. Although they can "guess" how you draw. We do this, and we do it in backsurface with any quick method, and of course we can copy it from other surface, Then paste it into the backsurface, submit it to primarysurface, let him flip, and the user sees the result (Primarysurface), and when the audience is raving about your work, you are modifying it on the artboard after the flip, Then flip the revised palette again ...
In this way, the two artboards solve the problem. At the same time only 1 viewers are watching, the other 1 is on hand, your assistant (Primarysurface) is very smart, not wrong, so you just feel at ease to draw the current artboard (Backbuffer) is enough
To emphasize, you always draw the Backbuffer,flip method will render your backbuffer to Primarybuffer, then draw, Render, draw, render ...
Or you understand that copying to Primarysurface can also (actually a chunk of memory move)
The general steps are consistent in the previous article, just a few surface for replication, the source code is only 200 lines, the main code is less than 100 lines, there are more detailed comments. So there's no need to explain this anymore.
' Key step, flip, and do not use wait, this may drop frames, but does not affect the speed
Ps. Flip (Nothing, Flipflags.novsync)
End Sub
Private Sub Form1_keyup (ByVal sender as Object, ByVal e as System.Windows.Forms.KeyEventArgs) Handles Mybase.keyup
If E.keycode = keys.escape Then End ' ESC exit
End Sub
Sub Getmousepos ()
GetCursorPos (M) ' Call API, get mouse position
End Sub
End Class
=====================================
A lot of the code is the same as the previous one, and the general idea is the same as the example I gave (Scenario 3).
Through the code. Can understand the specific steps
DirectDraw and then down is the image of the transparency of the calculation (this has the formula), the size of the transformation, rotation. Please refer to the ready-made code and formula, I did not learn computer graphics, it is very difficult to estimate. and DDraw has a lot of built-in ways to provide a simple way to transform, This estimate needs to check the English original DirectDraw7 to find the corresponding method ...
OK DirectDraw to this end, if possible, but also write an application DirectDraw demo, but the estimate will not be so specific description, hehe.
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.