GDI
Bird flying to the cursor's position
- Demonstration
- Functionality:
- Create an application with 1 window:
- No caption bar, no border
- Topmost
- Only the bird should be visible, the rest of the window should be transparent
- The window moves to the mouse cursor's position
- The speed of movement should be constant and independent on the direction
- An animated bird is displayed in the window
- The bird should be headed (in a proper way) to the cursor's position
- Animation frames can be found in this file
- Application can load them from files or resources
- In all frames, the RGB(0, 255, 255) colour should be used as transparent
- Hints:
- WS_EX_LAYERED, SetLayeredWindowAttributes()
- SetTimer(), WM_TIMER
- LoadBitmap(), LoadImage()
- atan2(), sin(), cos()
- SetGraphicsMode(), GM_ADVANCED, ModifyWorldTransform()
- Translation:
XFORM xform;
xform.eM11 = 1.0f;
xform.eM12 = 0.0f;
xform.eM21 = 0.0f;
xform.eM22 = 1.0f;
xform.eDx = (float)dx;
xform.eDy = (float)dy;
- Rotation:
XFORM xform;
xform.eM11 = cosine;
xform.eM12 = -sine;
xform.eM21 = sine;
xform.eM22 = cosine;
xform.eDx = 0.0f;
xform.eDy = 0.0f;
- Vertical mirroring:
XFORM xform;
xform.eM11 = -1.0f;
xform.eM12 = 0.0f;
xform.eM21 = 0.0f;
xform.eM22 = 1.0f;
xform.eDx = 0.0f;
xform.eDy = 0.0f;
- Approximate points:
- Window's features: 2.0
- Moving the window to the current cursor position: 3.0
- Displaying an animated bird in the window: 3.5
- Proper rotating and mirroring the bird: 1.5