程序不会为我更新显示。 我需要移动,但是我为我创建了包装器。我使用的是Linux / GNUDebian 9 64位和SDL2,我有opengl2.1。 这段代码可以用g ++编译,但是无法运行。我正在使用SDL_RenderClear制作新帧。
#include "include/view.h"
#include <stdio.h>
int loading = true;
int player_x = 150;
int player_y = 300;
Win* wind = new Win();
void loading_view(){
wind->setBackgroundColor(0, 0, 0);
wind->clear();
Rect* logo = new Rect();
logo->CreateAsImage(260,150,250,100,"assets/images/logo.png");
ProgressBar* lul = new ProgressBar();
lul->Create(player_x,player_y,400,50);
wind->render();
}
int main(){
wind->init("OpenPacman",800,640);
loading_view();
while(loading == true)
{
SDL_Event event;
if (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
{
break;
}
if(event.type == SDL_KEYDOWN){
player_y -= 1;
wind->update();
loading_view();
}
}
}
}