First i dont know if you initialized your struct at all.
Second you only made pointer in struct, but you needed pointer array.
Of course you could play around that, but then you always need extra pointer variable which then says "im saving here array" like this:
TEXT** texts = menu.texts;
Third you dont need make new strings for copying chars. That eat ram and you need to remember remove them at end
Ok cant remember more things at moment, but here you are.
This fixed one works good:
#include <acknex.h>
//for new struct allocating
#define new(struktura) sys_malloc(sizeof(struktura))
#define newm(struktura, daudzums) sys_malloc(daudzums*sizeof(struktura))
//testing font
FONT* fonts = "Arial#24b";
typedef struct
{
void* load;
void* unload;
TEXT** texts;//this is pointer array
var text_count;
PANEL* bg;
}Menu;
Menu* printm_menu;
//menu initialization function
Menu* Menu_inic()
{
Menu* lok_menu = new(Menu);
lok_menu.load = NULL;
lok_menu.unload = NULL;
lok_menu.texts = NULL;
lok_menu.text_count = 0;
lok_menu.bg = NULL;
return lok_menu;
}
//menu destructor function
function Menu_del(Menu* menu)
{
//if they here custom structs or vars
if(menu.load != NULL)
{
sys_free(menu.load);
}
if(menu.unload != NULL)
{
sys_free(menu.unload);
}
//here you remove every menu text
if(menu.texts != NULL)
{
int lok_i;
for(lok_i = 0; lok_i < menu.text_count; lok_i++)
{
ptr_remove((menu.texts)[lok_i]);
}
//after then remove pointer array
sys_free(menu.texts);
}
//and next things
if(menu.bg != NULL)
{
sys_free(menu.bg);
}
//text_count removes together with this struct as it is member not pointer
sys_free(menu);
return NULL;
}
//Just extra for auto counting texts
function Menu_create_texts(Menu* menu, int count)
{
menu.texts = newm(TEXT*, 2);
menu.text_count = 2;
int lok_i = 0;
//this part can be automatized more,
//but its just for so or you can take this out somewhere else.
for(lok_i = 0; lok_i < menu.text_count; lok_i++)
{
(menu.texts)[lok_i] = txt_create(1, 8);
(menu.texts)[lok_i].flags = CENTER_X | CENTER_Y;
(menu.texts)[lok_i].font = fonts;
}
}
//function printm(STRING* msg)
function printm()
{
//first you forgot about menu initialization
printm_menu = Menu_inic();
//What is this???
//TEXT* msg_txt[2];//=txt_create(msg,6);
//then you made your 2 text pointers
Menu_create_texts(printm_menu, 2);
//Your string values for texts
str_cpy(((printm_menu.texts)[0].pstring)[0], "test");
str_cpy(((printm_menu.texts)[1].pstring)[0], "OK");
//your positioning
(printm_menu.texts)[0].pos_x = screen_size.x / 2;
//printm_menu.bg.pos_x+(30*(desktop_size_x/1024)); //positioning
(printm_menu.texts)[0].pos_y = 50;
//printm_menu.bg.pos_y+(15*(desktop_size_y/768));
(printm_menu.texts)[1].pos_x = screen_size.x / 2;
(printm_menu.texts)[1].pos_y = 100;
//set them both visible
set((printm_menu.texts)[0],SHOW);
set((printm_menu.texts)[1],SHOW);
//dont know anything about yur bg
//set(printm_menu.bg,SHOW);
//and when you dont need your menu anymore delete it
while(key_space == 0){wait(1);}
Menu_del(printm_menu);
}
function main()
{
//Why you need this know only you
//printm(str_create("blah"));
printm();
}