Author Topic: GreyScale Splash Screen  (Read 13150 times)

0 Members and 3 Guests are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
GreyScale Splash Screen
« 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.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: GreyScale Splash Screen
« Reply #1 on: February 17, 2011, 10:41:57 am »
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
Code: [Select]
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.


I'm not a nerd but I pretend:

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: GreyScale Splash Screen
« Reply #2 on: February 17, 2011, 10:52:21 am »
Grayscale works by changing pixels on and off repeatly. you see this as gray.
You can do grayscale this way:
Code: [Select]
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.
« Last Edit: February 17, 2011, 10:54:19 am by ACagliano »

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: GreyScale Splash Screen
« Reply #3 on: February 17, 2011, 10:59:47 am »
How would I make the entire back buffer black?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: GreyScale Splash Screen
« Reply #4 on: February 17, 2011, 11:13:19 am »
How would I make the entire back buffer black?

The main buffer:

Code: [Select]
Rect(0,64,96,64)

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: GreyScale Splash Screen
« Reply #5 on: February 17, 2011, 11:15:35 am »
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?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: GreyScale Splash Screen
« Reply #6 on: February 17, 2011, 11:22:53 am »
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...

Code: [Select]
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.
« Last Edit: February 17, 2011, 11:23:21 am by Scout »

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: GreyScale Splash Screen
« Reply #7 on: February 17, 2011, 11:41:37 am »
It shows the text as grayscale too.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: GreyScale Splash Screen
« Reply #8 on: February 17, 2011, 11:56:52 am »
It shows the text as grayscale too.

Code: [Select]
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr

I tried this:

Code: [Select]
.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.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: GreyScale Splash Screen
« Reply #9 on: February 17, 2011, 12:15:58 pm »
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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
:Pt-On(X,Y,Pic1)
:DispGraph
:Repeat getKey
:End
But with grayscale, you'll have to write the code like this:
Code: (displays Pic1 in dark gray) [Select]
: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.

Code: [Select]
Rect(0,64,96,64)r
Text(0,0,"This is some black text")
DispGraphr

I tried this:

Code: [Select]
.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.
« Last Edit: June 14, 2011, 02:58:18 pm by DJ_O »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: GreyScale Splash Screen
« Reply #10 on: February 17, 2011, 01:41:33 pm »
"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.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: GreyScale Splash Screen
« Reply #11 on: February 17, 2011, 03:43:41 pm »
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.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: GreyScale Splash Screen
« Reply #12 on: February 17, 2011, 03:46:13 pm »
Same here, I never do it until I make a release. Also, it goes away as soon as your calc turns off.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: GreyScale Splash Screen
« Reply #13 on: February 17, 2011, 07:37:31 pm »
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...
Vy'o'us pleorsdti thl'e gjaemue

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: GreyScale Splash Screen
« Reply #14 on: February 17, 2011, 09:55:06 pm »
How would I make the entire back buffer black?

Fastest and easiest way:

Code: (Axe) [Select]
:0→{L3}
:Fill(L3,767)