Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: ACagliano on February 17, 2011, 10:33:04 am
-
I have failed to produce a good splash screen for Zelda. I still do not understand how to utilize the greyscale in Axe. I would like a splash screen that says "Legend of Zelda", "Ganon's Rage", and potentially has an image of the triforce. I don't care how many layers of greyscale it is. I would rather it be done by someone who has succeeded in using Axe grayscale before, but if someone teaches me how to do it, that would be cool too.
-
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
ClrDraw(radians) >next time, i use (r)
Pause 100 (to prevent the program fron shutting down immediately)
Repeat getKey
ClrDraw(r)
Pt-On(Xpos,Ypos,[FFFFFFFFFFFFFFFF
DispGraph(r)
End
This displays a grayscale square somewhere on the screen (put an X and Y position in)
You can do this for the whole image, but also for a part of it
If you want a part not being gray, simply don't put a (r) after the Pt-On
I hope that this short tutorial is useful for you.
-
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
ClrDraw(radians) >next time, i use (r)
Pause 100 (to prevent the program fron shutting down immediately)
Repeat getKey
ClrDraw(r)
Pt-On(Xpos,Ypos,[FFFFFFFFFFFFFFFF
DispGraph(r)
End
This displays a grayscale square somewhere on the screen (put an X and Y position in)
You can do this for the whole image, but also for a part of it
If you want a part not being gray, simply don't put a (r) after the Pt-On
I hope that this short tutorial is useful for you.
It does, but the code is only showing black.
I got it working.
-
How would I make the entire back buffer black?
-
How would I make the entire back buffer black?
The main buffer:
Rect(0,64,96,64)
-
Ok. And one last question. How would I draw the text I want to the back buffer, and have it remain black, as the rest is gray?
-
Ok. And one last question. How would I draw the text I want to the back buffer, and have it remain black, as the rest is gray?
Not sure what you mean, but maybe this...
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr
Note: the r after Rect() and DispGraph is accessed by 2ND+APPS+3.
If you're using Tokens to program, just do Rect(0,64,96,64)^^r.
-
It shows the text as grayscale too.
-
It shows the text as grayscale too.
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr
I tried this:
.IMG
Fix 5
Repeat getKey(15)
Rect(0,0,96,64)^r
Text(0,0,"Text
DispGraph^r
End
Fix 4
And I got grey background and in black, 'Text' at coordinates (0,0).
What Axe version are you using? Show me your code please.
-
Quick Grayscale Tutorial
3 level gray:
Three level grayscale is utilized by using the command DispGraphr in place of the normal DispGraph command. Three level gray uses the backbuffer (L3) and the front buffer (L6). Everything on the back buffer will show as gray while everything on the front buffer will show as black. The front buffer is drawn over the back buffer, so if a pixel is "on" on both the front and back buffers, it will be shown as black.
You can change the common drawing operations Pt-On, Pt-Off, Pt-Change, Pxl-On, ClrDraw, Rect, Line, DrawInv, etc. to operate on the back buffer by adding the raidan r at the end of the command. For example, Pt-On(X,Y,Pic1)r will draw Pic1 to the backbuffer. If you then look at it with DispGraph, you will see it in gray.
Text, by default is drawn directly to the screen and not to the buffer. For this reason, it can appear as grayscale because it is being erased every time you call DispGraphr, and then redrawn very quickly. To make it so that text is drawn to the buffer, put a Fix 5 at the beginning of the program (and a Fix 4 at the end). To draw text to the back buffer, you will have to Exch the back and front buffers, write to the front buffer, and switch back: Exch(L3,L6,768): Text(X,Y,"Text") : Exch(L3,L6,768)
4 level gray
With four level gray, the front buffer becomes somewhat transparent. Use the following table to figure out the pixel colors:Front:Back:Color
0 :1 :Light Gray
0 :0 :White
1 :0 :Dark Gray
1 :1 :Black
Buffer operations remain the same. To display in four level gray, use DispGraphrr
Note: In order for the grayscale to show up, you must put the DispGraphr or DispGraphrr in a loop. In monochrome, you can get away with this::Pt-On(X,Y,Pic1)
:DispGraph
:Repeat getKey
:End
But with grayscale, you'll have to write the code like this::Pt-On(X,Y,Pic1)
:Repeat getKey
:DispGraph[sup]r[/sup][sup]r[/sup]
:End
edit: 1000 posts :D
It shows the text as grayscale too.
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr
I tried this:
.IMG
Fix 5
Repeat getKey(15)
Rect(0,0,96,64)^r
Text(0,0,"Text
DispGraph^r
End
Fix 4
And I got grey background and in black, 'Text' at coordinates (0,0).
What Axe version are you using? Show me your code please.
I had it set Fix 4 at the beginning, that is why. It works now. Thanks.
-
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."
Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.
Your calculator can crash I think.
-
Actually the worst thing that can happen is that when you view the mode menu you don't see anything the first time :P Or similarly if you view the Y= menu or any other menu that uses the small font. It's so stable that I still haven't bothered putting a Fix 4 at the end of PortalX because I'm too lazy and I know that it won't cause any issues. That said, it is a good idea for a final release, because people might think you messed up their mode screen or whatever.
-
Same here, I never do it until I make a release. Also, it goes away as soon as your calc turns off.
-
It's actually kind of interesting with the lack of a fix 4 :P
I remember playing super mario 2.0 and everything was weird :P
Also, omnicalc looked interesting...
-
How would I make the entire back buffer black?
Fastest and easiest way:
:0→{L3}
:Fill(L3,767)
-
Correction :P
ᴇFFFF→{L₃}ʳ
Fill(L₃+1,766)
-
Correction :P
ᴇFFFF→{L₃}ʳ
Fill(L₃+1,766)
Whoops. I really need sleep x.x.x
-
For the smallest you can use ClrDrawr:DrawInvr methinks
-
Wouldn't Rect(0,,96,64)r work?
-
Rect(0,,96,)r works too methinks, its clipped right?
-
Umm...define "clipped"
I think that would work, Rect( can go off screen right?
EDIT: I'm an addict now :w00t:
-
if I make a rectangle 96x96 in Axe, it will still fill the screen properly and won't give me strange errors
-
I don't know exactly...I think I've had rectangles go off-screen before, but I've avoided it for the most part.
What comes after L6? Is it safe to write there, or does Axe stop at the end of the list?
-
Its very very unsafe to write to places after L6, some very important things are there. Thats why i belive Quigibo added clipping in the first place, so that people wouldn't crash their calcs when a rectangle goes off screen
-
So...clipping is the inability to draw offscreen?
-
For the smallest you can use ClrDrawr:DrawInvr methinks
If the DrawInv routine already exists in your program, then yes, that is the smallest solution. Here would be my priorities for the smallest way to fill the back buffer based on what routines already exist in your program:
- If the DrawInv routine exists — ClrDrawr:DrawInv r [12 bytes]
- If the Rect() routine exists — Rect(0,,-1,)r [18 bytes]
- Otherwise — EFFFF→{L3}r:Fill(L3+1,766) [20 bytes]
Also, in case anyone was wondering, the smallest ways to fill the front buffer:
- If the DrawInv routine exists — ClrDraw:DrawInv [6 bytes]
- If the Rect() routine exists — Rect(0,,-1,) [10 bytes]
- If the RectI() routine exists — ClrDraw:RectI(0,,-1,) [13 bytes]
- Otherwise — EFFFF→{L6}r:Fill(L6+1,766) [20 bytes]
And the smallest ways to fill both buffers:
- If the DrawInv routine exists — ClrDraw:DrawInv :StorePic [17 bytes]
- If the Rect() routine exists — Rect(0,,-1,):StorePic [21 bytes]
- If the RectI() routine exists — ClrDraw:RectI(0,,-1,):StorePic [24 bytes]
- Otherwise — ClrDraw:DrawInv :StorePic [33 bytes]
-
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."
Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.
Your calculator can crash I think.
I never disable fix 5 and i've never had weird problems... other fixes are nice to experiment ( for example: a fix1 program makes all text white on black :) )
-
"I had it set Fix 4 at the beginning, that is why. It works now. Thanks."
Fix 5 makes it able to have text and images in the same screen.
Fix 4 disables it, ALWAYS DISABLE IT (Fix 4) BEFORE THE PROGRAM CLOSES, ALWAYS.
Your calculator can crash I think.
I never disable fix 5 and i've never had weird problems... other fixes are nice to experiment ( for example: a fix1 program makes all text white on black :) )
That would be Fix 3, but be warned: Fix 1 (which enables large font text) can crash your calculator if you use 2.53/55MP's ALPHA menus.