48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
void BitBlt(int x, int y, int w, int h, const uint32_t* pixels);
|
|
void* HeapAlloc(void* heap, unsigned long flags, size_t size);
|
|
int HeapFree(void* heap, unsigned long flags, void* mem);
|
|
_Noreturn void ExitProcess(unsigned int code);
|
|
_Noreturn void ExitThread(unsigned long code);
|
|
void OutputDebugStringA(const char* s);
|
|
|
|
int main() {
|
|
OutputDebugStringA("Hello from the shell!\n");
|
|
int width = 300;
|
|
int height = 300;
|
|
|
|
// Allocate space for uint32_t (4 bytes per pixel)
|
|
uint32_t* image = (uint32_t *)HeapAlloc(NULL, 0, width * height * sizeof(uint32_t));
|
|
|
|
int tileSize = 8;
|
|
|
|
for (int y = 0; y < height; y++) {
|
|
for (int x = 0; x < width; x++) {
|
|
uint32_t color1 = 0xFFFFFFFF; // White
|
|
uint32_t color2 = 0xFF000000; // Black
|
|
|
|
int tileX = x / tileSize;
|
|
int tileY = y / tileSize;
|
|
|
|
if ((tileX + tileY) % 2 == 0) {
|
|
image[y * width + x] = color1;
|
|
} else {
|
|
image[y * width + x] = color2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Pass the 32-bit buffer directly to BitBlt
|
|
BitBlt(600, 400, width, height, image);
|
|
|
|
// for (size_t i = 0; i < 1000000000; i++) {
|
|
// // burn!
|
|
// }
|
|
|
|
OutputDebugStringA("Goodbye from the shell!\n");
|
|
|
|
ExitProcess(0);
|
|
}
|