On screen text display high level method proposal

View: New views
11 Messages — Rating Filter:   Alert me  

On screen text display high level method proposal

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Christian,

I perfected my system to show the texts in Pipmak.
I have tryed to write a simple function but in the same time powerfull:

There are only one new method:

   pipmak.displaytext("text")

the default behaviour show the text centered at the bottom of the screen and
it could be multiline using "line1\nline2\nline3",

without args the text remain showed until you clear it with
 
   pipmak.displaytext()

or you substitute with another text.

A border is drawed around the text with a contrasting color
to avoid situation like write white on white....

I have prefered name pipmak.displaytext() respect pipmak.message() because
last case could generate confusion with message passing, but you
can found another more suitable name.

If you add the delay parameter, the text will be deleted after the delay time:

  pipmak.displaytext{"message",delay=3}

The "message" will be deleted after 3 sec.

if you submit another text during the delay, the text doesn't substitute
last message, but it will be cached and showed after the deletion of
the first message:
 
  pipmak.displaytext{"message1",delay=3}
  pipmak.displaytext{"message2",delay=3}
  pipmak.displaytext{"message3"}

This permits also a lot of animation effects (see the demo)

other paramaters permit to modify size,font,color,position,alignment:

  x=...                  
  y=...                
  font="font.ttf"                      
  size=24
  color={r,g,b,a}
  border={r,g,b,a}  
  alignment=pipmak.left|pipmak.center|pipmak.right

There also another parameter: style

  style can store all of above parameters, to reuse they, without
  the need to rewrite
  (for example if I want to always use the same style in all my messages)
  it works like CSS, so I can redefine some parameters:

    mystyle={font="arial.ttf",size=24,x=50,alignment=pipmak.right,delay=3}
    pipmak.displaytext{"My message",style=mystyle,size=28}

  In this case I have redefined the size of the defined style
   
Last parameter is scroll.

 scroll can be one of {"char","word","line"}

delay in this case is the duration of a single scrolling step,
the text will be showed char by char, or word by word, or line by line.
if you don't define a delay, the scroll will proceed at the maximum speed
permited by the system.

I have prepare a demo here:

http://andrea.viarengo.googlepages.com/displaytext.pipmak 

There are only the definition of the function to place in defaults.lua
(now I placed in main.lua)
and the internal node -21 (but you can choice another number...)

What you thinking about?

Andrea







-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrea Viarengo wrote:
> I perfected my system to show the texts in Pipmak.

Wow, very cool! I'll definitely integrate this.

An idea that just occurred to me: would it make sense to put such
features that are implemented on top of Pipmak's (public) core
functionality into a separate namespace, maybe "pipmaklib" or something,
instead of "pipmak"? We could conceivably end up with hundreds of them,
and the pipmak table would be a bit crowded then.

Could you transform your descriptions into something that fits into
Reference.tex? Otherwise the commit will have to wait until I get around
to doing that. (I'm trying to take a hard stance on this - no feature
committed without documentation, otherwise it will never get written.)

Small bug: weird things happen with the positioning of the text when the
window is resized while the demo is running. Do you think this can be
fixed in a reasonable way?

> I have prefered name pipmak.displaytext() respect pipmak.message() because
> last case could generate confusion with message passing, but you
> can found another more suitable name.

"displaytext" is fine with me.

I haven't scrutinized the code very thoroughly, but a few detail
comments nonetheless:

> --   Globals defined:
> --      pipmak.cachedtext      (table)
> --      pipmak.istextdisplayed (boolean)

Do these need to be global (i.e. do they need to survive leaving and
reentering the node)? If they do, I think pipmak_internal would be a
better place for them than pipmak. (For the command line history I chose
to use a plain global, outside of any table, but that's probably not
such a good example to follow.)

> panel { pipmak.newimage( pipmak.screensize()) }

