NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

STEROWANIE ELIPSA(warunek – utworzono już jakieś elipsy)

<globalne>

int horizontal = 150;
int vertical = 150;

<pomiędzy WM_CREATE[command] oraz WM_PAINT>

case WM_KEYDOWN:
if (wParam == VK_UP && vertical<500)//czyli jesli tam wartosc podana byla dajmy 140 + vertical(czyli 500) przekroczy 640, to nie puści dalej
vertical++;
if (wParam == VK_DOWN)
vertical--;
if (wParam == VK_RIGHT)
horizontal++;
if (wParam == VK_LEFT)
horizontal--;
return 0;


<w WM_PAINT>

Ellipse(hMemDC, 210 + horizontal, 210 - vertical, 310 + horizontal, 274 – vertical);




Skaczące elipsy

<przed WM_CREATE, ale po WND PROC>

static HDC hdc, hMemDC;
static HBITMAP hBmp;
static PAINTSTRUCT ps;
static RECT client;
static HPEN hPen;
static HBRUSH hBrush;
static int SKALA = 150;
static double angleMove = 0.0f;
static double tmpMove;
static unsigned int czas, czas_klatki;





<WM_CREATE zaraz po case’ie>

hPen = CreatePen(PS_SOLID, 2, 0x00404040);
hBrush = CreateSolidBrush(0x0040A0F0);
czas = GetTickCount();

<WM_PAINT zaraz po case’ie>

do
czas_klatki = GetTickCount() - czas;
while (czas_klatki == 0);

angleMove += 3.1415927*czas_klatki / 1000.0;
hdc = BeginPaint(hWnd, &ps);
hMemDC = CreateCompatibleDC(hdc);
GetClientRect(hWnd, &client);

hBmp = CreateCompatibleBitmap(hdc, client.right – client.left, client.bottom - client.top);

SelectObject(hMemDC, hBmp);
FillRect(hMemDC, &client, (HBRUSH)GetStockObject(WHITE_BRUSH));
SelectObject(hMemDC, hPen);
SelectObject(hMemDC, hBrush);

tmpMove = SKALA*sqrt(fabs(sin(angleMove)));
Ellipse(hMemDC, 78, 210 - tmpMove, 142, 274 - tmpMove);

tmpMove = SKALA*sqrt(fabs(sin(angleMove + 0.5)));
Ellipse(hMemDC, 162, 210 - tmpMove, 226, 274 – tmpMove);

BitBlt(hdc, client.left, client.top, client.right – client.left, client.bottom - client.top, hMemDC, 0, 0, SRCCOPY);

DeleteObject(hBmp);
DeleteDC(hMemDC);
EndPaint(hWnd, &ps);
czas = GetTickCount();

<WM_DESTROY zaraz po case’ie>

DeleteObject(hPen);
DeleteObject(hBrush);




OBRACAJĄCA SIĘ SAMOISTNIE KONICZYNA

<przed WM_CREATE ale główna pętla>

static HDC hdc;
static PAINTSTRUCT ps;
static POINTFLOAT fPts[13];
static POINT ePts[13];
static RECT client;
static int SKALA = 200;
static int k;
static HBRUSH hBrush;
static HPEN hPen;
static HBRUSH hBrush2;
static HRGN bgHrgn;
static float tmpF;
static float kat = 3.1415 / 64.0f;

<WM_CREATE>

hBrush = CreateSolidBrush(RGB(46, 184, 46)); //tło koniczyny
hBrush2 = CreateSolidBrush(RGB(179, 217, 255)); //tło
hPen = CreatePen(PS_DASH, 3, RGB(20, 82, 20)); //kontury

