Bitmap Font editor for CX using CX

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
Regarding TTF font reading, I have attached the project I was playing with. You need the modified target for that too. I loads a TTF file and creates mojo2 compatible font files. Not the most convenient solution but it might give you a head start. You need to place the ttf font file inside the data folder in my example.
 

Attachments

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
@MikeHart Like, like like, like!!!! (because i cant click the like button 5 times)
Thank you sooo much. Looks like i was close, just dint know how to reference std-write-image.h in GLFW (I also tried importing it in png.cxs)
Will this be made official at some point for Canvas?
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
Regarding TTF font reading, I have attached the project I was playing with. You need the modified target for that too. I loads a TTF file and creates mojo2 compatible font files. Not the most convenient solution but it might give you a head start. You need to place the ttf font file inside the data folder in my example.
You're too good!!! This is a game changer (or should I say APP changer?)

Thank you!!!
 

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
@MikeHart Like, like like, like!!!! (because i cant click the like button 5 times)
Thank you sooo much. Looks like i was close, just dint know how to reference std-write-image.h in GLFW (I also tried importing it in png.cxs)
Will this be made official at some point for Canvas?
Maybe canvas, maybe databuffer. idk.
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
brilliant... just did a quick test and it works perfectly.

I did panic to begin with as it errored. i just removed the old GLFW build folder and let CX rebuild it ;-)
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
@MikeHart Just to let you know its not compatible with OS module
Code:
import os
error:
../main.cpp: In function 'String::CString<char> C_STR(const String&)':
../main.cpp:6149:30: error: redefinition of 'String::CString<char> C_STR(const String&)'
static String::CString<char> C_STR( const String &t ){ return t.ToCString<char>(); };
                              ^
../main.cpp:5485:30: note: 'String::CString<char> C_STR(const String&)' previously defined here
static String::CString<char> C_STR( const String &t ){
                              ^
Makefile:61: recipe for target 'build/Debug64/main.o' failed
mingw32-make: *** [build/Debug64/main.o] Error 1
I use os to CopyFile, but now I can save a PNG I dint need to copy the PNG file, so not a show stopper ;-)
 

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
Yup.

Change the top of png.cpp to this:
C++:
//static String::CString<char> C_STR( const String &t ){ return t.ToCString<char>(); };

#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
and add this line to the top of png.cxs:
C++:
Import os
This way it works even with the unmodified target.
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
@MikeHart heres a weird one. If you savePNG of a Canvas of the game area, the image is correct, but if you savePNG of a canvas of a New Image() the png is upside down
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
If you savePNG of a Canvas of the game area, the image is correct, but if you savePNG of a canvas of a New Image() the png is upside down
Well I would say if FreeImage is in the mix somewhere it's to be expected. Data is stored with the bottom scan line starting at the top.
But I don't recall FreeImage being needed anywhere.
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
Well I would say if FreeImage is in the mix somewhere it's to be expected. Data is stored with the bottom scan line starting at the top.
But I don't recall FreeImage being needed anywhere.
Just strange that canvas linked to the default draw area saves the the right way up, but a canvas linked to an image saves upside down. Yet both canvases draw the same in CX. Itl be something simple somewhere. I have a little look at the canvas object and can't see anything that stands out
 
Top Bottom