我似乎遇到了使用SDL_Surface的问题。
这是我的头文件(CApp.h):
#ifndef _CAPP_H_
#define _CAPP_H_
#include <SDL.h>
class CApp {
private:
bool Running;
SDL_Surface* Surf_Display;
public:
CApp();
int OnExecute();
public:
bool OnInit();
void OnEvent(SDL_Event* Event);
void OnLoop();
void OnRender();
void OnCleanup();
};
#endif
这就是问题所在:
#include "CApp.h"
CApp::CApp() {
Surf_Display = NULL;
Running = true;
}
int CApp::OnExecute() {
if(OnInit() == false) {
return -1;
}
SDL_Event Event;
while(Running) {
while(SDL_PollEvent(&Event)) {
OnEvent(&Event);
}
OnLoop();
OnRender();
}
OnCleanup();
return 0;
}
int main(int argc, char* argv[]) {
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Quit SDL
SDL_Quit();
return 0;
CApp theApp;
return theApp.OnExecute();
}
错误说'Surf_Display' was not declared in this scope.