(02-26-2011 10:25 PM)Dandruff Wrote: http://www.cplusplus.com/doc/tutorial/classes/
For your previous question, make sure they are defined before calling them
Thanks.
(02-26-2011 04:20 PM)Babulesnik Wrote: Not to create a new topic I decided to write here.
I created the structure of IM but when called to Lobbi.cpp
Chat (). Init_Chat ();-nothing happens. Why? No errors no issues.
Here is the code Lobbi_Lib.h:
struct Struct_Chat
{
Str str_chat;
}Data_Chat[150]=
{
{"678"},
{"678"},
{"678"},
};
ListGroup Chat_Group[]=
{
ListGroup(MEMBER(Struct_Chat,str_chat),0.47,L"Data ChatRoom"),
};
// ListGroup Chat_Group=ListGroup(DATA_STR,1,2,0.5f,L"");
struct Chat
{
GuiObjs Chat_Obj;
Str Name_Region
,Path_Gobj;
List <Struct_Chat>List_Chat;
void Init_Chat()
{
Name_Region="Chat_Region";
Path_Gobj ="../Data/Gui/Obj/chat.gobj";
Chat_Obj.load (Path_Gobj );Gui+=Chat_Obj;
Chat_Obj.getRegion(Name_Region)+=List_Chat.create(Chat_Group,1).setData(Data_Chat,ELMS(Data_Chat));
};
};
It was necessary to create a structure and then call it. Here is working code:
//==============================================
struct S_Chat
{
Str str_chat;
};/*Data_Chat[50]=
{
{"test_string"},
};*/
ListGroup Chat_Group[]=
{
ListGroup(MEMBER(S_Chat,str_chat),0.47,L"Data ChatRoom"),
// ListGroup(DATA_STR,1,2,0.5f,L""),
};
// ListGroup Chat_Group=ListGroup(DATA_STR,1,2,0.5f,L"");
struct Struct_Chat
{
Memb<Str>Data_Chat;
GuiObjs Chat_Obj;
Str Name_Region
,Path_Gobj;
List <Struct_Chat>List_Chat;
TextDS ChatFont;
void Init_Chat()
{
Data_Chat.add("12345");
//Data_Chat.add("56789");
ChatFont.reset();
ChatFont.font=Fonts("../Data/Gui/Fonts/chat_font.font");
Name_Region = "Chat_Region";
Path_Gobj = "../Data/Gui/Obj/chat.gobj";
Chat_Obj .load (Path_Gobj );Gui+=Chat_Obj;
Chat_Obj .getRegion(Name_Region).width=0.04 ;
Chat_Obj .getRegion(Name_Region)+=List_Chat.create(Chat_Group,1,true).setData(Data_Chat);//(Data_Chat,ELMS(Data_Chat));
List_Chat.tds =&ChatFont;
ChatFont .color=Color(255,241,191);
List_Chat.lit_color=Color(0,0,0,0);
List_Chat.cur_color=Color(0,0,0,0);
};
};
Struct_Chat Chat; -Here is where the problem. In the one line)))
//==============================================
Chat.Init_Chat(); -Works fine )