verrückter fehler



  • HIILLLFFFFEEEEE 😕 😕 😕

    map<string, shared_ptr<X> > eintrag; 
    // hier eintrag auffüllen
    

    hier sehe ich das fenster ohne inhalt
    ich habe den while inhalt ausgeklaammert, um zu zeigen das da nicht der fehler liegen kann

    int o=Mouse::GetInstanz().GetMPosY();
    	//bool c=Keys::GetInstanz().IsPressed(VK_RETURN);
    
    	map<string, shared_ptr<X> >::iterator it = eintrag.begin();
    	int z=1;
    	while(it != eintrag.end())
    	{ 
    	/*	
    		(*it->second).OnShow();
    
    		if ((*it->second).GetFokus())
    			f_font2D.Print(20,60, 2, "::%d %d",z,o);
    	*/	
    		it++; 
    
    		z++;
    	}
    

    jetzt klammer ich die ganze while aus und es GEHT!! 😮

    int o=Mouse::GetInstanz().GetMPosY();
    	//bool c=Keys::GetInstanz().IsPressed(VK_RETURN);
    
    	/*	
    	map<string, shared_ptr<X> >::iterator it = eintrag.begin();
    	int z=1;
    	while(it != eintrag.end())
    	{ 
    		(*it->second).OnShow();
    
    		if ((*it->second).GetFokus())
    			f_font2D.Print(20,60, 2, "::%d %d",z,o);
    		it++; 
    
    		z++;
    	}
    	*/
    

    jetzt nehm ich das "bool c=Keys::GetInstanz().IsPressed(VK_RETURN);" mit rein .. und ich sehe auch alles
    es wird auch o (x koordinate) richtig angezeigt 😮

    int o=Mouse::GetInstanz().GetMPosY();
    	bool c=Keys::GetInstanz().IsPressed(VK_RETURN);
    
    	// alle ELEMENTE darstellen
    	map<string, shared_ptr<X> >::iterator it = eintrag.begin();
    	int z=1;
    	while(it != eintrag.end())
    	{ 
    		(*it->second).OnShow();
    
    		if ((*it->second).GetFokus())
    			f_font2D.Print(20,60, 2, "::%d %d",z,o);
    
    		it++; 
    
    		z++;
    	}
    

    hier die beiden klassen:

    class Mouse
    {
    public:
    
    	void SetDownMLeft(bool status)	{ m_MouseDownLeft = status; }
    	void SetDownMMiddle(bool status){ m_MouseDownMiddle = status; }
    	void SetDownMRight(bool status)	{ m_MouseDownRight = status; }
    
    	bool GetDownMLeft()				{ return m_MouseDownLeft; }
    	bool GetDownMMiddle()			{ return m_MouseDownMiddle; }
    	bool GetDownMRight()			{ return m_MouseDownRight; }
    
    	void SetMPosX(int pos)			{ m_mousePosX = pos; }
    	void SetMPosY(int pos)			{ m_mousePosY = pos; }
    
    	int GetMPosX()					{ return m_mousePosX; }
    	int GetMPosY()					{ return m_mousePosY; }
    
    	static Mouse& GetInstanz()
    	{
    		static Mouse instanz;
    		return instanz;
    	}
    
    	void Clear()
    	{
    		m_MouseDownLeft		= false;
    		m_MouseDownMiddle	= false;
    		m_MouseDownRight	= false;
    
    		m_mousePosX			= GL_Window::GetInstanz().GetWidth()/2;
    		m_mousePosY			= GL_Window::GetInstanz().GetHeight()/2;
    
    /*
    hinweis...
    beim start des programmes befindet sich die maus im zentrum des fensters .. clear() wird also auch wirklich durchlaufen
    */
    		SetCursorPos(m_mousePosX,m_mousePosY); 
    	}
    
    private:
    
    	bool m_MouseDownLeft;
    	bool m_MouseDownMiddle;
    	bool m_MouseDownRight;
    
    	int m_mousePosX;
    	int m_mousePosY;
    
    	Mouse() { Clear(); }
    	Mouse(const Mouse&) {};
    
    	Mouse& operator=(const Mouse&);
    };
    
    // Einagbe der Tastatur => Virtuelle Keys und Character Keys
    #define MAX_KEYS  256
    
    class Keys
    {
    public:
    
    	bool IsPressed(unsigned int key)	{ return (key < MAX_KEYS) ? (k_KeyDown[key] == true) : false; }
    	void SetPressed(unsigned int key)	{ if (key < MAX_KEYS) k_KeyDown[key] = true; }
    	void SetReleased(unsigned int key)	{ if (key < MAX_KEYS) k_KeyDown[key] = false; }
    
    	void SetKeyCode(char key)			{ k_KeyCode = key; }
    	char GetKeyCode()					{ return k_KeyCode; }
    
    	void SetKeyCodeDown(bool down)		{ k_KeyCodeDown = down; }
    	bool GetKeyCodeDown()				{ return k_KeyCodeDown; }
    
    	static Keys& GetInstanz()
    	{
    		static Keys instanz;
    		return instanz;
    	}
    
    	void Clear()
    	{
    		ZeroMemory(&k_KeyDown, sizeof(k_KeyDown));
    		k_KeyCode = 0x00;
    		k_KeyCodeDown = false;
    	}
    
    private:
    
    	bool k_KeyDown[MAX_KEYS];
    	char k_KeyCode;
    	bool k_KeyCodeDown;
    
    	Keys() { Clear(); }
    	Keys(const Keys&) {};
    
    	Keys& operator=(const Keys&);
    };
    

    ich peile das nicht! nicht mal ansatzweise 🙄

    also wenn einer den scheiss, dreckigen, verdammichten, bösartigen und miesen fehler sieht, wäre ich sowas von glücklich 🤡



  • ich sollte vielleicht dazu sagen das für sich alleine auch läuft

    //int o=Mouse::GetInstanz().GetMPosY();
        //bool c=Keys::GetInstanz().IsPressed(VK_RETURN);
    
        map<string, shared_ptr<X> >::iterator it = eintrag.begin(); 
        int z=1; 
        while(it != eintrag.end()) 
        { 
            (*it->second).OnShow(); 
    
            if ((*it->second).GetFokus()) 
                f_font2D.Print(20,60, 2, "::%d %d",z,o); 
    
            it++; 
    
            z++; 
        }
    

    ich weiss wirklich nicht wo und nach was ich suchen soll 😕



  • was ist es denn für ein fehler?
    da sind noch X und seine memberfunktionen unbekannt (shared_ptr wird wohl boost::shared_ptr sein).
    was f_font2D ist sagst du auch nicht.

    und wenn du sagst

    int o=Mouse::GetInstanz().GetMPosY();
    bool c=Keys::GetInstanz().IsPressed(VK_RETURN);
    

    funktioniert, dann wird wohl daran nicht der fehler liegen (welcher auch immer)

    also noch mehr infos.



  • davie schrieb:

    also noch mehr infos.

    und am besten ein kompilierbares beispiel



  • leicht mal vereinfacht (compliliert und ausgetestet)

    die sache ist folgende:
    normal zeigt er mir ein windows fenster wo opengl drin abläuft.
    der fehler ist jetzt, das man nur ein blankes fenster sieht und KEIN opengl drin ist .. also eine leere "Form".
    ich kann die leere Form bewegen, maximieren, minimieren etc.

    class Basis
    {
    public:
    	map<string, int> test;  // <<<<<
    
    	Basis();
    	Basis()
    	{
    		OnDestroy();
    	}
    private:
    	void OnDestroy();
    };
    
    class Stores : public Basis
    {
    public:
    	bool OnShow();
    
    	Stores();
    	~Stores()
    	{
    		OnDestroy();
    	}
    private:
    	void OnDestroy();
    };
    

    das GEHT:

    bool Stores::OnShow()
    {
    	int a=Mouse::GetInstanz().GetMPosX();
    	f_font2D.Print(50,60, 2, "::%d",a);
    /*
    	map<string,int>::iterator it = test.begin();
    	while(it != test.end())
    	{ 
    		it++; 
    	}
    */
    	return true;
    }
    

    das GEHT auch:

    bool Stores::OnShow()
    {
    	int a=Mouse::GetInstanz().GetMPosX();
    	f_font2D.Print(50,60, 2, "::%d",a);
    
    	map<string,int>::iterator it = test.begin();
    /*
    	while(it != test.end())
    	{ 
    		it++; 
    	}
    */
    	return true;
    }
    

    das geht NICHT: => leere Form

    bool Stores::OnShow()
    {
    	int a=Mouse::GetInstanz().GetMPosX();
    	f_font2D.Print(50,60, 2, "::%d",a);
    
    	map<string,int>::iterator it = test.begin();
    	while(it != test.end())
    	{ 
    		it++; 
    	}
    	return true;
    }
    

    da soll einer sagen was er will ich schlag hier schon mit dem kopf auf der tischplatte auf..



  • ein wichtiger fehlt ja -.-

    das GEHT auch:

    bool Stores::OnShow()
    {
    /*
    	int a=Mouse::GetInstanz().GetMPosX();
    	f_font2D.Print(50,60, 2, "::%d",a);
    */
    	map<string,int>::iterator it = test.begin();
    	while(it != test.end())
    	{ 
    		it++; 
    	}
    
    	return true;
    }
    

    so also oben die 2 zeilen gehen für sich alleine .. unten das map und while geht für sich alleine .. aber beides zusammen killt sich ... warum ??



  • das scheint irgendwo anders nen speicherfehler zu sein, der sich da nur auswirkt.
    wenn ich nur das oben genannte auslagere, funktioniert es wunderbar.
    ich gebs auf 😡


Anmelden zum Antworten