Changeset 63:66d555da083e

Show
Ignore:
Timestamp:
06/27/08 13:35:33 (7 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

Moved many modules/packages to better reflect usage.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mde/events.d

    r61 r63  
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    1515 
    16 /// Handles all events from SDL_PollEvent. 
     16/** Handling for all events from SDL_PollEvent. 
     17 * 
     18 * Handles some events, including a quit-request and window resizing, and passes the rest on to the 
     19 * input system. */ 
    1720module mde.events; 
    1821 
    1922import imde = mde.imde; 
    20 import sdl = mde.sdl;           // resizeWindow 
     23import sdl = mde.setup.sdl;    // resizeWindow 
    2124 
    2225import mde.input.Input; 
  • mde/font/FontTexture.d

    r61 r63  
    2323 * coords are cartesian (i.e. y increases upwards), although largely this is too abstract to 
    2424 * matter. However, for the model/world coords, y increases downwards. */ 
    25 module mde.resource.FontTexture; 
    26  
    27 import mde.types.basic;    // Colour 
    28 import mde.Options; 
    29 import mde.resource.exception; 
     25module mde.font.FontTexture; 
     26 
     27import mde.types.Colour; 
     28import mde.lookup.Options; 
     29import mde.font.exception; 
    3030 
    3131import derelict.freetype.ft; 
     
    3737private Logger logger; 
    3838static this () { 
    39     logger = Log.getLogger ("mde.resource.FontTexture"); 
     39    logger = Log.getLogger ("mde.font.FontTexture"); 
    4040} 
    4141 
  • mde/font/exception.d

    r48 r63  
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    1515 
    16 /// Contains resource exceptions 
    17 module mde.resource.exception; 
     16/// Contains font exceptions 
     17module mde.font.exception; 
    1818import mde.exception; 
    1919 
     
    2121class fontException : mdeException { 
    2222    char[] getSymbol () { 
    23         return super.getSymbol ~ ".resource.font"; 
     23        return super.getSymbol ~ ".font"; 
    2424    } 
    2525     
  • mde/font/font.d

    r61 r63  
    1515 
    1616/// Sets up freetype (in a basic way). 
    17 module mde.resource.font; 
    18  
    19 public import mde.types.basic; // Colour 
    20 import mde.Options; 
    21 import mde.resource.FontTexture; 
    22 import mde.resource.exception; 
     17module mde.font.font; 
     18 
     19public import mde.types.Colour; 
     20import mde.lookup.Options; 
     21import mde.font.FontTexture; 
     22import mde.font.exception; 
    2323 
    2424import mde.mergetag.Reader; 
    2525import mde.mergetag.DataSet; 
    2626import mde.mergetag.exception; 
    27 import mde.resource.paths; 
     27import mde.setup.paths; 
    2828 
    2929import derelict.freetype.ft; 
     
    3636 
    3737// "Publically import" this symbol: 
    38 alias mde.resource.FontTexture.TextBlock TextBlock; 
     38alias mde.font.FontTexture.TextBlock TextBlock; 
    3939 
    4040private Logger logger; 
    4141static this () { 
    42     logger = Log.getLogger ("mde.resource.font"); 
     42    logger = Log.getLogger ("mde.font.font"); 
    4343} 
    4444 
  • mde/gl/draw.d

    r61 r63  
    2727import tango.util.log.Log : Log, Logger; 
    2828 
    29 import mde.resource.font; 
     29import mde.font.font; 
    3030private Logger logger; 
    3131static this () { 
  • mde/gui/Gui.d

    r58 r63  
    3838import mde.mergetag.Reader; 
    3939import mde.mergetag.Writer; 
    40 import mde.resource.paths; 
     40import mde.setup.paths; 
    4141 
    4242import tango.util.log.Log : Log, Logger; 
  • mde/gui/widget/TextWidget.d

    r62 r63  
    2525import mde.gui.content.Content; 
    2626 
    27 import mde.resource.font; 
     27import mde.font.font; 
    2828 
    2929import tango.io.Stdout; 
  • mde/input/Config.d

    r32 r63  
    2222 
    2323import MT = mde.mergetag.Reader; 
    24 import mde.resource.paths; 
     24import mde.setup.paths; 
    2525import tango.scrapple.text.convert.parseTo : parseTo; 
    2626 
  • mde/input/Input.d

    r61 r63  
    367367        es_m_fcts = [ ES_M.OUT : &es_m_out ]; 
    368368         
    369         logger = Log.getLogger ("mde.input.input.Input"); 
     369        logger = Log.getLogger ("mde.input.Input"); 
    370370    } 
    371371     
  • mde/lookup/Options.d

    r62 r63  
    2020* small numbers of variables for now. 
    2121*/ 
    22 module mde.Options; 
     22module mde.lookup.Options; 
    2323 
    2424import mde.exception; 
     
    2828import mde.mergetag.DataSet; 
    2929import mde.mergetag.exception; 
    30 import mde.resource.paths; 
     30import mde.setup.paths; 
    3131 
    3232import tango.scrapple.text.convert.parseTo : parseTo; 
     
    466466} 
    467467 
    468 /* NOTE: These Options classes use templates to ease inserting contents. 
    469 
    470 * Each entry has an I18nTranslation entry; see data/L10n/ClassName.mtt for descriptions. 
    471 
    472 * To create a new class, just copy and paste anywhere and adjust. 
     468/* NOTE: Options sub-classes are expected to use a template to ease inserting contents and 
     469* hide some of the "backend" functionality. Use impl as below, or read the documentation for impl. 
     470
     471* Each entry should have a Translation entry with humanized names and descriptions in 
     472* data/L10n/ClassName.mtt 
     473
     474* To create a new Options sub-class, just copy, paste and adjust. 
    473475*/ 
    474476 
  • mde/lookup/Translation.d

    r26 r63  
    1313You should have received a copy of the GNU General Public License 
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    15 /** I18nTranslation − internationalization module for translating strings 
     15/** Translation − internationalization module for translating strings 
    1616* 
    1717* The idea behind this module is a class which, when asked to load symbols for a particular module/ 
     
    3636* this feature. Of course, out of date entries are still valid for use. 
    3737*/ 
    38 module mde.i18n.I18nTranslation; 
     38module mde.lookup.Translation; 
    3939 
    4040import mde.options; 
     
    5555* Encoding used is UTF-8. 
    5656*/ 
    57 class I18nTranslation : IDataSection 
     57class Translation : IDataSection 
    5858{ 
    5959    final char[] name;      /// The module/package/... which the instance is for 
     
    9090    * loaded), or an error occurs while loading the database, a L10nLoadException will be thrown. 
    9191    */ 
    92     static I18nTranslation load (char[] name) 
     92    static Translation load (char[] name) 
    9393    { 
    9494        bool[ID] loadedSecs;        // set of all locales/sections loaded; used to prevent circular loading 
     
    9696        = [cast(ID) miscOpts.L10n];  // start by loading the current locale 
    9797         
    98         I18nTranslation transl = new I18nTranslation (name, miscOpts.L10n); 
     98        Translation transl = new Translation (name, miscOpts.L10n); 
    9999         
    100100        IReader reader; 
     
    134134     
    135135    static this() { 
    136         logger = Log.getLogger ("mde.input.i18n.I18nTranslation"); 
     136        logger = Log.getLogger ("mde.lookup.Translation"); 
    137137    } 
    138138     
     
    219219        miscOpts.L10n = "test-1"; 
    220220         
    221         I18nTranslation transl = load ("i18nUnitTest"); 
     221        Translation transl = load ("i18nUnitTest"); 
    222222         
    223223        // Simple get-string, check dependancy's entry doesn't override 
  • mde/mde.d

    r53 r63  
    2424import mde.imde;                        // this module's interface for external modules 
    2525import mde.events;                      // pollEvents 
    26 import mde.Options;                     // pollInterval option 
     26import mde.lookup.Options;              // pollInterval option 
    2727 
    2828import gl = mde.gl.draw;                // gl.draw() 
    2929import mde.input.Input;                 // new Input() 
    3030 
    31 import mde.scheduler.Init; 
     31import mde.setup.Init; 
    3232import mde.scheduler.Scheduler;         // Scheduler.run() 
    33 import mde.scheduler.exception;         // InitException 
     33import mde.setup.exception;             // InitException 
    3434 
    3535import tango.core.Thread : Thread;  // Thread.sleep() 
  • mde/scheduler/Scheduler.d

    r39 r63  
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    1515 
    16 /** Scheduler 
    17 */ 
     16/** A fairly generic scheduler. 
     17 * 
     18 * This class implements most functionality a generic scheduler might want, however currently it 
     19 * doesn't any uses where equivalent functionality couldn't be achived very easily anyway. */ 
    1820module mde.scheduler.Scheduler; 
    1921 
  • mde/setup/Init.d

    r56 r63  
    2121 * code; with the exception of that for the logger. 
    2222 *************************************************************************************************/ 
    23 module mde.scheduler.Init; 
    24  
    25 import mde.scheduler.init2;     // This module is responsible for setting up some init functions. 
    26 import mde.scheduler.initFunctions; 
    27 import mde.scheduler.exception; 
    28  
    29 import mde.Options; 
    30 import paths = mde.resource.paths; 
     23module mde.setup.Init; 
     24 
     25import mde.setup.init2;     // This module is responsible for setting up some init functions. 
     26import mde.setup.initFunctions; 
     27import mde.setup.exception; 
     28 
     29import mde.lookup.Options; 
     30import paths = mde.setup.paths; 
    3131import mde.exception; 
    3232 
     
    8585    private static Logger logger; 
    8686    static this() { 
    87         logger = Log.getLogger ("mde.scheduler.Init.Init"); 
     87        logger = Log.getLogger ("mde.setup.Init"); 
    8888    } 
    8989     
  • mde/setup/exception.d

    r26 r63  
    1515 
    1616/// Contains the exception classes for Init. 
    17 module mde.scheduler.exception; 
     17module mde.setup.exception; 
    1818 
    1919import mde.exception; 
     
    2222class InitException : mdeException { 
    2323    char[] getSymbol () { 
    24         return super.getSymbol ~ ".Init"; 
     24        return super.getSymbol ~ ".setup.Init"; 
    2525    } 
    2626     
  • mde/setup/init2.d

    r49 r63  
    2828/* Idea: go back to init being controlled from elsewhere. Add a function to wait for another init 
    2929 * function to complete (threaded; might need to be done differently for non-threaded). */ 
    30 module mde.scheduler.init2; 
     30module mde.setup.init2; 
    3131 
    32 import mde.scheduler.initFunctions; 
     32import mde.setup.initFunctions; 
    3333 
    3434import tango.util.log.Log : Log, Logger; 
     
    3838import mde.gui.Gui; 
    3939import mde.input.Input; 
    40 import font = mde.resource.font; 
     40import font = mde.font.font; 
    4141 
    4242// NOTE: error reporting needs a revision 
     
    4444private Logger logger; 
    4545static this () { 
    46     logger = Log.getLogger ("mde.scheduler.Init2"); 
     46    logger = Log.getLogger ("mde.setup.init2"); 
    4747     
    4848    init.addFunc (&initInput, "initInput"); 
  • mde/setup/initFunctions.d

    r39 r63  
    2222* either by throwing an exception or by returning a boolean. Functions may take parameters, e.g. 
    2323* "out cleanupFunc[]". */ 
    24 module mde.scheduler.initFunctions; 
     24module mde.setup.initFunctions; 
    2525 
    2626/+ unused 
    2727import tango.util.log.Log : Log, Logger; 
    2828static this() { 
    29     logger = Log.getLogger ("mde.scheduler.InitFunctions"); 
    30 }+/ 
     29    logger = Log.getLogger ("mde.setup.initFunctions"); 
     30
     31private Logger logger; 
     32+/ 
    3133 
    3234void setInitFailure () {    /// Call to indicate failure in an init function 
     
    7274package: 
    7375bool initFailure = false;   // set on failure (throwing through threads isn't a good idea) 
    74  
    75 private: 
    76 //Logger logger; 
  • mde/setup/paths.d

    r53 r63  
    3030* the FilePath has served its immediate purpose, since it's more convenient and creating new 
    3131* FilePaths for adjusted paths should be no slower than mutating existing ones. */ 
    32 module mde.resource.paths; 
     32module mde.setup.paths; 
    3333 
    3434import mde.exception; 
     
    310310            assert (files !is null, "mdeReader.this: files is null"); 
    311311        } body { 
     312            // Don't let sub-readers create their own, separate, datasets: 
    312313            if (ds is null) ds = new DataSet; 
    313314         
  • mde/setup/sdl.d

    r55 r63  
    1616/** Just a temporary place to put SDL Init and Video stuff. 
    1717*/ 
    18 module mde.sdl; 
     18module mde.setup.sdl; 
    1919 
    20 import mde.scheduler.initFunctions; 
     20import mde.setup.initFunctions; 
    2121import mde.input.joystick; 
    22 import mde.Options; 
     22import mde.lookup.Options; 
    2323import mde.gl.basic; 
    2424import imde = mde.imde; 
     
    3333private Logger logger; 
    3434static this() { 
    35     logger = Log.getLogger ("mde.SDL"); 
     35    logger = Log.getLogger ("mde.setup.sdl"); 
    3636     
    3737    init.addFunc (&initSdlAndGl, "initSdlAndGl"); 
  • mde/types/Colour.d

    r57 r63  
    1414along with this program.  If not, see <http://www.gnu.org/licenses/>. */ 
    1515 
    16 /** Contains basic types used by mde. Some may be moved to other modules. */ 
    17 module mde.types.basic; 
    18  
    19 //FIXME: remove import and change types or not? 
    20 import derelict.opengl.gltypes; 
     16/** Contains a basic colour type. */ 
     17module mde.types.Colour; 
    2118 
    2219/// Represent a colour using clamped floats 
    2320struct Colour { 
    2421    /// Returns GL_ONE if total value is nearer white than black, else GL_ZERO. 
    25     GLenum nearestGLConst () { 
    26         return r+g+b >= 1.5f ? GL_ONE : GL_ZERO
     22    uint nearestGLConst () { 
     23        return r+g+b >= 1.5f ? 1u : 0u
    2724    } 
    2825     
    29     GLclampf r,g,b;   /// values 
     26    float r,g,b;  /// values 
    3027     
    3128    static {