Author Topic: nSDL 1.1.1 Anniversary Edition—The Ultimate TI-Nspire Graphics Library  (Read 140809 times)

0 Members and 3 Guests are viewing this topic.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: nSDL 0.3.1—A fast & robust TI-Nspire graphics library
« Reply #240 on: June 11, 2012, 03:01:16 pm »
I've now updated nSDL to 0.3.2. I've done some major housekeeping, the code should be a lot cleaner and everything should be nicely organized (the current video code for instance (here) is nearly twice as small as 0.2.0's 400-liner (here)). I've purged all crap from everywhere, no more mouse support because it wasn't perfect when using SDL_PollEvent() and I couldn't bother to debug it (and I think Lua's better for that kind of stuff), no more diagonal arrow key support I added in the previous version. Removing those two simplified the event fetching code to a simple little loop, which means it's faster and I'm much more content with it. It's such a rewarding feeling to clean shit up.

Anyway I also added SDL_gfx and updated fdlibm no one's heard about (it's a working, fast, Sun's full implementation of math.h functions; newlib's math functions don't work): https://github.com/Hoffa/nSDL/wiki/Additional-libraries
I haven't really tested SDL_gfx THAT MUCH, but it should run alright. SDL_gfx allows you to rotate and stretch images, draw anti-aliased lines, circles, triangles and all of your deepest fantasies. If I remember correctly it should do some heavy surface conversions on the fly so it might be pretty damn slow on a calculator, but I haven't tested so what do I know.

So here are the changes:
- Removed mouse, diagonal arrow key support
- Using SDL_GetVideoInfo() should now always give accurate information
- Faster event loop
- A LOT of cleaning up
- Apart from nSDL itself, added SDL_gfx and updated fdlibm

I think I'm finally ready to leave my baby for quite a long time.

Is there any way of easily finding where you made changes to the SDL source? I would like to look a little to see what it takes to port it to a new platform
Sure. Check out the source code here: https://github.com/Hoffa/nSDL
If you don't see "Initial commit." next to the file, it means I've changed something. Click on the message the view the changes of that commit. You can browse different commits here also: https://github.com/Hoffa/nSDL/commits/master
Most of the interesting stuff is in the src/ folder obviously.
« Last Edit: June 11, 2012, 03:18:26 pm by hoffa »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #241 on: June 11, 2012, 03:23:34 pm »
Nice hoffa :)

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #242 on: June 12, 2012, 05:37:00 am »

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #243 on: June 12, 2012, 10:42:07 pm »
Where is SCREEN_WIDTH defined? I cannot seem to find its definition anywhere but you use it in nspirevideo and sdl uses it in joystick.
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #244 on: June 13, 2012, 12:51:36 am »
In libndls.h, included by os.h.

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #245 on: June 13, 2012, 01:01:51 am »
Ok thanks was driving me crazy not being able to find it.
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #246 on: June 23, 2012, 08:39:49 am »
Wow that looks great. :D When this is available for download, I need to try the color version to see how this looks like on my CX (assuming a demo of the above is made available?). :D
Of course!  :D

CX:
http://www.mediafire.com/?7omfqojuxjjrpp2
Touchpad/Clickpad:
http://www.mediafire.com/?ax8dyd9xqgjb2z5

And here's the source (just ignore my dirty random generator at the end):
http://pastebin.com/gqjXDTBw

Also, please note that the actual code that generates the plasma effect was not made by me, this is just a port of a demo available here.

Trying to recompile the plasma demo, I get an undefined reference to the sinus function.
How did you do?

Thanks.
TI-Planet co-admin.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #247 on: June 23, 2012, 09:12:43 am »
Newlib's math library doesn't work, so you have to use another library. In fact you need to use fdlibm compiled for the TI-Nspire, which you can find here. (I suggest including fdlibm.h rather than math.h, but both should work since they should be pretty much identical)
« Last Edit: June 23, 2012, 09:17:30 am by hoffa »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #248 on: June 23, 2012, 02:49:15 pm »
He finally got it working with   -lm  :)

Here's the game he ported : http://tiplanet.org/forum/viewtopic.php?p=126303#p126303
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #249 on: June 23, 2012, 05:56:45 pm »
That video looks awesome! :)

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #250 on: June 23, 2012, 10:41:50 pm »
fdlibm eh? Gotta try on the Prizm. Unless someone manages to make it work with newlib.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #251 on: June 24, 2012, 06:26:44 am »
fdlibm eh? Gotta try on the Prizm. Unless someone manages to make it work with newlib.
Yeah you should be able to compile it easily using the code from here. I'm not sure if there are any issues with globals on the Prizm, but that code should compile perfectly on any platform, just edit the Makefile a bit (and rename the resulting libm.a to libfdm.a to avoid doubts and name collisions). Oh and in fdlibm.h, remove the #ifdef _TINSPIRE/#endif at the top.

He finally got it working with   -lm  :)

Here's the game he ported : http://tiplanet.org/forum/viewtopic.php?p=126303#p126303
Damn that's awesome!

EDIT:
I edited the voxel demo a bit (nearly tripled range, made mountains much bigger and imposing, made it run full screen, added Mars-like colors and some other adjustments):


I've attached the download (yes, I know it's massive, it's because I couldn't bother to reduce the gigantic trig lookup table). Code's here. Check it out, tell me how it runs (on the Touchpad it seems to be pretty smooth, but it's hard to tell with the shitty LCD).

Controls are arrow keys to move, 5 toggle noclip, and +/- to increase/decrease altitude when in noclip.

EDIT2: Added a porting tips page in the wiki.
« Last Edit: June 24, 2012, 12:29:08 pm by hoffa »

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #252 on: June 27, 2012, 10:16:18 am »
so I heard that there's a gba emulator using SDL or something (at least I think that's what calc84maniac said before). Will it be possible to port it to nspire?
Sig wipe!

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #253 on: June 27, 2012, 10:20:27 am »
so I heard that there's a gba emulator using SDL or something (at least I think that's what calc84maniac said before). Will it be possible to port it to nspire?
I'm already porting it (and I removed all SDL references as well, since it's mainly used for the framebuffer)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: nSDL 0.3.2—A fast & robust TI-Nspire graphics library
« Reply #254 on: June 27, 2012, 10:20:56 am »
O.o I can't wait!
Sig wipe!