<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>the allegro gui</title>
		<link>http://www.allegro.cc/forums/view/590306</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 28 Feb 2007 12:04:08 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>so what i want is to display a length of text within a fixed size box on the screen, which is not SCREEN but a bitmap, and if it doesn&#39;t fit, have it wordwrap and get a scroll bar. so far, d_textbox_proc sounds like the perfect candidate. </p><p>everything&#39;d be fine, except the pesky thing doesn&#39;t return unless esc is pressed, and thus i get a game that only animates one frame at a time, when the player presses esc. now, this is no end of it&#39;s own cuteness and all, but i think i&#39;d rather it returned immediately.</p><p>any idea how i do that ? (im sure it is, as usual, trivial).</p><div class="source-code snippet"><div class="inner"><pre>     <span class="k1">char</span> the_text<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span> <span class="s">"some text"</span>

     <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> the_dialog<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span>
<span class="k2">{</span>
   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_textbox_proc" target="_blank"><span class="a">d_textbox_proc</span></a>,    <span class="n">172</span>, <span class="n">496</span>,  <span class="n">680</span>,   <span class="n">172</span>,   <span class="n">16</span>,  <span class="n">255</span>,    <span class="n">0</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    <span class="k2">(</span><span class="k1">void</span> <span class="k3">*</span><span class="k2">)</span>the_text,       NULL, NULL  <span class="k2">}</span>,
   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_keyboard_proc" target="_blank"><span class="a">d_keyboard_proc</span></a>,     <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,  KEY_F1,   <span class="n">0</span>,    NULL,          NULL, NULL  <span class="k2">}</span>,
   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_yield_proc" target="_blank"><span class="a">d_yield_proc</span></a>,        <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    NULL,                   NULL, NULL  <span class="k2">}</span>,
   <span class="k2">{</span> NULL,                <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    NULL,                   NULL, NULL  <span class="k2">}</span>
<span class="k2">}</span><span class="k2">;</span>

   <a href="http://www.allegro.cc/manual/do_dialog" target="_blank"><span class="a">do_dialog</span></a><span class="k2">(</span>the_dialog, <span class="k3">-</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

(for bonus points, anyone know how i a) get rid of the lines around the box and b) replace the ugly scroll thing with a bitmap)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (zenofeller_)</author>
		<pubDate>Wed, 28 Feb 2007 08:20:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Don&#39;t use <tt>do_dialog</tt>, use a dialog player:<span class="source-code"><a href="http://www.allegro.cc/manual/init_dialog" target="_blank"><span class="a">init_dialog</span></a></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Wed, 28 Feb 2007 10:18:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i&#39;ve had partial success with </p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k1">void</span> display_chat<span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp, <span class="k1">const</span> <a href="http://www.allegro.cc/manual/FONT" target="_blank"><span class="a">FONT</span></a> <span class="k3">*</span>f, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>s, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> color, <span class="k1">int</span> bg<span class="k2">)</span></td></tr><tr><td class="number">2</td><td>&#160;</td></tr><tr><td class="number">3</td><td><span class="k2">{</span></td></tr><tr><td class="number">4</td><td><span class="k1">char</span> the_text<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span></td></tr><tr><td class="number">5</td><td>     <span class="s">"some text"</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>&#160;</td></tr><tr><td class="number">7</td><td><a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> d <span class="k3">=</span> <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_textbox_proc" target="_blank"><span class="a">d_textbox_proc</span></a>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">680</span>, <span class="n">172</span>, <span class="n">16</span>, <span class="n">255</span><span class="c">/*unused?*/</span>, <span class="n">1</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="k2">(</span><span class="k1">void</span><span class="k3">*</span><span class="k2">)</span>the_text, NULL, NULL <span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>   <a href="http://www.allegro.cc/manual/gui_set_screen" target="_blank"><span class="a">gui_set_screen</span></a> <span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>&#160;</td></tr><tr><td class="number">11</td><td>   d.proc<span class="k2">(</span>MSG_START, <span class="k3">&amp;</span>d, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>   d.proc<span class="k2">(</span>MSG_DRAW, <span class="k3">&amp;</span>d, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>   d.proc<span class="k2">(</span>MSG_END, <span class="k3">&amp;</span>d, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

