From d43d5d769059f0d6f8d90a0df71ac65728fa8de4 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 12 Nov 2010 07:16:33 +0000 Subject: [PATCH] Getting BLF to work with the Blenderplayer. --- source/blender/editors/datafiles/SConscript | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/blenderplayer/CMakeLists.txt | 3 ++- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 -- source/gameengine/GamePlayer/ghost/CMakeLists.txt | 1 + source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 10 ++++++++++ source/gameengine/GamePlayer/ghost/SConscript | 1 + 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript index 99acd52806e..dd0db90af44 100644 --- a/source/blender/editors/datafiles/SConscript +++ b/source/blender/editors/datafiles/SConscript @@ -6,4 +6,4 @@ sources = env.Glob('*.c') incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' #/intern/guardedalloc' -env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core'], priority=[235] ) +env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core', 'player'], priority=[235, 30] ) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index d98459a113c..855317b9f76 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -129,7 +129,7 @@ void WM_init(bContext *C, int argc, char **argv) ED_file_init(); /* for fsmenu */ ED_init_node_butfuncs(); - BLF_init(11, U.dpi); + BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ BLF_lang_init(); /* get the default database, plus a wm */ diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 6c97c2a4465..b3c9aede6b5 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -70,7 +70,8 @@ IF(UNIX) bf_blenkernel bf_blenloader bf_blenpluginapi - bf_blroutines + bf_blroutines + bf_editor_datafiles bf_converter bf_ketsji bf_bullet diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 7f0a57be371..f6a84b0852d 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -116,8 +116,6 @@ struct Render *RE_GetRender(const char *name){return (struct Render *) NULL;} /* blenkernel */ char btempdir[] = ""; void RE_FreeRenderResult(struct RenderResult *res){} -char datatoc_bmonofont_ttf[] = ""; -int datatoc_bmonofont_ttf_size = 0; struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty){return (struct RenderResult *) NULL;} void RE_GetResultImage(struct Render *re, struct RenderResult *rr){} int RE_RenderInProgress(struct Render *re){return 0;} diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index e02a8a53ba2..824b11d77f8 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -36,6 +36,7 @@ SET(INC ../../../../source/gameengine/Converter ../../../../source/blender/imbuf ../../../../source/gameengine/Ketsji + ../../../../source/blender/blenfont ../../../../source/blender/blenlib ../../../../source/blender/blenkernel ../../../../source/blender/readblenfile diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 45eea75eb2f..d9aaa56b19e 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -72,6 +72,11 @@ extern "C" extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ extern char btempdir[]; /* use this to store a valid temp directory */ +// For BLF +#include "BLF_api.h" +extern int datatoc_bfont_ttf_size; +extern char datatoc_bfont_ttf[]; + #ifdef __cplusplus } #endif // __cplusplus @@ -389,6 +394,11 @@ int main(int argc, char** argv) GEN_init_messaging_system(); IMB_init(); + + // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) + BLF_init(11, U.dpi); + BLF_lang_init(); + BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); // Parse command line options #if defined(DEBUG) diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index d2224884f7f..eb3d50a49bd 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -19,6 +19,7 @@ incs = ['.', '#source/gameengine/Converter', '#source/blender/imbuf', '#source/gameengine/Ketsji', + '#source/blender/blenfont', '#source/blender/blenlib', '#source/blender/blenkernel', '#source/blender/readblenfile',