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

0 Members and 2 Guests are viewing this topic.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #60 on: March 02, 2012, 04:29:33 pm »
Thanks for the information! I think the freezes and clock icon appearing might be caused by some issues with the input code that sends a gazillion events (and needs fixing), or then by the main loop that runs too fast (or, in the worst case, too slow). Seems like I'll have to slowly start writing the non-CX graphics code so I can myself try it on my Touchpad so as to see how it runs.

Anyway, I added "classical" SDL events (those SDLK_* things for instance) which took quite a bit of time for the keymaps and whatnot, but again it behaves a bit weird with SDL_PollEvent.

EDIT: SDL doesn't seem to handle 4-bit color at all, which is a bit trickier. I think I'll have to pretend it's an 8 BPP display and just before copying to the framebuffer pack it in 4 bits or something.
« Last Edit: March 02, 2012, 06:43:09 pm by hoffa »

Offline atiatinini

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: SDL for the TI-Nspire
« Reply #61 on: March 02, 2012, 06:44:18 pm »
Hmmm, tried the new tinspire_test.tns and it reboots my CX..
Is it supposed to?

EDIT: Nevermind, just saw it tries to load a bmp image in /Examples. It's working better now, but the pink cursor no more moves continuously when holding a key.
« Last Edit: March 02, 2012, 06:54:23 pm by atiatinini »

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #62 on: March 02, 2012, 07:00:14 pm »
It shouldn't, no. Weird, works very well on the emulator.
It's still some early code though, I haven't thoroughly tested it (and more generally, the tinspire_test.tns on github doesn't necessarily have to work; I just push the changes when I feel like it). I think I'll write the video driver for non-CX first so that I have a better idea of the behavior on both machines.
Thanks again anyway, I'll look into it more tomorrow.

EDIT: It does try to load a BMP, but I don't think it should stop it from running, as it just returns NULL and moves on. It's normal that it doesn't work when holding the key, that's how events work in SDL. SDL_EnableKeyRepeat() should enable that behavior though, but I'm not entirely sure if it works currently as I haven't fully implemented the timers system (in fact there's only SDL_Delay()).
« Last Edit: March 02, 2012, 07:03:29 pm by hoffa »

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #63 on: March 03, 2012, 06:38:36 pm »
Seems like getting it working on the classical TI-Nspire has been more difficult than I thought. I can feel I'm pretty to close to getting it run, but those palettes, 4-bit pixels and whatnot have been a pain in the ass. This is the sort of thing I've been looking at for the last few hours:

Figuring out the cause of the issue is also always a major buttpain. Even more annoying is to go to sleep and leave it in its current state.

Anyway, on a side note, that whole Ndless-being-blocked-in-3.2 thing gave me quite a blow to the head. I have to admit I'm pretty fucking frustrated; I expected it but didn't think it'd come this quickly. Right now I feel like the work I'm doing is completely useless, and realistically speaking it is. It may take a month (or more) to have a first more or less stable version of SDL, from then on it takes time for people to learn the library/port programs. At that time 3.2 will be out, it'll be the shiny new thing and 3.1 will be outdated. Even I won't feel like staying on an "old" platform developing for a tiny minority. Even if I'd like to, I can't, as I'm getting my ass conscripted for about a year in the Finnish Army (yes I'm Finnish and we have conscription), and after that I'm moving to the UK for my university studies. There I will hardly ever use my TI-Nspire and will most probably develop on other platforms. I will try to finish this thing even for the sake of it (and to be able to add "ported SDL to a calculator" on my CV). Just realized it'll possibly be my last project on a calculator, but we'll see how it eventually turns out.

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: SDL for the TI-Nspire
« Reply #64 on: March 03, 2012, 06:45:57 pm »
Anyway, on a side note, that whole Ndless-being-blocked-in-3.2 thing gave me quite a blow to the head. I have to admit I'm pretty fucking frustrated; I expected it but didn't think it'd come this quickly. Right now I feel like the work I'm doing is completely useless, and realistically speaking it is. It may take a month (or more) to have a first more or less stable version of SDL, from then on it takes time for people to learn the library/port programs. At that time 3.2 will be out, it'll be the shiny new thing and 3.1 will be outdated. Even I won't feel like staying on an "old" platform developing for a tiny minority. Even if I'd like to, I can't, as I'm getting my ass conscripted for about a year in the Finnish Army (yes I'm Finnish and we have conscription), and after that I'm moving to the UK for my university studies. There I will hardly ever use my TI-Nspire and will most probably develop on other platforms. I will try to finish this thing even for the sake of it (and to be able to add "ported SDL to a calculator" on my CV). Just realized it'll possibly be my last project on a calculator, but we'll see how it eventually turns out.
:(

Well, it's great that you *are* finishing this up, so that we'll have something to work upon in the future. Heck, I think you might revive the Ndless community with this! ;) Once ports of many famous games are made, this will get more popular and TI will be pressured more to stop being silly... **

