Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define _WIN32_WINNT 0X0A00
- #include <windows.h>
- #include <time.h>
- void WinShow(HDC dc)
- {
- double x = 0.1, y = 0.1, xn, yn;
- for (int i = 0; i < 10000; i++)
- {
- int t = rand() % 100;
- if (t < 21)
- {
- xn = 0.088 * x + 0.521 * y + 0.785;
- yn = -0.464 * x - 0.378 * y + 8.096;
- }
- else
- {
- xn = 0.824 * x + 0.281 * y - 1.882;
- yn = -0.212 * x + 0.864 * y - 0.111;
- }
- x = xn; y = yn;
- int a = (int)(400 + x * 30);
- int b = (int)(400 - y * 30);
- SetPixel(dc, a, b, RGB(140, 140, 255));
- }
- }
- LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
- {
- if (message == WM_DESTROY)
- PostQuitMessage(0);
- else return DefWindowProcA(hwnd, message, wparam, lparam);
- }
- int main()
- {
- srand(time(NULL));
- WNDCLASSA wcl;
- memset(&wcl, 0, sizeof(WNDCLASSA));
- wcl.lpszClassName = "my_Window";
- wcl.lpfnWndProc = WndProc;
- RegisterClassA(&wcl);
- HWND hwnd;
- hwnd = CreateWindow(L"my_Window", L" ", WS_OVERLAPPEDWINDOW, 10, 10, 800, 600, NULL, NULL, NULL, NULL);
- HDC dc = GetDC(hwnd);
- ShowWindow(hwnd, SW_SHOWNORMAL);
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- WinShow(dc);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement