<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Kenn jemand ein Engine Tutorial?]]></title><description><![CDATA[<p>Hallo</p>
<p>Kennt jemand ein Engine Tutorial? Denn ich will eine Engine programmieren, und weiss nicht genau wie ich das machen soll.</p>
<p>Ich danke für eure Antworten</p>
<p>Gruss Patrick</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/242655/kenn-jemand-ein-engine-tutorial</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Apr 2026 06:20:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/242655.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Jun 2009 15:24:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 15:24:39 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Kennt jemand ein Engine Tutorial? Denn ich will eine Engine programmieren, und weiss nicht genau wie ich das machen soll.</p>
<p>Ich danke für eure Antworten</p>
<p>Gruss Patrick</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722322</guid><dc:creator><![CDATA[Eglifisch1]]></dc:creator><pubDate>Sat, 06 Jun 2009 15:24:39 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 15:30:30 GMT]]></title><description><![CDATA[<p>Was denn für eine Ändschin? Eine WinAPI-Ändschin?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722323</guid><dc:creator><![CDATA[Ändschineer]]></dc:creator><pubDate>Sat, 06 Jun 2009 15:30:30 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 15:34:08 GMT]]></title><description><![CDATA[<p>lol</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722326</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722326</guid><dc:creator><![CDATA[dust]]></dc:creator><pubDate>Sat, 06 Jun 2009 15:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 16:30:58 GMT]]></title><description><![CDATA[<p>Nee, eine DLL-Engine</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722366</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722366</guid><dc:creator><![CDATA[Eglifisch1]]></dc:creator><pubDate>Sat, 06 Jun 2009 16:30:58 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 16:50:09 GMT]]></title><description><![CDATA[<blockquote>
<p>01: Nee, eine DLL-Engine</p>
</blockquote>
<p>PARSE ERROR @Main: Line 01: exported Symbol 'DLL-Engine' not found !</p>
<p>Hä ? Was willst du ? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Grafik-Engine, Physik-Engine, Gui-Engine, ...<br />
was willst du denn überhaupt programmieren ?</p>
<p>Oder willst du einfach nur wissen, wie man eine DLL erstellt ?</p>
<p>MFG, userland</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722371</guid><dc:creator><![CDATA[userland]]></dc:creator><pubDate>Sat, 06 Jun 2009 16:50:09 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sat, 06 Jun 2009 16:57:16 GMT]]></title><description><![CDATA[<p>Also ich will nur wissen, wie man eine Engine programmieren kann. Ich denke an eine Grafik-Engine. Ich habe schon eine DLL programmiert, doch ich weiss nicht, ob man so eine Engine programmieren kann. Hier der Code:</p>
<pre><code class="language-cpp">// Dark3DCubeEnginedll.h
//
// Definitions of the functions
//
#ifndef DARK_HPP
#define DARK_HPP

#include &lt;windows.h&gt;
#include &quot;Structures.h&quot;

// create a namespace, called DCE
//
namespace DCE
{
	// Create a class, called Dark3DCubeEngine
	//
	class Dark3DCubeEngine
	{
	public:

		static __declspec(dllexport) void Initialize (const int WindowWidth, const int WindowHeight, const int WindowDepth);
		static __declspec(dllexport) HWND OpenWindow (HINSTANCE hInstance);
		static __declspec(dllexport) LRESULT WINAPI MsgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

	private:

		static int m_WindowWidth;
		static int m_WindowHeight;
		static int m_WindowDepth;

	}; // End of the class

} // End of the namespace

#endif

// Dark3DCubeEnginedll.cpp
//
// Definitions of the functions
//
#include &quot;Dark3DCubeEnginedll.h&quot;

// Create a namespace, called DCE
//
namespace DCE
{
	Dark3DCubeEngineProperties * props = new Dark3DCubeEngineProperties();
	int Dark3DCubeEngine::m_WindowDepth;  // = 0
	int Dark3DCubeEngine::m_WindowHeight; // = 0
	int Dark3DCubeEngine::m_WindowWidth;  // = 0 

	void Dark3DCubeEngine::Initialize (const int WindowWidth, const int WindowHeight, const int WindowDepth)
	{
		m_WindowWidth = WindowWidth;
		m_WindowHeight = WindowHeight;
		m_WindowDepth = WindowDepth;

		props-&gt;WindowWidth = WindowWidth;
		props-&gt;WindowHeight = WindowHeight;
		props-&gt;WindowDepth = WindowDepth;
	}

	HWND Dark3DCubeEngine::OpenWindow(HINSTANCE hInstance)
	{
		WNDCLASSEX wc;

		wc.style			= CS_HREDRAW | CS_VREDRAW;
		wc.cbSize			= sizeof (wc);
		wc.lpfnWndProc		= MsgProc;
		wc.cbClsExtra		= 0;
		wc.cbWndExtra		= 0;
		wc.hInstance		= hInstance;
		wc.hIcon			= LoadIcon (NULL, IDI_APPLICATION);
		wc.hCursor			= LoadCursor (NULL, IDC_ARROW);
		wc.hbrBackground	= (HBRUSH)GetStockObject(BLACK_BRUSH);
		wc.lpszMenuName		= NULL;
		wc.lpszClassName	= TEXT (&quot;Dark3DCubeEngine&quot;);
		wc.hIconSm			= LoadIcon (NULL, IDI_APPLICATION);

		if (RegisterClassEx (&amp;wc) == 0) return 0;

		return CreateWindowEx (NULL, TEXT(&quot;Dark3DCubeEngine&quot;), &quot;Dark3DCubeEngine&quot;,
							   WS_OVERLAPPEDWINDOW | WS_VISIBLE,
							   GetSystemMetrics(SM_CXSCREEN)/2 - 250,
							   GetSystemMetrics(SM_CYSCREEN)/2 - 187,
							   m_WindowWidth, m_WindowHeight, NULL,
							   NULL, hInstance, NULL);
	}

	LRESULT WINAPI Dark3DCubeEngine::MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
	{
		switch (msg)
		{
			// key was pressed
			//
		case WM_KEYDOWN:
			{
				switch (wParam)
				{
				case VK_ESCAPE:
					{
						PostMessage (hwnd, WM_CLOSE, 0, 0);
						return 0;
					}
				default: break;
				}
			} break;

		case WM_DESTROY:
			{
				PostQuitMessage (0);
				return 1;
			}
		default: break;
		}

		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
} // End of the namespace

// Structures.h
//
// Definitions of the Structures
//

// Create a namespace, called DCE
//
namespace DCE
{
	// Create a struct, called Dark3DCubeEngineProperties
	//
	struct Dark3DCubeEngineProperties
	{
		int WindowWidth;
		int WindowHeight;
		int WindowDepth;
	}; // End of the struct

} // End of the namespace
</code></pre>
<p>Und so habe ich diese DLL getestet:</p>
<pre><code class="language-cpp">// main.h
//
// MyGame
//
#include &lt;windows.h&gt;
#include &quot;Dark3DCubeEnginedll.h&quot;

// Create a class, called MyApplication
//
class MyApplication : public DCE::Dark3DCubeEngine
{
public:

	MyApplication (){}
	virtual ~MyApplication (){}

};

// main.cpp
//
// MyGame
//
#include &quot;main.h&quot;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, 
					LPSTR lpCmdLine, int nShowCmd)
{
	MSG msg;
	HWND hwnd;
	bool bDone = false;

	MyApplication * pApp = new MyApplication ();

	pApp-&gt;Initialize(800, 600, 32);
	hwnd = pApp-&gt;OpenWindow(hInstance);

	while (!bDone)
	{
		while (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&amp;msg);
			DispatchMessage(&amp;msg);
		}
	}

	delete pApp;

	return 0;
}
</code></pre>
<p>Kann mir jemand sagen, ob ich so eine Engine schreiben kann, oder ob ich anders vorgehen soll?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722377</guid><dc:creator><![CDATA[Eglifisch1]]></dc:creator><pubDate>Sat, 06 Jun 2009 16:57:16 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sun, 07 Jun 2009 04:20:56 GMT]]></title><description><![CDATA[<ol>
<li>Die Kommentare sind schlecht.</li>
<li>Zuerst planen, dann entwickeln.</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/1722543</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722543</guid><dc:creator><![CDATA[Ändschineer]]></dc:creator><pubDate>Sun, 07 Jun 2009 04:20:56 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Sun, 07 Jun 2009 11:06:55 GMT]]></title><description><![CDATA[<blockquote>
<ol>
<li>Die Kommentare sind schlecht.</li>
<li>Zuerst planen, dann entwickeln.</li>
</ol>
</blockquote>
<p>Na dann bring doch mal Vorschläge zur Planung anstatt hier einfach deine Stichpunkte in den Raum reinzuschmeißen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Also die Kommentare finde ich erst mal ganz ok. Warum auch nicht - sind ja auch nicht viele, denn es ist ja auch noch nicht sooo viel Sourcecode vorhanden.</p>
<p>Ähm jo. Du exportierst also jede Funktion einzeln aus deiner Klasse, wie ich hier sehe. Habe ich selbst noch nie so gemacht, weil ich das eher umständlich finde jeder einzelnen Funktion das __declspec (dllexport) voranzustellen und der Cpp-Compiler am Ende ganz ulkige Exportnamen mit @, Klassen -, Funktionsnamen und Argumentenlänge generiert. Kannst dir ja mal mit &quot;Dependency Walker&quot; deine exportierten Funktionsnamen angucken. Aber das ist nur eine Meinung.</p>
<p>Du könntest es auch so machen, wie es DirectX (z.B. d3d9.dll) macht - deine Klasse ganz normal deklarieren (also ohne die __declspec (dllexports) ) und dann eine einzige globale Funktion (die sich nicht in einer Klasse befindet) aus deiner DLL exportieren, die dem Aufrufer einen Zeiger auf eine Instanz deiner Klasse zurückgibt, wie z.B. Direct3DCreate9() das macht.</p>
<p>Ansonsten würde sich dabei nicht viel ändern:</p>
<p>Du gibst dem Benutzer deiner DLL wieder die Dark3DCubeEnginedll.h und die *.lib mit auf den Weg, die der Compiler benötigt und dann braucht er nur noch deine exportierte Funktion aufzurufen - sagen wir mal Dark3DCreateCubeEngine() - und bekommt dadurch einen Zeiger auf eine Instanz deiner Klasse im Speicher.</p>
<p>Also die exportierte Funktion sieht dann in deiner DLL ungefähr so aus:</p>
<pre><code class="language-cpp">extern &quot;C&quot; __declspec (dllexport) Dark3DCubeEngine * Dark3DCreateCubeEngine(void) 
{
    return new Dark3DCubeEngine ();
}
</code></pre>
<p>Benutzer-Code:</p>
<pre><code class="language-cpp">#include &quot;Dark3DCubeEnginedll.h&quot;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine, int nShowCmd)
{
    MSG msg;
    HWND hwnd;
    bool bDone = false;
    Dark3DCubeEngine * pCubeEngine;

    pCubeEngine = Dark3DCreateCubeEngine();
    pCubeEngine-&gt;Initialize(800, 600, 32);
    hwnd = pCubeEngine-&gt;OpenWindow(hInstance);

    while (!bDone)
    {
        while (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&amp;msg);
            DispatchMessage(&amp;msg);
        }
    }

    delete pCubeEngine;
    return 0;
}
</code></pre>
<p>k.A. könnte vielleicht professioneller rüberkommen, wenn DirectX das schon so macht - das ganze ist in Anlehnung an die COM - Spezifikation von Microsoft (Component Object Model), also eher Windows-konform. Wenn du aber darauf bestehst, mit Namespaces zu arbeiten, dann ist deine Variante sicherlich vorteilhafter.</p>
<p>Joa...is nur ein Vorschlag.<br />
Vielleicht gibts ja Jemand mit noch besseren Ideen. :p</p>
<p>MFG, userland</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722654</guid><dc:creator><![CDATA[userland]]></dc:creator><pubDate>Sun, 07 Jun 2009 11:06:55 GMT</pubDate></item><item><title><![CDATA[Reply to Kenn jemand ein Engine Tutorial? on Fri, 12 Jun 2009 17:18:39 GMT]]></title><description><![CDATA[<p>Danke userland für deinen sehr hilfreichen Beitrag.</p>
<p>Nun Frage, wo kann ich mich ein wenig in COM einarbeiten?</p>
<p>Kannst du mir eine Seite nennen, diese mir beim erlenen von COM hilft? Oder kannst du mir ein Bespielcode schreiben?</p>
<p>Gruss Patrick</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1725705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1725705</guid><dc:creator><![CDATA[Eglifisch1]]></dc:creator><pubDate>Fri, 12 Jun 2009 17:18:39 GMT</pubDate></item></channel></rss>