fPts[0].x = -0.25; fPts[0].y = 0.25;
fPts[1].x = -1.25; fPts[1].y = 1.25;
fPts[2].x = 1.25; fPts[2].y = 1.25;
fPts[3].x = 0.25; fPts[3].y = 0.25;
fPts[4].x = 1.25; fPts[4].y = 1.25;
fPts[5].x = 1.25; fPts[5].y = -1.25;
fPts[6].x = 0.25; fPts[6].y = -0.25;
fPts[7].x = 1.25; fPts[7].y = -1.25;
fPts[8].x = -1.25; fPts[8].y = -1.25;
fPts[9].x = -0.25; fPts[9].y = -0.25;
fPts[10].x = -1.25; fPts[10].y = -1.25;
fPts[11].x = -1.25; fPts[11].y = 1.25;
fPts[12].x = -0.25; fPts[12].y = 0.25;
SetTimer(hwnd, 101, 20, NULL);










<CASE WM_TIMER>

case WM_TIMER:
for (int k = 0; k < 13; k++)
{
//fPts[k].y += 0.03215f; //przesuwa się w górę
//obraca w lewo(aby w prawo dać - przy pi)
tmpF = fPts[k].x*std::cos(kat) - fPts[k].y*std::sin(kat);
fPts[k].y = fPts[k].x*std::sin(kat) + fPts[k].y*std::cos(kat);
fPts[k].x = tmpF;

}
InvalidateRect(hwnd, NULL, true);
return 0;

<CASE WM_PAINT>

GetClientRect(hwnd, &client);
for (k = 0; k < 13; k++)
{
ePts[k].x = (client.right - client.left) / 2 + SKALA*fPts[k].x;
ePts[k].y = (client.bottom - client.top) / 2 - SKALA*fPts[k].y;
}

SetPolyFillMode(hdc, WINDING);
hdc = BeginPaint(hwnd, &ps);
bgHrgn = CreateRectRgnIndirect(&client);
SelectObject(hdc, hBrush2);
FillRgn(hdc, bgHrgn, hBrush2);

BeginPath(hdc);
PolyBezier(hdc, ePts, 13);
EndPath(hdc);

EndPaint(hwnd, &ps);
SelectObject(hdc, hBrush);
SelectObject(hdc, hPen);
StrokeAndFillPath(hdc);

<WM DESTROY>

DeleteObject(hBrush);





KONICZYNA CO KRĘCI SIĘ ZA POMOCĄ MIZIANIA KLAWISZY

<główna pętla sam początek>
static HDC hdc;
static PAINTSTRUCT ps;
static POINTFLOAT fPts[13];
static POINT ePts[13];
static RECT client;
static int SKALA = 200;
static int k;
static HBRUSH hBrush;
static HPEN hPen;
static HBRUSH hBrush2;
static HRGN bgHrgn;
static float tmpF;
static float kat = 3.1415 / 54.0f;

<WM_CREATE>

hBrush = CreateSolidBrush(RGB(46, 184, 46)); //tło koniczyny
hBrush2 = CreateSolidBrush(RGB(179, 217, 255)); //tło
hPen = CreatePen(PS_DASH, 3, RGB(20, 82, 20)); //kontury

fPts[0].x = -0.25; fPts[0].y = 0.25;
fPts[1].x = -1.25; fPts[1].y = 1.25;
fPts[2].x = 1.25; fPts[2].y = 1.25;
fPts[3].x = 0.25; fPts[3].y = 0.25;
fPts[4].x = 1.25; fPts[4].y = 1.25;
fPts[5].x = 1.25; fPts[5].y = -1.25;
fPts[6].x = 0.25; fPts[6].y = -0.25;
fPts[7].x = 1.25; fPts[7].y = -1.25;
fPts[8].x = -1.25; fPts[8].y = -1.25;
fPts[9].x = -0.25; fPts[9].y = -0.25;
fPts[10].x = -1.25; fPts[10].y = -1.25;
fPts[11].x = -1.25; fPts[11].y = 1.25;
fPts[12].x = -0.25; fPts[12].y = 0.25;
return 0;











<WM_KEYDOWN>

case WM_KEYDOWN:
if (wParam == VK_LEFT)
for (int k = 0; k < 13; k++)
{
//obraca w lewo(aby w prawo dać - przy pi)
tmpF = fPts[k].x*std::cos(kat) - fPts[k].y*std::sin(kat);
fPts[k].y = fPts[k].x*std::sin(kat) + fPts[k].y*std::cos(kat);
fPts[k].x = tmpF;
}


