Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 124 users online: 12 members, 89 guests and 23 bots. Members: Ashbad, builderboy2005, geekboy1011, HOMER-16, Link, tifreak8x, xologist. Bots: Spinn3r (2), MSN/Bing (1), Magpie Crawler (2), Googlebot (17), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
helder7
Member

Joined: 23 Dec 2011 Posts: 136
|
Posted: 19 Aug 2012 05:57:11 am Post subject: |
|
|
Go Kerm, keep the good work!
About nspire lua compatibility, will include physics engine (3.2)? _________________ SiO2 + CaCO3 ----------> CaSiO3 + CO2 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 19 Aug 2012 07:45:22 am Post subject: |
|
|
To back up your vsnprintf example, in trying to pull in libc's code, I needed about 10 different files, and about 20 other dependencies that I pulled select pieces of code from to avoid having to pull in even more dependencies. There were general set/long jmp headers, SH-specific ones, SH4-specific ones, sysdep, the SH sysdep, and much more. The same thing happened when I tried to pull in a tiny piece of the locale system, only to throw up my hands five hours later and hard-code the locale. _________________
 |
|
| Back to top |
|
|
vebveb
Newbie

Joined: 02 Jul 2012 Posts: 24
|
Posted: 19 Aug 2012 08:22:41 am Post subject: |
|
|
| Yes, but we could just take some parts of the code to use specific features. For example we'll need an implementation of the %f %g %e options for printf, and as I said in an other topic, we can find it in glibc sources. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 21 Aug 2012 09:41:40 am Post subject: |
|
|
*bump* To keep you all updated, the zmg library continues, and I continue to debug running lua scripts from disk. Currently, something with fopen/fread is going wonky. Also, documentation:
http://prizm.cemetech.net/index.php?title=LuaZM_Reference _________________
 |
|
| Back to top |
|
|
merthsoft
File Archiver

