По какой-то причине после компиляции с использованием g++ требуется 6-7 секунд. run (на самом деле иконка исполняемого файла загружается 3-4 секунды после компиляции, я такого никогда не видел). Весь компьютер тормозит, а диспетчер задач также не показывает ничего вроде утечки памяти, высокой загрузки процессора или чего-то еще.
Код: Выделить всё
#include
#include
#include
#define glyph_width 5
#define glyph_height 5
int glyph[3][glyph_width * glyph_height] = {{0,1,1,0,0,
1,0,1,1,0,
1,0,0,1,0,
1,1,0,1,0,
0,1,1,0,0},
{0,0,1,0,0,
0,1,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,1,1,1,0},
{0,1,1,0,0,
1,0,0,1,0,
0,0,1,0,0,
0,1,0,0,0,
1,1,1,1,0}};
bool Running;
uint32_t* BitmapBuffer;
int BitmapWidth;
int BitmapHeight;
BITMAPINFO BitmapInfo;
uint32_t color = 0x00ffffff;
int box_x = 0;
int box_y = 0;
LRESULT CALLBACK WindowProcedure(HWND WindowHandle, uint32_t Message, WPARAM WParam, LPARAM LParam){
LRESULT Result = 0;
switch(Message){
case WM_CREATE:{
BitmapWidth = ((CREATESTRUCT*) LParam)->cx;
BitmapHeight = ((CREATESTRUCT*) LParam)->cy;
VirtualFree(BitmapBuffer, 0, MEM_RELEASE);
BitmapBuffer = (uint32_t*) VirtualAlloc(0, BitmapWidth * BitmapHeight * 4, MEM_COMMIT, PAGE_READWRITE);
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO);
BitmapInfo.bmiHeader.biWidth = BitmapWidth;
BitmapInfo.bmiHeader.biHeight = -BitmapHeight;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 32;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
} break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:{
uint16_t VKCode = (uint16_t) WParam;
bool WasKeyDown = (LParam & (1
Подробнее здесь: [url]https://stackoverflow.com/questions/78663778/my-windows-application-runs-very-slowly-due-to-peekmessage[/url]