<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Full GUI]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=910&amp;type=atom"/>
	<updated>2014-05-30T12:21:03Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=910</id>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6845#p6845"/>
			<content type="html"><![CDATA[<p>A great classic !</p><p>you will get that dll for sure if you install VS2010 (don&#039;t know about the others VS)<br />or maybe this will work : <a href="http://www.microsoft.com/en-us/download/details.aspx?id=5555">http://www.microsoft.com/en-us/download &#133; px?id=5555</a></p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-05-30T12:21:03Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6845#p6845</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6842#p6842"/>
			<content type="html"><![CDATA[<p>When I try to open the project, it says the program can&#039;t run because MSVCR100D.dll is missing from my computer. </p><p>It tells me to re-install the program to fix the problem.</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-05-30T03:56:06Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6842#p6842</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6841#p6841"/>
			<content type="html"><![CDATA[<p><a href="https://dl.dropboxusercontent.com/u/19970067/Maratis/Various/Display.rar">Here&#039;s a project</a> and it&#039;s dll, a blender file and a gimp file. containing all you need for an 1024x768 interface (but nothing else than THIS resolution)&nbsp; </p><p>The pane on the GUIScene will totally fit what the camera sees but.. dont go full screen nor increase window size &gt;.&lt;</p><p>If you want to make your own interface with anael&#039;s method,</p><p>Let&#039;s say this is your interface (grey area for the UI, transparent area for the game) :</p><p><span class="postimg"><img src="https://dl.dropboxusercontent.com/u/19970067/Maratis/Various/Int1.png" alt="PunBB bbcode test" /></span></p><p>First move your cursor at the extreme left and top of the transparent area (the red pixel)<br />these are X and Y position of your game window</p><p><span class="postimg"><img src="https://dl.dropboxusercontent.com/u/19970067/Maratis/Various/Int3.png" alt="PunBB bbcode test" /></span></p><p>Then select the whole transparent area and take note of the width/height</p><p><span class="postimg"><img src="https://dl.dropboxusercontent.com/u/19970067/Maratis/Various/Int2.png" alt="PunBB bbcode test" /></span></p><p>put all the values in the code ; </p><div class="codebox"><pre><code>    int X = 10; // pos x
    int Y = 10; // pos y
    int W = 500; // width
    int H = 300; // height

    render-&gt;setViewport(
           X,
           viewport[3]-H-Y,
           W,
           H
    );</code></pre></div><br /><p>compile, run game ; it&#039;s gg.</p><p>Hope it helps</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-05-29T21:44:32Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6841#p6841</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6836#p6836"/>
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>I want to make it easily editable for beginning Maratis users (no complicated setup).</p></blockquote></div><p>For a HUD with no interactions,<br />if you want to display some informations like in FPS games, using camera layering is enough,<br />if you want a full interface, go with Anael&#039;s method, even if you need VS, you can easily set up the window exactly where you want to</p><p>But for a clickable interface, when we will be able to use physic detection from one scene to another, <br />it will be very easy but for now it will be quite bulky (could work with a set up like in my first post figure 3)</p><div class="quotebox"><blockquote><p>The main issue is positioning things over the camera at a precise point.</p></blockquote></div><p>I have a blender file that may help you - i hope i didn&#039;t deleted/modified it - keep you in touch</p><p>for the WindowScale unfortunately i never made tests with that stuff</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-05-29T17:36:01Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6836#p6836</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6833#p6833"/>
			<content type="html"><![CDATA[<p>Hi Vegas. Trying to see how to go about making an easy to use GUI system for the starter pack. </p><p>Right now I just have an orthographic camera in a separate scene, and am using enableCamerLayer to display it over a camera. The main issue is positioning things over the camera at a precise point.</p><p>I figured I would have to use getWindowScale also so that things are positioned relative to the window size.</p><p>What does renderToTexture do for your GUI?</p><p>I want to make it easily editable for beginning Maratis users (no complicated setup).</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-05-28T18:08:05Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6833#p6833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6825#p6825"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>Tutorial Doctor wrote:</cite><blockquote><p>I am trying to do a GUI myself now, and I am running into all sorts of snags. <img src="http://forum.maratis3d.com/img/smilies/sad.png" width="15" height="15" alt="sad" /></p></blockquote></div><p>What&#039;s going on?</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-05-26T21:32:53Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6825#p6825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6798#p6798"/>
			<content type="html"><![CDATA[<p>I am trying to do a GUI myself now, and I am running into all sorts of snags. <img src="http://forum.maratis3d.com/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-05-19T23:38:41Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6798#p6798</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6174#p6174"/>
			<content type="html"><![CDATA[<p>Outstanding <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /> works like a charm ! Many Thanks <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-01-11T10:16:51Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6174#p6174</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6173#p6173"/>
			<content type="html"><![CDATA[<p>Sure, you can do this if you still use percents (if the screen need to adapt to the resolution) :<br /></p><div class="codebox"><pre><code>    int marginLeft = viewport[2]*0.1f;
    int marginRight = viewport[2]*0.1f;
    int marginTop = viewport[3]*0.1f;
    int marginBottom = viewport[3]*0.1f;

    render-&gt;setViewport(
           viewport[0]+marginLeft,
           viewport[1]+marginBottom,
           viewport[2]-marginRight-marginLeft,
           viewport[3]-marginBottom-marginTop
    );</code></pre></div><p>or if you want to enter pixel coords direcly :<br /></p><div class="codebox"><pre><code>    int X = 10; // pos x
    int Y = 10; // pos y
    int W = 500; // width
    int H = 300; // height

    render-&gt;setViewport(
           X,
           viewport[3]-H-Y,
           W,
           H
    );</code></pre></div>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2014-01-11T03:58:41Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6173#p6173</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6172#p6172"/>
			<content type="html"><![CDATA[<p>That&#039;s working great! thanks you!</p><p>But i noticed the game window is always centered,<br />to make it more usable, could it be possible to set-up<br />4 margins and make the game screen fit inside it ? (dont know if that&#039;s realistic)<br />or adjust the game window position with (X, Y, width, height) values ?</p><p>that would allow to make interfaces like <a href="http://img14.exs.cx/img14/886/insidedahq2ri.jpg">This one</a> or <a href="http://www.the-nextlevel.com/tnl/attachment.php%3Fattachmentid%3D56911%26d%3D1279785900">This one</a></p><p>Oh and it doesn&#039;t worked when using &quot;release&quot; mode (had alot of errors popping up), only debug mode worked</p><div class="quotebox"><blockquote><p>Et voila, a custom game plugin, you&#039;ll see it&#039;s no so complicated once you understand c/c++ syntax.<br />In c++ you can access the engine directly, so anything can be done.</p></blockquote></div><p>Yeah it makes want to investigate that stuff, but... i already know how it will end <img src="http://forum.maratis3d.com/img/smilies/tongue.png" width="15" height="15" alt="tongue" /> (bad)</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-01-11T01:45:52Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6172#p6172</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6171#p6171"/>
			<content type="html"><![CDATA[<p>so the example run fine with the GUI and the rotating box and all ?</p><p>if yes, now you can replace the code of MGame.cpp by this :<br /></p><div class="codebox"><pre><code>/////////////////////////////////////////////////////////////////////////////////////////////////////////
// SimpleGamePlugin
// MyGame.cpp
// 
// Code : Anael Seghezzi
/////////////////////////////////////////////////////////////////////////////////////////////////////////

#include &quot;MyGame.h&quot;


// constructor
MyGame::MyGame(void):
MGame()
{}

// destructor
MyGame::~MyGame(void)
{}


// GUI scene and objects
MScene * GUIScene = NULL;


// custom begin scene
void MyGame::onBeginScene(void)
{
    MGame::onBeginScene(); // call the default MGame begin scene
    
    MEngine * engine = MEngine::getInstance(); // get the engine instance
    MLevel * level = engine-&gt;getLevel(); // get the current level
    
    // get GUI scene
    GUIScene = level-&gt;getSceneByName(&quot;GUIScene&quot;);
}

// custom update
void MyGame::update(void)
{
    // custom GUI
    if(GUIScene) // check if the scene exist
    {
        // update GUI scene
        GUIScene-&gt;update();
        GUIScene-&gt;updateObjectsMatrices();
    }
    
    MGame::update(); // call the default MGame update (update current scene physics, animations, script... as done by default)
}

// custom draw
void MyGame::draw(void)
{
    MEngine * engine = MEngine::getInstance(); // get the engine instance
    MRenderingContext * render = engine-&gt;getRenderingContext(); // get the rendering context
    
    // use a smaller viewport for the current scene
    int viewport[4];
    render-&gt;getViewport(viewport);
    
    int marginX = viewport[2]*0.1f; // create a 10% margin of the current screen width : change this for your game
    int marginY = viewport[3]*0.1f; // create a 10% margin of the current screen height : change this for your game
    render-&gt;setViewport(viewport[0]+marginX, viewport[1]+marginY, viewport[2]-marginX*2, viewport[3]-marginY*2);

    MGame::draw(); // call the default MGame draw (this will draw the current scene as done by default)
    
    // restore the viewport
    render-&gt;setViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
    
    
    // custom GUI
    if(GUIScene) // check if the scene exist
    {
        if(GUIScene-&gt;getCamerasNumber() &gt; 0) // check if there is a camera in the GUI scene
        {
            MOCamera * camera = GUIScene-&gt;getCameraByIndex(0); // get the first camera
            
            render-&gt;clear(M_BUFFER_DEPTH); // clear depth buffer (to not be affeted by the current scene)
            
            // draw GUI on top
            camera-&gt;enable();
            GUIScene-&gt;draw(camera);
        }
    }
}</code></pre></div><p>- Then use your own game instead of the example or copy the dll in your game directory.<br />- name your GUI scene &quot;GUIScene&quot; or change the reference name in Game.cpp<br />- don&#039;t use render to texture or scene layer for the gui (it&#039;s all done by the cpp)</p><p>The code create a smaller viewport to render the current scene and draw the scene named &quot;GUIScene&quot; on top.</p><p>The part dealing with the viewport size is this :<br /></p><div class="quotebox"><blockquote><p>int marginX = viewport[2]*0.1f; // create a 10% margin of the current screen width : change this for your game<br />int marginY = viewport[3]*0.1f; // create a 10% margin of the current screen height : change this for your game</p></blockquote></div><p>Et voila, a custom game plugin, you&#039;ll see it&#039;s no so complicated once you understand c/c++ syntax.<br />In c++ you can access the engine directly, so anything can be done.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2014-01-10T17:32:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6171#p6171</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6170#p6170"/>
			<content type="html"><![CDATA[<p>Ok i get it... it was one of the most obvious item in the top bar *facepalm* <br />Well thank you, everything&#039;s fine now <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-01-10T07:35:59Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6170#p6170</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6168#p6168"/>
			<content type="html"><![CDATA[<p>&quot;release&quot; should be somewhere in the top bar,<br />usually a project is in &quot;debug&quot; mode by default, if you see &quot;debug&quot; somewhere, clic on it to change to release.</p><p>when you compile, the project should create a file named &quot;Game.dll&quot;<br />if it&#039;s not done by visual studio, copy it inside the maratis project folder</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2014-01-10T06:17:05Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6168#p6168</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6158#p6158"/>
			<content type="html"><![CDATA[<p>Alright, i used 2010 express edition (i remember having trouble with 2005 version, that was always missing window.h)</p><p>So, opening the .sln file makes the program crash, but it&#039;s ok with the vcproj (it just ask for converting it)</p><p>Weirdly, setting paths in the Game header (in the tree view), was not enough, <br />i had to manually enter paths for every .cpp files, after that, it worked <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>(ps. I didn&#039;t find the &quot;release&quot; mode option, where is this ? (in french if possible <img src="http://forum.maratis3d.com/img/smilies/tongue.png" width="15" height="15" alt="tongue" />))</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-01-09T15:24:10Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6158#p6158</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Full GUI]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6156#p6156"/>
			<content type="html"><![CDATA[<p>tell me if something is not going well,<br />it should be ok, there is a visual studio project in the example</p><p>- install visual studio (version 2005 works, express edition is free, I&#039;m not sure with the more recent versions)<br />- open the .sln file<br />- check the paths in the project properties<br />OR be sure the .sln file access maratis SDK folder this way : &quot;..\..\..\..\SDK&quot;<br />OR open the vcproj file with a text editor and replace &quot;..\..\..\..\SDK&quot; by your own path<br />- compile in &quot;release&quot; mode</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2014-01-09T13:57:34Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6156#p6156</id>
		</entry>
</feed>
