Hi i cant get my head around the data section use
in the below code the first const section has to be indexed in increments of 2 to work right.
but in the second data section refereing to the p1_buttons members in increments of 1 works ok,.
could someone tell me
1. why this is and
2. how to use the sizeof() function, it doesnt seem to work how i would expect and
3. what exactly ARE data members, pointers, aliases, ???
please see the code below
/**
* page 1 touch areas for buttons, in the format
* X0, Y0, X1, Y1 ( left, top, right, bottom )
*/
#DATA // L T R B
word p1_bt_new 285, 77, 365, 127
word p1_bt_same 370, 77, 470, 127
word p1_bt_stick 160, 143, 260, 193
word p1_bt_adjust 265, 143, 385, 193
word p1_bt_cut 390, 143, 470, 193
word p1_bt_settings 115, 209, 265, 259
word p1_bt_dxf 270, 209, 350, 259
word p1_bt_tip 355, 209, 415, 259
word p1_bt_help 420, 209, 470, 259
#END
// touch area access
#CONST
X0_DIM 0
Y0_DIM 2
X1_DIM 4
Y1_DIM 6
#END
// button group to make searching touch areas easier
#DATA
word p1_buttons p1_bt_new, p1_bt_same, p1_bt_stick, p1_bt_adjust, p1_bt_cut, p1_bt_settings, p1_bt_dxf, p1_bt_tip, p1_bt_help
#END
// button ids to access button group pointers
#CONST
bt_new 0
bt_same 1
bt_stick 2
bt_adjust 3
bt_cut 4
bt_settings 5
bt_dxf 6
bt_tip 7
bt_help 8
bt_total 9
#END
func test_ptrs()
var ptr;
var i;
for( i := 0; i < bt_total; i++ )
ptr := p1_buttons[ i ];
print ( "X0 = ", ptr[ X0_DIM ],", Y0 = ", ptr[ Y0_DIM ],", X1 = ", ptr[ X1_DIM ],", Y1 = ", ptr[ Y1_DIM ], "\n" );
next
endfunc
in the below code the first const section has to be indexed in increments of 2 to work right.
but in the second data section refereing to the p1_buttons members in increments of 1 works ok,.
could someone tell me
1. why this is and
2. how to use the sizeof() function, it doesnt seem to work how i would expect and
3. what exactly ARE data members, pointers, aliases, ???
please see the code below
/**
* page 1 touch areas for buttons, in the format
* X0, Y0, X1, Y1 ( left, top, right, bottom )
*/
#DATA // L T R B
word p1_bt_new 285, 77, 365, 127
word p1_bt_same 370, 77, 470, 127
word p1_bt_stick 160, 143, 260, 193
word p1_bt_adjust 265, 143, 385, 193
word p1_bt_cut 390, 143, 470, 193
word p1_bt_settings 115, 209, 265, 259
word p1_bt_dxf 270, 209, 350, 259
word p1_bt_tip 355, 209, 415, 259
word p1_bt_help 420, 209, 470, 259
#END
// touch area access
#CONST
X0_DIM 0
Y0_DIM 2
X1_DIM 4
Y1_DIM 6
#END
// button group to make searching touch areas easier
#DATA
word p1_buttons p1_bt_new, p1_bt_same, p1_bt_stick, p1_bt_adjust, p1_bt_cut, p1_bt_settings, p1_bt_dxf, p1_bt_tip, p1_bt_help
#END
// button ids to access button group pointers
#CONST
bt_new 0
bt_same 1
bt_stick 2
bt_adjust 3
bt_cut 4
bt_settings 5
bt_dxf 6
bt_tip 7
bt_help 8
bt_total 9
#END
func test_ptrs()
var ptr;
var i;
for( i := 0; i < bt_total; i++ )
ptr := p1_buttons[ i ];
print ( "X0 = ", ptr[ X0_DIM ],", Y0 = ", ptr[ Y0_DIM ],", X1 = ", ptr[ X1_DIM ],", Y1 = ", ptr[ Y1_DIM ], "\n" );
next
endfunc
Comment