Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
Axe
(Moderator:
Runer112
) »
Sprites and Greyscale
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Sprites and Greyscale (Read 4878 times)
0 Members and 1 Guest are viewing this topic.
dinosteven
LV4
Regular (Next: 200)
Posts: 194
Rating: +10/-1
Sprites and Greyscale
«
on:
November 09, 2012, 09:48:51 pm »
So... How do I do a Pt-On() where only the 'on' points are turned on?
How do I make it so it graphs that to both buffers?
Do I need to use two commands, or can I do it all in one command?
And the same questions for Pt-Off()
Logged
squidgetx
Food.
CoT Emeritus
LV10
31337 u53r (Next: 2000)
Posts: 1881
Rating: +503/-17
rawr.
Re: Sprites and Greyscale
«
Reply #1 on:
November 09, 2012, 09:53:58 pm »
Pt-On uses 'or' logic, so any black pixels in your sprite will be drawn black (n or 1 = 1), and anything white in the sprite will be transparent (n or 0 = n)
Pt-Off overwrites completely, so black will be black and white will be solid white.
To make them draw to the backbuffer, just add the ^r (radians symbol) at the end
Logged
Read my webcomic!
|
My SoundCloud
Projects:
[url=http://www.omnimaga.org/index.php?topic=5988.msg117813#msg117813]Check out the demo now!
- Current progress: battle engine and stuff
Proud author of:
Cuberunner
|
SpaceDash
|
The Psyche
|
XXEdit
|
AxeSynth
|
StickNinja
|
Gravity Guy
|
Embers:Phoenix
|
Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
dinosteven
LV4
Regular (Next: 200)
Posts: 194
Rating: +10/-1
Re: Sprites and Greyscale
«
Reply #2 on:
November 09, 2012, 10:00:03 pm »
How do I use an inverse function? Where it makes a white where it should be black, and black where it should be white?
And can I write to both buffers in one command? Not
Pt-On(X,Y,Pic1):Pt-On(X,Y,Pic1)^r
but Pt-On(X,Y,Pic1)^Coolsymbol
«
Last Edit: November 09, 2012, 10:00:32 pm by dinosteven
»
Logged
squidgetx
Food.
CoT Emeritus
LV10
31337 u53r (Next: 2000)
Posts: 1881
Rating: +503/-17
rawr.
Re: Sprites and Greyscale
«
Reply #3 on:
November 09, 2012, 10:04:42 pm »
You can't do it in one command, nor should you want to. Grayscale sprites come in two layers, so (well, I guess you waste a few cycles reloading the x and y arguments) you'd most commonly have code that looks like
pt-on(x,y,pic1) : pt-on(x,y,pic1+8)
r
Pt-Change is the invert, and it uses xor logic. So anything black on the sprite will be black if the pixel that's being drawn on is white, (1 xor 0 = 1), and white (invert) if the pixel it's being drawn on is black (1 xor 1 = 0). White pixels in the sprite will be transparent (n xor 0 = n)
«
Last Edit: November 09, 2012, 10:05:19 pm by squidgetx
»
Logged
Read my webcomic!
|
My SoundCloud
Projects:
[url=http://www.omnimaga.org/index.php?topic=5988.msg117813#msg117813]Check out the demo now!
- Current progress: battle engine and stuff
Proud author of:
Cuberunner
|
SpaceDash
|
The Psyche
|
XXEdit
|
AxeSynth
|
StickNinja
|
Gravity Guy
|
Embers:Phoenix
|
Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
dinosteven
LV4
Regular (Next: 200)
Posts: 194
Rating: +10/-1
Re: Sprites and Greyscale
«
Reply #4 on:
November 09, 2012, 10:39:28 pm »
So say something is all white on the main buffer and either all black or all white on the back buffer. I want to do a Pt-On() of a sprite to both buffers so the black points are entirely black and the white points of the sprite depend on how it already was.
I also want to use the same sprite and turn on all points that should be white in the main buffer and turn off all points that should be white.
Basically, I want to output a sprite and its exact inverse onto a possible grey background.
Logged
shmibs
しらす丼
Administrator
LV11
Super Veteran (Next: 3000)
Posts: 2132
Rating: +281/-3
try to be ok, ok?
Re: Sprites and Greyscale
«
Reply #5 on:
November 10, 2012, 02:27:16 am »
could you draw that in a picture? i'm not really getting what you're trying to say.
Logged
willrandship
Omnimagus of the Multi-Base.
LV11
Super Veteran (Next: 3000)
Posts: 2953
Rating: +98/-13
Insert sugar to begin programming subroutine.
Re: Sprites and Greyscale
«
Reply #6 on:
November 10, 2012, 02:58:50 am »
Easiest and fastest way to draw an inverse sprite: Draw a filled sprite (or a black square) and pt-change on top of it. Great way to get transparency
Logged
dinosteven
LV4
Regular (Next: 200)
Posts: 194
Rating: +10/-1
Re: Sprites and Greyscale
«
Reply #7 on:
November 10, 2012, 08:49:18 am »
Here's what I wanted. Making the sprite black or white without any grey on it, regardless of the state of the background.
EDIT: But my RAM just cleared randomly, deleting all my sprites. ARGH
«
Last Edit: November 10, 2012, 08:51:33 am by dinosteven
»
Logged
willrandship
Omnimagus of the Multi-Base.
LV11
Super Veteran (Next: 3000)
Posts: 2953
Rating: +98/-13
Insert sugar to begin programming subroutine.
Re: Sprites and Greyscale
«
Reply #8 on:
November 10, 2012, 08:55:26 am »
Well, that depends on what you're using. If you're using Black and white only, you ignore the back buffer entirely, but when using 3 or 4-level greyscale, just draw the sprite to both layers. That way, if it's black, it's all the way black, and white is all the way white.
To draw black, use pt-On.
To draw white, use pt-On then pt-Change (fill then invert)
To get a combination of the two, use pt-On with a silhouette, and use pt-change with a different sprite, which has all the white pixels as black.
«
Last Edit: November 10, 2012, 08:57:18 am by willrandship
»
Logged
aeTIos
Nonbinary computing specialist
LV12
Extreme Poster (Next: 5000)
Posts: 3915
Rating: +184/-32
Re: Sprites and Greyscale
«
Reply #9 on:
November 10, 2012, 08:56:56 am »
I think pt-off is what you need.
EDIT: and an additional pt-off()^r when you use 4-lv gray.
«
Last Edit: November 10, 2012, 08:57:52 am by aeTIos
»
Logged
I'm not a nerd but I pretend:
Print
Pages: [
1
]
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
Axe
(Moderator:
Runer112
) »
Sprites and Greyscale