1 registered members (tomaslolo),
1,542
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Crash on txt_create
#333108
07/14/10 01:27
07/14/10 01:27
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
Hello this is my code.. Whats wrong? because i assign apointer to the text, and then when i try to move it.. it crashes..
#include <acknex.h>
#include <default.c>
#include <litec.h>
TEXT* txt1;
STRING* txt1_content="alternative";
function load_text(TEXT* a, STRING* b){
a=txt_create(1,2);
(a.pstring)[0]=b;
set(a,SHOW);
}
function main(){
vec_set(screen_color,vector(53,53,53));
video_window(NULL,NULL,16,"TEST");
video_set(800,600,0,0);
level_load(NULL);
wait(1);
reset(camera,SHOW);
load_text(txt1,"Hellllo");
wait(-5);
//move the texto to right
txt1.pos_x=200;
}
Last edited by MMike; 07/14/10 01:29.
|
|
|
Re: Crash on txt_create
[Re: MMike]
#333155
07/14/10 13:34
07/14/10 13:34
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
Probably the TEXT pointer is not assigned correctly. You could try to do something similar to the following:
#include <acknex.h>
#include <default.c>
#include <litec.h>
TEXT* txt1;
STRING* txt1_content="alternative";
TEXT* load_text(STRING* b){
TEXT* a = txt_create(1,2);
if (a != NULL) {
if (b != NULL) {
str_cpy((a.pstring)[0], b);
} else {
str_cpy((a.pstring)[0], "");
}
set(a,SHOW);
}
return(a);
}
function main(){
vec_set(screen_color,vector(53,53,53));
video_window(NULL,NULL,16,"TEST");
video_set(800,600,0,0);
level_load(NULL);
wait(1);
reset(camera,SHOW);
txt1 = load_text("Hellllo");
wait(-5);
//move the texto to right
txt1.pos_x=200;
}
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|