Changeset 61:7cab2af4ba21
- Timestamp:
- 06/25/08 12:25:48 (7 months ago)
- Files:
-
- codeDoc/jobs.txt (modified) (1 diff)
- data/conf/gui.mtt (modified) (1 diff)
- mde/events.d (modified) (2 diffs)
- mde/gl/draw.d (modified) (1 diff)
- mde/gui/content/Content.d (added)
- mde/gui/content/ContentText.d (deleted)
- mde/gui/content/Services.d (added)
- mde/gui/widget/TextWidget.d (modified) (6 diffs)
- mde/gui/widget/createWidget.d (modified) (2 diffs)
- mde/input/Input.d (modified) (1 diff)
- mde/resource/FontTexture.d (modified) (2 diffs)
- mde/resource/font.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
codeDoc/jobs.txt
r58 r61 4 4 5 5 In progress: 6 GUI Content. 6 7 7 8 data/conf/gui.mtt
r57 r61 8 8 <int|x=150> 9 9 <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]]> 11 11 {WEmbedded} 12 12 <int|x=20> mde/events.d
r36 r61 26 26 import tango.time.Time; 27 27 import tango.util.log.Log : Log, Logger; 28 import tango.io.Stdout; 28 29 29 30 private Logger logger; … … 50 51 default: 51 52 try { 52 imde.input (event); 53 if (!imde.input (event)) 54 debug Stdout ("Unrecognised event with code ")(event.type).newline; 53 55 } catch (Exception e) { 54 56 logger.error ("Caught input exception; event will be ignored. Exception was:"); mde/gl/draw.d
r55 r61 39 39 40 40 gui.draw (); 41 debug FontStyle.drawTexture;41 debug (drawGlyphCache) FontStyle.drawTexture; 42 42 43 43 GLenum err = glGetError(); mde/gui/widget/TextWidget.d
r59 r61 20 20 import mde.gui.exception; 21 21 import mde.gui.renderer.IRenderer; 22 import mde.gui.content.Content Text;22 import mde.gui.content.Content; 23 23 24 24 import mde.resource.font; … … 27 27 28 28 /// Adapter to ease use of ContentText 29 struct AdapterText{29 struct ContentAdapter(ContentT : IContent) { 30 30 void set (int col) { 31 31 if (font is null) font = FontStyle.get("default"); 32 32 33 content = new ContentT ext;33 content = new ContentT; 34 34 colour = Colour (cast(ubyte) (col >> 16u), 35 35 cast(ubyte) (col >> 8u), … … 38 38 39 39 void getDimensions (out wdsize w, out wdsize h) { 40 font.updateBlock (content.t ext, textCache);40 font.updateBlock (content.toString, textCache); 41 41 w = cast(wdim) textCache.w; 42 42 h = cast(wdim) textCache.h; … … 44 44 45 45 void draw (wdabs x, wdabs y) { 46 font.textBlock (x,y, content.t ext, textCache, colour);46 font.textBlock (x,y, content.toString, textCache, colour); 47 47 } 48 48 49 ContentT extcontent;49 ContentT content; 50 50 TextBlock textCache; 51 51 Colour colour; … … 54 54 55 55 /// Basic text widget 56 class TextWidget: Widget56 class ContentWidget(ContentT : IContent) : Widget 57 57 { 58 58 this (IWindow wind, int[] data) { … … 69 69 70 70 protected: 71 AdapterTexttext;71 ContentAdapter!(ContentT) text; 72 72 } 73 74 alias ContentWidget!(ContentText) TextWidget; 75 alias ContentWidget!(ContentInt) IntWidget; mde/gui/widget/createWidget.d
r59 r61 63 63 SizableBlank = WSIZABLE | HSIZABLE | 0x1, 64 64 65 // text: 0x266 Text = 0x2,67 68 65 // buttons: 0x10 69 66 Button = INTERACTIBLE | 0x10, 67 68 // content: 0x20 69 Text = 0x21, 70 Int = 0x22, 70 71 71 72 GridLayout = LAYOUT | WSIZABLE | HSIZABLE | 0x4 … … 78 79 "FixedBlank", 79 80 "Text", 81 "Int", 80 82 "SizableBlank", 81 83 "Button", mde/input/Input.d
r60 r61 182 182 * Other types of event functions may be added. Returns true if the event was used, false if not 183 183 * 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). 184 186 * 185 187 * May throw InputClassExceptions (on configuration errors). Catching the exception and continuing should mde/resource/FontTexture.d
r57 r61 325 325 } 326 326 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 () { 328 329 if (tex.length == 0) return; 329 330 glEnable (GL_TEXTURE_2D); … … 366 367 367 368 // add a pretty background to the texture 368 static if (true) {369 debug (drawGlyphCache) { 369 370 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 370 371 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); mde/resource/font.d
r57 r61 52 52 //BEGIN Static: manager 53 53 static { 54 debug void drawTexture() {54 debug (drawGlyphCache) void drawTexture() { 55 55 if (fontTex !is null) 56 56 fontTex.drawTexture;
