Mercurial > projects > mde
changeset 83:2813ac68576f
Start of creating a separate gui demo module and leaving mde.d for testing.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 30 Aug 2008 10:54:32 +0100 |
parents | ea58f277f487 |
children | e0f1ec7fe73a |
files | mde/font/FontTexture.d mde/font/font.d mde/mde.d |
diffstat | 3 files changed, 20 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/mde/font/FontTexture.d Thu Aug 07 11:25:27 2008 +0100 +++ b/mde/font/FontTexture.d Sat Aug 30 10:54:32 2008 +0100 @@ -301,7 +301,7 @@ format = (fontOpts.renderMode & RENDER_LCD_BGR) ? GL_BGR : GL_RGB; } else if (b.pixel_mode == FT_Pixel_Mode.FT_PIXEL_MODE_LCD_V) { - // NOTE: Notes above apply. Only in this case converting the buffers seems essential. + // NOTE: Notes above apply. But in this case converting the buffers seems essential. buffer = new ubyte[b.width*b.rows]; for (uint i = 0; i < b.rows; ++i) for (uint j = 0; j < b.width; ++j) @@ -456,12 +456,15 @@ enum { RENDER_LCD_BGR = 1 << 30 } OptionsFont fontOpts; class OptionsFont : Options { - /* renderMode should be FT_LOAD_TARGET_NORMAL, FT_LOAD_TARGET_LIGHT, FT_LOAD_TARGET_LCD or - * FT_LOAD_TARGET_LCD_V, possibly with bit 31 set (see RENDER_LCD_BGR). - * FT_LOAD_TARGET_MONO is unsupported. + /* renderMode have one of the following values, possibly with bit 31 set (see RENDER_LCD_BGR): + * FT_LOAD_TARGET_NORMAL (0x00000) + * FT_LOAD_TARGET_LIGHT (0x10000) + * FT_LOAD_TARGET_LCD (0x30000) + * FT_LOAD_TARGET_LCD_V (0x40000) + * The mode FT_LOAD_TARGET_MONO (0x20000) is unsupported. * * lcdFilter should come from enum FT_LcdFilter: - * FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, FT_LCD_FILTER_LIGHT = 2 */ + * FT_LCD_FILTER_NONE (0), FT_LCD_FILTER_DEFAULT (1), FT_LCD_FILTER_LIGHT (2) */ mixin (impl!("int renderMode, lcdFilter;")); static this() {
--- a/mde/font/font.d Thu Aug 07 11:25:27 2008 +0100 +++ b/mde/font/font.d Sat Aug 30 10:54:32 2008 +0100 @@ -68,8 +68,10 @@ // Check version FT_Int maj, min, patch; FT_Library_Version (library, &maj, &min, &patch); - if (maj != 2 || min != 3) + if (maj != 2 || min != 3) { logger.warn ("Using an untested FreeType version: {}.{}.{}", maj, min, patch); + logger.info ("The only tested version of freetype is 2.3.5"); + } // Set LCD filtering method if LCD rendering is enabled. const RMF = FT_LOAD_TARGET_LCD | FT_LOAD_TARGET_LCD_V;
--- a/mde/mde.d Thu Aug 07 11:25:27 2008 +0100 +++ b/mde/mde.d Sat Aug 30 10:54:32 2008 +0100 @@ -15,22 +15,17 @@ /** Modular D Engine * - * This module contains main(), which calls Init and runs the main loop. + * This module contains a minimal main() function. Practically, it is useful for running unittests + * and some other testing. It also serves as a basic example program. */ module mde.mde; -// Comment to show use, where only used minimally: - import mde.imde; // this module's interface for external modules -import mde.events; // pollEvents +import mde.setup.Init; // initialization import mde.lookup.Options; // pollInterval option - +import mde.scheduler.Scheduler; // mainSchedule +import mde.events; // pollEvents() import gl = mde.gl.draw; // gl.draw() -import mde.input.Input; // new Input() - -import mde.setup.Init; -import mde.scheduler.Scheduler; // Scheduler.run() -import mde.setup.exception; // InitException import tango.core.Thread : Thread; // Thread.sleep() import tango.time.Clock; // Clock.now() @@ -38,24 +33,18 @@ int main(char[][] args) { - //BEGIN Initialisation - Logger logger = Log.getLogger ("mde.mde"); + // If compiled with unittests, notify that they completed and exit: debug (mdeUnitTest) { + Logger logger = Log.getLogger ("mde.mde"); logger.info ("Compiled unittests have completed; terminating."); return 0; } - scope Init init; - try { - init = new Init(args); // initialisation - } catch (InitException e) { - logger.fatal ("Initialisation failed: " ~ e.msg); - return 1; - } + scope Init init = new Init(args); // initialize mde + // Make sure pollInterval has a sane value. FIXME: get Options class to enforce range if (miscOpts.pollInterval !<= 1.0 || miscOpts.pollInterval !>= 0.0) miscOpts.set!(double) ("pollInterval", 0.01); - //END Initialisation //BEGIN Main loop setup /* Note: the main loop is currently controlled by the scheduler. This is not really ideal,