C++ SDL_SetRenderDrawColor(255,0,0,255);未设置使用Visual Studio 10以黑色继续打开窗口

C++ SDL_SetRenderDrawColor(255,0,0,255);未设置使用Visual Studio 10以黑色继续打开窗口,c++,sdl-2,C++,Sdl 2,我刚刚使用了SDL_SetRenderDrawColor(ren,255,0,0255) 对于SDL_Rect rec但未更改颜色,使用SDL_RenderPresent(ren)以黑色im渲染窗口 还需要用点什么吗?可能是SDL_RenderCopy 有人知道发生了什么吗 #include "game.h" Game::Game(){ SDL_Init(0); SDL_CreateWindowAndRenderer(800, 600, 0, &win, &re

我刚刚使用了SDL_SetRenderDrawColor(ren,255,0,0255)

对于SDL_Rect rec但未更改颜色,使用SDL_RenderPresent(ren)以黑色im渲染窗口

还需要用点什么吗?可能是SDL_RenderCopy

有人知道发生了什么吗

#include "game.h"

Game::Game(){
    SDL_Init(0);
    SDL_CreateWindowAndRenderer(800, 600, 0, &win, &ren);
    SDL_SetWindowTitle(win, "Game-SDL2");
    running=true;
    count=0;
    loop();
}

Game::~Game(){
    SDL_DestroyRenderer(ren);
    SDL_DestroyWindow(win);
    SDL_Quit();

}

void Game::loop(){
    while(running){

      lastFrame = SDL_GetTicks();
      int static lastTime;
      if (lastFrame >= (lastTime+1000))
      {
         lastTime=lastFrame;  
         frameCount=0;
         count++;
      }

      render();
      input();
      update();

      if (count > 3) running=false;

    }
}

void Game::render(){

    SDL_SetRenderDrawColor(ren, 255, 0, 0, 255);
    SDL_Rect rect;
    rect.x, rect.y=0;
    rect.w=800;
    rect.h=600;
    SDL_RenderFillRect(ren, &rect);

    frameCount++;
    int timerFPS = SDL_GetTicks()-lastFrame;
    if (timerFPS > (1000/60)){
        SDL_Delay((1000/60)-timerFPS);
    }

        SDL_RenderPresent(ren, &rect);

}
我刚把

SDL_RenderClear(ren)

工作了吗???显示为红色,但我更改了矩形矩形的尺寸,如果窗口800x600始终为红色,则没有更改大小,但我认为正确的颜色设置为矩形,而不是所有窗口的颜色

可能还不是解决方案