Re: [PDCurses] PDCurses and SDL2

2015-01-27 Thread Bill Gray

Hi Laura,

   For Win32a,  I added the options of 64-bit chtypes,  allowing 21
bits for the character,  which covers all of Unicode.  (As well as
providing the additional bits needed to support attributes such as
A_DIM,  A_ITALIC,  A_OVERLINE,  etc. that don't fit in 32-bit chtypes.)
I think if you borrowed curses.h,  you'd have a decent start on
getting full Unicode in your SDL2 version.

   Win32a also allows for entry of hex or decimal Unicode via the
keypad (though this was only posted about five days ago!),  but
borrowing from Win32a might be a little more difficult here.  Still
probably worth checking,  though.

   BTW,  I have to agree with you on Wine overhead.  Wine is a lovely
solution,  in the sense that it's enabled me to take a lot of my old
Windows code and,  with only minor tweaks,  get it to run at full speed
flawlessly in Linux.  But it's a bit large.  Understandably so,  given
what it has to do,  but I'm still hoping this SDL2 solution pans out.

-- Bill

On 01/27/2015 07:23 AM, LM wrote:

I compared the demos using SDL1 and SDL2 with SDL2_TTF support.
Results are very similar.  Ran the clipboard test in testcurs and it
works very nicely with SDL2 clipboard support.  The biggest design
issue I see is Unicode support.  Looking through the code, chtype is
set by default to handle 16 bits for the attributes and 16 bits for
the character.  On Windows systems, wchar_t is also limited to 16
bits.  The testcurs ACS test shows some internationalized characters
when PDC_WIDE is set true.  However, I don't see any code to handle
anything beyond the first 16 bits of a Unicode character set.  So, for
full Unicode support, one would at least need to modify the size of
chtype and deal with wchar_t representing UCS-2, UTF-16 or UTF-32,
etc. depending on the platform.  Also, on Windows (Win32), one can
input non-standard characters via the keyboard using Alt and the
keypad keys.  It would be nice to have a similar mechanism that works
with SDL.  It's difficult to determine when a user hits Alt and 0 on
the keypad whether they want back the keypad character on the key down
event or whether they want what the next series of key-presses
converts to in a Unicode representation.  That makes it difficult to
code a solution to inputting Unicode characters that suits every case.

Sincerely,
Laura



Re: [PDCurses] PDCurses and SDL2

2015-01-27 Thread LM
I compared the demos using SDL1 and SDL2 with SDL2_TTF support.
Results are very similar.  Ran the clipboard test in testcurs and it
works very nicely with SDL2 clipboard support.  The biggest design
issue I see is Unicode support.  Looking through the code, chtype is
set by default to handle 16 bits for the attributes and 16 bits for
the character.  On Windows systems, wchar_t is also limited to 16
bits.  The testcurs ACS test shows some internationalized characters
when PDC_WIDE is set true.  However, I don't see any code to handle
anything beyond the first 16 bits of a Unicode character set.  So, for
full Unicode support, one would at least need to modify the size of
chtype and deal with wchar_t representing UCS-2, UTF-16 or UTF-32,
etc. depending on the platform.  Also, on Windows (Win32), one can
input non-standard characters via the keyboard using Alt and the
keypad keys.  It would be nice to have a similar mechanism that works
with SDL.  It's difficult to determine when a user hits Alt and 0 on
the keypad whether they want back the keypad character on the key down
event or whether they want what the next series of key-presses
converts to in a Unicode representation.  That makes it difficult to
code a solution to inputting Unicode characters that suits every case.

Sincerely,
Laura


Re: [PDCurses] PDCurses and SDL2

2015-01-24 Thread anatoly techtonik
On Fri, Jan 23, 2015 at 3:48 PM, LM  wrote:
> On Thu, Jan 22, 2015 at 4:25 PM, Daniel Goldman  wrote:
>> Could you explain a little what SDL is, advantages, disadvantages? Sorry for
>> my ignorance. Daniel
>
> SDL is a graphics library that has been ported to several platforms.
> PDCurses already has support for SDL 1.2.x built in.   However, around
> 2012 the SDL developers completely rewrote the library and the new
> versions (SDL 2.x) are not backward compatible with the older ones.
> SDL2 works on Windows, Mac OS X, Linux, BSD, iOS and Android.  You can
> build SDL2 on Linux to work with X or DirectFB (if you want to avoid
> X).  There's also support in the works for Wayland on Linux.  Also
> noticed, SDL2 has some support for clipboard functionality.  Will be
> interesting to see how that works with PDCurses and how well
> applications might be able to share the clipboard.

I am pretty much interested in getting in making PDCurses more
accessible. My experience with SDL2 is that it outloads graphic
processing completely to GPU and you'd still need to understand
some details of textures and 3D programming.

My interest is to make PDCurses accessible from Python. I am not
using C, because I find Python more satisfying to work with for my
non-realtime means. There is a binding that can make experimenting
with C API easier:
http://pysdl2.readthedocs.org/en/latest/modules/sdl2.html to

> The main advantage of using SDL 1.2.x or SDL2 as a back-end for
> PDCurses is portability which is what I'm most interested in.

For portability I'd update / augment build system for PDCurses to
something like SCons, so that it can be compiled it on Windows /
Linux and BSD in the same way.

> working with it.  The nice thing is, as long as one sticks to the
> basic curses API, it should be fairly easy to port applications to
> whichever version of PDcurses or even ncurses someone wants to use.

Is there an official list of this `basic curses API`? Something like
"safe ALSA subset" for curses.

> I'm just getting starting with the SDL 2.x port of PDCurses and I have
> some work to do before I'm satisfied with the port and ready to share
> the code somewhere.

Huh? I agree that dealing with CVS requires too much effort to actually
share the code. That's not the cause with Mercurial and Git, and I'd
actually prefer to see the code available there so that it could be forked
more easily.

>   However, now would definitely be a good time if
> anyone has any input on design issues.  I'm keeping all the SDL 1.2.x
> code and adding the SDL 2.x code based on the preprocessor condition
> (SDL_VERSION_ATLEAST(2, 0, 0)).  As mentioned, I'm looking at using
> the SDL2 clipboard functionality instead of the internal clipboard
> used with SDL 1.2.x.  I'm also experimenting with SDL2_TTF support
> instead of a bitmap font.  Still looking into if/how best to support
> Unicode/UTF-8 and any suggestions in that area would be appreciated.

The problem with .ttf fonts I faced is that it is hard to find exactly
monospace fonts on Windows. Here are the gory details and a test code
https://code.google.com/p/pyglet/issues/detail?id=744

For Linux I didn't even started.

Basically I started making an interface in pyglet when I couldn't get
curses compile for Windows (including PDcurses), not speaking making
it work with Python. So, issue with upgrading the build toolchain and
accessing the code is very actual.

> Mark Hessling wrote:
>>I started my own port about 6 months ago, but other higher priority things 
>>got in the way and I didn't get very far :-(
>
> If you have any useful tips or ideas from the port you started, please
> let me know.
>
> When I have something I feel is stable and well tested, I'll be sure
> to post here about it.

It is absolutely ok to release as early as possible and maintain some
kind of page with progress http://buildbot.pypy.org/numpy-status/latest.html
This way people can join and help on the way.
-- 
anatoly t.


Re: [PDCurses] PDCurses and SDL2

2015-01-23 Thread LM
On Thu, Jan 22, 2015 at 4:25 PM, Daniel Goldman  wrote:
> Could you explain a little what SDL is, advantages, disadvantages? Sorry for
> my ignorance. Daniel

SDL is a graphics library that has been ported to several platforms.
PDCurses already has support for SDL 1.2.x built in.   However, around
2012 the SDL developers completely rewrote the library and the new
versions (SDL 2.x) are not backward compatible with the older ones.
SDL2 works on Windows, Mac OS X, Linux, BSD, iOS and Android.  You can
build SDL2 on Linux to work with X or DirectFB (if you want to avoid
X).  There's also support in the works for Wayland on Linux.  Also
noticed, SDL2 has some support for clipboard functionality.  Will be
interesting to see how that works with PDCurses and how well
applications might be able to share the clipboard.

The main advantage of using SDL 1.2.x or SDL2 as a back-end for
PDCurses is portability which is what I'm most interested in.

I have seen a few applications combine SDL's graphics drawing
capabilities with a PDCurses text based GUI.  I hope to look into
using something like that with some development I'm doing.

Bill Gray wrote:
 >Win32a is still useful to me -- I still write some Windows
>code,  and Win32a code runs well using Wine,  so it's actually a
>cross-platform solution,  at least for the Linux and OS/X desktops
>-- but yours might be a nice alternative.

Bill, I really like your Win32a code.  However, I do a lot of
cross-platform work and Wine seems like a lot of overhead to get a
simple application running on a Linux or BSD system.  Nano-X has some
Win32 support, so it might be possible to get the Win32a version
working with it.  The nice thing is, as long as one sticks to the
basic curses API, it should be fairly easy to port applications to
whichever version of PDcurses or even ncurses someone wants to use.

I'm just getting starting with the SDL 2.x port of PDCurses and I have
some work to do before I'm satisfied with the port and ready to share
the code somewhere.  However, now would definitely be a good time if
anyone has any input on design issues.  I'm keeping all the SDL 1.2.x
code and adding the SDL 2.x code based on the preprocessor condition
(SDL_VERSION_ATLEAST(2, 0, 0)).  As mentioned, I'm looking at using
the SDL2 clipboard functionality instead of the internal clipboard
used with SDL 1.2.x.  I'm also experimenting with SDL2_TTF support
instead of a bitmap font.  Still looking into if/how best to support
Unicode/UTF-8 and any suggestions in that area would be appreciated.

Mark Hessling wrote:
>I started my own port about 6 months ago, but other higher priority things got 
>in the way and I didn't get very far :-(

If you have any useful tips or ideas from the port you started, please
let me know.

When I have something I feel is stable and well tested, I'll be sure
to post here about it.

Thanks.

Sincerely,
Laura
http://www.distasis.com/cpp


Re: [PDCurses] PDCurses and SDL2

2015-01-22 Thread Daniel Goldman
Could you explain a little what SDL is, advantages, disadvantages? Sorry 
for my ignorance. Daniel


On 1/22/2015 1:06 PM, Mark Hessling wrote:

Hi Laura,

I'd be interested. I started my own port about 6 months ago, but other
higher priority things got in the way and I didn't get very far :-(

Cheers, Mark

On 23/01/15 06:32, LM wrote:

I started looking at how difficult it would be to add SDL2 support to
PDCurses as well as the current SDL 1.2.x support.  I'm also looking
at using SDL_TTF with a mono-spaced font instead of bitmap fonts.  I'm
actually making some progress and demos like firework and rain look
decent.  Still have some issues to work out like Unicode support and
cleaning up some font drawing cases.

Was wondering if anyone else besides me was interested in a SDL2 port
for PDCurses.

Sincerely,
Laura
http://www.distasis.com/cpp




Re: [PDCurses] PDCurses and SDL2

2015-01-22 Thread Mark Hessling

Hi Laura,

I'd be interested. I started my own port about 6 months ago, but other 
higher priority things got in the way and I didn't get very far :-(


Cheers, Mark

On 23/01/15 06:32, LM wrote:

I started looking at how difficult it would be to add SDL2 support to
PDCurses as well as the current SDL 1.2.x support.  I'm also looking
at using SDL_TTF with a mono-spaced font instead of bitmap fonts.  I'm
actually making some progress and demos like firework and rain look
decent.  Still have some issues to work out like Unicode support and
cleaning up some font drawing cases.

Was wondering if anyone else besides me was interested in a SDL2 port
for PDCurses.

Sincerely,
Laura
http://www.distasis.com/cpp


--

* Mark Hessling, m...@rexx.org http://www.rexx.org/
* Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL, Rexx/CURL, etc.
* Maintainer of Regina Rexx interpreter
* Use Rexx? join the Rexx Language Association: http://www.rexxla.org/