I can't believe I'm saying this, but the one platform that seems stable (for now) is the PRIZM. Unfortunately, as we all become, you will be busy soon and this will be your last project. :/

Anyway, good luck for the future! :D

** I'm an optimist. :P
« Last Edit: March 03, 2012, 06:46:20 pm by alberthrocks »
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #65 on: March 04, 2012, 01:21:38 pm »
Oh boy finally I have some code that initializes and runs stably on both calculators. I eventually noticed there was an extremely annoying memory leak that caused completely unpredictable and inconsistent behavior only with non-CX code (in non-graphical parts). Just before I hung myself I magically managed to fix the issue by fixing another issue. It's so goddamn reliving to see this showing up in the console no matter how many times you run the program:


Feels good man.

It also now prevents you from launching any code not compiled for the current calculator:
« Last Edit: March 04, 2012, 01:27:56 pm by hoffa »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: SDL for the TI-Nspire
« Reply #66 on: March 04, 2012, 01:54:24 pm »
Great ;)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #67 on: March 04, 2012, 02:28:27 pm »
And last update today: I wrote a first version of the non-CX video code. It works poorly with anything odd (as opposed to even; doesn't handle single nibbles when copying data), but I have some results:



(Oh, and I got to try it on my own TI-Nspire, which is nice; seems to be working well with that primitive example)
« Last Edit: March 04, 2012, 02:48:21 pm by hoffa »

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: SDL for the TI-Nspire
« Reply #68 on: March 04, 2012, 02:59:24 pm »
it might be simple, but it shows us you reached something.. i wouldn't say it's just "some results", it's nice to see it working.. that means it can be developped further, and that's the purpose i think, so be happy :)

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: SDL for the TI-Nspire
« Reply #69 on: March 04, 2012, 03:03:34 pm »
Awesome work hoffa :D
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: SDL for the TI-Nspire
« Reply #70 on: March 04, 2012, 03:23:44 pm »
Great job cant wait to see all the great games that will be made using this
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: SDL for the TI-Nspire
« Reply #71 on: March 04, 2012, 05:29:28 pm »
Actually this'll be the last update for today. On the previous screen you can see that gradient, but it only shows 7 colors and it doesn't seem to be consistent. That's because SDL's palette color mapper is crap (or not suited for 4-bit displays), so I decided to get completely rid of the palette and replace the color mapper code by a one-liner. It should be faster, much better, and should simplify and speed things up generally as all the bytes in the screen buffer are already within the 0-15 range. I'm not entirely sure that it won't cause any issues later (not sure how SDL deals with blitting surfaces with different formats etc.), but currently it seems to be working well, and here's the result (compare with the previous one, it's the same code for the gradient) (oh, also notice odd coordinates work well):



Here are the basic things I still need to do before we have a first beta version of SDL for the TI-Nspire:
- Get the BMP blitting to work
- Fix the events (it currently sends loads of them and at inappropriate moments; also some stuff with the joystick I need to fix)
- Implement the timers system fully
(- Add own function to blit images from array data)

Those are the most important things and the first things that come to my mind.

BTW, on my calculator performance-wise it seems quite fast, it's rather snappy and responsive although it's updating the whole screen every time and a lot more than it should (event system that needs working on). It's a very simple program but it's good to see it runs fast.
« Last Edit: March 04, 2012, 05:55:29 pm by hoffa »

Offline atiatinini

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: SDL for the TI-Nspire
« Reply #72 on: March 04, 2012, 06:10:14 pm »
Nice, keep up the good work!  ;)

Also, will it be possible to port VisualBoyAdvance? It's SDL-based.  :D

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #73 on: March 04, 2012, 06:13:18 pm »
Nice, keep up the good work!  ;)

Also, will it be possible to port VisualBoyAdvance? It's SDL-based.  :D
Depends what exactly are the libraries used by VBA, but sure, with some trimming it shouldn't be too big of an issue.
EDIT: Reo, are you sure about it? I honestly don't have an idea, but VBA might be optimized quite a bit as it's already a robust and mature program.
« Last Edit: March 05, 2012, 11:09:27 am by hoffa »

Offline Reo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +15/-0
    • View Profile
Re: SDL for the TI-Nspire
« Reply #74 on: March 04, 2012, 06:13:31 pm »
Nice, keep up the good work!  ;)

Also, will it be possible to port VisualBoyAdvance? It's SDL-based.  :D

It wouldn't run at any kind of playable speed. The closest anybody would get toward a playable experience is a port of gpsp.