<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Maratis MCore/MEngine C++ "Hello World" Example]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=276&amp;type=atom"/>
	<updated>2012-01-17T04:59:08Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=276</id>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1157#p1157"/>
			<content type="html"><![CDATA[<p>Well if anyone want&#039;s to use Maratis with SFML2 here is some code to start<br />with. Can&#039;t see the model but I imagen that has something to do with transformations.</p><p>But the viewport is visible.</p><div class="codebox"><pre><code>#include &lt;SFML/Graphics.hpp&gt;
#include &lt;MCore.h&gt;
#include &lt;MEngine.h&gt;
#include &quot;MGLContext.h&quot;
#include &lt;iostream&gt;

int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), &quot;SFML window&quot;);

     MEngine * engine = MEngine::getInstance();

     MRenderingContext * render = new MGLContext();
     render-&gt;disableScissorTest();
     render-&gt;setViewport(0, 0, 200, 200);

     engine-&gt;setRenderingContext(render);

     MGame * game = new MGame();
     engine-&gt;setGame(game);

     // get level
     MLevel * level = new MLevel();
     engine-&gt;setLevel(level);

     if(level-&gt;getScenesNumber() == 0)
     {
         MScene * scene = level-&gt;addNewScene();

         MOCamera * camera = scene-&gt;addNewCamera();
         camera-&gt;setClearColor(MVector3(1.0f, 0.075f, 1.0f)); // set grey clear color
         camera-&gt;setPosition(MVector3(0.0f, -80.0f, 20.0f));
         camera-&gt;setEulerRotation(MVector3(90.0f, 0.0f, 0.0f));

         MMeshRef * meshRef = level-&gt;loadMesh(&quot;box.mesh&quot;);
         MOEntity * box1 = scene-&gt;addNewEntity(meshRef);

         box1-&gt;setPosition(MVector3(70, 65, 0));
         box1-&gt;setScale(MVector3(4, 4, 0.2f));

         MOLight * light = scene-&gt;addNewLight();
         light-&gt;setPosition(MVector3(0.0f, 0.0f, 100.0f));
         light-&gt;setRadius(1000.0f);
     }

     game-&gt;begin();
     // Start the game loop
     while (window.IsOpened())
     {
         // Process events
         sf::Event event;
         while (window.PollEvent(event))
         {
             // Close window : exit
             if (event.Type == sf::Event::Closed)
                 window.Close();
         }
 
         // Clear screen
         window.Clear(sf::Color(255, 255, 255 ,255));
         game-&gt;draw();
         std::cout &lt;&lt; game-&gt;isRunning() &lt;&lt; std::endl;
         // Update the window
         window.Display();
     }
     
     game-&gt;end();

     SAFE_DELETE(game);
     SAFE_DELETE(level);

     SAFE_DELETE(render);
     return EXIT_SUCCESS;
 }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[zester]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=516</uri>
			</author>
			<updated>2012-01-17T04:59:08Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1157#p1157</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1156#p1156"/>
			<content type="html"><![CDATA[<p>I also want to know simple Hello World standalone executable, not dynamic library, and without MaratisPlayer<br />can it?</p><p>can I bundle MaratisPlayer source into my project?<br />what about the license?since MaratisPlayer use GPL not zlib/png license.</p><br /><p>*edit<br />forget it, I look at ManualUse, and this is what I&#039;m lookin for.</p><p>ohh, currently lua is used for scripting, right?<br />any plan to make lua as binding?so we can make game entirely with lua, just like corona <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></content>
			<author>
				<name><![CDATA[jurgel]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=522</uri>
			</author>
			<updated>2012-01-17T00:17:24Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1156#p1156</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1127#p1127"/>
			<content type="html"><![CDATA[<p>There is no game by default,<br />engine-&gt;getGame(); will return a NULL</p><p>but MGame implement basic functionalities, so you can create one :</p><p>MGame * game = new MGame();<br />engine-&gt;setGame(game);</p><p>And of course, for a custom game, you can inherit MGame and customize functions you want (update, draw).</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2012-01-15T10:13:31Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1127#p1127</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1126#p1126"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>anael wrote:</cite><blockquote><p>ManualUse example is one of the simplest,<br />just initializing MCore + MEngine and loading some mesh.</p><p>What do you mean by subclassed ?</p></blockquote></div><p>In ManualUse MyGame.h you derive a new class from MGame<br /></p><div class="codebox"><pre><code>class MyGame : public MGame
{
public:</code></pre></div><p>I was asking because with some library&#039;s there not meant to be used directly. You have to <br />&quot;subclass&quot; derive a new class from an existing one.</p><p>What I was trying to do was use Maratis&#039; Rendering context in SFML2<br /></p><div class="codebox"><pre><code> int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), &quot;SFML window&quot;);
 
    MEngine *engine = MEngine::getInstance();
    MRenderingContext *render = engine-&gt;getRenderingContext();
    MGame *game = engine-&gt;getGame();
    
    render-&gt;setViewport(0, 0, 100, 100);</code></pre></div><p>But when I initialize my MGame pointer *game I get a segfault.</p>]]></content>
			<author>
				<name><![CDATA[zester]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=516</uri>
			</author>
			<updated>2012-01-15T00:37:38Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1126#p1126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1118#p1118"/>
			<content type="html"><![CDATA[<p>ManualUse example is one of the simplest,<br />just initializing MCore + MEngine and loading some mesh.</p><p>What do you mean by subclassed ?</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2012-01-14T22:56:54Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1118#p1118</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1117#p1117"/>
			<content type="html"><![CDATA[<p>Looking at the example, it looks like you can inherit from MGame if you want (although it does nothing with it) however I think it&#039;s probably fairly unwise to replace MEngine as it&#039;s a singleton.</p>]]></content>
			<author>
				<name><![CDATA[Nistur]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=500</uri>
			</author>
			<updated>2012-01-14T22:55:31Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1117#p1117</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1115#p1115"/>
			<content type="html"><![CDATA[<p>Maybe I asked the wrong question.</p><p>Do the MEngine or MGame classes have to be subclassed<br />in order to be used?</p>]]></content>
			<author>
				<name><![CDATA[zester]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=516</uri>
			</author>
			<updated>2012-01-14T22:45:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1115#p1115</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1112#p1112"/>
			<content type="html"><![CDATA[<p><a href="http://www.maratis3d.org/?p=500">http://www.maratis3d.org/?p=500</a> &lt;-- have you tried that example?</p>]]></content>
			<author>
				<name><![CDATA[Nistur]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=500</uri>
			</author>
			<updated>2012-01-14T21:04:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1112#p1112</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Maratis MCore/MEngine C++ "Hello World" Example]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=1111#p1111"/>
			<content type="html"><![CDATA[<p>I was wondering if anyone had a simple C++ &quot;Hello, World&quot; type example that uses <br />MCore &amp; MEngine?</p><p>I tried using the ManualUse example as a reference for a bare-bones<br />type example but I keep getting a segfault.</p><p>I need something even more basic for testing.</p><p>Any help would be great <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[zester]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=516</uri>
			</author>
			<updated>2012-01-14T20:59:13Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=1111#p1111</id>
		</entry>
</feed>
