[Mu] OOP: A study case

From: Michele Andreoli (m.andreoli@tin.it)
Date: Wed Apr 16 2003 - 23:25:23 CEST

  • Next message: Michele Andreoli: "[Mu] Problem accessing the site"

    Hello friends, what are you doing??

    I'm currently studing C++ and object-oriented programming, possibly
    implementing something useful.

    And because one of the most fashinating area in the OOP programming
    is the structure and behaviour of a computer graphics interface, I'm
    using it as case study.

    I always think that "to make" is the best way "to learn", so I'm developing
    from scratch a complete C++ Toolkit in order to do graphics stuff in Linux.

    RTK
    -----

    The toolkit is called RTK (Rustic ToolKit). My plan is to interpolate
    what I like, borrowing from these model: AWT (Sun, Java), Kaffe(Java), QT (Trolltech,C++) and
    FLTK (Fast Light ToolKit, www.fltk.org, C++), with the size and simplicity
    in mind.

    FLTK but uses XWindow as graphics engine.
    Qt use Framebuffer (the embedded version) and XWindow.
    AWT use Xwindow.
    Kaffe use Xwindow, but there was a porting on the Framebuffer from pocketlinux.com.

    I plan to use, interchangably, both Framebuffer engine and VCS engine (a form
    of curses, graphics in the Linux console).

    And, because I wish to NOT use any preexisting modules in order to
    handle mouse and keyboard, I wrote my own code that read mouse and keyboard
    and writes some bytes in the video memory cells.

    To be concrete, this is pure C++ code, without external libraries.
    I only use some ioctl() from the Linux kernel, in order to talk with
    the keyboard, the mouse and the video ram.

    Status
    ----------

    RTK is in a very, very early stage a this time, but I've a mouse that fly
    on the screen, the keyboard working, event handling, components,
    containers, graphics contexts, clipping.

    Very slowly, I'm understanding what happens in a graphical interface,
    and reading a lot of open source code.

    As first concrete result, I wrote a form of emulation of the
    ncurses graphics libraries (muless, MC and lynx uses it, for example),
    based on RTK.
    I compiled "muless" against it and now muless do not use libncurses anymore!
    It appairs a simple linux binary, that use libc5. On a floppy linux,
    this means to gain 200K of additional libraries.

    Next
    -------

    My VCS module can currently draw rectangles, polygons and string, with basic colors,
    in the rectangular area of the screen, where the pixel is a character
    + an attribute.

    After that, I will wrote the FB (framebuffer) module, where the pixel
    is a true microscopical pixel. Fortunately, I already know this subject a little.
    I've my routines able to handle jpeg and ppm images, without external
    libraries (self-made).

    A this point, if someone of you wish to join this project, we can
    write an X module, able to use the Xwindow graphical engine, so that
    an RTK app can also work on the X server.

    A sample program
    ---------------------

    This sample program, "boxes", writes on the screen 10 colored boxes.
    It is only 25K, when compiled. It works in the pure linux console.

    ============================================================
    #include "vcs.H"
    #include "box.H"
    #include "app.H"
    #include "misc.H"

    rApp a;
    rComponent* b;

    int i;
    int x,y;

    char buffer[64];

    int main()
    {

    for(i=1; i<=10; i++) {
    x=rnd(a.w()-5);
    y=10+rnd(a.h()-20);
    sprintf(buffer,"box%d\0",i);
    b=new rBox( x, y, rnd(7),buffer);
    a.add(b);
    }

    a.repaint();
    while(1) a.run();
    }
    ============================================================

    The final
    ------------

    Because RTK is small, I can compile statically my programs, remaing
    small.
    When project is in a good stage, I will wrote a little window manager and will put
    it on the Lepton floppy disk.

    Michele

    -- 
    Living on Earth may be expensive, but it includes an annual free trip
    around the Sun.				[Anonymous]
    -------------------------------------------------------
    This sf.net email is sponsored by:ThinkGeek
    Welcome to geek heaven.
    http://thinkgeek.com/sf
    _______________________________________________
    Mulinux-forum mailing list
    Mulinux-forum@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/mulinux-forum
    

  • Next message: Michele Andreoli: "[Mu] Problem accessing the site"

    This archive was generated by hypermail 2.1.6 : Thu Apr 17 2003 - 08:23:09 CEST