C # 및 XNA에서는 다음과 같이 1x1 텍스처를 만들 수 있습니다.
Texture2D white_pixel;
white_pixel = new Texture2D(GraphicsDevice, 1, 1);
white_pixel.SetData<Color[]>(new Color{ Color.White });
// Sorry if I got the syntax wrong, it's been a while
그런 다음 나중에 다음을 수행하여 임의의 크기와 색상으로 픽셀을 임의로 그릴 수 있습니다.
spriteBatch.Begin();
spriteBatch.Draw(white_pixel, new Rectangle(0, 0, width, height), Color.Whatever);
spriteBatch.End();
SDL에서 이에 상응하는 것은 무엇입니까?
SDL_Texture *tex = nullptr;
SDL_CreateTexture(renderer,
Uint32 format, // What do I put here
int access, // and here
1
1);
// Not sure if this is correct
SDL_SetTextureColorMod(tex,
255,
255,
255)
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = 10;
rect.h = 10;
SDL_RenderCopy(renderer, tex, nullptr, &rect);
SDL_PIXELFORMAT_RGB24
/ SDL_PIXELFORMAT_BGR24
for format
and SDL_TEXTUREACCESS_STATIC
for access
는 좋은 시작이 될 것입니다.
또는 당신은 단지를 통해 직접 색깔의 사각형을 그릴 수 SDL_SetRenderDrawColor()
및 SDL_RenderFillRect()
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다