overlayPrint() implemented.
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.png filter=lfs diff=lfs merge=lfs -text
|
2
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
*~
|
||||
*.log
|
||||
*.user
|
||||
*.user.*
|
||||
*.ISO
|
||||
*.iso
|
||||
*.m4v
|
||||
|
@ -34,3 +35,4 @@ videotest/*.singe
|
|||
games/
|
||||
build/
|
||||
singe/source.inc.sh
|
||||
singe/font.h
|
||||
|
|
BIN
singe/font.png
(Stored with Git LFS)
Normal file
|
@ -142,15 +142,25 @@ function autoBuild() {
|
|||
}
|
||||
|
||||
|
||||
function createEmbeddedBinary() {
|
||||
local BINFILE=$1
|
||||
local SOURCEFILE=$2
|
||||
local BLOCKER=$3
|
||||
|
||||
if [[ ! -e "${SOURCEFILE}" ]]; then
|
||||
outputHeader ${BLOCKER} > ${SOURCEFILE}
|
||||
xxd -i ${BINFILE} >> ${SOURCEFILE}
|
||||
outputFooter ${BLOCKER} >> ${SOURCEFILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function createExtensionHeader() {
|
||||
local FFMPEG=$1
|
||||
local a=
|
||||
local c=0
|
||||
|
||||
outputLicense
|
||||
printf "\n\n#ifndef FFMPEG_EXTENSIONS_H\n#define FFMPEG_EXTENSIONS_H\n\n\n"
|
||||
printf "// ===== THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT =====\n\n\n"
|
||||
printf "#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n"
|
||||
outputHeader FFMPEG_EXTENSIONS_H
|
||||
printf "static char *ffmpegExtensions[] = {\n"
|
||||
printf "\t"
|
||||
getExtensions "${FFMPEG}" | sort | uniq -u | while read a; do
|
||||
|
@ -161,7 +171,8 @@ function createExtensionHeader() {
|
|||
c=0
|
||||
fi
|
||||
done
|
||||
printf "0\n};\n#pragma GCC diagnostic pop\n\n\n#endif // FFMPEG_EXTENSIONS_H\n"
|
||||
printf "0\n};"
|
||||
outputFooter FFMPEG_EXTENSIONS_H
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,7 +197,16 @@ function getExtensions() {
|
|||
}
|
||||
|
||||
|
||||
function outputLicense() {
|
||||
function outputFooter() {
|
||||
local BLOCKER=$1
|
||||
|
||||
printf "\n#pragma GCC diagnostic pop\n\n\n#endif // ${BLOCKER}\n"
|
||||
}
|
||||
|
||||
|
||||
function outputHeader() {
|
||||
local BLOCKER=$1
|
||||
|
||||
cat <<-LICENSE
|
||||
/*
|
||||
*
|
||||
|
@ -209,6 +229,9 @@ function outputLicense() {
|
|||
*
|
||||
*/
|
||||
LICENSE
|
||||
printf "\n\n#ifndef ${BLOCKER}\n#define ${BLOCKER}\n\n\n"
|
||||
printf "// ===== THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT =====\n\n\n"
|
||||
printf "#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n"
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,3 +402,6 @@ if [[ ! -e "${G_INSTALLED}/lib/everything.a" ]]; then
|
|||
LIBS
|
||||
popd
|
||||
fi
|
||||
|
||||
# === Overlay Font ===
|
||||
createEmbeddedBinary font.png font.h FONT_H
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "util.h"
|
||||
#include "videoPlayer.h"
|
||||
#include "singe.h"
|
||||
#include "font.h"
|
||||
|
||||
|
||||
#define AUDIO_MAX_VOLUME 63
|
||||
|
@ -159,34 +160,37 @@ int _confYResolution = -1;
|
|||
|
||||
// Other globals
|
||||
static MouseT _mice[MAX_MICE];
|
||||
static lua_State *_luaContext = NULL;
|
||||
static SDL_Color _colorForeground = { 255, 255, 255, 255 };
|
||||
static SDL_Color _colorBackground = { 0, 0, 0, 0 };
|
||||
static SDL_Surface *_overlay = NULL;
|
||||
static SDL_Window *_window = NULL;
|
||||
static SDL_Renderer *_renderer = NULL;
|
||||
static SDL_Texture *_videoTexture = NULL;
|
||||
static int _nextSpriteId = 0;
|
||||
static int _nextSoundId = 0;
|
||||
static int _nextFontId = 0;
|
||||
static int _effectsVolume = AUDIO_MAX_VOLUME;
|
||||
static int _keyboardMode = KEYBD_NORMAL;
|
||||
static int _videoHandle = -1;
|
||||
static int _fontQuality = 1;
|
||||
static int _mouseMode = MOUSE_SINGLE;
|
||||
static int _mouseCount = 0;
|
||||
static double _overlayScaleX = 1; // Difference between overlay and video
|
||||
static double _overlayScaleY = 1; // Difference between overlay and video
|
||||
static bool _pauseState = false; // by RDG2010
|
||||
static bool _pauseEnabled = true; // by RDG2010
|
||||
static bool _refreshDisplay = false;
|
||||
static bool _running = true;
|
||||
static bool _discStopped = true;
|
||||
static bool _mouseEnabled = true;
|
||||
static SpriteT *_spriteList = NULL;
|
||||
static SoundT *_soundList = NULL;
|
||||
static FontT *_fontList = NULL;
|
||||
static FontT *_fontCurrent = NULL;
|
||||
static lua_State *_luaContext = NULL;
|
||||
static SDL_Color _colorForeground = { 255, 255, 255, 255 };
|
||||
static SDL_Color _colorBackground = { 0, 0, 0, 0 };
|
||||
static SDL_Surface *_overlay = NULL;
|
||||
static SDL_Window *_window = NULL;
|
||||
static SDL_Renderer *_renderer = NULL;
|
||||
static SDL_Texture *_videoTexture = NULL;
|
||||
static SDL_Surface *_consoleFontSurface = NULL;
|
||||
static int _consoleFontWidth = 0;
|
||||
static int _consoleFontHeight = 0;
|
||||
static int _nextSpriteId = 0;
|
||||
static int _nextSoundId = 0;
|
||||
static int _nextFontId = 0;
|
||||
static int _effectsVolume = AUDIO_MAX_VOLUME;
|
||||
static int _keyboardMode = KEYBD_NORMAL;
|
||||
static int _videoHandle = -1;
|
||||
static int _fontQuality = 1;
|
||||
static int _mouseMode = MOUSE_SINGLE;
|
||||
static int _mouseCount = 0;
|
||||
static double _overlayScaleX = 1; // Difference between overlay and video
|
||||
static double _overlayScaleY = 1; // Difference between overlay and video
|
||||
static bool _pauseState = false; // by RDG2010
|
||||
static bool _pauseEnabled = true; // by RDG2010
|
||||
static bool _refreshDisplay = false;
|
||||
static bool _running = true;
|
||||
static bool _discStopped = true;
|
||||
static bool _mouseEnabled = true;
|
||||
static SpriteT *_spriteList = NULL;
|
||||
static SoundT *_soundList = NULL;
|
||||
static FontT *_fontList = NULL;
|
||||
static FontT *_fontCurrent = NULL;
|
||||
|
||||
|
||||
static int _keyDefs[SWITCH_COUNT][2] = {
|
||||
|
@ -932,13 +936,35 @@ int apiOverlayGetWidth(lua_State *L) {
|
|||
|
||||
|
||||
int apiOverlayPrint(lua_State *L) {
|
||||
int n = lua_gettop(L);
|
||||
int n = lua_gettop(L);
|
||||
int i = 0;
|
||||
char *s = NULL;
|
||||
int length = 0;
|
||||
SDL_Rect src;
|
||||
SDL_Rect dst;
|
||||
|
||||
if (n == 3) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
if (lua_isnumber(L, 2)) {
|
||||
if (lua_isstring(L, 3)) {
|
||||
//***TODO*** g_pSingeIn->draw_string((char *)lua_tostring(L, 3), lua_tonumber(L, 1), lua_tonumber(L, 2), g_se_surface);
|
||||
src.y = 0;
|
||||
src.w = _consoleFontWidth;
|
||||
src.h = _consoleFontHeight;
|
||||
dst.x = lua_tonumber(L, 1);
|
||||
dst.y = lua_tonumber(L, 2);
|
||||
dst.w = _consoleFontWidth;
|
||||
dst.h = _consoleFontHeight;
|
||||
s = (char *)lua_tostring(L, 3);
|
||||
if (strlen(s) < (unsigned int)((_overlay->w - dst.x) / _consoleFontWidth)) {
|
||||
length = strlen(s);
|
||||
} else {
|
||||
length = (_overlay->w - dst.x) / _consoleFontWidth;
|
||||
}
|
||||
for (i=0; i<length; i++) {
|
||||
src.x = s[i] * _consoleFontWidth;
|
||||
SDL_BlitSurface(_consoleFontSurface, &src, _overlay, &dst);
|
||||
dst.x += _consoleFontWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2049,6 +2075,13 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
|||
// Let us know when sounds end
|
||||
Mix_ChannelFinished(channelFinished);
|
||||
|
||||
// Load overlay font
|
||||
_consoleFontSurface = IMG_LoadPNG_RW(SDL_RWFromMem(font_png, font_png_len));
|
||||
if (_consoleFontSurface == NULL) utilDie("%s", SDL_GetError());
|
||||
_consoleFontWidth = _consoleFontSurface->w / 256;
|
||||
_consoleFontHeight = _consoleFontSurface->h;
|
||||
SDL_SetColorKey(_consoleFontSurface, true, _consoleFontSurface->format->Rmask | _consoleFontSurface->format->Bmask);
|
||||
|
||||
// Start video
|
||||
videoPlay(_videoHandle);
|
||||
_discStopped = false;
|
||||
|
@ -2238,8 +2271,9 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
|||
// Stop Lua
|
||||
lua_close(_luaContext);
|
||||
|
||||
// Free overlay
|
||||
// Free overlay & overlay font
|
||||
SDL_FreeSurface(_overlay);
|
||||
SDL_FreeSurface(_consoleFontSurface);
|
||||
|
||||
// Unload fonts
|
||||
HASH_ITER(hh, _fontList, font, fontTemp) {
|
||||
|
|
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 128 B |
BIN
singe/thirdparty/SDL2/Xcode-iOS/Demos/Default.png
vendored
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 130 B |
BIN
singe/thirdparty/SDL2/Xcode-iOS/Demos/Icon.png
vendored
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 558 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 79 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 57 B After Width: | Height: | Size: 127 B |