Project: Cplua
#801
Posted 04 February 2007 - 11:03 AM
#802
Posted 27 February 2007 - 02:04 AM
Can you add a vertical font, and their respective draw.text() variants to the next CPLua release?. and a new "microfont'' (The same as the AFX series font that you see when you use drawtext).
a vertical microfont would be really useful in order to display huge data on screen when placed horizontally .
I can post here all the characters if you want
#803 Guest_LuaMania_*
Posted 20 April 2007 - 01:03 AM
#804
Posted 22 April 2007 - 09:39 AM
Well, these are two rather unrelated things.I just read a post where someone wrote their program in CPBasic only because it can be called from Main in OS 3.0. What are the odds of having a Main-like window in CPLua?
The first thing is that you will (most certainly) never be able to call a Lua function from the ClassPad "Main" application. This would suppose that you could interact with an Add-In from that application, and it's absolutely not supported at the moment.
The second thing is that you could imagine having a Main-like window inside CPLua, but interactions with the Lua language itself wouldn't be easy. The "interactive" mode of CPLua is a kind of solution to this (and actually it has nothing to do with the Main application), but its main weakness is that the "natural display" (writing formula's in 2D) is currently unsupported. But perhaps this could be improved later
#805
Posted 16 June 2007 - 06:27 AM
I can share my programs but i don't like to share the code. I think it is usefull the make a compress mode as Basic.
#806
Posted 09 July 2007 - 07:54 PM
Studies are definitively over ( ), I have 2 months free now, so let's do something great
Sorry for the long time without news: I have been horribly this year, and I couldn't take much time to work on CPLua until now.
I already created a new mathedit component for the UI package, to input/display 2D math expressions. There are several things I'd like to add/improve, and I must write the documentation too (finally )
But first I'd like to know what needs to be corrected in CPLua 0.9D. I know that drawing operations are a lot slower than in version 0.8, and I will take care of that I also think that there were some issues with memory management
In the meantime, I'd like to have your opinion for some changes about the draw package. I plan to add some new useful functions like arc(), ellipse(), patternline() etc, but I also think of changing the way to define the style:
Actually to draw a black rectangle and a black circle filled in white with a width of 2 pixels, one would write this:
draw.rect(x1, y1, x2, y2, 2, COL_BLACK, COL_WHITE) draw.circle(x, y, r, 2, COL_BLACK, COL_WHITE)I'm currently thinking of something like this:
draw.setstyle{width=2, border="black", fill="white"} draw.rect(x1, y1, x2, y2) draw.circle(x, y, r)Of course there would be a draw.getstyle() function too to get the current "default" style. And each drawing function would accept a last optional parameters, which would be a specific style overriding the default one.
For example, if you want the circle to have a width of 4 pixels instead:
draw.setstyle{width=2, border="black", fill="white"} draw.rect(x1, y1, x2, y2) draw.circle(x, y, r, {width=4})It's not shorter than the code we would write in the current versions (with arguments "COL_BLACK" etc etc), but I think it is clearer and easier to remember. I would like to have your opinion about that anyways
How, and I'm thinking of similar functions draw.setfont{} and draw.getfont{} too
About compressed files: There should be possible to do something like that, but it is not a real priority at the moment
#807
Posted 10 July 2007 - 10:18 AM
Yayyy . Welcome back.Okay let's go back after a long break
Studies are definitively over ( ), I have 2 months free now, so let's do something great
I definitely prefer the first (current) approach, a thing which is obvious by the way I have written LNA. If I remeber well, we had had a long conversation about this, more than 1 year ago. The second approach reminds me how GTK+ is implemented. If you will ever use GTK+, you will know how inconvenient it is.I also think of changing the way to define the style:
Actually to draw a black rectangle and a black circle filled in white with a width of 2 pixels, one would write this:draw.rect(x1, y1, x2, y2, 2, COL_BLACK, COL_WHITE) draw.circle(x, y, r, 2, COL_BLACK, COL_WHITE)I'm currently thinking of something like this:draw.setstyle{width=2, border="black", fill="white"} draw.rect(x1, y1, x2, y2) draw.circle(x, y, r)
IMHO, it's not clearer nor easier to remember. Furthermore, one needs to issue multiple setstyle() commands if, for example, he wants to draw several rectangles and/or circles with different borders (one with thick border, one with thin border, then again one with thick border, etc).It's not shorter than the code we would write in the current versions (with arguments "COL_BLACK" etc etc), but I think it is clearer and easier to remember. I would like to have your opinion about that anyways
I agree, this should have a very low priority.About compressed files: There should be possible to do something like that, but it is not a real priority at the moment
#808
Posted 12 July 2007 - 09:15 PM
And, pleased to see you back here.
#809
Posted 25 July 2007 - 04:54 PM
Nonono, I'm still here and guess what I have now...
CPLua version 0.9E
I've been working hard during these last days, I hope you will like the changes. So what's new:
- New UI components: Dialogs and MathEdit
You can now create your own custom dialogs to display a message, ask for a specific input etc. There are also some predefined dialogs, to display a simple message or ask for a filename.
There is also the new mathedit component, which can be used to display/input 2D math expressions For example it is now very easy to create a dialog replicating the CPBasic "PrintNatural" command. I'll try to add some other examples soon.
- Faster screen update
The drawing operations on the screen were faster with CPLua 0.8, because of the predefined size of the Graph Window. Now that this window can be resized with the UI package, the function needed to update the screen is more complicated and is thus slower. I have completely rewritten this function, and it's now a bit faster than the previous CPLua 0.9 versions (but of course not as fast as CPLua 0.8).
- Timers for UI windows and widgets
The UI Window and Widgets can now use timers to execute some code periodically or after a given time. This is useful e.g. for windows/widgets that need to update themselves periodically, for example to display the current hour etc The default precision is 0.5 seconds: I will try to implement another solution for programs needing to measure time more accurately
- Expandable UI Windows
If you don't specify the size of a new UI Window, it will expand to fit the screen and resize itself automatically if you show/hide the keypad
- New drawing functions
The functions draw.polygon(), draw.patternline(), draw.fill(), draw.textsize() are now available. I wanted to create draw.ellipse() and draw.arc() too, bug there is a bug in the SDK so it won't work correctly
- Support of *.lua files on the emulator
The emulator has now 2 special commands ("Import" & "Export") to open/save a Lua file (*.lua or *.txt) on the computer. It's just a small feature to avoid frequent copy/paste operations
As allways, I need your comments
Another thing: I'm also thinking about CPLua's documentation, especially about the functions and packages reference. I was looking for a good way to document the different functions and packages available in CPLua, as well as the new packages and libraries (like LNA etc) created by the users.
I finally thought that XML would be a good idea; I wrote a first Schema to define the syntax of a Lua XML Reference document, and here is an example of a valid file.
The advantage of using XML is that online (HTML) documentation and PDF documents can be easily and automatically generated from these files And I plan to create a kind of "Help Browser" for CPLua, with a tool to convert such files into compressed MCS files, which means that we will be able to consult this documentation directly on the handheld
Of course I'd like to have your opinion about this too (maybe there is something missing in the syntax etc)
#810
Posted 25 July 2007 - 09:58 PM
The most interesting thing (in my opinion, of course) is the draw.patternline() and draw.fill() functions (which will be used by the new LNA version), and the ability to import lua files (which I'm going to check soon). Expect a test report concerning these features in the next few days.Nonono, I'm still here and guess what I have now...
As allways, I need your comments
I don't use the UI package because it needs memory, and it was unstable in version 0.9D (I've got plenty of crashes, as I have reported here some months ago). Is it stable now?
I suggest to use LaTeX, the de facto standard for creating professional documents. LaTeX is, in fact, a huge set of macros based on a programming language called TeX. Although the resulting printed document is excellent, it is rather difficult to learn LaTeX. Fortunately, there is a front-end, called LyX, which makes things much easier. LaTeX documents can be easily exported to anything, including PDF and HTML, among others. There is a problem, however: LaTeX and LyX are a part of any <{GNULINUX}> distribution, but if you use Window$, you will need to download several programs to make it working properly. If you feel adventurous, give it a try. You will never want to use stupid Word processors anymore. XML is not a bad idea anyway, and it is related to LaTeX.I finally thought that XML would be a good idea; I wrote a first Schema to define the syntax of a Lua XML Reference document, and here is an example of a valid file.
Btw, as you can guess, LNA's documentation is entirely written in LyX .
#811
Posted 25 July 2007 - 10:18 PM
Of course, because almost everything else concerns the UI package and you don't use it This package is the most advanced feature of CPLua btw, and the major addition of CPLua 0.9 Thus it's normal for me to work on it with top priority for the moment But don't worry, it's almost complete.The most interesting thing (in my opinion, of course) is the draw.patternline() and draw.fill() functions (which will be used by the new LNA version), and the ability to import lua files (which I'm going to check soon). Expect a test report concerning these features in the next few days.
I've made a lot of tests during the last days and changed several things. I didn't see any crash - or when I saw one I fixed it immediatly. I don't see why it would use a lot of memory btw I'll read the topic again to check your old reportsI don't use the UI package because it needs memory, and it was unstable in version 0.9D (I've got plenty of crashes, as I have reported here some months ago). Is it stable now?
Well... As you may guess, I don't like LaTeX. I never tried LyX however, I'm gonna take a look someday But I must be sure that anyone will be able to convert such document into a MCS data file for CPLua, and I'm almost certain that it will be a lot easier to use a XML parser than a LyX processorI suggest to use LaTeX, the de facto standard for creating professional documents. LaTeX is, in fact, a huge set of macros based on a programming language called TeX. Although the resulting printed document is excellent, it is rather difficult to learn LaTeX.
Edit (after a quick glance on Lyx): No, this is not what I need. I need a way to exactly specify the nature of the document's content, not its format. For what I've seen, LyX seems like a sophisticated tool to define the appearance of a document, exactly like HTML - but a lot more powerful. I absolutely don't care about the appearance here: I just want to list the Lua packages, functions, and methods, and describe it precisely (like in a database). Then I'll join a stylesheet or use a XML parser to get the information I need and format it in a convenient way, but this is another story Take a look at the example file, you should see what I mean
#812
Posted 26 July 2007 - 11:31 AM
PD: when I run anyone of your examples I get an error: bad argument #1 to 'window' ('exand' used with dimensions)
it doesn't appear in CPLua 0.9D
#813
Posted 26 July 2007 - 12:05 PM
For example, how can I draw a 1-pixel on - 1-pixel off line, or a 1-pixel on - 4-pixels off line?
Good idea, although I think that just typing the keyword is faster than searching for it in the "cat" menu.Maybe you can put all the CPLua's functios in the virtual keyboard->cat, but only when you enter in the CPLua not in the basic... is that possible?
#814
Posted 26 July 2007 - 12:15 PM
For example, how can I draw a 1-pixel on - 1-pixel off line?
0b10101010 10101010 10101010 10101010 10101010 10101010 10101010 10101010
=0xAAAAAAAA
#815
Posted 26 July 2007 - 01:00 PM
It could be... I will see But personnaly I think it will be more useful to have a complete page with CPLua reference than just a list in the keypadMaybe you can put all the CPLua's functios in the virtual keyboard->cat, but only when you enter in the CPLua not in the basic... is that possible?
Oops, I forgot to change the examples :oops:PD: when I run anyone of your examples I get an error: bad argument #1 to 'window' ('exand' used with dimensions)
it doesn't appear in CPLua 0.9D
Indeed, with CPLua 0.9E you cannot use "expand" and x/y/width/height at the same time anymore. Just remove "expand=..." and it will work again
> PAP: It's not easy to explain exactly how the pattern works Think about the binary representation (1 pixel = 1 bit, like in vanhoa'example), then convert it to hexadecimal
#816
Posted 26 July 2007 - 01:09 PM
pattern (32 pixels): 10000100001000010000100001000010
binary: 1000 0100 0010 0001 0000 1000 0100 0010
hexadecimal: 84210842
-> pattern string: "84210842"
Of course the pattern won't be "perfect" here, because the max length is 32 pixels (which is not dividable by 5 (=1+4) ).
#817
Posted 26 July 2007 - 01:13 PM
Ok, I think I've already figured it out. But why strictly 8 hex digits? It would be better if the user could supply up to 8 digits (not exactly 8), so that, "A" means 1-dot on - 1-dot off. As it is now, some patterns cannot be implemented. For example, 1-dot on - 4-dots off can be given with 5 digits only: "84210". However, the user is forced to supply 3 more digits, so, as it is now, 1-dot on - 4-dots off cannot be implemented.> PAP: It's not easy to explain exactly how the pattern works Think about the binary representation (1 pixel = 1 bit, like in vanhoa'example), then convert it to hexadecimal
#818
Posted 26 July 2007 - 01:28 PM
The function of the SDK is:
void PegScreen::PatternLine ( PegThing * Caller, SIGNED wXStart, SIGNED wYStart, SIGNED wXEnd, SIGNED wYEnd, PegColor & Color, SIGNED wWidth, DWORD dPattern, UCHAR Rop = RF_SRCCOPY ) This function draws a dashed line. The dash pattern is determined by the dPattern value. For example, a dPattern value of 0xf0f0f0f0 would draw a line alternating between 4 pixels on and four pixels off.
As you can see I didn't write it myself
Btw, I just noticed that this function applies the pattern from the beggining AND from the end of the line, which could give some strange results at the center
Well, you see the kind of things we have to manage with the SDK
#819
Posted 26 July 2007 - 02:00 PM
Yes, I've already noticed that. I had changed the way grid is implemented in LNAplot, so that draw.patternline() is used. However, the dashed grid line is messed up near the center, plus there is no noticeable speed up, compared to a simple do-loop drawing pixels. So, I decided not to use draw.patternline() at all.Btw, I just noticed that this function applies the pattern from the beggining AND from the end of the line, which could give some strange results at the center
Obviously, the SDK could be much better...Well, you see the kind of things we have to manage with the SDK
#820
Posted 26 July 2007 - 02:02 PM
It shouldn't take long to fix it
#821
Posted 26 July 2007 - 02:55 PM
I modified the first UI example too.
Thanks for your reports
#822
Posted 26 July 2007 - 06:13 PM
Good idea, although I think that just typing the keyword is faster than searching for it in the "cat" menu.
Yes is more faster type the function, but you could use it when you forget some function, like a help browser (more or less)...
It could be... I will see But personnaly I think it will be more useful to have a complete page with CPLua reference than just a list in the keypad
What do you mean with "complete page with CPLua reference" explain more please...
Can you make any more examples with the new things of ui package and draw function. Thanks.
#823 Guest_giov_roger_*
Posted 02 August 2007 - 03:33 PM
CPLua 0.9D
1) Run the interactive mode
2) any way you can get the >> prompt (type "_VERSION" for example)
3) tap the classpad's menu icon (lower part of the touch screen)
i'm guessing an infinite loop.
#824
Posted 02 August 2007 - 07:48 PM
Thanks for your report, it will be fixed soon
#825
Posted 29 August 2007 - 08:14 PM
But in the ui package there are some bugs.
Because I have canceled a "dialog.save"-function the OS of my ClassPad can't be loaded without any errors!
The dialogs often can't be closed so that no fatal error ocurres!
I spend a lot of time to program some things with CPLua but it's not good to damage the OS by this application.
It would be really great if you could fix this bugs!
#826
Posted 29 August 2007 - 10:26 PM
What makes you say that?
Could you give me more details about this? I'm afraid I don't really understand what you did and what happenedBecause I have canceled a "dialog.save"-function the OS of my ClassPad can't be loaded without any errors!
The dialogs often can't be closed so that no fatal error ocurres!
And did you ask for a picture, a text file or a data file name with dialog.save?
#827
Posted 04 September 2007 - 11:54 AM
The errors sometimes appeared when I closed a dialog which had no variable to hold the "closed" status.
#828
Posted 04 September 2007 - 07:18 PM
#829
Posted 06 September 2007 - 09:46 AM
It was about:
require "ui" "draw" ... pict.save(p,dialog.save("pict"))As the dialog appeared I cancelled it and then the Big Error came...
I don't exactly remember the arguments...
But don't try it with the ClassPad!!! I do not know what will happen but it's better for the CP...
#830 Guest_Carlos Marquez_*
Posted 20 October 2007 - 01:50 PM
No corren los programas hechos en CPLua 9D.
Muestra error.
Por favor alguien podria ayudarme.
#831
Posted 03 November 2007 - 06:52 PM
I have problem with all ui examples on my CP (CPLua 0.9E). When I run it this error occurs "bad argument #1 to 'window' ('expand' used with dimensions)" but on PC it works ok! What is wrong?
#832
Posted 05 November 2007 - 10:15 PM
Orwell
(D*mn, I really must release at least the final version of CPLua... If only I had enough time for it )
#833
Posted 06 November 2007 - 06:15 AM
Orwell
(D*mn, I really must release at least the final version of CPLua... If only I had enough time for it )
We are waiting it, you have made the most important add in for the classpad and it isn't finished yed
Good luck and try to get some time for CPLua
#834
Posted 30 November 2007 - 09:11 AM
Thanks for help! I've just started to write in Lua, it's cool!!!
I have problem with
function win:_pendown(x,y)
maluj(x,y) // <-- this draw something on the screen
end
On PC emulator everything works ok, but on CP it works good only for few cliks on the screen. After it CP crash... (I have to reset CP). I don't know why??? I've already tested a few possibilities. My program is small, it doesn't get a lot of memory... . Function maluj(x,y) also works good in loop...
Do you know, what could be wrong?
#835
Posted 01 December 2007 - 10:49 AM
Could you give us the entire code so I can test it myself?
#836
Posted 01 December 2007 - 10:50 PM
-----------------------function siatka(x_p,y_p,nx_max,ny_max)for n=0,ny_max dodraw.line(x_p,y_p+n*6,x_p+nx_max*6,y_p+n*6)endfor n=0,nx_max dodraw.line(x_p+n*6,y_p,x_p+n*6,y_p+ny_max*6)endwin:update()end-----------------------function maluj(x_pen,y_pen)col=1-- okreslanie aktualnej komorkirepeatx=xset+col*6col=col+1until x_pen<xcol=col-1row=1repeaty=yset+row*6row=row+1until y_pen<yrow=row-1-- przerysowanie komorkiif col<=maxcol and row<=maxrow and col>0 and row>0 thenif mat[col][row]==0thendraw.rect(x-5,y-5,x-1,y-1,1,BLACK,1)mat[col][row]=1elseif mat[col][row]==1thendraw.rect(x-5,y-5,x-1,y-1,1,WHITE,0)draw.pixel(x-3,y-3)mat[col][row]=2elsedraw.rect(x-5,y-5,x-1,y-1,1,WHITE,0)mat[col][row]=0endendendwin:update()end-----------------------function nowyobraz()menu=1menu2=1path=nildraw.clear()init()siatka(xset,yset,maxcol,maxrow)statusbar(path)end----------------------function generujkod()end-----------------------function generujobraz()end-----------------------function obraz_update()end-----------------------function wczytajobraz()end-----------------------function zapisz()end-----------------------function init()xset=35yset=50maxrow=25maxcol=20for i=1,maxcol do local tab = {} for j=1,maxrow do tab[j]=0 end mat[i]=tabendend----------------------function zapisz_data()end----------------------function zapiszjako_data()end----------------------function otworz_data()end----------------------function sprawdz()end------------------------------ Main -------------------------------require("ui","draw","io","string") -- create windowwin = ui.window{ name="Test1", x=0, y=0,expand=false,width=160, height=215 }draw.onpict( win:getpict() )draw.clear()win:update()win:show(true)function win:_pendown(x,y)if menu==1 thenmaluj(x,y)endend---------------------xset=35yset=50maxrow=25maxcol=20mat={}tab1={}tab2={}init()------- menu 1 --------m1 = ui.menu()m1:add{type="button", text="Wczytaj obraz", _action= wczytajobraz}m1:add{type="button", text="Zapisz zmiany", _action=zapisz}m1:add{type="button", text="Sprawdz", _action=sprawdz}m1:add{type="line"}m1:add{type="button", text="Wyjscie", _action=function() ui.stop() end}------- menu 2 --------m2 = ui.menu()m2:add{type="button", text="Nowy obraz", _action=nowyobraz}m2:add{type="line"}m2:add{type="button", text="Otworz", _action=function()otworz_data() end}m2:add{type="button", text="Zapisz", _action=function()zapisz_data() end}m2:add{type="button", text="Zapisz jako", _action=zapiszjako_data}m2:add{type="line"}m2:add{type="button", text="Generuj obraz", _action=generujobraz}------- menu 3 --------m3 = ui.menu()--m3:add{type="button", text="Zasady gry", _action=tytul}m3:add{type="button", text="O programie", _action=function()dialog.message{title="O programie",text="Ver. 1.0 by ndzamana",x=1,y=70,width=157,height=60,buttons={"ok"}} end}------- MENU --------m = ui.menu()m:add{type="menu", text="Gra", menu=m1}m:add{type="menu", text="Rysuj", menu=m2}m:add{type="menu", text="Pomoc",menu=m3}--m:add{type="break"}win:add(m)win:show()ui.start()
#837 Guest_Carlos Marquez_*
Posted 09 December 2007 - 07:13 PM
En CPLua9D, se adiciona normal.
Someone knows if i can add objects to a widget?
In CPLua 0.9D i can do it normally
#838
Posted 11 December 2007 - 10:24 PM
#839
Posted 12 December 2007 - 02:38 AM
#840
Posted 12 December 2007 - 07:49 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users