<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro5 with GTK, QT or Wxwidgets</title>
		<link>http://www.allegro.cc/forums/view/605416</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 30 Oct 2010 04:53:28 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello everyone!<br />Sometime ago I made a program to help me make animations to my games. For that I used guichan. But guichan is for using more with ingame stuff. I was thinking about remaking my program with a better gui, like wxWidgets, QT or GTK.<br />I know thats a way to use allegro 4.2 with wxwidgets.. Is that a way to do so with allegro5?</p><p>I know that allegro now uses(can use, i think) openGL to render its graphics, is there a way to get the opengl window handler, or somethink like this? case with QT, I can embed an opengl window with my gui.</p><p>Please help me, I read a lot about allegro5 possible guis but. I dont really need an ingame gui, WHAT I NEED is a gui, with an allegro5 window embed...<br />let me try to explain better. I got a program, with my gui, I will let the user change a lot of values, and in the &quot;allegro window&quot;, I will render some graphics with the data gathered. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /></p><p>So thats it, i would really appreciate your help. Thanks in advance. </p><p>If you wanna know exactly what i will remake see this, maybe you can understand better: <div class="media-player youtube"><div style="margin: 1em 2em; background: url(/images/movie.png); width: 180px; height: 100px; text-align: center;"><a href="http://www.allegro.cc//www.youtube.com/watch?v=keFAY8oHwsw" target="_blank"><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/object/2/c/2cea05cb248542e8be1726e7da3a8fd0.jpg" border="0" alt="video" title="Click to play video" /></a></div></div>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (aniquilator)</author>
		<pubDate>Fri, 29 Oct 2010 14:16:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d probably just use Qt&#39;s or OpenGL functions to do the drawing if I was going to the trouble of making a tool for a game in Qt.</p><p>But I think you might be able to mix Qt and Allegro 5 if you make sure to handle allegro 5 messages in with the Qt messages. I assume that&#39;d be done using the <a href="http://doc.trolltech.com/4.6/qeventloop.html">QEventLoop</a> stuff. And after that you&#39;d grab the window id from allegro, and tell Qt to embed that window in one of its own widgets. That part is going to need platform specific code though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 29 Oct 2010 14:35:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey, thanks, i will to try to look at QEventLoop.<br />unfortunately I cant just use openGl or Qts function to do the drawing, cause, i made a lot of classes that use allegro5 drawing, and I need those classes to render the graphics, they render animations, and spritepacks at most. I could try to convert the images they return to qt&#39;s image format, but I think it must be a better way.</p><p>Now I could initiate a application in Qt, and display an allegro window, but when I quit the application, it seems that the allegro don&#39;t let qt finish it all. Do you know why? I just put this code in the constructor of my widget:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"allegro_init()-call\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 2</span>al_install_system<span class="k2">(</span>ALLEGRO_VERSION_INT, NULL<span class="k2">)</span> <span class="k3">=</span><span class="k3">=</span> <span class="k1">true</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 3</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"allegro_init()-end\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 4</span>mydisplay <span class="k3">=</span> al_create_display<span class="k2">(</span><span class="n">320</span>, <span class="n">240</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>
And I put this code in the destructor of my class:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span>al_destroy_display<span class="k2">(</span>mydisplay<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 2</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"al_uninstall_system()-call\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 3</span>al_uninstall_system<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 4</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"al_uninstall_system()-end\n"</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>
I works fine, It inits, create the display, and show the quit message properly, but the application, stills running..<br />If I remove the al_install_system ... it quits properly. Any idea?<br />Thanks in advance</p><p><b>Edit:</b><br />I was doing some tests here, and something very interesting happened..<br />Like I explained before, I&#39;m creating a display for allegro, and was drawing some rectangles in the display with <b>al_draw_filled_rectangle</b>. The weird thing is that the rectangles are being drawn into the QT widget, instead of their being drawn into the allegro&#39;s display! look at the code below:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k1">int</span> x<span class="k3">=</span><span class="n">10</span>,y<span class="k3">=</span><span class="n">10</span><span class="k2">;</span>
<span class="number">  2</span><span class="k1">int</span> W<span class="k3">=</span><span class="n">50</span>,H<span class="k3">=</span><span class="n">50</span><span class="k2">;</span>
<span class="number">  3</span>
<span class="number">  4</span>al_set_target_backbuffer<span class="k2">(</span>mydisplay<span class="k2">)</span><span class="k2">;</span>
<span class="number">  5</span>al_draw_filled_rectangle<span class="k2">(</span>x, y, x <span class="k3">+</span> W, y <span class="k3">+</span> H, al_map_rgba_f<span class="k2">(</span><span class="n">1</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">1</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  6</span>al_draw_bitmap<span class="k2">(</span>bmp, <span class="n">100</span>, <span class="n">100</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span>al_draw_filled_rectangle<span class="k2">(</span><span class="n">0</span>, <span class="n">0</span>, W, H, al_map_rgba_f<span class="k2">(</span><span class="n">1</span>, <span class="n">1</span>, <span class="n">0</span>, <span class="n">0</span>.<span class="n">1</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>al_flip_display<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>
About the things being drawn into the Qt widget, its ok, even better to me, I just need to know how to hide the allegro display now. </p><p>In addiction the rectangles are being drawn correctly, but the BITMAP just show a white rectangle... It doesn&#39;t show the image itself. I made a program to test the image, and it shows ok.</p><p><b>Edit:</b><br />I&#39;ve discovered something, it seems that the problem that is leading to corrupt images being drawn is because the images are being loaded corrupted..<br />I&#39;ve checked the same image loaded in a common program, and the image loaded in QT. It seems that the image addon is messing with the image pixels, i dont know why..<br />it inits ok, I&#39;ve checked everythings ok, maybe I&#39;m missing something...&gt;:(</p><p><b>Edit:</b><br />I&#39;ve discovered more... It was a long day full of tests guys... so The problem with QT isn&#39;t about the image addon that loads the image, its about the bitmap structure..<br />Even if I create a bitmap, and put pixels to it, it will corrupt, and I don&#39;t know why.. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /> <br />To test my theory I used another lib to load the sprite and store it in a matrix of pixels, and I made a function to draw the pixels, just 2 FORs, and thats it.<br />It worked.. So the problem was really with the bitmap struct. </p><p>So, after that I start to mess around with GTK. And I got better results. =) Allegro can draw everything in an openGL widget! =) thats right everything works, and the best: The application quits properly. Now what I have to do is to stop creating the allegro display... </p><p>Is There some way to tell allegro to use a openGL context, and not create its own display? If there&#39;s a way every gonna be almost perfect! LOL8-)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (aniquilator)</author>
		<pubDate>Sat, 30 Oct 2010 04:53:28 +0000</pubDate>
	</item>
</rss>