Note to self: We need a way to make a panel or slide without any
background image. Storing and drawing such a big texture of pure
transparency is just a waste of resources.
But, in the meantime: you could make the image 1x1 pixel and stretch it
by setting the panel's "w" and "h". Or even leave it at 1x1 - patches
can also be outside of the rectangle of the panel, as seen on the Lua
command line.

  -Christian


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Walther <cwalther <at> gmx.ch> writes:

> An idea that just occurred to me: would it make sense to put such
> features that are implemented on top of Pipmak's (public) core
> functionality into a separate namespace, maybe "pipmaklib" or something,
> instead of "pipmak"? We could conceivably end up with hundreds of them,
> and the pipmak table would be a bit crowded then.

You mean that we have to call the method:
pipmaklib.displaytext{..}

For me it's ok, (just a little long to write...)

We can put here macro-functions builded on base functionalities:
is this your idea?

I think that at this point, we have to make some thought about a
more sophisticated library/plugin system to make Pipmak more modular...

I do not know if you gave a look to the wiki page "Pipmak Library Project"
which I have written some time ago...
All that things (for the moment there are only color lib published)
should be suitable to become pipmaklib....

For example, what are you thinking about this:

a folder called lib or plugin or something like at the level of pipmak.exe
inside the folder we put files with extension .pipmaklib
which are .zip renamed like "Pipmak Resource"

each pipmaklib file have an own default.lua and own nodes and resources,

On open project, pipmak scans the folder and load every
default.lua inside the pipmaklib files and load new pipmaklib functions
that use own nodes and resources included into .pipmaklib files

In this manner we can create a lot of modules/plugins and
it should be sufficient only copy to the lib folder to make
available new features build on basic pipmak API, without the need to
modify "Pipmak Resources" or act some pipmak.dofile...or add other
nodes/resource to the project.

The first problem which I see is the numbering of the nodes...
Because every pipmaklib (potentially made by different people)
should be have an own numbering system
(ie.: every lib could have a node number 1)
We have to modify node numbering introducing global or local or
absolute or relative numbering or other ... I don't known....

What do you think?

> Could you transform your descriptions into something that fits into
> Reference.tex? Otherwise the commit will have to wait until I get around
> to doing that. (I'm trying to take a hard stance on this - no feature
> committed without documentation, otherwise it will never get written.)

I'm not an expert of tex... I will try...
You use some visual tool to write doc, or you use just a text editor?

> Small bug: weird things happen with the positioning of the text when the
> window is resized while the demo is running. Do you think this can be
> fixed in a reasonable way?

I will check it

> I haven't scrutinized the code very thoroughly, but a few detail
> comments nonetheless:
>
> > --   Globals defined:
> > --      pipmak.cachedtext      (table)
> > --      pipmak.istextdisplayed (boolean)
>

I would like to don't use any globals....but I need to store the cache
of the messages from a displaytext call and the next, this need only
until the overlayed node is displayed (when the overlay is closed,
the cache is empty)
If you have other ideas, I will be happy to use them.

>
> > panel { pipmak.newimage( pipmak.screensize()) }
>

I will try your suggestions...

Bye

-Andrea




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Walther <cwalther <at> gmx.ch> writes:

>
> > --   Globals defined:
> > --      pipmak.cachedtext      (table)
> > --      pipmak.istextdisplayed (boolean)
>

Fixed!!
simply I define them local!!!

local cachedtext
local istextdisplayed


>
> > panel { pipmak.newimage( pipmak.screensize()) }
>

Fixed!!
local width,height=pipmak.screensize()
panel { pipmak.newimage(1,1),w=width,h=height }

it works nice.

About the BUG on resize, I fixed moving also panel

pipmak.thisnode():moveto(nil,nil,0,0)

but it's valid for all the text displayed after resize operation,
text displayed during resize isn't always corrected (depend by alignment)

Probably I have to align panel to center, and not to the left angle...
I have to do more tests.

I haven't possibility to update my file now, maybe on monday...

-Andrea





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Aidan Gauland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Or how about making Pipmak even more modular by seperating higher level
functionality into plugins?  (Written in C or C++.)  There could be an
"authoring GUI" plugin.  Some
plugins could be official (supported and maintained by Pipmak developers), and
plugins by other people could just be hosted wherever.

Christian Walther wrote:

> Andrea Viarengo wrote:
>> I perfected my system to show the texts in Pipmak.
>
> Wow, very cool! I'll definitely integrate this.
>
> An idea that just occurred to me: would it make sense to put such
> features that are implemented on top of Pipmak's (public) core
> functionality into a separate namespace, maybe "pipmaklib" or something,
> instead of "pipmak"? We could conceivably end up with hundreds of them,
> and the pipmak table would be a bit crowded then.
>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aidan Gauland <wgsilkie <at> ihug.co.nz> writes:

>
> Or how about making Pipmak even more modular by seperating higher level
> functionality into plugins?  (Written in C or C++.)  There could be an
> "authoring GUI" plugin.  Some
> plugins could be official (supported and maintained by Pipmak developers),
and
> plugins by other people could just be hosted wherever.
>

This is already possible using lua loadlib function.

For example using a compressed package pipmaklib (or piplib) like which
one I have described before in this thread,
it would it be possible also include into the local lib "default.lua"
of the package, a loadlib which
load some extra function writed in "C" and packaged into a .DLL or .so

There only a missing function: pipmak.getos() or pipmak.getplatform()
which return a string describing the host operating system
{"osx","linux","win"}, so I can load the correct library
DLL for windows or .so for OSX or Linux;

This would avoid having to rewrite the 3 different versions of piplib.

For example, I'm trying to write a small authoring system
(you can see a screenshot in this forum) that uses only a dll to add
to Pipmak all those functions that are missed,
such as reading and writing of text files, parsering lua files,
opening of dialog boxes for uploading image files, writing and reading
GIF image file and so on.
But it isn't sufficient, because I have to add some extra nodes, to display
Authoring panels and menus, and glue together all the functions that
I put inside the dll, which, for the moment, I have included as internal nodes,
into the "Pipmak Resources".
At last I've also to little modify "default.lua" in "Pipmak Resources" to
load dll without the need to load it explicitly in my project
(and that it would not be a good place to put it!)

With a system like which i have described, I only have to put
"author.piplib" and "author.dll" into the folder lib, and immediately
I could have all the new features available.

To resolve the issue about library nodes which can have the same number,
I believe that we should introduce the concept of "nodespace"
there are a nodespace of the project (which own nodes)
and other nodespaces for each pipmaklib
lua file of the project or into "Pipmak Resources" have as default
nodespace that of the project ("../" "/" or something) ,
lua file inside pipmaklib have as default nodespace of the library
("nameofthelib").
If I don't want use the default I could change it with
pipmak.setnodespace(ns) (like an unix cd) or retrive the
current nodespace with pipmak.getnodespace() (like unix pwd),
in this way I could have project and pipmaklib package with nodes numbered
with the same number...

Off course all of this ar only ideas...

Think about it!

Bye

Andrea










-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Walther <cwalther <at> gmx.ch> writes:
>
> Could you transform your descriptions into something that fits into
> Reference.tex? Otherwise the commit will have to wait until I get around
> to doing that. (I'm trying to take a hard stance on this - no feature
> committed without documentation, otherwise it will never get written.)
>
Ok,
you found documentation.tex (Fix my bad English!) inside the

http://andrea.viarengo.googlepages.com/displaytext.pipmak 

which I have re-uploaded also with fixes you suggest.

But,
before integrate it into Pipmak, make your thoughts about Pipmak libs/plugins
which you can found some ideas on this thread.

Displaytext could become the first official pipmak plugin!
Other could be "color managment", "inventory managment",
"dialog managment", "menu managments" and more.

Bye,
and as every summer,
A very special and restoring holiday to all!

Andrea Viarengo




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: On screen text display high level method proposal

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrea Viarengo wrote:

