mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 02:08:16 +00:00
Merge pull request #2190 from frangarcj/master
(Vita) Vita2d font renderer
This commit is contained in:
commit
38d59e1e86
@ -205,7 +205,7 @@ else ifeq ($(platform), vita)
|
||||
PLATCFLAGS := -O3 -mfloat-abi=hard -ffast-math -fsingle-precision-constant
|
||||
LIBS += -lSceKernel_stub -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lUVLoader_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lz -lm -lc
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lfreetype -lz -lm -lc
|
||||
|
||||
PLATOBJS += audio/audio_utils_neon.o audio/drivers_resampler/sinc_neon.o \
|
||||
audio/drivers_resampler/cc_resampler_neon.o
|
||||
|
99
gfx/drivers_font/vita2d_font.c
Normal file
99
gfx/drivers_font/vita2d_font.c
Normal file
@ -0,0 +1,99 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <vita2d.h>
|
||||
#include "../../vita/stockfont.h"
|
||||
|
||||
#include "../font_renderer_driver.h"
|
||||
#include "../font_driver.h"
|
||||
|
||||
typedef struct vita_font
|
||||
{
|
||||
vita2d_font *font;
|
||||
float size;
|
||||
|
||||
} vita_font_t;
|
||||
|
||||
static void *vita2d_font_init_font(void *gl_data, const char *font_path, float font_size)
|
||||
{
|
||||
RARCH_LOG("vita2d_font_init()\n");
|
||||
|
||||
vita_font_t *vita = (vita_font_t *)calloc(1, sizeof(vita_font_t));
|
||||
|
||||
vita->font = vita2d_load_font_mem(stockfont,stockfont_size);
|
||||
vita->size = font_size;
|
||||
RARCH_LOG("vita2d_font_init()\n");
|
||||
|
||||
return vita;
|
||||
}
|
||||
|
||||
static void vita2d_font_free_font(void *data)
|
||||
{
|
||||
RARCH_LOG("vita2d_font_free()\n");
|
||||
|
||||
vita_font_t *vita = (vita_font_t *)data;
|
||||
|
||||
if(vita->font)
|
||||
vita2d_free_font(vita->font);
|
||||
|
||||
vita->size = 0;
|
||||
|
||||
RARCH_LOG("vita2d_font_free()\n");
|
||||
}
|
||||
|
||||
static void vita2d_font_render_msg(void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
float x, y, scale;
|
||||
unsigned color;
|
||||
settings_t *settings = config_get_ptr();
|
||||
vita_font_t *vita = (vita_font_t *)data;
|
||||
const struct font_params *params = (const struct font_params*)userdata;
|
||||
|
||||
(void)data;
|
||||
|
||||
if (params)
|
||||
{
|
||||
x = params->x;
|
||||
y = params->y;
|
||||
scale = params->scale;
|
||||
color = params->color;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = settings->video.msg_pos_x;
|
||||
y = 0.90f;
|
||||
scale = 1.04f;
|
||||
color = SILVER;
|
||||
}
|
||||
|
||||
vita2d_font_draw_text(vita->font, x, y, color, vita->size*scale, msg);
|
||||
|
||||
if (!params)
|
||||
vita2d_font_draw_text(vita->font, x, y, color, vita->size*(scale - 0.01f), msg);
|
||||
|
||||
}
|
||||
|
||||
font_renderer_t vita2d_font_renderer = {
|
||||
vita2d_font_init_font,
|
||||
vita2d_font_free_font,
|
||||
vita2d_font_render_msg,
|
||||
"vita2dfont",
|
||||
NULL, /* get_glyph */
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
NULL, /* get_message_width */
|
||||
};
|
@ -274,6 +274,11 @@ FONTS
|
||||
#include "../gfx/drivers_font/xdk360_fonts.c"
|
||||
#endif
|
||||
|
||||
#if defined(VITA)
|
||||
#include "../vita/stockfont.c"
|
||||
#include "../gfx/drivers_font/vita2d_font.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
INPUT
|
||||
============================================================ */
|
||||
|
10652
vita/stockfont.c
Normal file
10652
vita/stockfont.c
Normal file
File diff suppressed because it is too large
Load Diff
14
vita/stockfont.h
Normal file
14
vita/stockfont.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
This file was autogenerated by raw2c.
|
||||
Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
#ifndef _stockfont_h_
|
||||
#define _stockfont_h_
|
||||
//---------------------------------------------------------------------------------
|
||||
extern const unsigned char stockfont[];
|
||||
extern const int stockfont_size;
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif //_stockfont_h_
|
||||
//---------------------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user