0
有沒有sdl「畫圈」功能?或者我應該從cero製作它? 或者,而不是...有沒有一個已經在c + +的功能呢?SDL2繪圖圈?
類似:
int main(){
// create the window
SDL_Window * window1 =
SDL_CreateWindow("Window",700,50,500,450, SDL_WINDOW_SHOWN);
// create the renderer
SDL_Renderer * renderer = SDL_CreateRenderer(window1, -1 , SDL_RENDERER_ACCELERATED);
// Set background
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
// Set circle's position
int x = 100; int y = 100;
int radius = 40;
// Loop to hold the window in screen
bool running = true;
while(running) {
SDL_Event event1;
while(SDL_PollEvent(&event1) !=0){
// CIRCLE FUNCTION ??????
functionSDLcircle(x, y, radius);
if(event1.type ==SDL_KEYDOWN) {
switch (event1.key.keysym.sym){
case SDLK_RETURN:
running = false;
break;
}
}
}
}
return 0;
}
如果你想要像圈子這樣的高級功能而不需要抓取一個完整的遊戲引擎,我會推薦優秀的[SFML(簡單快速媒體庫)](https://www.sfml-dev.org/)。 – Defenestrator