Lo que decía era que hagas un constructor vacío, por ejemplo:
Menu::Menu( sf::RenderWindow *r ){
// no hacer nada
}
Y lo llamás:
Menu Pausa( &app );
Lo compilás y si sale bien, le agregás de a uno los demás parámetros.
Tu código lo puse en un mismo archivo y me compiló bien. Lo puse así:
#include<iostream>
#include<SFML/Graphics.hpp>
#include<iostream>
class Subrayado{
public:
bool Init( sf::RenderWindow *r ){ return true; };
bool Create( int a,int b,int c,int d,int e,int f,int g){ return true; }
bool Set( bool a ){ return true; }
bool Opacity( int a ){ return true; }
};
class Sonido{
};
class Menu {
private:
sf::RenderWindow *_App;
bool _On;
sf::Shape _Rect;
sf::Color _CD;
int _NumberElement;//
sf::Font _Font;
bool _ElementType[10];// true dynamic, false static
Subrayado _Sub;
int _ElementClick;
int _ElementAbove;
sf::Image _Ibg;
sf::Sprite _Sbg;
bool _MenuType;//true image. false shader
//Sonidos
Sonido _S[2];
bool _SoundOn;//true hay sonido, false no hay sonido
int _ElementLoop;
public:
sf::String _Element[10];
Menu(sf::RenderWindow *r,float x,float y,const sf::Unicode::Text &text,bool s);
Menu(sf::RenderWindow *r,float x,float y,float w,float h,bool s);
void Print();
void SetState(bool x);//true or false
bool GetState();//true or false
void AddElement(const sf::Unicode::Text &Text,float size,bool t);//bool tyoe static or dynamic
void SetPosition(int ele,float x,float y);
bool Comprobar(float x,float y,bool &click);
int GetClick();
void SetClick(int i);
void SetSound(const sf::Unicode::Text &text,int x);
};
Menu::Menu(sf::RenderWindow *r,float x,float y,float w,float h,bool s=false){
_Sub.Init( r );
_Sub.Create(255,255,255,0,0,0,0);
_Sub.Set(false);
_Sub.Opacity(60);
_CD.r=0;
_CD.g=0;
_CD.b=0;
_CD.a=230;
_App=r;
_Rect.AddPoint(x,y,_CD,_CD);
_Rect.AddPoint(x+w,y,_CD,_CD);
_Rect.AddPoint(x+w,y+h,_CD,_CD);
_Rect.AddPoint(x,y+h,_CD,_CD);
_Font.LoadFromFile("ace_futurism.ttf");
_MenuType=false;
_ElementClick= -1;
_SoundOn=s;
_ElementLoop=-1;
_ElementAbove=-1;
};
Menu::Menu(sf::RenderWindow *r,float x,float y,const sf::Unicode::Text &text,bool s=false){
_Sub.Init( r );
_App=r;
_Sub.Create(255,255,255,0,0,0,0);
_Sub.Set(false);
_Sub.Opacity(60);
_Font.LoadFromFile("ace_futurism.ttf");
_Ibg.LoadFromFile("img/logo.png");
_Ibg.SetSmooth(false);
_Sbg.SetImage(_Ibg);
_Sbg.SetPosition(x,y);
_MenuType=true;
_ElementClick= -1;
_SoundOn=s;
_ElementLoop=-1;
_ElementAbove=-1;
}
int main(){
sf::RenderWindow app( sf::VideoMode( 100, 100,32 ), "ejemplo" );
Menu Pausa(&app,0,0,290,350);
Menu Inicio(&app,0,0,"img/logo.png");
while( app.IsOpened() ){
sf::Event evento;
while( app.GetEvent( evento ) ){
if( evento.Type == sf::Event::Closed )app.Close();
}
app.Display();
}
return 0;
}
Le agregué las clases
Sonido y
Subrayado para no borrar la declaración de las variables y que quede igual a tu código.
Si estás separando el código en
hpp y
cpp tal vez tenés un problema en las cabeceras. Te puede faltar un
include en los
cpps por ejemplo.