I created a class for the smooth attenuation of the text.But when I create object of this class and I start to use it leads to critical end of the program.Because of it I cannot trace in what place an error (((
Header
Code:
struct SystemMessage
{
TextDS TextDSMessage;
SystemMessage(); //конструктор
SystemMessage FontMsg (Str FontMsg );
SystemMessage ColorMsg (Vec ColorMsg );
SystemMessage Speed (Flt SpeedMsg );
void Update ( );
void Show ( );
private:
Flt Alpha ;
Bool ShowMsg ;
Flt SpeedMessage ;
};
Source
Code:
/*******************************************************************************
Набор полезных функций и классов для расширения возможностей и облегчения
написания програм.
*******************************************************************************/
#include "stdafx.h"
#include "Main.h"
SystemMessage::SystemMessage()
{
SpeedMessage =0.001;
Alpha =0;
ShowMsg =false;
TextDSMessage.reset ( );
TextDSMessage.font =Fonts("Gui/Fonts/Arial.font");
TextDSMessage.color =Color(0,0,0,0 );
TextDSMessage.scale = (0.08,0.08 );
};
SystemMessage SystemMessage::Speed(Flt SpeedMsg)
{
SpeedMessage=SpeedMsg;
return *this;
};
SystemMessage SystemMessage::FontMsg (Str FontMsg )
{
TextDSMessage.reset();
TextDSMessage.load(FontMsg);
return *this;
};
SystemMessage SystemMessage::ColorMsg (Vec ColorMsg)
{
TextDSMessage.color =Color(ColorMsg);
TextDSMessage.color.a=Alpha;
return *this;
};
void SystemMessage::Show()
{
Alpha =255 ;
ShowMsg=true ;
};
void SystemMessage::Update ()
{
if(ShowMsg)
{
Alpha-=SpeedMessage;
if (Alpha<1){ShowMsg=false;};
};
};
The declaration and usage
Code:
Init()
...
SystemMessage Message;
login_menu.getText ("login_info" ).tds=&Message.TextDSMessage;
Catastrophe is resulted by the output agent of the button
Code:
void enter_login(Ptr)
{
Str Login,Pass,ErrorMessage;
Login=login_menu.getTextLine("login_enter")();
Pass =login_menu.getTextLine("pass_enter" )();
if(!ValidStr(ErrorMessage,Login))
{login_menu.getText("login_info").set(ErrorMessage);CAlpha=255;pokaz=1;}
else SendLogin(Login,Pass);
login_menu.getTextLine("login_enter" ).clear();
login_menu.getTextLine("pass_enter" ).clear();
}
I will be very glad to hear any help.
P.S I assume that an error somewhere in the constructor,because if to change for this code of errors is not present
Code:
TextDS Font_Login;
Font_Login.reset();
Font_Login.font=Fonts("Gui/Fonts/Arial.font");
login_menu.getText ("login_info" ).tds=&Font_Login;