if (wParam == VK_RIGHT)
for (int k = 0; k < 13; k++)
{
//obraca w lewo(aby w prawo dać - przy pi)
tmpF = fPts[k].x*std::cos(-kat) - fPts[k].y*std::sin(-kat);
fPts[k].y = fPts[k].x*std::sin(-kat) + fPts[k].y*std::cos(-kat);
fPts[k].x = tmpF;
}
InvalidateRect(hwnd, NULL, true);
return 0;

<WM_PAINT>
GetClientRect(hwnd, &client);
for (k = 0; k < 13; k++)
{
ePts[k].x = (client.right - client.left) / 2 + SKALA*fPts[k].x;
ePts[k].y = (client.bottom - client.top) / 2 – SKALA*fPts[k].y;
}

SetPolyFillMode(hdc, WINDING);
hdc = BeginPaint(hwnd, &ps);

bgHrgn = CreateRectRgnIndirect(&client);
SelectObject(hdc, hBrush2);
FillRgn(hdc, bgHrgn, hBrush2);

BeginPath(hdc);
PolyBezier(hdc, ePts, 13);
EndPath(hdc);

EndPaint(hwnd, &ps);

SelectObject(hdc, hBrush);
SelectObject(hdc, hPen);
StrokeAndFillPath(hdc);
return 0;

<WM_DESTROY>
DeleteObject(hBrush);
BITMAPA
<główna pętla>
static BITMAPINFO bmpInfo;
static BYTE bmpBits[16] = { 0,0,255,255,255,255,0,0, 255,255,255,0,0,255,0,0 };
static HDC hdc;
static HDC hMemDC;
static HBITMAP hBmp;
static PAINTSTRUCT ps;
static HPEN hPen;
static HBRUSH hBrush;

<WM_CREATE>
bmpInfo.bmiHeader.biSize = 40;
bmpInfo.bmiHeader.biWidth = 2;
bmpInfo.bmiHeader.biHeight = 2;
bmpInfo.bmiHeader.biPlanes = 1;
bmpInfo.bmiHeader.biBitCount = 24;
bmpInfo.bmiHeader.biCompression = BI_RGB;
bmpInfo.bmiHeader.biSizeImage = 0;
bmpInfo.bmiHeader.biXPelsPerMeter = 0;
bmpInfo.bmiHeader.biYPelsPerMeter = 0;
bmpInfo.bmiHeader.biClrUsed = 0;
bmpInfo.bmiHeader.biClrImportant = 0;
bmpInfo.bmiColors[0].rgbRed = 0;
bmpInfo.bmiColors[0].rgbGreen = 0;
bmpInfo.bmiColors[0].rgbBlue = 0;
bmpInfo.bmiColors[0].rgbReserved = 0;
hBrush = CreateSolidBrush(0x00FF0000);
hBmp = LoadBitmap(((LPCREATESTRUCT)lParam)->hInstance,
MAKEINTRESOURCE(1001));
hPen = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
return 0;
<WM_PAINT>
hdc = BeginPaint(hwnd, &ps);
StretchDIBits(hdc, 10, 10, 300, 300, 0, 0, 2, 2,
bmpBits, &bmpInfo, DIB_RGB_COLORS, SRCCOPY);
hMemDC = CreateCompatibleDC(hdc);
SelectObject(hMemDC, hBmp);
SelectObject(hMemDC, hPen);
Ellipse(hMemDC, 124, 80, 128, 84);
Ellipse(hMemDC, 295, 176, 299, 180);
Ellipse(hMemDC, 161, 262, 165, 266);
SelectObject(hMemDC, (HBRUSH)GetStockObject(NULL_BRUSH));
Ellipse(hMemDC, 60, 60, 160, 160);
Ellipse(hMemDC, 250, 160, 320, 230);
Ellipse(hMemDC, 130, 250, 180, 300);
BitBlt(hdc, 0, 0, 400, 400, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
EndPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
return 0;
<WM_DESTROY>
DeleteObject(hBrush);
DeleteObject(hBmp);
DeleteObject(hPen);
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.