Untitled
#include "SDL3/SDL.h" #include "SDL3_image/SDL_image.h" int main (int argc, char **argv) { SDL_SetHint ("SDL_WINDOWS_DPI_AWARENESS", "1"); SDL_Init (SDL_INIT_VIDEO); SDL_Window *win = SDL_CreateWindow ("minimal_repro_9grid_bug", 640, 480, SDL_WINDOW_RESIZABLE); SDL_Renderer *rend = SDL_CreateRenderer (win, NULL); SDL_SetRenderVSync (rend, true); SDL_SetHint (SDL_HINT_GPU_DRIVER, "vulkan"); SDL_SetHint (SDL_HINT_RENDER_GPU_DEBUG, "1"); SDL_SetRenderDrawBlendMode (rend, SDL_BLENDMODE_BLEND); SDL_Texture *larger_host = SDL_CreateTexture ( rend, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 100, 100); SDL_Surface *ngrid_surface = IMG_Load ("dat/ngrid.png"); SDL_Surface *stream; SDL_LockTextureToSurface (larger_host, NULL, &stream); SDL_BlitSurface (ngrid_surface, NULL, stream, &(SDL_Rect){ 0, 0, 50, 50 }); SDL_UnlockTexture(larger_host); SDL_Event e; while (1) { while (SDL_PollEvent (&e) > 0) { if (e.type == SDL_EVENT_QUIT) { SDL_Quit (); exit (0); } } SDL_SetRenderDrawColor (rend, 55u, 55u, 23u, 255u); SDL_RenderClear (rend); SDL_RenderTexture9Grid (rend, larger_host, &(SDL_FRect){ 0.f, 0.f, 50.f, 50.f }, 10, 10, 14, 10, 1.f, NULL); SDL_RenderPresent (rend); } return 0; }
Leave a Comment