Changeset 83:2813ac68576f
- Timestamp:
- 08/30/08 05:54:32
(4 months ago)
- Author:
- Diggory Hardy <diggory.hardy@gmail.com>
- branch:
- default
- Message:
Start of creating a separate gui demo module and leaving mde.d for testing.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r63 |
r83 |
|
| 302 | 302 | format = (fontOpts.renderMode & RENDER_LCD_BGR) ? GL_BGR : GL_RGB; |
|---|
| 303 | 303 | } else if (b.pixel_mode == FT_Pixel_Mode.FT_PIXEL_MODE_LCD_V) { |
|---|
| 304 | | // NOTE: Notes above apply. Only in this case converting the buffers seems essential. |
|---|
| | 304 | // NOTE: Notes above apply. But in this case converting the buffers seems essential. |
|---|
| 305 | 305 | buffer = new ubyte[b.width*b.rows]; |
|---|
| 306 | 306 | for (uint i = 0; i < b.rows; ++i) |
|---|
| … | … | |
| 457 | 457 | OptionsFont fontOpts; |
|---|
| 458 | 458 | class OptionsFont : Options { |
|---|
| 459 | | /* renderMode should be FT_LOAD_TARGET_NORMAL, FT_LOAD_TARGET_LIGHT, FT_LOAD_TARGET_LCD or |
|---|
| 460 | | * FT_LOAD_TARGET_LCD_V, possibly with bit 31 set (see RENDER_LCD_BGR). |
|---|
| 461 | | * FT_LOAD_TARGET_MONO is unsupported. |
|---|
| | 459 | /* renderMode have one of the following values, possibly with bit 31 set (see RENDER_LCD_BGR): |
|---|
| | 460 | * FT_LOAD_TARGET_NORMAL (0x00000) |
|---|
| | 461 | * FT_LOAD_TARGET_LIGHT (0x10000) |
|---|
| | 462 | * FT_LOAD_TARGET_LCD (0x30000) |
|---|
| | 463 | * FT_LOAD_TARGET_LCD_V (0x40000) |
|---|
| | 464 | * The mode FT_LOAD_TARGET_MONO (0x20000) is unsupported. |
|---|
| 462 | 465 | * |
|---|
| 463 | 466 | * lcdFilter should come from enum FT_LcdFilter: |
|---|
| 464 | | * FT_LCD_FILTER_NONE = 0, FT_LCD_FILTER_DEFAULT = 1, FT_LCD_FILTER_LIGHT = 2 */ |
|---|
| | 467 | * FT_LCD_FILTER_NONE (0), FT_LCD_FILTER_DEFAULT (1), FT_LCD_FILTER_LIGHT (2) */ |
|---|
| 465 | 468 | mixin (impl!("int renderMode, lcdFilter;")); |
|---|
| 466 | 469 | |
|---|
| r79 |
r83 |
|
| 69 | 69 | FT_Int maj, min, patch; |
|---|
| 70 | 70 | FT_Library_Version (library, &maj, &min, &patch); |
|---|
| 71 | | if (maj != 2 || min != 3) |
|---|
| | 71 | if (maj != 2 || min != 3) { |
|---|
| 72 | 72 | logger.warn ("Using an untested FreeType version: {}.{}.{}", maj, min, patch); |
|---|
| | 73 | logger.info ("The only tested version of freetype is 2.3.5"); |
|---|
| | 74 | } |
|---|
| 73 | 75 | |
|---|
| 74 | 76 | // Set LCD filtering method if LCD rendering is enabled. |
|---|
| r75 |
r83 |
|
| 16 | 16 | /** Modular D Engine |
|---|
| 17 | 17 | * |
|---|
| 18 | | * This module contains main(), which calls Init and runs the main loop. |
|---|
| | 18 | * This module contains a minimal main() function. Practically, it is useful for running unittests |
|---|
| | 19 | * and some other testing. It also serves as a basic example program. |
|---|
| 19 | 20 | */ |
|---|
| 20 | 21 | module mde.mde; |
|---|
| 21 | 22 | |
|---|
| 22 | | // Comment to show use, where only used minimally: |
|---|
| 23 | | |
|---|
| 24 | 23 | import mde.imde; // this module's interface for external modules |
|---|
| 25 | | import mde.events; // pollEvents |
|---|
| | 24 | import mde.setup.Init; // initialization |
|---|
| 26 | 25 | import mde.lookup.Options; // pollInterval option |
|---|
| 27 | | |
|---|
| | 26 | import mde.scheduler.Scheduler; // mainSchedule |
|---|
| | 27 | import mde.events; // pollEvents() |
|---|
| 28 | 28 | import gl = mde.gl.draw; // gl.draw() |
|---|
| 29 | | import mde.input.Input; // new Input() |
|---|
| 30 | | |
|---|
| 31 | | import mde.setup.Init; |
|---|
| 32 | | import mde.scheduler.Scheduler; // Scheduler.run() |
|---|
| 33 | | import mde.setup.exception; // InitException |
|---|
| 34 | 29 | |
|---|
| 35 | 30 | import tango.core.Thread : Thread; // Thread.sleep() |
|---|
| … | … | |
| 39 | 34 | int main(char[][] args) |
|---|
| 40 | 35 | { |
|---|
| 41 | | //BEGIN Initialisation |
|---|
| 42 | | Logger logger = Log.getLogger ("mde.mde"); |
|---|
| | 36 | // If compiled with unittests, notify that they completed and exit: |
|---|
| 43 | 37 | debug (mdeUnitTest) { |
|---|
| | 38 | Logger logger = Log.getLogger ("mde.mde"); |
|---|
| 44 | 39 | logger.info ("Compiled unittests have completed; terminating."); |
|---|
| 45 | 40 | return 0; |
|---|
| 46 | 41 | } |
|---|
| 47 | 42 | |
|---|
| 48 | | scope Init init; |
|---|
| 49 | | try { |
|---|
| 50 | | init = new Init(args); // initialisation |
|---|
| 51 | | } catch (InitException e) { |
|---|
| 52 | | logger.fatal ("Initialisation failed: " ~ e.msg); |
|---|
| 53 | | return 1; |
|---|
| 54 | | } |
|---|
| | 43 | scope Init init = new Init(args); // initialize mde |
|---|
| 55 | 44 | |
|---|
| | 45 | // Make sure pollInterval has a sane value. FIXME: get Options class to enforce range |
|---|
| 56 | 46 | if (miscOpts.pollInterval !<= 1.0 || miscOpts.pollInterval !>= 0.0) |
|---|
| 57 | 47 | miscOpts.set!(double) ("pollInterval", 0.01); |
|---|
| 58 | | //END Initialisation |
|---|
| 59 | 48 | |
|---|
| 60 | 49 | //BEGIN Main loop setup |
|---|