Changeset 61:7cab2af4ba21

Show
Ignore:
Timestamp:
06/25/08 12:25:48 (7 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

A little bit of progress on the content handling system (relevent code is likely to be revised).

Also some changes to debug statements, in particular a new drawGlyphCache debug version.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • codeDoc/jobs.txt

    r58 r61  
    44 
    55In progress: 
     6GUI Content. 
    67 
    78 
  • data/conf/gui.mtt

    r57 r61  
    88<int|x=150> 
    99<int|y=200> 
    10 <int[][int]|widgetData=[0:[0xB004,5,5,2,1,2,1,2,1,1,1,1,1,2,1,2,1,2,1,1,1,1,1,2,1,2,1,2],1:[0x3001],2:[0x2,0xFFFF00]]> 
     10<int[][int]|widgetData=[0:[0xB004,5,5,2,1,22,1,2,1,1,1,1,1,2,1,22,1,2,1,1,1,1,1,2,1,22,1,2],1:[0x3001],2:[0x21,0xFFFF00],22:[0x22,0xFF00]]> 
    1111{WEmbedded} 
    1212<int|x=20> 
  • mde/events.d

    r36 r61  
    2626import tango.time.Time; 
    2727import tango.util.log.Log : Log, Logger; 
     28import tango.io.Stdout; 
    2829 
    2930private Logger logger; 
     
    5051            default: 
    5152                try { 
    52                     imde.input (event); 
     53                    if (!imde.input (event)) 
     54                        debug Stdout ("Unrecognised event with code ")(event.type).newline; 
    5355                } catch (Exception e) { 
    5456                    logger.error ("Caught input exception; event will be ignored. Exception was:"); 
  • mde/gl/draw.d

    r55 r61  
    3939     
    4040    gui.draw (); 
    41     debug FontStyle.drawTexture; 
     41    debug (drawGlyphCache) FontStyle.drawTexture; 
    4242     
    4343    GLenum err = glGetError(); 
  • mde/gui/widget/TextWidget.d

    r59 r61  
    2020import mde.gui.exception; 
    2121import mde.gui.renderer.IRenderer; 
    22 import mde.gui.content.ContentText
     22import mde.gui.content.Content
    2323 
    2424import mde.resource.font; 
     
    2727 
    2828/// Adapter to ease use of ContentText 
    29 struct AdapterText
     29struct ContentAdapter(ContentT : IContent)
    3030    void set (int col) { 
    3131        if (font is null) font = FontStyle.get("default"); 
    3232         
    33         content = new ContentText
     33        content = new ContentT
    3434        colour = Colour (cast(ubyte) (col >> 16u), 
    3535                         cast(ubyte) (col >> 8u), 
     
    3838     
    3939    void getDimensions (out wdsize w, out wdsize h) { 
    40         font.updateBlock (content.text, textCache); 
     40        font.updateBlock (content.toString, textCache); 
    4141        w = cast(wdim) textCache.w; 
    4242        h = cast(wdim) textCache.h; 
     
    4444     
    4545    void draw (wdabs x, wdabs y) { 
    46         font.textBlock (x,y, content.text, textCache, colour); 
     46        font.textBlock (x,y, content.toString, textCache, colour); 
    4747    } 
    4848     
    49     ContentText content; 
     49    ContentT content; 
    5050    TextBlock textCache; 
    5151    Colour colour; 
     
    5454 
    5555/// Basic text widget 
    56 class TextWidget : Widget 
     56class ContentWidget(ContentT : IContent) : Widget 
    5757{ 
    5858    this (IWindow wind, int[] data) { 
     
    6969     
    7070protected: 
    71     AdapterText text; 
     71    ContentAdapter!(ContentT) text; 
    7272} 
     73 
     74alias ContentWidget!(ContentText) TextWidget; 
     75alias ContentWidget!(ContentInt) IntWidget; 
  • mde/gui/widget/createWidget.d

    r59 r61  
    6363    SizableBlank            = WSIZABLE | HSIZABLE | 0x1, 
    6464     
    65     // text: 0x2 
    66     Text            = 0x2, 
    67      
    6865    // buttons: 0x10 
    6966    Button                  = INTERACTIBLE | 0x10, 
     67     
     68    // content: 0x20 
     69    Text            = 0x21, 
     70    Int             = 0x22, 
    7071     
    7172    GridLayout              = LAYOUT | WSIZABLE | HSIZABLE | 0x4 
     
    7879        "FixedBlank", 
    7980        "Text", 
     81        "Int", 
    8082        "SizableBlank", 
    8183        "Button", 
  • mde/input/Input.d

    r60 r61  
    182182    * Other types of event functions may be added. Returns true if the event was used, false if not 
    183183    * or no config was available. Hmm... doesn't seem very useful, but has practically no cost. 
     184    * (Due to lack of use of this feature, false is returned even for used events when no config is 
     185    * available). 
    184186    * 
    185187    * May throw InputClassExceptions (on configuration errors). Catching the exception and continuing should 
  • mde/resource/FontTexture.d

    r57 r61  
    325325    } 
    326326     
    327     void drawTexture () {   // temp func 
     327    // Draw the first glyph cache texture in the upper-left corner of the screen. 
     328    debug (drawGlyphCache) void drawTexture () { 
    328329        if (tex.length == 0) return; 
    329330        glEnable (GL_TEXTURE_2D); 
     
    366367         
    367368        // add a pretty background to the texture 
    368         static if (true) { 
     369        debug (drawGlyphCache) { 
    369370            glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 
    370371            glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 
  • mde/resource/font.d

    r57 r61  
    5252    //BEGIN Static: manager 
    5353    static { 
    54         debug void drawTexture() { 
     54        debug (drawGlyphCache) void drawTexture() { 
    5555            if (fontTex !is null) 
    5656                fontTex.drawTexture;