mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-05 05:17:58 +03:00
Move sjis_to_unicode to platform directory
This commit is contained in:
@@ -24,6 +24,7 @@ OBJS = src/fileio.o \
|
||||
src/sys/nact_input.o \
|
||||
src/sys/nact_sys3.o \
|
||||
src/win/nact_dialog.o \
|
||||
src/win/unicode.o \
|
||||
src/res3/Script1.o
|
||||
|
||||
DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
+3
-13
@@ -21,24 +21,14 @@ typedef char _TCHAR;
|
||||
#define _stprintf_s sprintf_s
|
||||
|
||||
// type definition
|
||||
#ifndef uint8
|
||||
typedef unsigned char uint8;
|
||||
#endif
|
||||
#ifndef uint16
|
||||
typedef unsigned short uint16;
|
||||
#endif
|
||||
#ifndef uint32
|
||||
typedef unsigned long uint32;
|
||||
#endif
|
||||
|
||||
#ifndef int8
|
||||
typedef signed char int8;
|
||||
#endif
|
||||
#ifndef int16
|
||||
typedef signed short int16;
|
||||
#endif
|
||||
#ifndef int32
|
||||
typedef signed long int32;
|
||||
#endif
|
||||
|
||||
// utilities
|
||||
uint16 sjis_to_unicode(uint16 sjis);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-19
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
#include <windows.h>
|
||||
|
||||
void AGS::draw_text(char string[])
|
||||
{
|
||||
@@ -54,24 +53,7 @@ void AGS::draw_text(char string[])
|
||||
|
||||
void AGS::draw_char(int dest, int dest_x, int dest_y, uint16 code, int size, uint8 color)
|
||||
{
|
||||
char string[3];
|
||||
int length;
|
||||
SDL_Color white = {0xff, 0xff, 0xff};
|
||||
|
||||
// パターン取得
|
||||
if(code > 0xff) {
|
||||
string[0] = code >> 8;
|
||||
string[1] = code & 0xff;
|
||||
string[2] = '\0';
|
||||
length = 2;
|
||||
} else {
|
||||
string[0] = code & 0xff;
|
||||
string[1] = '\0';
|
||||
length = 1;
|
||||
}
|
||||
Uint16 buf[2];
|
||||
MultiByteToWideChar(CP_ACP, 0, string, length, (LPWSTR)buf, 2);
|
||||
|
||||
TTF_Font* font = NULL;
|
||||
switch (size) {
|
||||
case 16: font = hFont16; break;
|
||||
@@ -81,7 +63,8 @@ void AGS::draw_char(int dest, int dest_x, int dest_y, uint16 code, int size, uin
|
||||
case 64: font = hFont64; break;
|
||||
}
|
||||
|
||||
SDL_Surface* fs = TTF_RenderGlyph_Solid(font, buf[0], white);
|
||||
SDL_Color white = {0xff, 0xff, 0xff};
|
||||
SDL_Surface* fs = TTF_RenderGlyph_Solid(font, sjis_to_unicode(code), white);
|
||||
|
||||
// パターン出力
|
||||
// TODO: Blit?
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "common.h"
|
||||
#include <windows.h>
|
||||
|
||||
uint16 sjis_to_unicode(uint16 code)
|
||||
{
|
||||
char string[3];
|
||||
int length;
|
||||
|
||||
if(code > 0xff) {
|
||||
string[0] = code >> 8;
|
||||
string[1] = code & 0xff;
|
||||
string[2] = '\0';
|
||||
length = 2;
|
||||
} else {
|
||||
string[0] = code & 0xff;
|
||||
string[1] = '\0';
|
||||
length = 1;
|
||||
}
|
||||
uint16 buf[2];
|
||||
MultiByteToWideChar(CP_ACP, 0, string, length, (LPWSTR)buf, 2);
|
||||
return buf[0];
|
||||
}
|
||||
Reference in New Issue
Block a user