Permalink
Browse files

Add a new font editor

  • Loading branch information...
mniip committed Apr 29, 2018
1 parent 04c8751 commit c0c550e920c037b3a85eb2fed92f403f4137205d
Showing with 637 additions and 4 deletions.
  1. +12 −4 SConscript
  2. +5 −0 data/font.h
  3. +9 −0 src/PowderToySDL.cpp
  4. +544 −0 src/gui/font/FontEditor.cpp
  5. +67 −0 src/gui/font/FontEditor.h
@@ -67,6 +67,7 @@ AddSconsOption('static', False, False, "Compile statically.")
AddSconsOption('opengl', False, False, "Build with OpenGL interface support.")
AddSconsOption('opengl-renderer', False, False, "Build with OpenGL renderer support (turns on --opengl).") #Note: this has nothing to do with --renderer, only tells the game to render particles with opengl
AddSconsOption('renderer', False, False, "Build the save renderer.")
AddSconsOption('font', False, False, "Build the font editor.")
AddSconsOption('wall', False, False, "Error on all warnings.")
AddSconsOption('no-warnings', False, False, "Disable all compiler warnings.")
@@ -266,7 +267,7 @@ def findLibs(env, conf):
else:
FatalError("SDL.h not found")
if not GetOption('nolua') and not GetOption('renderer'):
if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'):
#Look for Lua
if platform == "FreeBSD":
luaver = "lua-5.1"
@@ -494,7 +495,7 @@ if GetOption('static'):
#Add other flags and defines
if not GetOption('nofft'):
env.Append(CPPDEFINES=['GRAVFFT'])
if not GetOption('nolua') and not GetOption('renderer'):
if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'):
env.Append(CPPDEFINES=['LUACONSOLE'])
if GetOption('opengl') or GetOption('opengl-renderer'):
@@ -507,6 +508,9 @@ if GetOption('renderer'):
else:
env.Append(CPPDEFINES=['USE_SDL'])
if GetOption('font'):
env.Append(CPPDEFINES=['FONTEDITOR'])
if GetOption("wall"):
if msvc:
env.Append(CCFLAGS=['/WX'])
@@ -540,7 +544,7 @@ if GetOption('beta'):
#Generate list of sources to compile
sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/*/*/*.cpp") + Glob("generated/*.cpp")
if not GetOption('nolua') and not GetOption('renderer'):
if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'):
sources += Glob("src/lua/socket/*.c") + Glob("src/lua/LuaCompat.c")
if platform == "Windows":
@@ -559,7 +563,11 @@ elif platform == "Darwin":
if GetOption('output'):
programName = GetOption('output')
else:
programName = GetOption('renderer') and "render" or "powder"
programName = "powder"
if GetOption('renderer'):
programName = "render"
if GetOption('font'):
programName = "font"
if "BIT" in env and env["BIT"] == 64:
programName += "64"
if isX86 and GetOption('no-sse'):
@@ -1,6 +1,7 @@
#ifndef FONT_H_CHECK
#define FONT_H_CHECK
#define FONT_H 12
#ifndef FONTEDITOR
#ifdef INCLUDE_FONTDATA
unsigned char font_data[] = {
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -299,5 +300,9 @@ short font_ptrs[] = {
extern unsigned char font_data[];
extern short font_ptrs[];
#endif
#else
extern unsigned char *font_data;
extern short *font_ptrs;
#endif
#endif
@@ -50,6 +50,8 @@ extern "C" {
#include "gui/game/GameController.h"
#include "gui/game/GameView.h"
#include "gui/font/FontEditor.h"
#include "gui/dialogues/ErrorMessage.h"
#include "gui/dialogues/ConfirmPrompt.h"
#include "gui/interface/Keys.h"
@@ -1108,6 +1110,7 @@ int main(int argc, char * argv[])
try {
#endif
#ifndef FONTEDITOR
gameController = new GameController();
engine->ShowWindow(gameController->GetView());
@@ -1204,6 +1207,12 @@ int main(int argc, char * argv[])
}
}
#else // FONTEDITOR
if(argc <= 1)
throw std::runtime_error("Not enough arguments");
engine->ShowWindow(new FontEditor(argv[1]));
#endif
//initial mouse coords
int sdl_x, sdl_y;
SDL_GetMouseState(&sdl_x, &sdl_y);
Oops, something went wrong.

0 comments on commit c0c550e

Please sign in to comment.