Steward
分享是一種喜悅、更是一種幸福
程式語言 - Wine - C/C++ - SDL v1.2 - Hello, world!
參考資訊:
http://www.winprog.org/tutorial/start.html
https://www.libsdl.org/release/?utm_source=chatgpt.com
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
main.c
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
#include <SDL_gfxPrimitives.h>
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
SDL_Surface *screen = NULL;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE);
stringRGBA(screen, 100, 100, "Hello, world!", 0xff, 0xff, 0xff, 0xff);
SDL_Flip(screen);
SDL_Delay(3000);
SDL_Quit();
return 0;
}
編譯、執行
$ winegcc main.c -o main -I/usr/include/SDL -lSDL -lSDL_gfx $ wine main.exe.so