Bugfixes:
- Allow for load screens for networked clients - Reworked the font loading for win32 so it will respect font names and sizes - Disabled Alt-Enter for win32
This commit is contained in:
parent
d5a55f6a83
commit
a71f0d0e7c
Binary file not shown.
|
@ -125,7 +125,8 @@ void Game::load(){
|
||||||
// try to use a faction related loading screen
|
// try to use a faction related loading screen
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for faction loading screen\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for faction loading screen\n",__FILE__,__FUNCTION__);
|
||||||
for ( int i=0; i < gameSettings.getFactionCount(); ++i ) {
|
for ( int i=0; i < gameSettings.getFactionCount(); ++i ) {
|
||||||
if(gameSettings.getFactionControl(i)==ctHuman){
|
if( gameSettings.getFactionControl(i) == ctHuman ||
|
||||||
|
(gameSettings.getFactionControl(i) == ctNetwork && gameSettings.getThisFactionIndex() == i)){
|
||||||
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
||||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||||
const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ gameSettings.getFactionTypeName(i);
|
const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ gameSettings.getFactionTypeName(i);
|
||||||
|
|
|
@ -213,8 +213,8 @@ void MainWindow::eventKeyDown(char key){
|
||||||
// This stupidity only required in win32.
|
// This stupidity only required in win32.
|
||||||
// We reload the textures so that
|
// We reload the textures so that
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Renderer &renderer= Renderer::getInstance();
|
//Renderer &renderer= Renderer::getInstance();
|
||||||
renderer.reinitAll();
|
//renderer.reinitAll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "noimpl.h"
|
#include "noimpl.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
#include <vector>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Graphics::Gl;
|
using namespace Shared::Graphics::Gl;
|
||||||
|
@ -81,6 +81,19 @@ void PlatformContextGl::swapBuffers() {
|
||||||
// Global Fcs
|
// Global Fcs
|
||||||
// ======================================
|
// ======================================
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe,
|
||||||
|
NEWTEXTMETRICEX *lpntme,
|
||||||
|
int FontType,
|
||||||
|
LPARAM lParam) {
|
||||||
|
std::vector<std::string> *systemFontList = (std::vector<std::string> *)lParam;
|
||||||
|
systemFontList->push_back((char *)lpelfe->elfFullName);
|
||||||
|
return 1; // I want to get all fonts
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
int charCount, FontMetrics &metrics) {
|
int charCount, FontMetrics &metrics) {
|
||||||
#ifdef X11_AVAILABLE
|
#ifdef X11_AVAILABLE
|
||||||
|
@ -173,10 +186,48 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
#else
|
#else
|
||||||
// we badly need a solution portable to more than just glx
|
// we badly need a solution portable to more than just glx
|
||||||
//NOIMPL;
|
//NOIMPL;
|
||||||
|
|
||||||
|
std::string useRealFontName = type;
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] trying to load useRealFontName [%s], size = %d, width = %d\n",__FILE__,__FUNCTION__,__LINE__,useRealFontName.c_str(),size,width);
|
||||||
|
|
||||||
|
static std::vector<std::string> systemFontList;
|
||||||
|
if(systemFontList.size() == 0) {
|
||||||
|
LOGFONT lf;
|
||||||
|
//POSITION pos;
|
||||||
|
|
||||||
|
lf.lfCharSet = ANSI_CHARSET;
|
||||||
|
lf.lfFaceName[0]='\0';
|
||||||
|
|
||||||
|
HDC hDC = wglGetCurrentDC();
|
||||||
|
::EnumFontFamiliesEx(hDC,
|
||||||
|
&lf,
|
||||||
|
(FONTENUMPROC) EnumFontFamExProc,
|
||||||
|
(LPARAM) &systemFontList, 0);
|
||||||
|
|
||||||
|
for(unsigned int idx = 0; idx < systemFontList.size(); ++idx) {
|
||||||
|
string &fontName = systemFontList[idx];
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found system font [%s]\n",__FILE__,__FUNCTION__,__LINE__,fontName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(unsigned int idx = 0; idx < systemFontList.size(); ++idx) {
|
||||||
|
string &fontName = systemFontList[idx];
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] checking font [%s]\n",__FILE__,__FUNCTION__,__LINE__,fontName.c_str());
|
||||||
|
|
||||||
|
if(_stricmp(useRealFontName.c_str(),fontName.c_str()) != 0) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] switch font name from [%s] to [%s]\n",__FILE__,__FUNCTION__,__LINE__,useRealFontName.c_str(),fontName.c_str());
|
||||||
|
|
||||||
|
useRealFontName = fontName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HFONT font= CreateFont(
|
HFONT font= CreateFont(
|
||||||
size, 0, 0, 0, width, 0, FALSE, FALSE, ANSI_CHARSET,
|
size, 0, 0, 0, width, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
|
OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||||
DEFAULT_PITCH, type.c_str());
|
DEFAULT_PITCH| (useRealFontName.c_str() ? FF_DONTCARE:FF_SWISS), useRealFontName.c_str());
|
||||||
|
|
||||||
assert(font!=NULL);
|
assert(font!=NULL);
|
||||||
|
|
||||||
|
@ -184,6 +235,8 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
SelectObject(dc, font);
|
SelectObject(dc, font);
|
||||||
BOOL err= wglUseFontBitmaps(dc, 0, charCount, base);
|
BOOL err= wglUseFontBitmaps(dc, 0, charCount, base);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] wglUseFontBitmaps returned = %d, charCount = %d, base = %d\n",__FILE__,__FUNCTION__,__LINE__,err,charCount,base);
|
||||||
|
|
||||||
FIXED one;
|
FIXED one;
|
||||||
one.value= 1;
|
one.value= 1;
|
||||||
one.fract= 0;
|
one.fract= 0;
|
||||||
|
@ -198,9 +251,15 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
mat2.eM21= zero;
|
mat2.eM21= zero;
|
||||||
mat2.eM22= one;
|
mat2.eM22= one;
|
||||||
|
|
||||||
|
//MAT2 mat2 = {{0,1},{0,0},{0,0},{0,1}};
|
||||||
|
|
||||||
|
|
||||||
//metrics
|
//metrics
|
||||||
GLYPHMETRICS glyphMetrics;
|
GLYPHMETRICS glyphMetrics;
|
||||||
int errorCode= GetGlyphOutline(dc, 'a', GGO_METRICS, &glyphMetrics, 0, NULL, &mat2);
|
int errorCode= GetGlyphOutline(dc, 'a', GGO_METRICS, &glyphMetrics, 0, NULL, &mat2);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] GetGlyphOutline returned = %d\n",__FILE__,__FUNCTION__,__LINE__,errorCode);
|
||||||
|
|
||||||
if(errorCode!=GDI_ERROR){
|
if(errorCode!=GDI_ERROR){
|
||||||
metrics.setHeight(static_cast<float>(glyphMetrics.gmBlackBoxY));
|
metrics.setHeight(static_cast<float>(glyphMetrics.gmBlackBoxY));
|
||||||
}
|
}
|
||||||
|
@ -209,6 +268,10 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
if(errorCode!=GDI_ERROR){
|
if(errorCode!=GDI_ERROR){
|
||||||
metrics.setWidth(i, static_cast<float>(glyphMetrics.gmCellIncX));
|
metrics.setWidth(i, static_cast<float>(glyphMetrics.gmCellIncX));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] GetGlyphOutline returned = %d for i = %d\n",__FILE__,__FUNCTION__,__LINE__,errorCode,i);
|
||||||
|
metrics.setWidth(i, static_cast<float>(6));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteObject(font);
|
DeleteObject(font);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user