Commit ac176507 authored by deuce's avatar deuce
Browse files

Add new wrapper functions to get/set the scaling factor.

parent cc856ab7
...@@ -61,10 +61,6 @@ if(SDL_FOUND) ...@@ -61,10 +61,6 @@ if(SDL_FOUND)
target_compile_definitions(ciolib PUBLIC WITH_SDL) target_compile_definitions(ciolib PUBLIC WITH_SDL)
endif() endif()
if(NEED_BITMAP)
target_compile_definitions(ciolib PUBLIC HAS_VSTAT)
endif()
if(NOT WIN32) if(NOT WIN32)
target_link_libraries(ciolib pthread) target_link_libraries(ciolib pthread)
endif() endif()
......
...@@ -577,6 +577,17 @@ int bitmap_getfont(void) ...@@ -577,6 +577,17 @@ int bitmap_getfont(void)
return(current_font); return(current_font);
} }
void bitmap_setscaling(int new_value)
{
if(new_value > 0)
vstat.scaling = new_value;
}
int bitmap_getscaling(void)
{
return vstat.scaling;
}
/* Called from event thread only */ /* Called from event thread only */
int bitmap_loadfont(char *filename) int bitmap_loadfont(char *filename)
{ {
......
...@@ -28,5 +28,7 @@ void bitmap_getcustomcursor(int *s, int *e, int *r, int *b, int *v); ...@@ -28,5 +28,7 @@ void bitmap_getcustomcursor(int *s, int *e, int *r, int *b, int *v);
void bitmap_setcustomcursor(int s, int e, int r, int b, int v); void bitmap_setcustomcursor(int s, int e, int r, int b, int v);
int bitmap_getvideoflags(void); int bitmap_getvideoflags(void);
void bitmap_setvideoflags(int flags); void bitmap_setvideoflags(int flags);
void bitmap_setscaling(int new_value);
int bitmap_getscaling(void);
#endif #endif
...@@ -113,6 +113,8 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt); ...@@ -113,6 +113,8 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt);
CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen); CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen);
CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void); CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void);
CIOLIBEXPORT int CIOLIBCALL ciolib_get_window_info(int *width, int *height, int *xpos, int *ypos); CIOLIBEXPORT int CIOLIBCALL ciolib_get_window_info(int *width, int *height, int *xpos, int *ypos);
CIOLIBEXPORT void CIOLIBCALL ciolib_setscaling(int new_value);
CIOLIBEXPORT int CIOLIBCALL ciolib_getscaling(void);
#define CIOLIB_INIT() { if(initialized != 1) initciolib(CIOLIB_MODE_AUTO); } #define CIOLIB_INIT() { if(initialized != 1) initciolib(CIOLIB_MODE_AUTO); }
...@@ -152,6 +154,8 @@ int try_sdl_init(int mode) ...@@ -152,6 +154,8 @@ int try_sdl_init(int mode)
cio_api.getcliptext=sdl_getcliptext; cio_api.getcliptext=sdl_getcliptext;
#endif #endif
cio_api.get_window_info=sdl_get_window_info; cio_api.get_window_info=sdl_get_window_info;
cio_api.setscaling=bitmap_setscaling;
cio_api.getscaling=bitmap_getscaling;
return(1); return(1);
} }
return(0); return(0);
...@@ -189,6 +193,8 @@ int try_x_init(int mode) ...@@ -189,6 +193,8 @@ int try_x_init(int mode)
cio_api.copytext=x_copytext; cio_api.copytext=x_copytext;
cio_api.getcliptext=x_getcliptext; cio_api.getcliptext=x_getcliptext;
cio_api.get_window_info=x_get_window_info; cio_api.get_window_info=x_get_window_info;
cio_api.setscaling=bitmap_setscaling;
cio_api.getscaling=bitmap_getscaling;
return(1); return(1);
} }
return(0); return(0);
...@@ -1321,3 +1327,18 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_getvideoflags(void) ...@@ -1321,3 +1327,18 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_getvideoflags(void)
return(cio_api.getvideoflags()); return(cio_api.getvideoflags());
return(0); return(0);
} }
/* Optional */
CIOLIBEXPORT void CIOLIBCALL ciolib_setscaling(int new_value)
{
if(cio_api.setscaling)
cio_api.setscaling(new_value);
}
/* Optional */
CIOLIBEXPORT int CIOLIBCALL ciolib_getscaling(void)
{
if(cio_api.getscaling)
return(cio_api.getscaling());
return(0);
}
......
...@@ -295,6 +295,8 @@ typedef struct { ...@@ -295,6 +295,8 @@ typedef struct {
void (*setcustomcursor) (int startline, int endline, int range, int blink, int visible); void (*setcustomcursor) (int startline, int endline, int range, int blink, int visible);
void (*setvideoflags) (int flags); void (*setvideoflags) (int flags);
int (*getvideoflags) (void); int (*getvideoflags) (void);
void (*setscaling) (int new_value);
int (*getscaling) (void);
int *ESCDELAY; int *ESCDELAY;
} cioapi_t; } cioapi_t;
...@@ -360,6 +362,8 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_getcustomcursor(int *startline, int *endline ...@@ -360,6 +362,8 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_getcustomcursor(int *startline, int *endline
CIOLIBEXPORT void CIOLIBCALL ciolib_setcustomcursor(int startline, int endline, int range, int blink, int visible); CIOLIBEXPORT void CIOLIBCALL ciolib_setcustomcursor(int startline, int endline, int range, int blink, int visible);
CIOLIBEXPORT void CIOLIBCALL ciolib_setvideoflags(int flags); CIOLIBEXPORT void CIOLIBCALL ciolib_setvideoflags(int flags);
CIOLIBEXPORT int CIOLIBCALL ciolib_getvideoflags(void); CIOLIBEXPORT int CIOLIBCALL ciolib_getvideoflags(void);
CIOLIBEXPORT void CIOLIBCALL ciolib_setscaling(int flags);
CIOLIBEXPORT int CIOLIBCALL ciolib_getscaling(void);
/* DoorWay specific stuff that's only applicable to ANSI mode. */ /* DoorWay specific stuff that's only applicable to ANSI mode. */
CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable); CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
...@@ -419,6 +423,8 @@ CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable); ...@@ -419,6 +423,8 @@ CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
#define setcustomcursor(a,b,c,d,e) ciolib_setcustomcursor(a,b,c,d,e) #define setcustomcursor(a,b,c,d,e) ciolib_setcustomcursor(a,b,c,d,e)
#define setvideoflags(a) ciolib_setvideoflags(a) #define setvideoflags(a) ciolib_setvideoflags(a)
#define getvideoflags() ciolib_getvideoflags() #define getvideoflags() ciolib_getvideoflags()
#define setscaling(a) ciolib_setscaling(a)
#define getscaling() ciolib_getscaling()
#endif #endif
#ifdef WITH_SDL #ifdef WITH_SDL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment