Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Adriweb

Pages: 1 ... 88 89 [90] 91 92 ... 115
1336
Lua / Re: Lua 'XML' reader
« on: December 18, 2011, 03:28:55 pm »
Good for me ;)

1337
Lua / Re: Lua 'XML' reader
« on: December 18, 2011, 03:03:55 pm »
here's an even more improved version :

Code: [Select]
-- Adriweb
-- TI-Planet

-- Original Idea by Nick Steen, Some things added by Extended

platform.apilevel = '1.0'

count = 0

markup = {
 {ttl = "hello"},
 {txt = "hallo"},
 {center = {txt = "centered text"} },
 {txt = "goodbye"},
 {bold = {txt = "oh wait ! bold text !!"} },
 {img = "\016\000\000\000\018\000\000\000\000\000\000\000 \000\000\000\016\000\001\000\156\243\156\243\156\243\189\247\213\222\235\193\136\181g\181\135\181g\181\137\185O\202\189\247\156\243\156\243\156\243\156\243\156\243{\239O\206\168\222F\243D\243d\247d\247#\243\004\235E\214\170\1858\231\156\243\156\243\156\243\213\222m\210\231\230d\247\132\251\195\255\131\255\131\255\131\255C\251\003\247\132\226\233\193r\210z\239\156\243\204\189\198\226\132\247\166\218\007\198\198\226\195\255\131\255#\243\231\197\007\198\002\251\131\230\135\185\246\222\212\218g\210D\243\166\218\166\218\197\226D\239\131\255\131\255C\247\165\218d\222\006\206\194\242\196\205O\206\170\185\005\239\131\255\197\226D\239\131\255\131\255\131\255\131\255C\251\034\255\002\255E\218\226\250b\234\167\193G\173C\247\131\255\131\255\130\218\001\198\162\222\131\255c\251\002\243\161\197\161\197\226\250\226\250\162\246\133\193f\181#\243C\251\131\255\194\193\194\156\002\202C\251\034\255\162\234\194\156\194\156\193\250\193\254\193\254\133\193g\181\003\247c\251\034\255\196\230e\218\196\234\034\255\034\255\226\242%\218%\218\226\250\226\250\161\254\133\193&\169\226\242\034\255\034\255\034\255\034\255\034\255\002\255\002\255\193\254\193\254\226\250\161\254\161\254\161\254d\189G\173\163\234\002\255\226\242\194\242\163\234\162\242\162\242\162\242\130\238\130\242B\242\130\242\162\246B\242\133\193\014\198E\214\194\242f\181\198\156\231\156\231\156\231\156\231\156\231\156\231\156\198\156\231\156B\242\227\213\235\197Y\235\136\185\130\238\193\254\132\189s\206\222\251\222\251\222\251\222\251{\239\198\156\130\242\129\254d\189\179\214\156\243\237\193\196\205\162\242\162\242\198\201)\165)\165)\165)\165H\173B\242\129\254\227\213\169\193\023\227\156\243z\239\137\185\034\226\162\246\130\242B\234\034\230\034\230B\234\034\234\129\254\130\242D\181\213\222\156\243\156\243\156\243\023\227\201\197\002\222\162\246\161\254\129\254\161\254\129\254\129\250\034\234d\189\147\214\156\243\156\243\156\243\156\243\156\243\246\222\011\206\196\205\002\222B\238\034\238\034\230\196\209\165\197\147\214{\239\156\243\156\243\156\243\189\247\156\243\156\243\023\227p\210\011\206\198\205\198\205\232\205O\210\147\214\156\243\156\243\156\243\156\243"},
 {txt = "really, goodbye"}
}

function on.paint(gc)
   if go then
       go = false
       print("----")
       Parse(gc, markup, {centered=false})
       count = 0
   end
end

function Parse(gc, data, options)
    for i, v in ipairs(data) do
        local t = type(v)
        if t == "table" then
            if v.ttl then count = count + 1 gc:setFont("serif","b",18) myPrint(gc, v.ttl, count-1, {})
            elseif v.txt then gc:setFont("serif","r",12) myPrint(gc, v.txt, count, options)
            elseif v.img then local tmpImg = image.new(v.img) gc:drawImage(tmpImg,0,image.height(tmpImg)*(count-2)) print('Image displayed')
            elseif v.center then Parse(gc, {v.center}, {centered=true})
            elseif v.bold then Parse(gc, {v.bold}, {bold=true})
            end
            count = count + 1
        else
            print("what's going on here ?")
            myPrint(gc, v, count, {centered=false})
        end
    end
end

function drawXCenteredString(gc,str,y)
    gc:drawString(str, (pww() - gc:getStringWidth(str)) / 2, y, "top")
end

function myPrint(gc, string, y, options)
    if options.centered then
        drawXCenteredString(gc,string,14*y)
    elseif options.bold then
        gc:setFont("serif","b",12)       
        gc:drawString(string,1,14*y,"top")
    else
        gc:drawString(string,1,14*y,"top")
    end
    print(string)