> I think that at this point, we have to make some thought about a
> more sophisticated library/plugin system to make Pipmak more modular...
>
> For example, what are you thinking about this:
>
> a folder called lib or plugin or something like at the level of pipmak.exe
> inside the folder we put files with extension .pipmaklib
> which are .zip renamed like "Pipmak Resource"
>
> each pipmaklib file have an own default.lua and own nodes and resources,
>
> On open project, pipmak scans the folder and load every
> default.lua inside the pipmaklib files and load new pipmaklib functions
> that use own nodes and resources included into .pipmaklib files

I don't feel comfortable about loading everything from the start. That
could introduce namespace collisions, and loading plugins that are not
going to be used is a waste of resources. What about requiring project
authors to state what plugins they need using some kind of "require" or
"import" command?

When designing such a system, we should also take care to make it
compatible with the package/module system of Lua 5.1, so we don't have
to redesign everything once we switch to Lua 5.1 with Pipmak 0.3
(probably Lua will be at 5.7 by that time...). Description at
<http://www.lua.org/manual/5.1/manual.html#5.3> and
<http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf>, for the reference.

> There only a missing function: pipmak.getos() or pipmak.getplatform()
> which return a string describing the host operating system
> {"osx","linux","win"}, so I can load the correct library
> DLL for windows or .so for OSX or Linux;

Wouldn't it be simpler and less error-prone to just try loading one
after the other of the platform-specific binaries until you find one
that fits? Can you think of a constellation in which that would give
incorrect results?

> To resolve the issue about library nodes which can have the same number,
> I believe that we should introduce the concept of "nodespace"
> there are a nodespace of the project (which own nodes)
> and other nodespaces for each pipmaklib
> lua file of the project or into "Pipmak Resources" have as default
> nodespace that of the project ("../" "/" or something) ,
> lua file inside pipmaklib have as default nodespace of the library
> ("nameofthelib").
> If I don't want use the default I could change it with
> pipmak.setnodespace(ns) (like an unix cd) or retrive the
> current nodespace with pipmak.getnodespace() (like unix pwd),
> in this way I could have project and pipmaklib package with nodes numbered
> with the same number...

I'm having trouble seeing how this would work, but maybe my mind is just
too far removed from Pipmak and Lua at this time... in a C Lua function
within the Pipmak core (like pipmak.getimage), how do you tell whether
the call came from a library or from the project?

The first approach to this problem that comes to my mind is to provide
some function by which modules can register their nodes with Pipmak and
get back a unique (negative) node number, which they then assign to a
name within the module to make it available to users. Pipmak would keep
an internal table of these nodes and would direct accesses by node
number to the correct path.

  -Christian


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: Module system (was: On screen text display high level method proposal)

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wrote:
> The first approach to this problem that comes to my mind is to provide
> some function by which modules can register their nodes with Pipmak and
> get back a unique (negative) node number, which they then assign to a
> name within the module to make it available to users. Pipmak would keep
> an internal table of these nodes and would direct accesses by node
> number to the correct path.

Even better solution: implement the "named nodes" request from
<http://pipmak.sourceforge.net/wiki/index.php/Proposals>. When nodes are
  referred to by name rather than by number, each module can put its
nodes into its own subfolder.

I'm going to try this.

  -Christian


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: Module system (was: On screen text display high level method proposal)

by Andrea Viarengo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Walther <cwalther <at> gmx.ch> writes:

> Even better solution: implement the "named nodes" request from
> <http://pipmak.sourceforge.net/wiki/index.php/Proposals>. When nodes are
>   referred to by name rather than by number, each module can put its
> nodes into its own subfolder.
>
> I'm going to try this.

yes, probably "named nodes" are a better solution...

A part the implementation,
I have understood you like the addition of modules/plugin in Pipmak, right?

-Andrea





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: Module system

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrea Viarengo wrote:
> yes, probably "named nodes" are a better solution...
>
> A part the implementation,
> I have understood you like the addition of modules/plugin in Pipmak, right?

Yes, that seems like a good idea. I have a rough plan in my head and
will try to work it out once the "named nodes" thing is done. Speaking
of which, I have a prototype working (in a backwards-compatible way) at
this moment, but it still needs more rigorous testing, and updated
documentation.

  -Christian


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users