Author Topic: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale  (Read 29404 times)

0 Members and 1 Guest are viewing this topic.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #15 on: September 11, 2013, 07:52:12 pm »
Are you sure it actually crashed? The contrast settings wrap around, so it seems likely to me that you may have wrapped around from the darkest to the lightest setting, making the screen look blank and as if the calculator crashed.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #16 on: September 12, 2013, 02:25:08 am »
Nevermind i did'nt understand what to use, I used Gon, and not GLoad... By the way, 'should do a tutorial or something like this.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #17 on: September 12, 2013, 04:02:12 am »
Aren't example programs included? That's all the tutorial you should need, along with proper AI docs.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #18 on: September 15, 2013, 05:54:24 am »
I digged into them! I just didn't read correctly...

After some tests, this lib s fantastic, but too heavy for Hinawa.my fps drops to 1.5 fps if I use them... Don't draw too much with this lib!

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #19 on: September 15, 2013, 02:21:01 pm »
Yeah, it uses a lot of processing time. Perhaps I should've mentioned this somewhere, but updating the screen at 60Hz drops the effective CPU speed down to only about 33%, so 2MHz for Normal and 6MHz for Full.

Offline Aspiring

  • LV3 Member (Next: 100)
  • ***
  • Posts: 81
  • Rating: +5/-0
  • The only source of knowledge is experience-Einsten
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #20 on: October 08, 2013, 07:08:10 pm »
This is awesome!  :thumbsup:  Just tried it on my calc. I was able to make the flicker completely go away!

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #21 on: November 26, 2013, 10:52:26 pm »
I'm a little confused with this, could I see some example code to draw a grayscale sprite and display it please?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #22 on: November 27, 2013, 01:21:18 am »
The simple answer is just draw them to a front buffer and back buffer like normal, but use GB1 and GB2 as the front and back buffers, respectively.

I whipped up the classic single-sprite-moving-around-on-the-screen demo for GrayLib. Code and screenshots and stuff below. The code is also attached in 8xp form, one file with the comments below and one with them stripped out.




Code: [Select]
.GRAYSPRT
.An example GrayLib program by Runer112

.==GrayLib==

.4-level grayscale, 83+ support, GDisp(), GDisp() clears, GTune() (and first run auto run), GWait(), getKey support (always on)
1→°G4→°GS83→°GID→°GDC→°GIGT→°GIW→°GSGK
prgmGRAYLIB


.==SETUP==

.Enable grayscale
GLoad()
.Sprite X and Y positions
16→X→Y


.==MAIN==

.Main loop
While 1
 .Increment or decrement X by 2 if right or left is pressed, respectively, and increment or decrement Y by 2 if down or up is pressed, respectively, not letting the sprite go offscreen, and draw the first layer of the 8x8 grayscale sprite
 Pt-Off(getKey(3)*2+X-(?getKey(2)*2)+(≤88-1*2)→X,getKey(1)*2+Y-(?getKey(4)*2)+(≤56-1*2)→Y,Pic0,GB1)
 .Draw the second layer of the 8x8 grayscale sprite
Pt-Off(X,Y,Pic0+8,GB2)
 .Wait until the last frame has been fully dispalyed with each dither mask
 GWait()
 .Mark the new frame for display
 GDisp()
 .If VARS was pressed, run grayscale tuner
 !If getKey  xor 23
  GTune()
 End
.End the main loop if CLEAR was pressed
End!If  xor 24


.==TEARDOWN==

.Disable grayscale and quit
Goto GUnload


.==DATA==

.8x8 grayscale sprite
[FFFFC3C3C3C3FFFFFF81BDA5A5BD81FF]→Pic0
« Last Edit: November 27, 2013, 01:23:09 am by Runer112 »

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #23 on: November 27, 2013, 11:30:20 am »
Perfect, thanks  ;D
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #24 on: November 27, 2013, 11:53:35 am »
It sounds pretty simple to use. I'll have to check it out when I make a low resources greyscale prog.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #25 on: November 27, 2013, 02:16:15 pm »
Runer, the scrolling mask you did in the Pokemon demo should be an actual function in your lib. That makes the rendered result quite clearer.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #26 on: November 27, 2013, 02:18:39 pm »
Runer, the scrolling mask you did in the Pokemon demo should be an actual function in your lib. That makes the rendered result quite clearer.

That's a pretty good idea. Perhaps I should turn the whole 2D tilemapping engine from the Pokemon demo into an extension of GrayLib?

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #27 on: November 27, 2013, 02:19:58 pm »
Holy yes! A full powered grayscale lib! Oo

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #28 on: November 27, 2013, 02:43:34 pm »
What Pokemon demo is that you're talking about ?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« Reply #29 on: November 27, 2013, 02:44:38 pm »
I'm saying yes. O.O