Shop OBEX P1 Docs P2 Docs Learn Events
Window Manager — Parallax Forums

Window Manager

stevenmess2004stevenmess2004 Posts: 1,102
edited 2008-02-04 08:00 in Propeller 1
This is a window manager I have been working on. It currently draws windows, text, text boxes and vector sprites. I plan to add pixel sprites soon.
I am going to clean it up a bit and then fix it so it works with DOL. When thats done I will change the mouse driver so that you can register buttons and things and then we can have event driven code. smile.gif

Run the program and the display will change after about a minute

This is only single buffered, but if the screen is only updated when required I don't think this will be a problem.

Issues
-The bottom of the screen is wrapping around to the top and there is some garbage in the top left hand corner so there
-must be a problem with the pointers to the screen array somewhere. If anyone can see where the problem is I would greatly appreciate it.

Comments

  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-02 10:52
    Here is an update. Added support for pixel sprites. Does anyone know a way to calculate the text width in the graphics object?
    In the text box at the moment I am just using a fixed width. While this works sometimes it does not work very well.

    Steven
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-02 11:49
    The textwidth is determined by the spacing you state. This is not an "inter character space" but counts from the leftmost coordinate of the last character (to avoid negative values for kerning).

    So a string of n characters has simply a width of
    spacing*(n-1) + chartacter-width
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-02 21:34
    deSilva, in your formula
    spacing is the spacing that is set in the graphics routines - normally 6?
    n is the number of characters
    what is character-width?

    Steven
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-02 23:59
    Character width is
    8*x_scale
    - or so, I am not quite sure at the moment whether the standard charcter size is 8 or 6....

    I am also not quite sure whether x_scale might also influence the "spacing" parameter... I shall have a look
    ----
    Edit:
    It multiplies.. So the correct formula should be:

    string_of_N_characters_width = (spacing*(N-1) + 6)*x_scale

    Post Edited (deSilva) : 2/3/2008 12:11:11 AM GMT
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-03 01:17
    deSilva, why is it
    string_of_N_characters_width = (spacing*(N-1) + 6)*x_scale

    and not
    string_of_N_characters_width = (spacing*(N) )*x_scale

    the default spacing is 6.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-03 10:05
    Here is a new version. I am now using linked lists for all items so you can keep adding things until you run out of memory.

    Now for a question. In the TV driver is the following

    '' bits 15..10: select the colorset* for the associated pixel tile
    '' bits 9..0: select the pixelgroup** address %ppppppppppcccc00 (p=address, c=0..15)

    Is something the wrong way around here? Aren't the 6 right bits bits 0 to 5 and not 15 to 10?

    Also, the address for the pixelgroup is only 10 bits. This is not enough to address the whole memory so how do you set where the tile is in memory?

    Thanks

    Steven
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-03 10:51
    @Steven... oops... very basic questions...

    The upper 6 bits contain a number between 0 and 63 indicating the entry in the COLOR vector. Working in 4-colour mode, this entry is a LONG and contains the TV settings of color #0 to color #3, one byte each (4 bits chroma wheel, 1 bit chroma enable, 3 bits luma - but mind 0,1, and 7!!)

    The next 10 bits contain the address divided by 64 of the tile to place (64 bytes = 16X16X2 bits)

    This is a nuissance as those tiles must be aligned correctly, but the glyphs in the ROM are...

    This is also well described in the wiki I think...

    Post Edited (deSilva) : 2/3/2008 11:18:32 AM GMT
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-03 11:06
    Thanks deSilva. I did have a look at something on the wiki but the page I looked at only said that the way it worked was hard to explain or something along those lines. I could have missed (obviously did) else.


    Thanks again

    Steven
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-03 11:24
    As you see, it was not so difficult to explain smile.gif
    But there was not yet so much explanation in the wiki as I though... I sometimes mix-up my own unpublished notes, forum postings, Andre's Hydra book, and the Wiki...

    What I was thinking of is this - however not very comprehensiv.. propeller.wikispaces.com/Converting+Text+Output+Display+Type

    Post Edited (deSilva) : 2/4/2008 9:21:51 AM GMT
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-04 08:00
    Another version.

    Changes
    -Thanks to deSilva the bitmap is now correctly aligned and will display properly all the time
    -You can now set any window to be the top window using the setTop method
    -You can now redraw just one window if you want. This will only work if the window is the top window and cover the same or greater area than before

    It isn't really documented and I probably update this version anymore unless someone wants to use it because I am going to work on making it work on DOL. smile.gif DOL will allow you to dynamically allocate memory for windows and window contents and other things so I think it will be more flexible.

    If someone does want to use this than I would be glad to do some documentation of this. Just leave a note in this thread.

    Steven
Sign In or Register to comment.