mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-08 14:58:14 +03:00
@@ -73,6 +73,7 @@ Texture *gfx_main_surface(void);
|
||||
void gfx_set_window_logical_size(int w, int h);
|
||||
void gfx_update_screen_scale(void);
|
||||
void gfx_set_wait_vsync(bool wait);
|
||||
float gfx_get_frame_rate(void);
|
||||
|
||||
void gfx_load_shader(struct shader *dst, const char *vertex_shader_path, const char *fragment_shader_path);
|
||||
GLuint gfx_load_shader_file(const char *path, GLenum type);
|
||||
|
||||
@@ -114,6 +114,9 @@ void StoatSpriteEngine_SP_SetTextSpriteBoldWeight(float weight);
|
||||
void StoatSpriteEngine_SP_SetTextSpriteEdgeWeight(float weight);
|
||||
void StoatSpriteEngine_SP_SetTextSpriteEdgeColor(int r, int g, int b);
|
||||
bool StoatSpriteEngine_SP_SetDashTextSprite(int sp_no, int width, int height);
|
||||
void StoatSpriteEngine_FPS_SetShow(bool show);
|
||||
bool StoatSpriteEngine_FPS_GetShow(void);
|
||||
float StoatSpriteEngine_FPS_Get(void);
|
||||
//int StoatSpriteEngine_SP_SetBrightness(int sp_no, int brightness);
|
||||
//int StoatSpriteEngine_SP_GetBrightness(int sp_no);
|
||||
int StoatSpriteEngine_SYSTEM_IsResetOnce(void);
|
||||
|
||||
@@ -205,8 +205,6 @@ HLL_WARN_UNIMPLEMENTED(false, bool, ChipmunkSpriteEngine, SP_Suspend, int sp_no)
|
||||
//static void ChipmunkSpriteEngine_CombineTexture(void);
|
||||
//static void ChipmunkSpriteEngine_ReleaseCombinedTexture(void);
|
||||
|
||||
HLL_WARN_UNIMPLEMENTED( , void, StoatSpriteEngine, FPS_SetShow, bool bShow);
|
||||
HLL_WARN_UNIMPLEMENTED(false, bool, StoatSpriteEngine, FPS_GetShow, void);
|
||||
|
||||
HLL_LIBRARY(ChipmunkSpriteEngine,
|
||||
HLL_EXPORT(_PreLink, ChipmunkSpriteEngine_PreLink),
|
||||
@@ -277,7 +275,7 @@ HLL_LIBRARY(ChipmunkSpriteEngine,
|
||||
HLL_TODO_EXPORT(SP_GetAlphaClipperSpriteNumber, ChipmunkSpriteEngine_SP_GetAlphaClipperSpriteNumber),
|
||||
HLL_EXPORT(FPS_SetShow, StoatSpriteEngine_FPS_SetShow),
|
||||
HLL_EXPORT(FPS_GetShow, StoatSpriteEngine_FPS_GetShow),
|
||||
HLL_TODO_EXPORT(FPS_Get, StoatSpriteEngine_FPS_Get),
|
||||
HLL_EXPORT(FPS_Get, StoatSpriteEngine_FPS_Get),
|
||||
HLL_EXPORT(GAME_MSG_GetNumof, sact_GAME_MSG_GetNumOf),
|
||||
HLL_TODO_EXPORT(GAME_MSG_Get, SACT2_GAME_MSG_Get),
|
||||
HLL_EXPORT(IntToZenkaku, sact_IntToZenkaku),
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "AnteaterADVEngine.h"
|
||||
#include "CharSpriteManager.h"
|
||||
|
||||
static bool fps_show = false;
|
||||
|
||||
HLL_WARN_UNIMPLEMENTED( , void, StoatSpriteEngine, JoypadQuake_Set, int num, int type, int magnitude);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, StoatSpriteEngine, SP_SetBrightness, int sp_no, int brightness);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, StoatSpriteEngine, SP_GetBrightness, int sp_no);
|
||||
@@ -169,9 +171,19 @@ bool StoatSpriteEngine_SP_SetDashTextSprite(int sp_no, int width, int height)
|
||||
return true;
|
||||
}
|
||||
|
||||
//static void StoatSpriteEngine_FPS_SetShow(bool bShow);
|
||||
//static bool StoatSpriteEngine_FPS_GetShow(void);
|
||||
//static float StoatSpriteEngine_FPS_Get(void);
|
||||
void StoatSpriteEngine_FPS_SetShow(bool show)
|
||||
{
|
||||
fps_show = show;
|
||||
}
|
||||
bool StoatSpriteEngine_FPS_GetShow(void)
|
||||
{
|
||||
return fps_show;
|
||||
}
|
||||
|
||||
float StoatSpriteEngine_FPS_Get(void)
|
||||
{
|
||||
return gfx_get_frame_rate();
|
||||
}
|
||||
|
||||
HLL_WARN_UNIMPLEMENTED( , void, StoatSpriteEngine, VIEW_SetOffsetPos, int x, int y);
|
||||
|
||||
@@ -1003,9 +1015,9 @@ HLL_LIBRARY(StoatSpriteEngine,
|
||||
HLL_EXPORT(SP_SetTextSpriteEdgeWeight, StoatSpriteEngine_SP_SetTextSpriteEdgeWeight),
|
||||
HLL_EXPORT(SP_SetTextSpriteEdgeColor, StoatSpriteEngine_SP_SetTextSpriteEdgeColor),
|
||||
HLL_EXPORT(SP_SetDashTextSprite, StoatSpriteEngine_SP_SetDashTextSprite),
|
||||
HLL_TODO_EXPORT(FPS_SetShow, StoatSpriteEngine_FPS_SetShow),
|
||||
HLL_TODO_EXPORT(FPS_GetShow, StoatSpriteEngine_FPS_GetShow),
|
||||
HLL_TODO_EXPORT(FPS_Get, StoatSpriteEngine_FPS_Get),
|
||||
HLL_EXPORT(FPS_SetShow, StoatSpriteEngine_FPS_SetShow),
|
||||
HLL_EXPORT(FPS_GetShow, StoatSpriteEngine_FPS_GetShow),
|
||||
HLL_EXPORT(FPS_Get, StoatSpriteEngine_FPS_Get),
|
||||
HLL_EXPORT(GAME_MSG_GetNumof, sact_GAME_MSG_GetNumOf),
|
||||
HLL_TODO_EXPORT(GAME_MSG_Get, SACT2_GAME_MSG_Get),
|
||||
HLL_EXPORT(IntToZenkaku, sact_IntToZenkaku),
|
||||
|
||||
+22
@@ -68,6 +68,7 @@ static struct texture main_surface;
|
||||
static struct texture *view = &main_surface;
|
||||
static GLint max_texture_size;
|
||||
static SDL_Color clear_color = { 0, 0, 0, 255 };
|
||||
static float frame_rate;
|
||||
|
||||
static GLchar *read_shader_file(const char *path)
|
||||
{
|
||||
@@ -379,6 +380,25 @@ void gfx_set_view_offset(int x, int y)
|
||||
glm_translate(mw_transform, off);
|
||||
}
|
||||
|
||||
float gfx_get_frame_rate(void)
|
||||
{
|
||||
return frame_rate;
|
||||
}
|
||||
|
||||
static void gfx_update_frame_rate_counter(void)
|
||||
{
|
||||
static uint64_t timestamp;
|
||||
static int frame_count;
|
||||
|
||||
frame_count++;
|
||||
uint64_t current_time = SDL_GetTicks64();
|
||||
if (current_time > timestamp + 1000) {
|
||||
frame_rate = frame_count * 1000.f / (current_time - timestamp);
|
||||
timestamp = current_time;
|
||||
frame_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_swap(void)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
@@ -403,6 +423,8 @@ void gfx_swap(void)
|
||||
SDL_GL_SwapWindow(sdl.window);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, main_surface_fb);
|
||||
glViewport(0, 0, sdl.w, sdl.h);
|
||||
|
||||
gfx_update_frame_rate_counter();
|
||||
}
|
||||
|
||||
void gfx_set_view(struct texture *t)
|
||||
|
||||
Reference in New Issue
Block a user