Bläddra i källkod

Minigame Testprogramm für Minigame Entwickler fertig

Kolja Strohm 6 år sedan
förälder
incheckning
7a3426b24e
36 ändrade filer med 1081 tillägg och 516 borttagningar
  1. 97 0
      Test/DLLDateien.cpp
  2. 37 0
      Test/DLLDateien.h
  3. 25 264
      Test/Main.cpp
  4. 289 0
      Test/Minigame.cpp
  5. 51 0
      Test/Minigame.h
  6. 451 0
      Test/Minigames.cpp
  7. 82 0
      Test/Minigames.h
  8. 0 126
      Test/RotationTest.cpp
  9. 11 4
      Test/Test.vcxproj
  10. 16 2
      Test/Test.vcxproj.filters
  11. 0 120
      Test/TestKamera2D.cpp
  12. BIN
      Test/data/Minigames/Asteroids/bilder/asteroids.ltdb
  13. BIN
      Test/data/Minigames/Asteroids/bilder/f_burn.ltdb
  14. BIN
      Test/data/Minigames/Asteroids/bilder/f_start.ltdb
  15. BIN
      Test/data/Minigames/Asteroids/bilder/hintergrund.ltdb
  16. BIN
      Test/data/Minigames/Asteroids/bilder/ship.ltdb
  17. BIN
      Test/data/Minigames/Asteroids/bilder/titel.ltdb
  18. 0 0
      Test/data/Minigames/Asteroids/data/game.mgc
  19. 6 0
      Test/data/Minigames/Asteroids/data/optionen.ini
  20. BIN
      Test/data/Minigames/Asteroids/data/score.ksgt
  21. 3 0
      Test/data/Minigames/Asteroids/mg.ini
  22. BIN
      Test/data/Minigames/Asteroids/models/asteroids.m2
  23. BIN
      Test/data/Minigames/Asteroids/models/ship.m2
  24. BIN
      Test/data/Minigames/Blöcke/bilder/hintergrund.ltdb
  25. BIN
      Test/data/Minigames/Blöcke/bilder/titel.ltdb
  26. 3 0
      Test/data/Minigames/Blöcke/mg.ini
  27. BIN
      Test/data/Minigames/Fangen/bilder/hintergrund.ltdb
  28. BIN
      Test/data/Minigames/Fangen/bilder/titel.ltdb
  29. 3 0
      Test/data/Minigames/Fangen/mg.ini
  30. BIN
      Test/data/Minigames/Snake/bilder/hintergrund.ltdb
  31. BIN
      Test/data/Minigames/Snake/bilder/titel.ltdb
  32. 3 0
      Test/data/Minigames/Snake/mg.ini
  33. BIN
      Test/data/Minigames/Tetris/bilder/hintergrund.ltdb
  34. BIN
      Test/data/Minigames/Tetris/bilder/titel.ltdb
  35. 3 0
      Test/data/Minigames/Tetris/mg.ini
  36. 1 0
      Test/data/Minigames/test.txt

+ 97 - 0
Test/DLLDateien.cpp

@@ -0,0 +1,97 @@
+#include "DLLDateien.h"
+
+// Inhalt der DLLDateien Klasse aus DLLDateien.h
+// Konstruktor
+DLLDateien::DLLDateien()
+{
+    dlls = new Array< DLLDatei* >();
+    ref = 1;
+}
+
+// Destruktor
+DLLDateien::~DLLDateien()
+{
+    cs.lock();
+    int anz = dlls->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+    {
+        DLLDatei *tmp = dlls->get( i );
+        if( tmp )
+        {
+            tmp->name->release();
+            FreeLibrary( tmp->handle );
+        }
+        delete tmp;
+    }
+    dlls->release();
+    cs.unlock();
+}
+
+// nicht constant
+HINSTANCE DLLDateien::ladeDLL( char *name, char *pfad )
+{
+    cs.lock();
+    int anz = dlls->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+    {
+        DLLDatei *tmp = dlls->get( i );
+        if( tmp && tmp->name->istGleich( name ) )
+        {
+            tmp->ref++;
+            cs.unlock();
+            return tmp->handle;
+        }
+    }
+    HINSTANCE h = LoadLibrary( pfad );
+    if( !h )
+    {
+        cs.unlock();
+        return 0;
+    }
+    DLLDatei *dll = new DLLDatei();
+    dll->name = new Text( name );
+    dll->handle = h;
+    dll->ref = 1;
+    dlls->add( dll );
+    cs.unlock();
+    return h;
+}
+
+void DLLDateien::releaseDLL( char *name )
+{
+    cs.lock();
+    int anz = dlls->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+    {
+        DLLDatei *tmp = dlls->get( i );
+        if( tmp && tmp->name->istGleich( name ) )
+        {
+            tmp->ref--;
+            if( !tmp->ref )
+            {
+                tmp->name->release();
+                FreeLibrary( tmp->handle );
+                delete tmp;
+                dlls->remove( i );
+            }
+            cs.unlock();
+            return;
+        }
+    }
+    cs.unlock();
+}
+
+// Reference Counting
+DLLDateien *DLLDateien::getThis()
+{
+    ref++;
+    return this;
+}
+
+DLLDateien *DLLDateien::release()
+{
+    ref--;
+    if( !ref )
+        delete this;
+    return 0;
+}

+ 37 - 0
Test/DLLDateien.h

@@ -0,0 +1,37 @@
+#ifndef DLLDateien_H
+#define DLLDateien_H
+
+#include <Text.h>
+#include <Array.h>
+#include <Critical.h>
+
+using namespace Framework;
+
+struct DLLDatei
+{
+    Text *name;
+    HINSTANCE handle;
+    int ref;
+};
+
+class DLLDateien
+{
+private:
+    Array< DLLDatei* > *dlls;
+    Critical cs;
+    int ref;
+
+public:
+    // Konstruktor
+    DLLDateien();
+    // Destruktor
+    ~DLLDateien();
+    // nicht constant
+    HINSTANCE ladeDLL( char *name, char *pfad );
+    void releaseDLL( char *name );
+    // Reference Counting
+    DLLDateien *getThis();
+    DLLDateien *release();
+};
+
+#endif

+ 25 - 264
Test/Main.cpp

@@ -1,4 +1,3 @@
-
 #include <iostream>
 #include <Fenster.h>
 #include <Bildschirm.h>
@@ -15,6 +14,10 @@
 #include <Model2D.h>
 #include <Bild.h>
 #include <Textur2D.h>
+#include <MiniGameV.h>
+#include "Minigames.h"
+#include <DateiSystem.h>
+#include "DLLDateien.h"
 
 namespace Framework
 {
@@ -23,118 +26,6 @@ namespace Framework
 }
 
 using namespace Framework;
