Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Yeong on September 11, 2011, 06:06:33 pm

Title: Pictures, etc.
Post by: Yeong on September 11, 2011, 06:06:33 pm
Is it possible to display pic and sprites same time?
Also, why can't I do Data(variable, number, number, etc) ?
Title: Re: Pictures, etc.
Post by: Runer112 on September 11, 2011, 06:14:25 pm
You can copy a picture to a buffer and then draw whatever you want on top of it. Just copy the picture data to the buffer every frame before drawing anything else with code like this:

Code: [Select]
Copy([Pic1],L₆,768)


And you can't include the value of a variable in a data declaration because all the data is added to the program at compile time, whereas variables only have meaningful values at run time. If you must include a variable in a list of data, you can do something like the following:

Code: [Select]
Data(0,number,number,etc)→GDB0
variable→{GDB0}
Title: Re: Pictures, etc.
Post by: Builderboy on September 11, 2011, 06:14:44 pm
What do you mean by displaying a picture and a sprite at the same time?  Do you mean display a sprite over a picture?

And you can't use variables in the Data() command, because the Data is inserted at compile time, NOT when the program is running, so all of the numbers have to be constant

EDIT: Ninja'd :P
Title: Re: Pictures, etc.
Post by: Yeong on September 11, 2011, 06:17:51 pm
i meant to display sprite over a pic.
I managed to draw a pic over sprite, but not vice versa
Title: Re: Pictures, etc.
Post by: Builderboy on September 11, 2011, 06:18:55 pm
If you just follow Runers' instructions, that should work for you.  Just remember to draw the picture before you draw the sprite
Title: Re: Pictures, etc.
Post by: Yeong on September 11, 2011, 06:20:36 pm
so do like:
Code: [Select]
Copy([Pic1],L6,768]
-Displaying Sprites-
DispGraph
this?
Title: Re: Pictures, etc.
Post by: Builderboy on September 11, 2011, 06:22:58 pm
yep, that's it :) You could also store your picture into L3, that way instead of typing Copy([Pic1],L6,768) you can just enter RecallPic
Title: Re: Pictures, etc.
Post by: Yeong on September 12, 2011, 07:03:40 am
Erm another question XP
I got stuck here..It just won't work

Code: [Select]
.Making AppData with pics
[Pic1]->Str1
GetCalc("appvSIL001",768)->A
Str1->A

Code: [Select]
.Using AppData here
...codes
GetCalc("appvSIL001", Y[sub]1[/sub])
...codes
Copy(Y[sub]1[/sub],L[sub]6[/sub],768)
...codes
DispGraph

Somehow it doesn't work for me. Does anyone know why?
Title: Re: Pictures, etc.
Post by: calc84maniac on September 12, 2011, 12:05:14 pm
Your problem is the Str1->A line. That just stores the address of Str1 into the A variable. I think what you meant to do is Copy(Str1,A,768).
Title: Re: Pictures, etc.
Post by: Yeong on September 12, 2011, 12:08:18 pm
Oh, thank you.
then what's the difference of just storing and Copy() ?
Title: Re: Pictures, etc.
Post by: Builderboy on September 12, 2011, 01:43:53 pm
A is what's known as a pointer.  No matter what you do to A, it will just be a number from 0 to 65536 and nothing more.  Storing to A will do nothing but change A to be a number from 0 to 65536. 

The calculator has lots of RAM, and each piece of RAM has what's known as an Address.  That is, each byte has a number associated with it.  If you are talking about the 5th byte of RAM, the address of that RAM would be 5.  If you are talking about the 3475th byte of RAM, your address would be 3475.  What GetCalc does, is it finds the specific byte of RAM where your appvar starts, and returns it's address.  If you GetCalc("vM")->A, and if A now holds 57, that means that your appvar starts at the 57th byte of RAM.  Now, if you store to A, 8383->A, you arn't doing anything to the 57th byte of RAM, you are storing 8383 into A.  If you want to store into the byte of RAM *at* A, you use the copy command, or the brackets {A}.  These commands will use A as a location, and modify the RAM at that location instead of the variable itself.
Title: Re: Pictures, etc.
Post by: Yeong on September 12, 2011, 03:00:01 pm
ah, ok. Thanks for the explanation.
Title: Re: Pictures, etc.
Post by: LincolnB on September 12, 2011, 10:49:13 pm
Also keep in mind that:

5->A

^^stores 5 in variable A

Copy(Y1,L6,768)

^^copies 768 consecutive bytes of data, starting at Y1 (your archive location) into L6, the display buffer.