Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, howardR), 1,001 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Crash on txt_create #333108
07/14/10 01:27
07/14/10 01:27
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline 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..

Code:
#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
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

Joined: Dec 2005
Posts: 116
Probably the TEXT pointer is not assigned correctly.
You could try to do something similar to the following:
Code:
#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;
}






Re: Crash on txt_create [Re: tD_Datura_v] #334576
07/24/10 00:32
07/24/10 00:32
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
well for this then i will just use on the main()

the txt_create method and that works.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1