void GameSurfaceSDL::fpsProcess()
{
- SDL_Rect windowRect = {0, 0, 120, 20};
+ SDL_Rect windowRect = {0, 0, 60, 10};
+ SDL_Surface *surface;
char fpsBuf[12];
int getTicks;
int i;
frameTimeLast = getTicks;
framesPerSecond = 1000.f * FPS_UPDATE / frameTime;
sprintf_s(fpsBuf, 12, "fps:%d", framesPerSecond);
- fpsSurface = TTF_RenderUTF8_Blended(fontSmall, fpsBuf, color);
+ surface = TTF_RenderUTF8_Blended(fontSmall, fpsBuf, color);
+ fpsTexture = SDL_CreateTextureFromSurface(renderer, surface);
+ SDL_FreeSurface(surface);
}
- SDL_BlitSurface(fpsSurface, &windowRect, windowSurface, &windowRect);
+ SDL_RenderCopy(renderer, fpsTexture, NULL, &windowRect);
}
SDL_RenderClear(renderer);
SDL_GetWindowSize(window, &rect.w, &rect.h);
- SDL_SetRenderDrawColor(renderer, 50, 50, 0, 255);
+ SDL_SetRenderDrawColor(renderer, 50, 20, 0, 255);
SDL_FillRect(windowSurface, &rect, SDL_MapRGBA(windowSurface->format, 50, 20, 10, 255));
- //SDL_RenderCopy(renderer, titleTexture, &rectTitleSrc, &rectTitleDst);
SDL_RenderCopy(renderer, titleTexture, &rectTitleSrc, &rectTitleDst);
if(this->viewFieldPtr)
this->fpsProcess();
SDL_Delay(16 - frameDeltaTime > 0 ? 16 - frameDeltaTime : 0);
-
// SDL_UpdateWindowSurfaceRects(window, &rect, 1);
// SDL_UpdateWindowSurface(window);
SDL_RenderPresent(renderer);
SDL_Surface *creatureStatusSurface; //!< \83N\83\8a\81[\83`\83\83\81[\83X\83e\81[\83^\83X\95\\8e¦\82ÌSurface\8eQ\8fÆ
SDL_Surface *creatureSideStatusSurface; //!< \83T\83C\83h\83N\83\8a\81[\83`\83\83\81[\83X\83e\81[\83^\83X\95\\8e¦\82ÌSurface\8eQ\8fÆ
SDL_Surface *gameTimeStatusSurface; //!< \83Q\81[\83\80\8e\9e\8aÔ\95\\8e¦\82ÌSurface\8eQ\8fÆ
- SDL_Surface *fpsSurface;
+ SDL_Texture *fpsTexture;
std::map<TAG, SDL_Surface*> floorSurfaces; //!< \83t\83\8d\83A\83O\83\89\83t\83B\83b\83N\82ÌSurface\8eQ\8fÆ\83\8a\83X\83g