static orxSTATUS orxFASTCALL Init() { #define orxFONTGEN_DECLARE_PARAM(SN, LN, SD, LD, FN) {orxPARAM_KU32_FLAG_STOP_ON_ERROR, SN, LN, SD, LD, &FN}, orxU32 i; orxSTATUS eResult = orxSTATUS_SUCCESS; orxPARAM astParamList[] = { orxFONTGEN_DECLARE_PARAM("o", "output", "Font output name", "Font base output name: .png will be added to the image and .ini will be added to the config file", ProcessOutputParams) orxFONTGEN_DECLARE_PARAM("s", "size", "Size (height) of characters", "Height to use for characters defined with this font", ProcessSizeParams) orxFONTGEN_DECLARE_PARAM("p", "padding", "Character padding", "Extra padding added to all characters on both dimensions (width and height)", ProcessPaddingParams) orxFONTGEN_DECLARE_PARAM("f", "font", "Input font file", "TrueType font (usually .ttf) used to generate all the required glyphs", ProcessFontParams) orxFONTGEN_DECLARE_PARAM("t", "textlist", "List of input text files", "List of text files containing all the characters that will be displayed using this font", ProcessInputParams) orxFONTGEN_DECLARE_PARAM("m", "monospace", "Monospaced font", "Will output a monospace (ie. fixed-width) font", ProcessMonospaceParams) orxFONTGEN_DECLARE_PARAM("a", "advance", "Use glyph advance values for non-monospace fonts", "In non-monospace mode only: the font's original glyph advance values will be used instead of packing glyphs as efficiently as possible", ProcessAdvanceParams) }; // Clears static controller orxMemory_Zero(&sstFontGen, sizeof(orxFONTGEN_STATIC)); // Creates character table sstFontGen.pstCharacterTable = orxHashTable_Create(orxFONTGEN_KU32_CHARACTER_TABLE_SIZE, orxHASHTABLE_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN); // Creates glyph bank sstFontGen.pstGlyphBank = orxBank_Create(orxFONTGEN_KU32_CHARACTER_TABLE_SIZE, sizeof(orxFONTGEN_GLYPH), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN); // For all params but last for(i = 0; (i < (sizeof(astParamList) / sizeof(astParamList[0])) - 1) && (eResult != orxSTATUS_FAILURE); i++) { // Registers param eResult = orxParam_Register(&astParamList[i]); } // Not in monospace mode? if(!orxFLAG_TEST(sstFontGen.u32Flags, orxFONTGEN_KU32_STATIC_FLAG_MONOSPACE)) { // Logs message orxFONTGEN_LOG(MODE, "Output mode set to non-monospace."); // Registers last param eResult = orxParam_Register(&astParamList[(sizeof(astParamList) / sizeof(astParamList[0])) - 1]); // Not using original advance values? if(!orxFLAG_TEST(sstFontGen.u32Flags, orxFONTGEN_KU32_STATIC_FLAG_ADVANCE)) { // Logs message orxFONTGEN_LOG(PACKING, "Characters will be packed."); } } // Done! return eResult; }
/** Inits the plugin module * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxPlugin_Init() { orxSTATUS eResult = orxSTATUS_FAILURE; /* Not already Initialized? */ if(!(sstPlugin.u32Flags & orxPLUGIN_KU32_STATIC_FLAG_READY)) { /* Cleans control structure */ orxMemory_Zero(&sstPlugin, sizeof(orxPLUGIN_STATIC)); /* Creates an empty spst_plugin_list */ sstPlugin.pstPluginBank = orxBank_Create(orxPLUGIN_CORE_ID_NUMBER, sizeof(orxPLUGIN_INFO), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN); /* Is bank valid? */ if(sstPlugin.pstPluginBank != orxNULL) { #ifndef __orxEMBEDDED__ orxPARAM stParams; #endif /* !__orxEMBEDDED__ */ /* Updates status flags */ sstPlugin.u32Flags = orxPLUGIN_KU32_STATIC_FLAG_READY; /* Registers all core plugins */ orxPlugin_RegisterCorePlugins(); #ifdef __orxEMBEDDED__ /* Updates all modules */ orxPlugin_UpdateAllModule(); #else /* __orxEMBEDDED__ */ /* Inits the param structure */ orxMemory_Zero(&stParams, sizeof(orxPARAM)); stParams.pfnParser = orxPlugin_ProcessParams; stParams.u32Flags = orxPARAM_KU32_FLAG_MULTIPLE_ALLOWED; stParams.zShortName = "p"; stParams.zLongName = "plugin"; stParams.zShortDesc = "Loads the specified plugins."; stParams.zLongDesc = "Loads the specified plugins from the current execution folder. More than one plugin can be specified. They can be core or user plugins."; /* Registers it */ orxParam_Register(&stParams); #endif /* __orxEMBEDDED__ */ /* Successful */ eResult = orxSTATUS_SUCCESS; } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_PLUGIN, "Failed to create bank."); /* Bank not created */ eResult = orxSTATUS_FAILURE; } } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_PLUGIN, "Tried to initialize plugin module when it was already initialized."); /* Already initialized */ eResult = orxSTATUS_SUCCESS; } /* Done! */ return eResult; }