From c28783ee430b106b636bf636bddf0799126a19d5 Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Fri, 21 Mar 2014 13:17:10 +0000 Subject: Experimental support for cross compiling with mingw-w64. Fix blinking HangUpText. Exit 1 if not terminated correctly. --- CHANGELOG.TXT | 8 +++++++- global.h | 2 +- hgeft.cpp | 9 +++++---- hgehelp/hgeguictrls.cpp | 3 ++- hgewin/resource.cpp | 2 +- include/hge.h | 9 +++++---- libcghEx.cpp | 2 +- main.cpp | 12 +++++------- 8 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index f6841fd..cc98a75 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,9 +1,11 @@ =================================================================== Next version: 0.8.1-1_PR (b77) -New level. +Todo's: +(the only) New level. Random segmentation fault in "Hyper-threading". Random crashes in Windows. +Circle Indicator crashes in mingw-w64 build. Pre-Released versions: 0.8.1-0_PR (b76) @@ -17,9 +19,13 @@ Allow bullets to pause before being accelerated. Modify "Gravity vortex". Add command line argument support. Use "--help" for usage. Add freetype support to hge. It's still pretty buggy. +Add experimental support for cross compiling with mingw-w64. +(Mingw-w64 build might be the official build in the future.) +Fix blinking HangUpText. Change numeric characters to monospace. Modify player speed settings. Beewx still messes up memory... fixed now. +Exit 1 if not terminated correctly. 0.8.0-1_PR (b75) New level Supernova. diff --git a/global.h b/global.h index 8c17718..c12c33c 100644 --- a/global.h +++ b/global.h @@ -329,7 +329,7 @@ void Error(const char *EC,bool hgecreated=false) _rmdir("./Resources/Music"); _rmdir("./Resources"); #endif - exit(0); + exit(1); } void ShowTip(const char *tip) { diff --git a/hgeft.cpp b/hgeft.cpp index 5beca1e..c067a1f 100644 --- a/hgeft.cpp +++ b/hgeft.cpp @@ -1,13 +1,14 @@ #include "hgeft.h" +static const char* HGEFT_SRC_FN="hgeft.cpp"; void hgeTTChar::Free(){if(quad.tex)hge->Texture_Free(quad.tex),quad.tex=0;} bool hgeTTChar::SetChar(wchar_t ch,FT_Face ttfface) { FT_GlyphSlot slot=ttfface->glyph; FT_UInt glyph_index=FT_Get_Char_Index(ttfface,ch); FT_Error err=FT_Load_Glyph(ttfface,glyph_index,FT_LOAD_DEFAULT); - if(err)return false; + if(err){hge->System_Log("%s: Glyph load failed!",HGEFT_SRC_FN);return false;} err=FT_Render_Glyph(ttfface->glyph,FT_RENDER_MODE_NORMAL); - if(err)return false; + if(err){hge->System_Log("%s: Glyph render failed!",HGEFT_SRC_FN);return false;} _w=slot->advance.x>>6;_h=slot->bitmap.rows;//we are one line only. rw=slot->bitmap.width;rh=slot->bitmap.rows; quad.tex=hge->Texture_Create( @@ -46,9 +47,9 @@ void hgeTTChar::Render(double x,double y,DWORD col) bool hgeTTFont::Init(const char *ttf,int size) { FT_Error err=FT_Init_FreeType(&libft); - if(err)return false; + if(err){hge->System_Log("%s: Failed to initialize freetype",HGEFT_SRC_FN);return false;} err=FT_New_Face(libft,ttf,0,&ttfface); - if(err)return false; + if(err){hge->System_Log("%s: Failed to load font: %s",HGEFT_SRC_FN,ttf);return false;} err=FT_Set_Char_Size(ttfface,0,size*64,96,96); return true; } diff --git a/hgehelp/hgeguictrls.cpp b/hgehelp/hgeguictrls.cpp index a02e18f..4319491 100644 --- a/hgehelp/hgeguictrls.cpp +++ b/hgehelp/hgeguictrls.cpp @@ -12,7 +12,8 @@ #include #include - +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) /* ** hgeGUIText */ diff --git a/hgewin/resource.cpp b/hgewin/resource.cpp index 2e223ce..fa1ddf9 100755 --- a/hgewin/resource.cpp +++ b/hgewin/resource.cpp @@ -11,7 +11,7 @@ #define NOCRYPT //#define NOUNCRYPT -#include "ZLIB\unzip.h" +#include "ZLIB/unzip.h" bool CALL HGE_Impl::Resource_AttachPack(const char *filename, const char *password) diff --git a/include/hge.h b/include/hge.h index 131cbbf..daed571 100644 --- a/include/hge.h +++ b/include/hge.h @@ -12,8 +12,9 @@ #include "unix_compat.h" -#ifdef _WINDOWS +#ifdef WIN32 #include +#include #endif #define HGE_VERSION 0x181 @@ -47,12 +48,12 @@ #define sinf (float)sin #define powf (float)pow #define fabsf (float)fabs - - #define min(x,y) ((x) < (y)) ? (x) : (y) - #define max(x,y) ((x) > (y)) ? (x) : (y) + #define min(x,y) ((x) < (y)? (x) : (y)) + #define max(x,y) ((x) > (y)? (x) : (y)) #endif + /* ** Common data types */ diff --git a/libcghEx.cpp b/libcghEx.cpp index bea7341..860b322 100644 --- a/libcghEx.cpp +++ b/libcghEx.cpp @@ -68,7 +68,7 @@ void CircleIndicator::Render(double x,double y){circle->Render(x,y);} void LinearProgresser::Init(double _a,double _b,double _Lim){a=_a,b=_b,Limit=_Lim;} void LinearProgresser::Launch(){Elapsed=0;val=a;} -void LinearProgresser::Update(double DT){if (Elapsed>=Limit)return;Elapsed+=DT;val=(b-a)*(Elapsed/Limit)+a;} +void LinearProgresser::Update(double DT){if (Elapsed>=Limit)return (void)(val=b,Elapsed=Limit);Elapsed+=DT;val=(b-a)*(Elapsed/Limit)+a;} double LinearProgresser::GetValue(){return val;} double LinearProgresser::GetA(){return a;} double LinearProgresser::GetB(){return b;} diff --git a/main.cpp b/main.cpp index 3df15e5..34a8d68 100644 --- a/main.cpp +++ b/main.cpp @@ -45,8 +45,8 @@ #ifdef WIN32 #include #include -#include -#include +#include +#include #include #include #endif @@ -933,9 +933,7 @@ int main(int argc,char *argv[]) BTarg.Init(-0.001,vector2d(400,300)); BTarg.targspr->SetColor(0xFFC00000); if(!quad.tex||!SprSheet||!TexTitle||!TexCredits) - { - Error("Error Loading Resources!",true); - } + Error("Error Loading Resources!",true); quad.blend=BLEND_ALPHABLEND | BLEND_COLORMUL | BLEND_NOZWRITE; DBGColor=0xFF888820; for(int i=0;i<4;i++) @@ -948,9 +946,9 @@ int main(int argc,char *argv[]) quad.v[2].x=800; quad.v[2].y=600; quad.v[3].x=0; quad.v[3].y=600; #ifdef WIN32 - rbPanelFont.Init("%SystemRoot%/Fonts/cour.ttf",18); + if(!rbPanelFont.Init("C:/Windows/Fonts/cour.ttf",18))return 1; #else - rbPanelFont.Init("/usr/share/fonts/truetype/freefont/FreeMono.ttf",18); + if(!rbPanelFont.Init("/usr/share/fonts/truetype/freefont/FreeMono.ttf",18))return 1; #endif fnt=new hgeFont("./Resources/charmap.fnt"); TipFont=new hgeFont("./Resources/charmap.fnt"); -- cgit v1.2.3