-using namespace KSGScript;
-
-class Obj : public Zeichnung
-{
-private:
-    Model2D mdl;
-    Model2D mdlA;
-    Model2D mdlB;
-    Punkt maus;
-    Punkt mausAlt;
-    Vertex hp;
-    Vertex speed;
-    Textur2D txt;
-    float rot;
-
-public:
-    Obj()
-    {
-        M2Datei d;
-        d.setPfad( "ship.m2" );
-        d.leseDaten();
-        Model2DData *m = d.ladeModel( "ship" );
-        mdl.setModel( m );
-        mdl.setStyle( Model2D::Style::Mesh | Model2D::Style::Textur | Model2D::Style::Sichtbar );
-        mdl.setFarbe( 0xFFFFFFFF );
-        mdl.setPosition( 150, 150 );
-        mdlA.setStyle( Model2D::Style::Mesh | Model2D::Style::Textur );
-        mdlA.setFarbe( 0xFFFFFFFF );
-        mdlA.setPosition( 50, 50 );
-        mdlB.setStyle( Model2D::Style::Mesh | Model2D::Style::Textur );
-        mdlB.setFarbe( 0xFFFFFFFF );
-        mdlB.setPosition( 250, 50 );
-        hp = Vertex( 0, 0 );
-        mausAlt = Punkt( 0, 0 );
-        maus = Punkt( 0, 0 );
-        LTDBDatei td;
-        td.setDatei( new Text( "ship.ltdb" ) );
-        td.leseDaten( 0 );
-        Bild *b = td.laden( 0, new Text( "a.png" ) );
-        txt.setTexturZ( b );
-        mdl.setTextur( txt.getThis(), "ship" );
-    }
-    ~Obj()
-    {}
-    void doMausEreignis( MausEreignis &me ) override
-    {
-        lockZeichnung();
-        maus.x = me.mx;
-        maus.y = me.my;
-        if( me.id == ME_RLinks )
-        {
-            mausAlt.x = me.mx;
-            mausAlt.y = me.my;
-        }
-        hp = Vertex( 0, 0 );
-        speed = Vertex( 0, 0 );
-        if( mdl.zModel()->calcHitPoint( mausAlt - Vertex( 150, 150 ), maus - mausAlt, "ship", hp, speed, rot ) )
-        {
-            if( me.id == ME_RRechts )
-            {
-                Polygon2D a;
-                Polygon2D b;
-                Punkt pa;
-                Punkt pb;
-                mdl.zModel()->split( mausAlt - Vertex( 150, 150 ), maus - mausAlt, "ship", a, b, pa, pb, []()
-                {
-                    return rand() / (double)RAND_MAX;
-                } );
-                Array< Polygon2D > *aa = new Array< Polygon2D >();
-                aa->add( a );
-                Model2DData *ad = new Model2DData();
-                ad->erstelleModell( aa );
-                Array< Polygon2D > *ba = new Array< Polygon2D >();
-                ba->add( b );
-                Model2DData *bd = new Model2DData();
-                bd->erstelleModell( ba );
-                mdlA.setModel( ad );
-                mdlB.setModel( bd );
-                mdlA.setTextur( txt.getThis() );
-                mdlB.setTextur( txt.getThis() );
-                mdlA.addStyle( Model2D::Style::Sichtbar );
-                mdlB.addStyle( Model2D::Style::Sichtbar );
-            }
-        }
-        unlockZeichnung();
-    }
-    bool tick( double t ) override
-    {
-        return 1;
-    }
-    void render( Bild &bild ) override
-    {
-        lockZeichnung();
-        mdl.render( bild );
-        mdlA.render( bild );
-        mdlB.render( bild );
-        bild.fillCircle( maus.x, maus.y, 1, 0xFFFF0000 );
-        bild.drawLinie( mausAlt, maus, 0xFF00FF00 );
-        bild.fillCircle( hp.x + 150, hp.y + 150, 1, 0xFF0000FF );
-        bild.drawLinie( Punkt( 150, 150 ), speed + Punkt( 150, 150 ), 0xFF00FF00 );
-        for( int i = 1; i < 10; i++ )
-        {
-            Vertex pos = hp + ( maus - mausAlt ) * i + Vertex( 150, 150 );
-            Vertex pos2 = hp + ( maus - mausAlt ) * ( i - 1 ) + Vertex( 150, 150 );
-            bild.drawLinie( pos, pos2, 0xFFFF0000 );
-            bild.fillCircle( pos.x, pos.y, 1, 0xFF00FFFF );
-        }
-        unlockZeichnung();
-    }
-};
-
-KSGScriptEditor *obj;
 
 void FClose( void *p, void *zF )
 {
@@ -144,171 +35,31 @@ void FClose( void *p, void *zF )
 int kamera2DTest();
 int rotationTest();
 
-int main()
+void doStuff()
 {
-    //return rotationTest();
-    return kamera2DTest();
-    
-    Datei d;
-    Datei d2;
-    d.setDatei( "data_old.map" );
-    d2.setDatei( "data.map" );
-    d2.open( Datei::Style::schreiben );
-    d.open( Datei::Style::lesen );
-    int ressourceAnz = 0;
-    d.lese( (char*)&ressourceAnz, 4 );
-    d2.schreibe( (char*)&ressourceAnz, 4 );
-    for( int i = 0; i < ressourceAnz; i++ )
-    {
-        int j = 0;
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        char len = 0;
-        d.lese( &len, 1 );
-        d2.schreibe( (char*)&len, 1 );
-        Text txt;
-        txt.fillText( '0', len + 1 );
-        d.lese( txt, len );
-        d2.schreibe( (char*)txt, len );
-    }
-    d.lese( (char*)&ressourceAnz, 4 );
-    d2.schreibe( (char*)&ressourceAnz, 4 );
-    d.lese( (char*)&ressourceAnz, 4 );
-    d2.schreibe( (char*)&ressourceAnz, 4 );
-    d.lese( (char*)&ressourceAnz, 4 );
-    d2.schreibe( (char*)&ressourceAnz, 4 );
-    for( int i = 0; i < ressourceAnz; i++ )
-    {
-        int j = 0;
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        double f = 0;
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        char t = 0;
-        d.lese( &t, 1 );
-        d2.schreibe( (char*)&t, 1 );
-    }
-    for( int i = 0; i < 9; i++ )
-    {
-        int j = 0;
-        double f = 0;
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&f, 8 );
-        f = 5;
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        double antriebsEffizienz = 100;
-        d.lese( (char*)&antriebsEffizienz, 8 );
-        d2.schreibe( (char*)&antriebsEffizienz, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-    }
-    for( int i = 0; i < 3; i++ )
-    {
-        int j = 0;
-        double f = 0;
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-        d.lese( (char*)&f, 8 );
-        d2.schreibe( (char*)&f, 8 );
-        double antriebsEffizienz = 0;
-        d.lese( (char*)&antriebsEffizienz, 8 );
-        d2.schreibe( (char*)&antriebsEffizienz, 8 );
-        d.lese( (char*)&j, 4 );
-        d2.schreibe( (char*)&j, 4 );
-    }
-    d.close();
-    d2.close();
-    getchar();
-    return 0;
-    
-
-#ifdef _DEBUG
-    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
-#endif
-    initFramework();
     WFenster *f = new WFenster();
     WNDCLASS fc = F_Normal( 0 );
     fc.lpszClassName = "Test";
     f->erstellen( WS_OVERLAPPEDWINDOW, fc );
-    f->setSize( 900, 900 );
+    f->setSize( 800, 500 );
     f->setPosition( Punkt( 100, 100 ) );
     f->setVSchließAktion( FClose );
     f->setMausAktion( _ret1ME );
     f->setTastaturAktion( _ret1TE );
     f->setAnzeigeModus( 1 );
     Bildschirm *b = new Bildschirm3D( f->getThis() );
-    b->setBackBufferSize( 300, 300 );
+    b->setBackBufferSize( 800, 500 );
     f->setBildschirm( b->getThis() );
     b->setTestRend( 0 );
 
-    Obj o;
-    b->addMember( &o );
+    LTDSDatei sd;
+    sd.setPfad( new Text( "normal.ltds" ) );
+    sd.leseDaten();
+    Schrift *schrift = sd.ladeSchrift();
+    DLLDateien dlls;
+
+    MiniGames *mGames = new MiniGames( schrift, dlls.getThis(), b->getThis() );
+    b->addMember( mGames );
 
     b->update();
     RenderTh *r = new RenderTh();
@@ -318,9 +69,19 @@ int main()
     StartNachrichtenSchleife();
     r->beenden();
     r->release();
+    mGames->release();
     f->setBildschirm( 0 );
     b->release();
     f->release();
+}
+
+int main()
+{
+#ifdef _DEBUG
+    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
+#endif
+    initFramework();
+    doStuff();
     releaseFramework();
     return 0;
 }

+ 289 - 0
Test/Minigame.cpp

@@ -0,0 +1,289 @@
+#include "MiniGame.h"
+#include <Rahmen.h>
+#include <Datei.h>
+#include <InitDatei.h>
+#include <DateiSystem.h>
+#include <MausEreignis.h>
+
+// Inhalt der Minigame Klasse aus MiniGame.h
+// Konstruktor
+MiniGame::MiniGame( char *name )
+{
+    xPos = 0;
+    yPos = 0;
+    xAbs = 0;
+    yAbs = 0;
+    zXPos = 0;
+    zYPos = 0;
+    xSpeed = 0;
+    ySpeed = 0;
+    this->name = new Text( name );
+    bgBild = 0;
+    mausAlpha = new AlphaFeld();
+    mausAlpha->setSize( 248, 98 );
+    mausAlpha->setFarbe( 0xFF00FF00 );
+    mausAlpha->setStrength( 50 );
+    rahmen = new LRahmen();
+    rahmen->setSize( 250, 100 );
+    rahmen->setFarbe( 0xFFFFFFFF );
+    rahmen->setRamenBreite( 1 );
+    sichtbar = 1;
+    alpha = 0;
+    mausIn = 0;
+    ok = 1;
+    rend = 0;
+    ref = 1;
+    Text *pfad = new Text( "data/Minigames/" );
+    pfad->append( name );
+    if( !DateiExistiert( pfad->getThis() ) )
+    {
+        ok = 0;
+        pfad->release();
+        return;
+    }
+    pfad->append( "/mg.ini" );
+    if( !DateiExistiert( pfad->getThis() ) )
+    {
+        ok = 0;
+        pfad->release();
+        return;
+    }
+    InitDatei *mgIni = new InitDatei( pfad );
+    if( !mgIni->laden() )
+    {
+        ok = 0;
+        mgIni->release();
+        return;
+    }
+    if( !mgIni->wertExistiert( "TitelBild" ) || !mgIni->wertExistiert( "TitelBildPfad" ) || !mgIni->wertExistiert( "DllPfad" ) )
+    {
+        ok = 0;
+        mgIni->release();
+        return;
+    }
+    Text *bPfad = new Text( "data/Minigames/" );
+    bPfad->append( name );
+    bPfad->append( "/" );
+    bPfad->append( mgIni->zWert( "TitelBildPfad" )->getText() );
+    if( !DateiExistiert( bPfad->getThis() ) )
+    {
+        ok = 0;
+        bPfad->release();
+        mgIni->release();
+        return;
+    }
+    LTDBDatei *bDat = new LTDBDatei();
+    bDat->setDatei( bPfad );
+    bDat->leseDaten( 0 );
+    bgBild = bDat->laden( 0, mgIni->getWert( "TitelBild" ) );
+    bDat->release();
+    mgIni->release();
+    if( !bgBild )
+        ok = 0;
+}
+
+// Destruktor
+MiniGame::~MiniGame()
+{
+    name->release();
+    if( bgBild )
+        bgBild->release();
+    mausAlpha->release();
+    rahmen->release();
+}
+
+// nicht constant
+void MiniGame::setPosition( int x, int y )
+{
+    if( !xPos && !yPos )
+    {
+        xPos = x;
+        yPos = y;
+    }
+    zXPos = x;
+    zYPos = y;
+    xAbs = (int)( zXPos - xPos );
+    yAbs = (int)( zYPos - yPos );
+}
+
+void MiniGame::setSichtbar( bool sichtbar )
+{
+    this->sichtbar = sichtbar;
+}
+
+void MiniGame::doMausEreignis( MausEreignis &me )
+{
+    if( !this->sichtbar )
+        return;
+    if( me.mx > xPos && me.mx < xPos + 250 && me.my > yPos && me.my < yPos + 100 )
+    {
+        if( !mausIn )
+        {
+            rend = 1;
+            rahmen->setFarbe( 0xFF00FF00 );
+        }
+        mausIn = 1;
+    }
+    else
+    {
+        if( mausIn )
+        {
+            rend = 1;
+            rahmen->setFarbe( 0xFFFFFFFF );
+        }
+        mausIn = 0;
+    }
+    me.verarbeitet |= mausIn;
+}
+
+bool MiniGame::tick( double z )
+{
+    bool ret = rend;
+    rend = 0;
+    int val = (int)( z * 150 );
+    if( sichtbar && alpha != 255 )
+    {
+        if( alpha + val > 255 )
+            alpha = 255;
+        else
+            alpha += val;
+        ret = 1;
+    }
+    if( !sichtbar && alpha )
+    {
+        if( alpha - val < 0 )
+            alpha = 0;
+        else
+            alpha -= val;
+        ret = 1;
+    }
+    if( xPos != zXPos || yPos != zYPos )
+    {
+        if( xPos != zXPos )
+        {
+            if( xAbs > 0 )
+            {
+                if( zXPos - xPos >= xAbs / 2 )
+                    xSpeed += xAbs * z;
+                else
+                {
+                    xSpeed -= xAbs * z;
+                    if( xSpeed < zXPos - xPos )
+                        xSpeed += xAbs * z;
+                }
+            }
+            else
+            {
+                if( zXPos - xPos <= xAbs / 2 )
+                    xSpeed += xAbs * z;
+                else
+                {
+                    xSpeed -= xAbs * z;
+                    if( xSpeed > zXPos - xPos )
+                        xSpeed += xAbs * z;
+                }
+            }
+        }
+        if( yPos != zYPos )
+        {
+            if( yAbs > 0 )
+            {
+                if( zYPos - yPos >= yAbs / 2 )
+                    ySpeed += yAbs * z;
+                else
+                {
+                    ySpeed -= yAbs * z;
+                    if( ySpeed < zYPos - yPos )
+                        ySpeed += yAbs * z;
+                }
+            }
+            else
+            {
+                if( zYPos - yPos <= yAbs / 2 )
+                    ySpeed += yAbs * z;
+                else
+                {
+                    ySpeed -= yAbs * z;
+                    if( ySpeed > zYPos - yPos )
+                        ySpeed += yAbs * z;
+                }
+            }
+        }
+        xPos += xSpeed * z;
+        yPos += ySpeed * z;
+        if( xAbs > 0 )
+        {
+            if( xPos >= zXPos )
+            {
+                xPos = zXPos;
+                xSpeed = 0;
+            }
+        }
+        else
+        {
+            if( xPos <= zXPos )
+            {
+                xPos = zXPos;
+                xSpeed = 0;
+            }
+        }
+        if( yAbs > 0 )
+        {
+            if( yPos >= zYPos )
+            {
+                yPos = zYPos;
+                ySpeed = 0;
+            }
+        }
+        else
+        {
+            if( yPos <= zYPos )
+            {
+                yPos = zYPos;
+                ySpeed = 0;
+            }
+        }
+        ret = 1;
+    }
+    return ret;
+}
+
+void MiniGame::render( Bild &zRObj )
+{
+    zRObj.setAlpha( alpha );
+    zRObj.drawBild( (int)( xPos ), (int)( yPos ), 250, 100, *bgBild );
+    rahmen->setPosition( (int)xPos, (int)yPos );
+    rahmen->render( zRObj );
+    if( mausIn )
+    {
+        mausAlpha->setPosition( (int)xPos + 1, (int)yPos + 1 );
+        mausAlpha->render( zRObj );
+    }
+    zRObj.releaseAlpha();
+}
+
+// constant
+Text *MiniGame::zName()
+{
+    return name;
+}
+
+bool MiniGame::istOk() const
+{
+    return ok;
+}
+
+// Reference Counting
+MiniGame *MiniGame::getThis()
+{
+    ref++;
+    return this;
+}
+
+MiniGame *MiniGame::release()
+{
+    ref--;
+    if( !ref )
+        delete this;
+    return 0;
+}

+ 51 - 0
Test/Minigame.h

@@ -0,0 +1,51 @@
+#ifndef MiniGame_H
+#define MiniGame_H
+
+#include <Bild.h>
+#include <Text.h>
+#include <AlphaFeld.h>
+
+using namespace Framework;
+
+class MiniGame
+{
+private:
+    double xPos;
+    double yPos;
+    int xAbs;
+    int yAbs;
+    int zXPos;
+    int zYPos;
+    double xSpeed;
+    double ySpeed;
+    Text *name;
+    Bild *bgBild;
+    AlphaFeld *mausAlpha;
+    LRahmen *rahmen;
+    bool sichtbar;
+    unsigned char alpha;
+    bool mausIn;
+    bool ok;
+    bool rend;
+    int ref;
+
+public:
+    // Konstruktor
+    MiniGame( char *name );
+    // Destruktor
+    ~MiniGame();
+    // nicht constant
+    void setPosition( int x, int y );
+    void setSichtbar( bool sichtbar );
+    void doMausEreignis( MausEreignis &me );
+    bool tick( double z );
+    void render( Bild &zRObj );
+    // constant
+    Text *zName();
+    bool istOk() const;
+    // Reference Counting
+    MiniGame *getThis();
+    MiniGame *release();
+};
+
+#endif

+ 451 - 0
Test/Minigames.cpp

@@ -0,0 +1,451 @@
+#include "MiniGames.h"
+#include <Punkt.h>
+#include <Rahmen.h>
+#include <Datei.h>
+#include <InitDatei.h>
+#include <KSGTDatei.h>
+#include <KSGNetwork.h>
+
+class MSCWrapper : public KSGClient::MinigameServerClient
+{
+private:
+    int ref;
+public:
+    MSCWrapper()
+    {
+        ref = 1;
+    }
+    // verbindet sich mit dem zugewiesenen Minigame Server
+    //  Gibt 1 zurück, falls der Vorgang erfolgreich ist, 0 sonnst
+    bool verbinde()
+    {
+        return 1;
+    }
+    // Ermittelt die liste mit allen Optionen zu einem Minigame zurück, zu denen es Welt beste Scores gibt
+    //  mName: Der Name des Minigames
+    //  zOptionList: Enthält nach erfolgreichem Aufruf eine Liste mit Optionen
+    //  Gibt die Anzahl der Optionen zurück
+    int getMinigameOptionList( char *mName, Framework::RCArray< Framework::Text > *zOptionList )
+    {
+        return 0;
+    }
+    // Ermittelt eine Liste mit den Weltbesten Scores zurück
+    //  mName: Der Name des Minigames
+    //  zScore: Enthält nach erfolgreichem Aufruf eine Liste mit Scores
+    //  zPlayerList: Enthält nach erfolgreichem Aufruf eine Liste mit angezeigten Account Namen, die die Scores erreicht haben.
+    //  zOptionList: Enthält nach erfolgreichem Aufruf eine Liste mit Optionen, die beim erreichen der Scores aktiv waren.
+    //  Gibt die Anzahl der Bestscores zurück
+    int getMinigameBestscoreList( char *mName, Framework::Array< int > *zScore, Framework::RCArray< Framework::Text > *zPlayerList, Framework::RCArray< Framework::Text > *zOptionList )
+    {
+        return 0;
+    }
+    // Gibt den Welt bestscore zu einem Bestimmten Minigame mit bestimmten Optionen zurück.
+    //  mName: Der Name des Minigames
+    //  oName: Die Optionen
+    //  zPlayer: Enthält nach erfolgreichem Aufruf den Angezeigten Namen des Accounts, der den Score erreicht hat
+    int getMinigameOptionBestscore( char *mName, char *oName, Framework::Text *zPlayer )
+    {
+        return 0;
+    }
+    // Meldet die Beendigung eines Minigames
+    //  mName: Der Name des Minigames
+    //  oName: Die Optionen mit denen gespielt wurde
+    //  score: Der Erreichte Score
+    //  zCapture: Ein Zeiger auf eine Datei mit der Spielaufzeichnung
+    //  Gibt 0 zurück wenn eines Fehler aufgetreten ist, 1 wenn der Forgang erfolgreich war
+    bool reportEndOfGame( char *mName, char *oName, int score, Framework::Datei *zCapture )
+    {
+        return 1;
+    }
+    // Lädt ein Game Capture herunter und speichert sie unter data/tmp/minigames/wb.mgc
+    //  mName: Der Name des Minigames
+    //  oName: Die Optionen
+    //  Gibt die Datei mit dem Capture zurück
+    Framework::Datei *downloadGameCapture( char *mName, char *oName )
+    {
+        return 0;
+    }
+    // Erhält die Verbindung aufrecht
+    //  Gibt 1 zurück, falls der Vorgang erfolgreich ist, 0 sonnst
+    //  Sollte während einer bestehenden Verbindung etwa einmal alle 60 Sekunden aufgerufen werden, da sonst der Router die Verbindung automatisch trennt
+    bool keepAlive()
+    {
+        return 1;
+    }
+    // Trennt die Verbindung zum Server
+    //  Gibt 1 zurück, falls der Vorgang erfolgreich ist, 0 sonnst
+    //  Sollte erst nach einem erfolgreichen Aufruf von verbinde aufgerufen werden
+    bool trenne( bool abmelden )
+    {
+        return 1;
+    }
+    // Gibt 1 zurück, falls der Client verbunden ist, 0 sonst
+    bool istVerbunden() const
+    {
+        return 1;
+    }
+    // gibt den Letzten Fehlertext zuück
+    //  sollte erst aufgerufen werden, nachdem eine andere aufgerufene Methode fehlgeschlagen ist
+    char *getLetzterFehler() const
+    {
+        return "";
+    }
+    // Erhöht den Reference Counter um 1 un gibt this zurück
+    MinigameServerClient *getThis()
+    {
+        ref++;
+        return this;
+    }
+    // Verringert den Reference Counter um 1 und gibt 0 zurück.
+    //  Falls der Reference Counter nach dem Aufruf auf 0 ist löscht sich das Objekt selbst 
+    MinigameServerClient *release()
+    {
+        if( !--ref )
+            delete this;
+        return 0;
+    }
+};
+
+typedef MiniGameV *( *GetMiniGame )( );
+
+// Inhalt der MGLaden Klasse aus MiniGames.h
+// Konstruktor
+MGSuchen::MGSuchen( MiniGames *mGames )
+{
+    this->mGames = mGames;
+    start();
+}
+
+// Destruktor
+MGSuchen::~MGSuchen()
+{
+    mGames->release();
+}
+
+// nicht constant
+void MGSuchen::thread()
+{
+    Datei *d = new Datei();
+    d->setDatei( "data/Minigames" );
+    if( !d->existiert() )
+        DateiPfadErstellen( "data/MiniGames/" );
+    RCArray< Text > *list = d->getDateiListe();
+    if( list )
+    {
+        for( int i = 0; i < list->getEintragAnzahl(); i++ )
+        {
+            MiniGame *mg = new MiniGame( list->z( i )->getText() );
+            if( !mg->istOk() )
+            {
+                mg->release();
+                continue;
+            }
+            mGames->addMiniGame( mg );
+        }
+        list->release();
+    }
+    d->release();
+    delete this;
+}
+
+
+// Inhalt der MGLaden Klasse aus MiniGameV.h
+// Konstruktor
+MGLaden::MGLaden( char *name, DLLDateien *zDLLs )
+{
+    this->name = new Text( name );
+    game = 0;
+    ref = 1;
+    dLLs = zDLLs->getThis();
+    start();
+}
+
+// Destruktor
+MGLaden::~MGLaden()
+{
+    if( game )
+    {
+        game->release();
+        dLLs->releaseDLL( name->getText() );
+    }
+    name->release();
+    dLLs->release();
+}
+
+// nicht constant
+void MGLaden::thread()
+{
+    Text *pfad = new Text( "data/Minigames/" );
+    pfad->append( name->getText() );
+    if( !DateiExistiert( pfad->getThis() ) )
+    {
+        pfad->release();
+        run = 0;
+        return;
+    }
+    pfad->append( "/mg.ini" );
+    if( !DateiExistiert( pfad->getThis() ) )
+    {
+        pfad->release();
+        run = 0;
+        return;
+    }
+    InitDatei *mgIni = new InitDatei( pfad );
+    if( !mgIni->laden() )
+    {
+        mgIni->release();
+        run = 0;
+        return;
+    }
+    if( !mgIni->wertExistiert( "DllPfad" ) )
+    {
+        mgIni->release();
+        run = 0;
+        return;
+    }
+    Text *dllPfad = new Text( "data/Minigames/" );
+    dllPfad->append( name->getText() );
+    dllPfad->append( "/" );
+    dllPfad->append( mgIni->zWert( "DllPfad" )->getText() );
+    mgIni->release();
+    if( !DateiExistiert( dllPfad->getThis() ) )
+    {
+        dllPfad->release();
+        run = 0;
+        return;
+    }
+    HMODULE dll = dLLs->ladeDLL( name->getText(), dllPfad->getText() );
+    dllPfad->release();
+    if( !dll )
+    {
+        run = 0;
+        return;
+    }
+    GetMiniGame getMiniGame = (GetMiniGame)GetProcAddress( dll, "GetMiniGame" );
+    if( !getMiniGame )
+    {
+        dLLs->releaseDLL( name->getText() );
+        run = 0;
+        return;
+    }
+    game = getMiniGame();
+    if( !game )
+    {
+        dLLs->releaseDLL( name->getText() );
+        run = 0;
+        return;
+    }
+    game->setMinigameClientZ( new MSCWrapper() );
+    if( !game->laden() )
+    {
+        game = game->release();
+        dLLs->releaseDLL( name->getText() );
+    }
+    run = 0;
+}
+
+// constant
+bool MGLaden::fertig() const
+{
+    return !isRunning();
+}
+
+MiniGameV *MGLaden::zGame() const
+{
+    return game;
+}
+
+// Reference Counting
+MGLaden *MGLaden::getThis()
+{
+    ref++;
+    return this;
+}
+
+MGLaden *MGLaden::release()
+{
+    ref--;
+    if( !ref )
+        delete this;
+    return 0;
+}
+
+
+// Inhalt der MiniGames Klasse aus MiniGames.h
+// Konstruktor
+MiniGames::MiniGames( Schrift *zSchrift, DLLDateien *zDLLs, Bildschirm *screen )
+    : Zeichnung()
+{
+    this->screen = screen->getThis();
+    dLLs = zDLLs->getThis();
+    schrift = zSchrift->getThis();
+    bildschirmGröße = BildschirmGröße();
+    rahmen = new LRahmen();
+    setSize( 800, 500 );
+    rahmen->setFarbe( 0xFFFFFFFF );
+    alpha2 = 0;
+    tickVal = 0;
+    games = new RCArray< MiniGame >();
+    mgl = 0;
+    ref = 1;
+    new MGSuchen( getThis() );
+}
+
+// Destruktor
+MiniGames::~MiniGames()
+{
+    if( schrift )
+        schrift->release();
+    rahmen->release();
+    games->release();
+    if( mgl )
+        mgl->release();
+    dLLs->release();
+    screen->release();
+}
+
+// nicht constant
+void MiniGames::addMiniGame( MiniGame *mg )
+{
+    games->add( mg );
+    int i = games->getEintragAnzahl() - 1;
+    games->z( i )->setPosition( 10 + 10 * ( i % 3 ) + 250 * ( i % 3 ), 50 + 10 * ( i / 3 ) + 100 * ( i / 3 ) );
+    int anz = games->getEintragAnzahl();
+    bool *fertig = new bool[ anz ];
+    for( int i = 0; i < anz; i++ )
+        fertig[ i ] = 0;
+    for( int i = 0; i < anz; i++ )
+    {
+        int p = -1;
+        for( int j = 0; j < anz; j++ )
+        {
+            if( !fertig[ j ] )
+            {
+                p = j;
+                games->z( j )->setSichtbar( 1 );
+            }
+        }
+        if( p < 0 )
+            break;
+        fertig[ p ] = 1;
+        games->z( p )->setPosition( 10 + 10 * ( i % 3 ) + 250 * ( i % 3 ), 50 + 10 * ( i / 3 ) + 100 * ( i / 3 ) );
+    }
+}
+
+void MiniGames::doMausEreignis( MausEreignis &me )
+{
+    me.mx -= pos.x;
+    me.my -= pos.y;
+    if( alpha2 )
+    {
+        int anz = games->getEintragAnzahl();
+        for( int i = 0; i < anz; i++ )
+        {
+            bool vera = me.verarbeitet;
+            games->z( i )->doMausEreignis( me );
+            if( !vera && me.verarbeitet && me.id == ME_RLinks )
+            { // spiel starten
+                if( mgl )
+                    mgl = mgl->release();
+                mgl = new MGLaden( games->z( i )->zName()->getText(), dLLs );
+            }
+        }
+    }
+    if( mgl && mgl->zGame() )
+        mgl->zGame()->doMausEreignis( me );
+    me.mx += pos.x;
+    me.my += pos.y;
+}
+
+void MiniGames::doTastaturEreignis( TastaturEreignis &te )
+{
+    if( mgl && mgl->zGame() )
+        mgl->zGame()->doTastaturEreignis( te );
+}
+
+bool MiniGames::tick( double z )
+{
+    if( mgl && mgl->fertig() )
+    {
+        if( !mgl->zGame() )
+        {
+            mgl = mgl->release();
+        }
+        else
+        {
+            mgl->zGame()->setSchriftZ( schrift->getThis() );
+            mgl->zGame()->setBildschirmZ( screen->getThis() );
+        }
+    }
+    if( mgl && mgl->zGame() && !alpha2 )
+    {
+        rend |= mgl->zGame()->tick( z );
+        if( mgl->zGame()->istEnde() )
+            mgl = mgl->release();
+    }
+    if( alpha2 )
+    {
+        int anz = games->getEintragAnzahl();
+        for( int i = 0; i < anz; i++ )
+            rend |= games->z( i )->tick( z );
+    }
+    tickVal += z * 150;
+    int val = (int)tickVal;
+    if( val < 1 )
+    {
+        bool ret = rend;
+        rend = 0;
+        return ret;
+    }
+    tickVal -= val;
+    if( mgl && alpha2 )
+    {
+        alpha2 -= val;
+        if( alpha2 < 0 )
+            alpha2 = 0;
+        rend = 1;
+    }
+    if( !mgl && alpha2 != 255 )
+    {
+        alpha2 += val;
+        if( alpha2 > 255 )
+            alpha2 = 255;
+        rend = 1;
+    }
+    bool ret = rend;
+    rend = 0;
+    return 1;
+}
+
+void MiniGames::render( Bild &zRObj )
+{
+    rahmen->setPosition( pos );
+    rahmen->setSize( gr );
+    rahmen->render( zRObj );
+    if( !zRObj.setDrawOptions( pos.x + 1, pos.y + 1, gr.x - 2, gr.y - 2 ) )
+        return;
+    int rbr = rahmen->getRBreite();
+    zRObj.setAlpha( (unsigned char)alpha2 );
+    int anz = games->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+        games->z( i )->render( zRObj );
+    zRObj.releaseAlpha();
+    if( mgl && mgl->fertig() && mgl->zGame() )
+        mgl->zGame()->render( zRObj );
+    zRObj.releaseDrawOptions();
+}
+
+// Reference Counting
+MiniGames *MiniGames::getThis()
+{
+    ref++;
+    return this;
+}
+
+MiniGames *MiniGames::release()
+{
+    ref--;
+    if( !ref )
+        delete this;
+    return 0;
+}

+ 82 - 0
Test/Minigames.h

@@ -0,0 +1,82 @@
+#ifndef MiniGames_H
+#define MiniGames_H
+
+#include <Fenster.h>
+#include <Animation.h>
+#include "MiniGame.h"
+#include <Thread.h>
+#include <Knopf.h>
+#include <MiniGameV.h>
+#include "DLLDateien.h"
+
+using namespace Framework;
+
+class MiniGames; // aus dieser Datei
+
+class MGSuchen : private Thread
+{
+private:
+    MiniGames * mGames;
+public:
+    // Konstruktor
+    MGSuchen( MiniGames *mGames );
+    // Destruktor
+    ~MGSuchen();
+    // nicht constant
+    void thread() override;
+};
+
+class MGLaden : private Thread
+{
+private:
+    Text * name;
+    MiniGameV *game;
+    DLLDateien *dLLs;
+    int ref;
+
+public:
+    // Konstruktor
+    MGLaden( char *name, DLLDateien *zDLLs );
+    // Destruktor
+    ~MGLaden();
+    // nicht constant
+    void thread();
+    // constant
+    bool fertig() const;
+    MiniGameV *zGame() const;
+    // Reference Counting
+    MGLaden *getThis();
+    MGLaden *release();
+};
+
+class MiniGames : public Zeichnung
+{
+private:
+    Punkt bildschirmGröße;
+    LRahmen *rahmen;
+    RCArray< MiniGame > *games;
+    MGLaden *mgl;
+    Schrift *schrift;
+    DLLDateien *dLLs;
+    Bildschirm *screen;
+    double tickVal;
+    int alpha2;
+    int ref;
+
+public:
+    // Konstruktor
+    MiniGames( Schrift *zSchrift, DLLDateien *zDLLs, Bildschirm *zScreen );
+    // Destruktor
+    ~MiniGames();
+    // nicht constant
+    void addMiniGame( MiniGame *mg );
+    void doMausEreignis( MausEreignis &me ) override;
+    void doTastaturEreignis( TastaturEreignis &te ) override;
+    bool tick( double z ) override;
+    void render( Bild &zRObj ) override;
+    // Reference Counting
+    MiniGames *getThis();
+    MiniGames *release();
+};
+
+#endif

+ 0 - 126
Test/RotationTest.cpp

@@ -1,126 +0,0 @@
-#include <Fenster.h>
-#include <Bildschirm.h>
-#include <RenderThread.h>
-#include <Welt2D.h>
-#include <M2Datei.h>
-#include <Model2D.h>
-#include <DateiSystem.h>
-#include <Textur2D.h>
-#include <Kamera2D.h>
-#include <iostream>
-#include <Bild.h>
-
-using namespace Framework;
-
-namespace Framework
-{
-    void initFramework();
-    void releaseFramework();
-}
-
-void FClose( void *p, void *zF );
-
-extern Punkt p1;
-extern Punkt p2;
-Model2DObject *obj;
-Model2DObject *obj2;
-
-int rotationTest()
-{
-    p1 = Punkt( -1, -1 );
-    initFramework();
-
-    Welt2D w2d;
-    Welt2D *w2 = &w2d;
-    Kamera2D kam2d;
-    Kamera2D *kam2 = &kam2d;
-
-    WNDCLASS wndC = Framework::F_Normal( 0 );
-    wndC.lpszClassName = "Kamera 2D Test";
-    WFenster f;
-    f.erstellen( WS_OVERLAPPEDWINDOW, wndC );
-    f.setPosition( Punkt( 100, 100 ) );
-    f.setSize( 900, 900 );
-    f.setVSchließAktion( FClose );
-    f.setMausAktion( [ w2, kam2 ]( void *p, void *o, MausEreignis me )
-    {
-        p2 = Punkt( me.mx, me.my );
-        if( me.id == ME_RRechts )
-        {
-            Vertex wp = kam2->getWorldCoordinates( Punkt( me.mx, me.my ) );
-            w2->explosion( wp, 100000, 10000 );
-        }
-        if( me.id == ME_RLinks )
-        {
-            if( p1 == Punkt( -1, -1 ) )
-                p1 = Punkt( me.mx, me.my );
-            else
-            {
-                w2->impuls( kam2->getWorldCoordinates( p1 ), kam2->getWorldDirection( Vertex( me.mx, me.my ) - (Vertex)p1 ) );
-                p1 = Punkt( -1, -1 );
-            }
-        }
-        return 1;
-    } );
-    f.setTastaturAktion( _ret1TE );
-    f.setAnzeigeModus( 1 );
-
-    Bildschirm2D b( f.getThis() );
-    b.update();
-    b.setTestRend( 0 );
-    b.setFill( 0 );
-    f.setBildschirm( b.getThis() );
-
-    RenderTh rth;
-    rth.setBildschirm( b.getThis() );
-    rth.setRenderFunktion( []( void*a, void*rth, Bild*c )
-    {
-        c->fillRegion( 0, 0, c->getBreite(), c->getHeight(), 0xFF000000 );
-        std::cout << "FPS: " << ( 1 / ( (RenderTh*)rth )->getRenderTickZeit() ) << " | Zeit pro Tick:" << ( (RenderTh*)rth )->getRenderTickZeit() << "\n";
-        if( p1 != Punkt( -1, -1 ) )
-            c->drawLinie( p1, p2, 0xFFFFFFFF );
-        obj2->setDrehung( obj->getDrehung() );
-        Vertex speed( 1, 0 );
-        speed = speed.rotation( obj->getDrehung() );
-        float faktor = -1;
-        if( obj->getDrehung() > PI )
-            faktor = -faktor;
-        if( obj->getDrehung() < -PI )
-            faktor = -faktor;
-        obj2->addDrehung( faktor * speed.angle( Vertex( 1, 0 ) ) );
-    } );
-
-    M2Datei d;
-    d.setPfad( "ship.m2" );
-    d.leseDaten();
-    Model2DData *m = d.ladeModel( "ship" );
-    LTDBDatei td;
-    td.setDatei( new Text( "ship.ltdb" ) );
-    td.leseDaten( 0 );
-    Bild *bt = td.laden( 0, new Text( "a.png" ) );
-    Textur2D txt;
-    txt.setTexturZ( bt );
-    obj = new Model2DObject();
-    obj->setModel( m->getThis() );
-    obj->setTextur( txt.getThis(), "ship" );
-    obj->setDrehungSpeed( -0.5 );
-    w2d.addObject( obj );
-    obj2 = new Model2DObject();
-    obj2->setPosition( 200, 0 );
-    obj2->setModel( m->getThis() );
-    obj2->setTextur( txt.getThis(), "ship" );
-    w2d.addObject( obj2 );
-
-    rth.beginn();
-
-    kam2d.setStyle( Kamera2D::Style::Sichtbar );
-    kam2d.setSize( 900, 900 );
-    kam2d.setWelt( w2d.getThis() );
-    b.addMember( &kam2d );
-
-    StartNachrichtenSchleife();
-
-    rth.beenden();
-
-    return 0;
-}

+ 11 - 4
Test/Test.vcxproj

@@ -75,7 +75,7 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
-    <IncludePath>..\..\Framework;..\..\ksgScript\ksgScript\Include;$(IncludePath)</IncludePath>
+    <IncludePath>..\..\Framework;..\..\ksgScript\ksgScript\Include;..\..\..\Spiele Platform\Klient\Include;..\..\..\Spiele Platform\Klient\KSGNetwork\Include;$(IncludePath)</IncludePath>
     <LibraryPath>..\..\Framework\x64\Debug;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -111,7 +111,8 @@
       <AdditionalDependencies>Framework.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     <CustomBuildStep>
-      <Command>copy "..\..\Framework\x64\Debug\Framework.dll" "framework.dll"</Command>
+      <Command>copy "..\..\Framework\x64\Debug\Framework.dll" "framework.dll"
+xcopy /S /Q /y "..\..\..\Spiele Platform\Klient\Fertig\Debug\Minigames\x64" "data\Minigames"</Command>
       <Outputs>kopieren;%(Outputs)</Outputs>
     </CustomBuildStep>
   </ItemDefinitionGroup>
@@ -155,9 +156,15 @@
     </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="DLLDateien.cpp" />
     <ClCompile Include="Main.cpp" />
-    <ClCompile Include="RotationTest.cpp" />
-    <ClCompile Include="TestKamera2D.cpp" />
+    <ClCompile Include="Minigame.cpp" />
+    <ClCompile Include="Minigames.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="DLLDateien.h" />
+    <ClInclude Include="Minigame.h" />
+    <ClInclude Include="Minigames.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 16 - 2
Test/Test.vcxproj.filters

@@ -18,11 +18,25 @@
     <ClCompile Include="Main.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
-    <ClCompile Include="TestKamera2D.cpp">
+    <ClCompile Include="Minigames.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
-    <ClCompile Include="RotationTest.cpp">
+    <ClCompile Include="Minigame.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="DLLDateien.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Minigames.h">
+      <Filter>Quelldateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Minigame.h">
+      <Filter>Quelldateien</Filter>
+    </ClInclude>
+    <ClInclude Include="DLLDateien.h">
+      <Filter>Quelldateien</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>

+ 0 - 120
Test/TestKamera2D.cpp

@@ -1,120 +0,0 @@
-#include <Fenster.h>
-#include <Bildschirm.h>
-#include <RenderThread.h>
-#include <Welt2D.h>
-#include <M2Datei.h>
-#include <Model2D.h>
-#include <DateiSystem.h>
-#include <Textur2D.h>
-#include <Kamera2D.h>
-#include <iostream>
-#include <Bild.h>
-
-using namespace Framework;
-
-namespace Framework
-{
-    void initFramework();
-    void releaseFramework();
-}
-
-void FClose( void *p, void *zF );
-
-Punkt p1;
-Punkt p2;
-
-int kamera2DTest()
-{
-    p1 = Punkt( -1, -1 );
-    initFramework();
-
-    Welt2D w2d;
-    w2d.setAirResistance( 0.001 );
-    w2d.setCircular( 1 );
-    w2d.setSize( 5000, 5000 );
-    w2d.setSize( 1 );
-    Welt2D *w2 = &w2d;
-    Kamera2D kam2d;
-    Kamera2D *kam2 = &kam2d;
-
-    WNDCLASS wndC = Framework::F_Normal( 0 );
-    wndC.lpszClassName = "Kamera 2D Test";
-    WFenster f;
-    f.erstellen( WS_OVERLAPPEDWINDOW, wndC );
-    f.setPosition( Punkt( 100, 100 ) );
-    f.setSize( 900, 900 );
-    f.setVSchließAktion( FClose );
-    f.setMausAktion( [ w2, kam2 ]( void *p, void *o, MausEreignis me )
-    {
-        p2 = Punkt( me.mx, me.my );
-        if( me.id == ME_RRechts )
-        {
-            Vertex wp = kam2->getWorldCoordinates( Punkt( me.mx, me.my ) );
-            w2->explosion( wp, 100000, 10000 );
-        }
-        if( me.id == ME_RLinks )
-        {
-            if( p1 == Punkt( -1, -1 ) )
-                p1 = Punkt( me.mx, me.my );
-            else
-            {
-                w2->impuls( kam2->getWorldCoordinates( p1 ), kam2->getWorldDirection( Vertex( me.mx, me.my ) - (Vertex)p1 ) );
-                p1 = Punkt( -1, -1 );
-            }
-        }
-        return 1;
-    } );
-    f.setTastaturAktion( _ret1TE );
-    f.setAnzeigeModus( 1 );
-
-    Bildschirm2D b( f.getThis() );
-    b.update();
-    b.setTestRend( 0 );
-    b.setFill( 0 );
-    f.setBildschirm( b.getThis() );
-    
-    RenderTh rth;
-    rth.setBildschirm( b.getThis() );
-    rth.setRenderFunktion( []( void*a, void*rth, Bild*c )
-    {
-        c->fillRegion( 0, 0, c->getBreite(), c->getHeight(), 0xFF000000 );
-        std::cout << "FPS: " << (1 / (( RenderTh*)rth)->getRenderTickZeit()) << " | Zeit pro Tick:" << ( (RenderTh*)rth )->getRenderTickZeit() << "\n";
-        if( p1 != Punkt( -1, -1 ) )
-            c->drawLinie( p1, p2, 0xFFFFFFFF );
-    } );
-    rth.beginn();
-
-    M2Datei d;
-    d.setPfad( "ship.m2" );
-    d.leseDaten();
-    Model2DData *m = d.ladeModel( "ship" );
-    LTDBDatei td;
-    td.setDatei( new Text( "ship.ltdb" ) );
-    td.leseDaten( 0 );
-    Bild *bt = td.laden( 0, new Text( "a.png" ) );
-    Textur2D txt;
-    txt.setTexturZ( bt );
-    for( int i = 0; i < 100; i++ )
-    {
-        Model2DObject *mdl = new Model2DObject();
-        mdl->setModel( m->getThis() );
-        mdl->setPosition( (float)(rand() / 16 - RAND_MAX / 32), (float)(rand() / 16 - RAND_MAX / 32) );
-        mdl->setSpeed( (float)rand() / 128 - (float)rand() / 128, (float)rand() / 128 - (float)rand() / 128 );
-        mdl->setDrehungSpeed( (float)rand() / ( RAND_MAX / 2 ) - (float)rand() / ( RAND_MAX / 2 ) );
-        mdl->setTextur( txt.getThis(), "ship" );
-        w2d.addObject( mdl );
-    }
-
-    kam2d.setStyle( Kamera2D::Style::Sichtbar );
-    kam2d.setSize( 900, 900 );
-    kam2d.setWelt( w2d.getThis() );
-    kam2d.setZoom( 0.3f );
-    
-    b.addMember( &kam2d );
-
-    StartNachrichtenSchleife();
-
-    rth.beenden();
-
-    return 0;
-}

BIN
Test/data/Minigames/Asteroids/bilder/asteroids.ltdb


BIN
Test/data/Minigames/Asteroids/bilder/f_burn.ltdb


BIN
Test/data/Minigames/Asteroids/bilder/f_start.ltdb


BIN
Test/data/Minigames/Asteroids/bilder/hintergrund.ltdb


BIN
Test/data/Minigames/Asteroids/bilder/ship.ltdb


BIN
Test/data/Minigames/Asteroids/bilder/titel.ltdb


+ 0 - 0
Test/data/Minigames/Asteroids/data/game.mgc


+ 6 - 0
Test/data/Minigames/Asteroids/data/optionen.ini

@@ -0,0 +1,6 @@
+Breite=800
+Höhe=500
+Größe=100
+Timer=5000
+Ship=0
+Fortsetzen=0

BIN
Test/data/Minigames/Asteroids/data/score.ksgt


+ 3 - 0
Test/data/Minigames/Asteroids/mg.ini

@@ -0,0 +1,3 @@
+TitelBild=titel.jpg
+TitelBildPfad=bilder/titel.ltdb
+DllPfad=bin/game.dll

BIN
Test/data/Minigames/Asteroids/models/asteroids.m2


BIN
Test/data/Minigames/Asteroids/models/ship.m2


BIN
Test/data/Minigames/Blöcke/bilder/hintergrund.ltdb


BIN
Test/data/Minigames/Blöcke/bilder/titel.ltdb


+ 3 - 0
Test/data/Minigames/Blöcke/mg.ini

@@ -0,0 +1,3 @@
+TitelBild=titel.jpg
+TitelBildPfad=bilder/titel.ltdb
+DllPfad=bin/game.dll

BIN
Test/data/Minigames/Fangen/bilder/hintergrund.ltdb


BIN
Test/data/Minigames/Fangen/bilder/titel.ltdb


+ 3 - 0
Test/data/Minigames/Fangen/mg.ini

@@ -0,0 +1,3 @@
+TitelBild=titel.jpg
+TitelBildPfad=bilder/titel.ltdb
+DllPfad=bin/game.dll

BIN
Test/data/Minigames/Snake/bilder/hintergrund.ltdb


BIN
Test/data/Minigames/Snake/bilder/titel.ltdb


+ 3 - 0
Test/data/Minigames/Snake/mg.ini

@@ -0,0 +1,3 @@
+TitelBild=titel.jpg
+TitelBildPfad=bilder/titel.ltdb
+DllPfad=bin/game.dll

BIN
Test/data/Minigames/Tetris/bilder/hintergrund.ltdb


BIN
Test/data/Minigames/Tetris/bilder/titel.ltdb


+ 3 - 0
Test/data/Minigames/Tetris/mg.ini

@@ -0,0 +1,3 @@
+TitelBild=titel.jpg
+TitelBildPfad=bilder/titel.ltdb
+DllPfad=bin/game.dll

+ 1 - 0
Test/data/Minigames/test.txt

@@ -0,0 +1 @@
+bla