Neat information box in the middle of the screen. - how to ?

  • 13 Replies
  • 1306 Views
Neat information box in the middle of the screen. - how to ?
« on: 29 / January / 2014, 03:43:04 »
Advertisements
The only thing that my script is missing now, is a way to announce mode change
in ascii that could be a frame like:
(didn't the this code yet)

set_console_layout(8, 10, 30, 3)   
print("----------------")
print("|   VIDEO     |")
print("----------------")

By any chance, is there a code that makes a nice frame around text already and centers it in screen ?

Or,
I see neat boxes like "show build info" is using  - are those available as a function, with timeout (auto-destruct) - or as code example, or do I need to go bananas with "draw*" functions from scratch ?

Re: Neat information box in the middle of the screen. - how to ?
« Reply #1 on: 29 / January / 2014, 08:06:56 »
You need to draw that stuff from scratch.  And redraw it periodically as the Canon UI overwrites it.

Here's an example from one of my scripts:


CHDK 1.3.0 also supports using larger fonts,  which may be sufficient for your purpose :


The look a bit nicer than this - the image is from an early prototype.

See the scaling parameter for draw_string() :  http://chdk.wikia.com/wiki/Lua/Lua_Reference#Drawings
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Neat information box in the middle of the screen. - how to ?
« Reply #2 on: 29 / January / 2014, 08:24:11 »
Thank you
Will follow your example, and/or check out the draw option.

I am aware of the feature of 1.3 "medium" would be great , but the warning about stability problems makes it not ready yet for my use.
i would like to avoid mapping several km2 over 3 hours just to find out it crashed after 100 pictures. :)

Re: Neat information box in the middle of the screen. - how to ?
« Reply #3 on: 29 / January / 2014, 08:47:25 »
I'm following the forum from time to time and now I found this tip, that there's a scalling param fot text - so cool!

However, I just jumped to the doc and found, that the function is draw_string - OMG, what a bad name I gave it :D Maybe we could add an alias draw_text() ?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Neat information box in the middle of the screen. - how to ?
« Reply #4 on: 29 / January / 2014, 15:29:41 »
I am aware of the feature of 1.3 "medium" would be great , but the warning about stability problems makes it not ready yet for my use.  i would like to avoid mapping several km2 over 3 hours just to find out it crashed after 100 pictures. :)
Well, that's probably the safest thing to do.  But FWIW,  I only use 1.3.0 and have not seen any stability issues. Changes to 1.3.0 are carefully made despite the "unstable" label.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Neat information box in the middle of the screen. - how to ?
« Reply #5 on: 29 / January / 2014, 16:41:45 »
oops !
I am using "draw_string"
After making a pretty nice interface, I get only grayish/white boxes, no text, when using composite video output.

Is this a limitation ? 
now that I think of it work "screen" and "LCD" is used very much here, is it posible the the DAC doesnt get this data when making analog video ?
« Last Edit: 29 / January / 2014, 16:45:36 by Andre-K »

*

Offline srsa_4c

  • ******
  • 3530
Re: Neat information box in the middle of the screen. - how to ?
« Reply #6 on: 29 / January / 2014, 17:20:27 »
After making a pretty nice interface, I get only grayish/white boxes, no text, when using composite video output.
Do other parts (OSD, menu) of the CHDK UI show up correctly on the composite out? Does your text look right on the LCD?

There is a possibility that the analogue video out has a different palette or that the palette entries get a slightly different interpretation. Try finding colors that are available (open the palette viewer and see the colors). You can also attach some screenshots (comparing the LCD and video out appearance).

Re: Neat information box in the middle of the screen. - how to ?
« Reply #7 on: 30 / January / 2014, 02:22:32 »
CHDK UI, and the console output show up fine.
So does the draw_string output - until I plug in the composite cable (that enables composite output)  , and it also works after I remove the video-cable.
The printed "info" is across 4 lines and uses 2 different background and 2 different text colors - so at least something should be visible.




*

Offline philmoz

  • *****
  • 3056
    • Photos
Re: Neat information box in the middle of the screen. - how to ?
« Reply #8 on: 30 / January / 2014, 02:46:04 »
CHDK UI, and the console output show up fine.
So does the draw_string output - until I plug in the composite cable (that enables composite output)  , and it also works after I remove the video-cable.
The printed "info" is across 4 lines and uses 2 different background and 2 different text colors - so at least something should be visible.

Probably a different palette table is being used.

For the S110 CHDK overwrites unused color entries in the palette with the CHDK colors. Not all palettes are updated, only the most used ones. The unused colors are usually white.

When you plug in the video lead, it is probably switching to a new palette that CHDK is not overwriting.

Try displaying the value of the 'active_palette_buffer' variable on screen to see what it changes to when you plug in the lead.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

Re: Neat information box in the middle of the screen. - how to ?
« Reply #9 on: 30 / January / 2014, 10:32:39 »
print(active_palette_buffer) gives nil , in both cases.  - something's wrong ?

 

Related Topics