end
 
function pww()
    return platform.window:width()
end

function pwh()
    return platform.window:height()
end

function on.enterKey()
    go = true
end



It does that :



from :

Code: [Select]
markup = {
 {ttl = "hello"},
 {txt = "hallo"},
 {center = {txt = "centered text"} },
 {txt = "goodbye"},
 {bold = {txt = "oh wait ! bold text !!"} },
 {img = //image-string//},
 {txt = "really, goodbye"}
}

1338
Lua / Re: Lua 'XML' reader
« on: December 18, 2011, 05:47:57 am »
Good idea, Extended, though the xml syntax itself tends to disappear now... :P

Anyway, Nick succeded to set up his GitHub account !

Here's this project :

https://github.com/NickSteen/Lua-XML-reader/

1339
Lua / Re: Lua 'XML' reader
« on: December 18, 2011, 04:45:27 am »
because i (well, not i, just the calc xp) read the line, and seperate the tags, i can easely add them if you want to, it's 2 seconds of work, i just thought it would be easier to not use them as it work per line (the tag ends at the end of the string).
Oh, it's not a bad idea you had, I was just asking out of curiosity ! :)

and i'm having a look at that github, it would be a good idea to post it there, for having the most recent version every time
Exactly  !
I recommand using SmartGit (on Windows) and GitHub for Mac (well, on Mac :P).
Once you know how to use Git/Github, it's really awesome :)
And it's like an onlince backup of your stuff... this is a lifesaver sometimes...

1340
Lua / Re: Lua 'XML' reader
« on: December 18, 2011, 04:23:56 am »
Oh, nice !
:D

( Y U NO endtags ? )

You have so many projects you should put them all (their source) on GitHub, it's really good, there :)

1341
News / Re: nDoom for the CX at the horizon
« on: December 17, 2011, 04:20:13 pm »
I went farther than Levak :D

1342
TI-Nspire / Re: [Lua] Gravity guy
« on: December 15, 2011, 04:31:24 pm »
Nice !!

By linear gravity, I'm not sure what you mean ...

If it looks good ingame, it's ... good enough ? :D

Approimating real gravity shouldn't be really difficult...
It could just use more cpu if calculations get called rather often...

Do you have an animated screenshot ? ;)

1343
Lua / Re: Stopwatch - Lua Timer Accuracy
« on: December 11, 2011, 03:53:15 pm »
you could use the timer.getMilliSecCounter instead, because the timer isn't correct at all..
if you store the start millisec and increment by the current millisec, you get the millisec that are passed since the start of the program.
when you divide by 1000, you get the nr of seconds (and take the math.floor() of it)

Of course... I actually assumed he was using it, I must have misread then :P

And yes, it will be much more precise :)

1344
Lua / Re: Stopwatch - Lua Timer Accuracy
« on: December 11, 2011, 01:57:32 pm »
Not sure...

TI made a Lua script for a stopwatch, you can download it here : http://tiplanet.org/forum/archives_voir.php?id=3613&play= (click on the "Télécharger" button)

1345
We have asked (Jim, I believe) TI to put some more unicode support, so maybe it will be better soon :-)

1346
TI-Nspire / Re: Bomberman
« on: December 11, 2011, 08:03:01 am »
Nick, this is awesome.

And As I see all your projects you're doing, I really want you to share with us your Time Turner (that Hermione uses to attend multiple classes at the same time)... because I have no idea otherwise how you manage to have time to do all these O_O

1347
Lua / Re: Lua on calc guide
« on: December 11, 2011, 07:58:59 am »
Yes, TI plans to have a Lua SDK in 2012, as announced on their site ;)
(which some of us here -levak, critor, jimbauwens and myself) are alpha/beta-testing, but here we can't talk about it, really :P)

1348
Lua / Re: Lua on calc guide
« on: December 11, 2011, 06:01:41 am »
You could first download all the pages you want to be in your app, then make some kind of script (in whatever language you want) that reads the html output (or the wiki source directly...) and formats everything the way you want for your guide.

If everything is all correctly setup, it would really be easy to get new updates on your guide when they get avilable on the wiki ;)

A while ago, I asked TI if they could provide some xml formatted API documentation, with everything in a known format. It would be used in their Lua SDK but could be a great help for the wiki too and your program, for example.

I dont know if they did it or plan to do so.... I'll ask them again :P

1349
Lua / Re: Lua on calc guide
« on: December 10, 2011, 02:57:05 pm »
So.... Inspired-Lua-Wiki in the pocket ? :D

Very nice, really :)

Will be a nice thing to program on OcLua when you have that along :)


I'll have to translate that into french, too :)

1350
TI-Nspire / Re: TI-Nspire GB Emulator
« on: December 10, 2011, 02:50:19 pm »
Very nice !

Indeed in my video, I didn't about its orientation(portrait)... >.>


(the screen brightness and contrast are so good in the video we can think it's fake lol)

Pages: 1 ... 88 89 [90] 91 92 ... 115