(after a suggestion by kittycat in this thread : <a href="http://www.allegro.cc/forums/thread/581296">http://www.allegro.cc/forums/thread/581296</a>)</p><p>namely, it prints just fine, but obviously it doesn&#39;t know when the mouse wants the slider moved. im going to look at dialog players next, if i don&#39;t figure them out im going to try see what more i need added here to make the scroll mouse-sensitive.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (zenofeller_)</author>
		<pubDate>Wed, 28 Feb 2007 10:39:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>By the way, really, start typing properly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Wed, 28 Feb 2007 10:48:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>so i&#39;ve tried </p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>    <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> the_dialog<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span></td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_textbox_proc" target="_blank"><span class="a">d_textbox_proc</span></a>,    <span class="n">0</span>, <span class="n">0</span>,  <span class="n">680</span>,   <span class="n">172</span>,   <span class="n">16</span>,  <span class="n">255</span>,    <span class="n">1</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    <span class="k2">(</span><span class="k1">void</span> <span class="k3">*</span><span class="k2">)</span>the_text,       NULL, NULL  <span class="k2">}</span>,</td></tr><tr><td class="number">4</td><td>&#160;</td></tr><tr><td class="number">5</td><td>   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_keyboard_proc" target="_blank"><span class="a">d_keyboard_proc</span></a>,     <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,  KEY_F1,   <span class="n">0</span>,    NULL,          NULL, NULL  <span class="k2">}</span>,</td></tr><tr><td class="number">6</td><td>   <span class="k2">{</span> <a href="http://www.allegro.cc/manual/d_yield_proc" target="_blank"><span class="a">d_yield_proc</span></a>,        <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    NULL,                   NULL, NULL  <span class="k2">}</span>,</td></tr><tr><td class="number">7</td><td>   <span class="k2">{</span> NULL,                <span class="n">0</span>,   <span class="n">0</span>,    <span class="n">0</span>,    <span class="n">0</span>,   <span class="n">0</span>,  <span class="n">0</span>,    <span class="n">0</span>,      <span class="n">0</span>,       <span class="n">0</span>,   <span class="n">0</span>,    NULL,                   NULL, NULL  <span class="k2">}</span></td></tr><tr><td class="number">8</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td>&#160;</td></tr><tr><td class="number">11</td><td> <a href="http://www.allegro.cc/manual/DIALOG_PLAYER" target="_blank"><span class="a">DIALOG_PLAYER</span></a> <span class="k3">*</span>player <span class="k3">=</span> <a href="http://www.allegro.cc/manual/init_dialog" target="_blank"><span class="a">init_dialog</span></a><span class="k2">(</span>the_dialog, <span class="k3">-</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td> <a href="http://www.allegro.cc/manual/gui_set_screen" target="_blank"><span class="a">gui_set_screen</span></a> <span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td> <a href="http://www.allegro.cc/manual/update_dialog" target="_blank"><span class="a">update_dialog</span></a><span class="k2">(</span>player<span class="k2">)</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

and its significantly slower than the other variant. i wonder why. (also, how do i go about posting a reply in a thread i started as a &quot;question with a definite answer&quot; without locking it ?)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (zenofeller_)</author>
		<pubDate>Wed, 28 Feb 2007 11:31:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
(also, how do i go about posting a reply in a thread i started as a &quot;question with a definite answer&quot; without locking it ?)
</p></div></div><p>You can&#39;t post twice in a row.</p><p>The code you showed would be slower by itself, as it would only update the dialog once. Show more code. Type properly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Wed, 28 Feb 2007 11:37:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>either snippet i&#39;ve shown would get updated once per page flip because the function they&#39;re in gets called once per flip. the 2nd slows down the flips tho. </p><p>or are you saying each call to d.proc in the first triggers a re-draw ? then <i>that</i> should be slower, because it still wouldn&#39;t make it to the screen but once, on the page flip. or otherwise what do you mean by &quot;only once&quot; ?</p><p>at any rate i&#39;m not sure what i&#39;d show for more code.</p><p>and what&#39;s with all the typing fascism ?</p><p>(now more to the point, what i&#39;d call as a d.proc to make the slider bar functional ? the exgui just uses do_dialog, and i can&#39;t seem to find what i need in the manual. i suppose the alternative would be i just use a simple text box and implement scrolling myself... but i&#39;d love to save myself the trouble)</p><p>[edit]<br />well, i&#39;ve now had enough bashing my head against the wall of this.</p><p>what i will do as a work-around is, make the 1st snippet above output to a bitmap that&#39;s x+21, y+2 what i need, then blit it at 1,1,x,y of what i need. that way, the annoying as hell border and the unusable scroll are cut out and i&#39;m left with a function that does wordwrapping in a box. i&#39;ll implement keyboard shortcuts for scrolling up and down, and that will be the end of it.</p><p>it would be absolutely wonderful if there existed some way to use the scroll bar without giving mouse ownership to the &quot;gui&quot; thingy. i understand it&#39;s not all that easy or straightforward to do, but that doesn&#39;t change the fact it&#39;d be wonderful.</p><p>if anyone comes up with anything, i&#39;ll be interested to hear, even if it&#39;s months later. thanks all.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (zenofeller_)</author>
		<pubDate>Wed, 28 Feb 2007 12:04:08 +0000</pubDate>
	</item>
</rss>