Joined: 09 May 2010 Posts: 2735
|
Posted: 21 Aug 2012 09:51:05 am Post subject: |
|
|
I have a couple things to talk about. One is naming. I think all-lowercase-naming is a pretty bad idea. I think Pascal case is the way to go: zmg.DrawLine(), zmg.CopySpriteMask(), etc. This will make it easier to read. I'd also be OK with camel case or even underscores, just so long as there's something to separate the words and make reading it faster.
I notice that for colors it's a number. Is it possible to have a color class instead? I think that would make the most sense, especially since we have the color constants right now (shamelessly dumped from the C# color definitions). And then people can do zmg.Color.Red (or however it would look). If we want to take a cue from C# we can even do a Color.FromName(string) in place of something like zmg.nametocolor("red"). There could be a couple constructors, one that just takes in an int16, and one that takes in the RGB values individually.
As I mentioned in IRC, whether the function clips or not should be an optional parameter at the end of all the graphics calls. It should probably default to True.
The sprites should just be a DrawSprite, and then pass in logic (I assume there are enums): copy, xor, and, or, whatever. This could also be optional with the default as probably copy. And possibly include an optional mask param so that function is also wrapped into this one (though I'm not 100% on that--is masking distinct enough to be its own thing?). _________________ Shaun
Last edited by merthsoft on 21 Aug 2012 10:50:22 am; edited 1 time in total |
|
| Back to top |
|
|
Deep Thought

Expert

Joined: 11 Mar 2010 Posts: 739 Location: The Universe
|
Posted: 21 Aug 2012 10:43:34 am Post subject: |
|
|
In case you're wondering (on the topic of case in function names), on the Nspire there are two forms. The standard Lua functions are all-lowercase (according to the Lua spec), but TI's official functions are all in camelCase (for example, in the extended Lua library).
So if you move away from the usual all-lowercase function names, you could use camelCase to add readability while making it still feel close to the Nspire Lua interpreter.
(All class names on the Nspire are in PascalCase, by the way.) _________________
  |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 896 Location: Akron, OH
|
Posted: 21 Aug 2012 10:51:50 am Post subject: |
|
|
Is there a release of this yet? _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 21 Aug 2012 11:37:50 am Post subject: |
|
|
Shaun and Deep Thought: I had made my function names (or are they methods?) all lowercase as per the Lua convention, but I personally prefer camelCase or some other distinctive casing. I would be happy to switch to camelCase, as long as no one objects.
Shaun:
:: As you may note in the zmg.drawcolor() documentation, I did indeed plan to have at least a function to take a color name like "red" and turn it into the requisite number. A zmg.color.* (table? I really need to get the nomenclature down) would be even better, I think, but those would still just boil down to numbers.
:: Actually, I'm not even convinced that there's value in having routines to or/and/xor on a color screen; it might be better to just offer overwriting or masking as the two options. I wonder if there's value in returning a string of the old contents of the area for easy restoration, at least in one version.
Edit: Flyingfisch: No. Be patient. _________________
 |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 896 Location: Akron, OH
|
Posted: 21 Aug 2012 11:44:04 am Post subject: |
|
|
| KermMartian wrote: | ...
I would be happy to switch to camelCase, as long as no one objects.
...
Edit: Flyingfisch: No. Be patient. |
I don't object to camelCase, I use it in my lua code all the time.
I will be patient.
I was just wondering because I thought I saw someone post a luaZM demo, but now that I can't find it, it seems that it must have been a figment of my imagination. Sorry.  _________________

 
 |
|
| Back to top |
|
|
merthsoft
File Archiver

Joined: 09 May 2010 Posts: 2735
|
Posted: 21 Aug 2012 11:51:27 am Post subject: |
|
|
| KermMartian wrote: | | Shaun and Deep Thought: I had made my function names (or are they methods?) all lowercase as per the Lua convention, but I personally prefer camelCase or some other distinctive casing. I would be happy to switch to camelCase, as long as no one objects. | I think camel or Pascal case would be favorable. (My vote is Pascal case. Then camel case.)
| KermMartian wrote: | Shaun:
:: As you may note in the zmg.drawcolor() documentation, I did indeed plan to have at least a function to take a color name like "red" and turn it into the requisite number. | I know you had a plan to do this, that's why I said
| Quote: | | If we want to take a cue from C# we can even do a Color.FromName(string) in place of something like zmg.nametocolor("red"). | zmg.nametocolor("red") is taken right from your documentation. My point is that if we have a color class, it can go in there and be all encapsulated and stuff.
| KermMartian wrote: | | A zmg.color.* (table? I really need to get the nomenclature down) would be even better, I think, but those would still just boil down to numbers. | Well, everything in programming just boils down to numbers, so, yes, it would just boil down to numbers. Type safety is a good thing, though, and using a class (or table, or whatever Lua uses) is a more idealistic solution than just numbers or defines. That being said, I don't know how Lua is meant to handle these things. I would expect static objects in the class, but I don't even know if Lua has proper classes, in which class static defines in the namespace or something (clearly there's something like a namespace if you can do zmg.*). I'd even be willing to investigate and work on this if you want to work on something else. Is the code available somewhere for me? I promise I won't break it
| ibid. wrote: | | :: Actually, I'm not even convinced that there's value in having routines to or/and/xor on a color screen; it might be better to just offer overwriting or masking as the two options. I wonder if there's value in returning a string of the old contents of the area for easy restoration, at least in one version. | I think that's a good point--do we want or/and/xor in something like this? Perhaps instead of returning the data, there can just be a function, like, getRect() or something that gets the data in the specified rectangle. _________________ Shaun |
|
| Back to top |
|
|
vebveb
Newbie

Joined: 02 Jul 2012 Posts: 24
|
Posted: 22 Aug 2012 03:53:13 am Post subject: |
|
|
| Well, you can put many names to call the same function: a name in lowercase, a name in camelCase and a name in Pascal case. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 22 Aug 2012 09:09:57 am Post subject: |
|
|
That's true, but we should think of a primary casing for consistency and documentation. I went with camelCase, and updated both the code and the reference page accordingly.
Shaun: I removed the xor routine and made copySprite do clipping. I think I will keep copySpriteMask a separate routine for now, but also add clipping for that. And I agree that two VRAM-reading functions are needed: one to read the color of a single pixel (a la pxlTest() ) and one to read out a string representing a rectangular area that could by copySprite'd back to the LCD.
Regarding troubles opening Lua files on-calc: fgetc was broken. A fix is pending in libfxcg/libc from AHelper. _________________
 |
|
| Back to top |
|
|
merthsoft
File Archiver

Joined: 09 May 2010 Posts: 2735
|
Posted: 22 Aug 2012 09:37:44 am Post subject: |
|
|
| KermMartian wrote: | That's true, but we should think of a primary casing for consistency and documentation. I went with camelCase, and updated both the code and the reference page accordingly.
Shaun: I removed the xor routine and made copySprite do clipping. I think I will keep copySpriteMask a separate routine for now, but also add clipping for that. And I agree that two VRAM-reading functions are needed: one to read the color of a single pixel (a la pxlTest() ) and one to read out a string representing a rectangular area that could by copySprite'd back to the LCD.
Regarding troubles opening Lua files on-calc: fgetc was broken. A fix is pending in libfxcg/libc from AHelper. | All this sounds great. Out of curiosity, what do you mean by a "string representation"? Shouldn't it be an array of colors? Or at the least an array of shorts. _________________ Shaun |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 22 Aug 2012 11:34:13 am Post subject: |
|
|
Well, sprites are going to be passed in as ASCII-encoded hex, like "F5008704..." etc. It makes sense to spit out strings like that, too, so that they can easily be passed back in. _________________
 |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 896 Location: Akron, OH
|
Posted: 22 Aug 2012 11:51:54 am Post subject: |
|
|
| KermMartian wrote: | | Well, sprites are going to be passed in as ASCII-encoded hex, like "F5008704..." etc. It makes sense to spit out strings like that, too, so that they can easily be passed back in. |
Oh, like in LuaFX? We pass sprites as string in LuaFX also. _________________

 
 |
|
| Back to top |
|
|
vebveb
Newbie

Joined: 02 Jul 2012 Posts: 24
|
Posted: 22 Aug 2012 11:53:36 am Post subject: |
|
|
| It is because it's the type that uses the less memory and because it is easy to read a lua string in C (tables are difficult to read for example) |
|
| Back to top |
|
|
merthsoft
File Archiver

Joined: 09 May 2010 Posts: 2735
|
Posted: 22 Aug 2012 11:56:39 am Post subject: |
|
|
| KermMartian wrote: | | Well, sprites are going to be passed in as ASCII-encoded hex, like "F5008704..." etc. It makes sense to spit out strings like that, too, so that they can easily be passed back in. | Ah, ok. Then I would expect to be able to pass around colors as strings as well in any function that takes colors (or if we go the color class route, have a constructor or static creator method that takes in a string). _________________ Shaun |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
Posted: 22 Aug 2012 12:39:10 pm Post subject: |
|
|
| vebveb wrote: | | It is because it's the type that uses the less memory and because it is easy to read a lua string in C (tables are difficult to read for example) | Indeed. How about something like zmg.color.red and zmg.color.blue, though, vebveb? How hard would that be to create? _________________
 |
|
| Back to top |
|
|
AHelper

LONG LIVE COMICTECH

Joined: 30 Jan 2011 Posts: 1661 Location: Aufhelperstan, Utopian Republic
|
Posted: 22 Aug 2012 12:57:08 pm Post subject: |
|
|
KermM, I have a serialized sprite format that can contains multiple variable-sized sprites (with meta-data), compressed using LZ77. I can send you the specs to the format, the file parser, and PC build tools for it If you are going to have large sprites, then you would have very large character strings (Not saying to replace, just another option.) _________________ °ᴥ° Get Lucky
<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol." |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.042451 seconds.
|