#ifndef SpielAuswahl_H
#define SpielAuswahl_H

#include <Klient.h>
#include <Bild.h>
#include <Thread.h>
#include <TextFeld.h>
#include <Animation.h>
#include <KSGScript.h>

using namespace Framework;
using namespace KSGScript;

class SpielDaten; // aus dieser Datei

class SpielDaten : public Thread
{
private:
	int spielId;
	Text *name;
	Bild *hintergrund;
	Animation2D *aAnimation;
	Schrift *schrift;
    KSGScriptObj *beschreibung;
    HINSTANCE ksgs;
	LRahmen *rahmen;
	double tickVal;
	int animation;
	bool ausgew�hlt;
	Punkt pos;
	Punkt gr;
	int geladen;
	int aktion;
	AlphaFeld *auswahl;
	int ladenBild;
	bool beenden;
	bool rend;
	bool erlaubt;
    unsigned char tAlpha;
    unsigned char alpha;
	int ref;

public:
	// Konstruktor
	SpielDaten( Schrift *zSchrift, const char *name, int id );
	// Destruktor
	~SpielDaten();
	// nicht constant
	virtual void thread();
    void ksgsAktion( RCArray< KSGSVariable > *parameter, KSGSVariable **retVal );
	void updateErlaubt();
	void setSichtbar( bool sichtbar );
	void setSichtbar();
	void setAuswahl( bool auswahl );
	void setPosition( int lPos );
	bool tick( double tickVal );
	void doMausEreignis( MausEreignis &me );
	void render( Bild &zRObj );
	// constant
	int getSpielId() const;
	bool istausgew�hlt() const;
	Text *zName() const;
	bool istErlaubt() const;
	// Reference Counting
	SpielDaten *getThis();
	SpielDaten *release();
};

class SpielAuswahlFenster : private Thread
{
private:
	int anzahl;
	int auswahl;
	RCArray< SpielDaten > *members;
	LRahmen *rahmen;
	Schrift *schrift;
	double tickVal;
	int animation;
	Punkt pos;
	Punkt gr;
	int seite;
	bool rend;
    unsigned char alpha;
	int ref;

public:
	// Konstruktor
	SpielAuswahlFenster( Schrift *zSchrift );
	// Destruktor
	~SpielAuswahlFenster();
	// nicht constant
	void setSichtbar( bool sichtbar );
	void bl�ttern( bool oben );
	void updateListe();
	virtual void thread();
	bool tick( double tickVal );
	void doMausEreignis( MausEreignis &me );
	void render( Bild &zrObj );
	// constant
	int getAnzahl() const;
	int getSeiteAnzahl() const;
	int getSeite() const;
	int getAnzahlAufSeite() const;
	bool hatAuswahl() const;
	SpielDaten *getAuswahl() const;
	SpielDaten *zAuswahl() const;
	bool istAuswahlErlubt() const;
	// Reference Counting
	SpielAuswahlFenster *getThis();
	SpielAuswahlFenster *release();
};

#endif