| 1 | = TextEngine = |
| 2 | {{{ |
| 3 | #!html |
| 4 | <div style="border:1px outset #8c5b00;padding: 0.5em 1em 0.5em 1em;background: #ffe17b;-moz-border-radius:10px"><table style="width:100%"><tr><td align="left"> |
| 5 | }}} |
| 6 | [[Image(icons:archive.png, 50)]] |
| 7 | {{{ |
| 8 | #!html |
| 9 | </td><td align="center"><b>This is an archived page!</b><br/>This page is very old and the content is not up to date.<br/>Not everything (if any) which is written here will be in the final game!</td><td align="right"> |
| 10 | }}} |
| 11 | [[Image(icons:archive.png, 50)]] |
| 12 | {{{ |
| 13 | #!html |
| 14 | </td></tr></table></div> |
| 15 | }}} |
| 16 | An engine, that renders text on openGLTextures, and displays them on the screen. |
| 17 | |
| 18 | == usage == |
| 19 | * simple: |
| 20 | {{{ |
| 21 | #!cpp |
| 22 | #include "text.h" |
| 23 | ... |
| 24 | // create a new Text. |
| 25 | Text* newText = new Text("fontfile.ttf", 16); |
| 26 | // set some color (red, green, blue [0-1]) |
| 27 | newText->setColor(1, 0, 0); |
| 28 | // set some blending, and everything will shine through. |
| 29 | newText->setBlending(.8); |
| 30 | // set another alignment |
| 31 | newText->setAlignment(TEXT_ALIGN_LEFT); |
| 32 | // and display some text |
| 33 | newText->setText("wow... so easy??"); |
| 34 | ... |
| 35 | }}} |
| 36 | * advanced: |
| 37 | * Text implements Element2D from [wiki:Render2D Render2D] |
| 38 | * you can reload fonts using |
| 39 | {{{ |
| 40 | #!cpp |
| 41 | newText->setFont(const char* fontFile, unsigned int fontSize); |
| 42 | }}} |
| 43 | * if you like to be quick, and handle the char-array externally (the text wont delete the array, and will segfault, if the char-array is deleted) use something like: (notice the true) |
| 44 | {{{ |
| 45 | #!cpp |
| 46 | char* textPointerHandledExternally = "blabla"; |
| 47 | newText->setText(textPointerHandledExternally, true); |
| 48 | }}} |
| 49 | * Hiding text: |
| 50 | {{{ |
| 51 | #!cpp |
| 52 | newText->setVisibility(false); |
| 53 | }}} |
| 54 | (this is Element2D-functionality) |
| 55 | |