LUA Drawing: how to set background color - LUA Scripting - CHDK Forum supplierdeeply

LUA Drawing: how to set background color

  • 22 Replies
  • 16370 Views
*

Offline otosclerosi

  • *
  • 22
  • Canon IXUS160 with CHDK 1.5
LUA Drawing: how to set background color
« on: 01 / December / 2016, 11:30:31 »
Advertisements
Hi there, i'm new in the forum and i also use chdk since a week.
First of all, i love the fact that chdk implements lua, is very interesting...
now, i would like to develop something cool in lua with the drawing library, the goal is to develop a little 2d game, probably an rpg, but it's a long term goal...
howeaver, the question is
how can i set a background color with lua? i was wondering if creating a black rectangle filled occupying the whole display would work...
and then using draw.overdraw() over and over...
any ideas?
srry for bad english, i'm italian :)
Can a kangaroo jump higher than a house?
Of course, a house doesn’t jump at all.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: LUA Drawing: how to set background color
« Reply #1 on: 01 / December / 2016, 13:18:19 »
how can i set a background color with lua?
A filled rectangle ist the only way. There is no function for the background color.

You know chdk includes some games all written in C. But the problem with the background is the same.
https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/modules/games

msl
CHDK-DE:  CHDK-DE links

*

Offline otosclerosi

  • *
  • 22
  • Canon IXUS160 with CHDK 1.5
Re: LUA Drawing: how to set background color
« Reply #2 on: 02 / December / 2016, 10:03:34 »
thanks for your reply
meanwhile i tried the filled rect and it is useful, i mean, it works and it's not noticeable different from a background.
It would be good to have a C compiler for chdk, though...
the only strange (is it?) thing is that i can't create a 360x240 rect (my monitor resolution), i have to create a 359x239 rect...no visible difference, but it's weird
is there any way to use C to create something for chdk?
Can a kangaroo jump higher than a house?
Of course, a house doesn’t jump at all.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: LUA Drawing: how to set background color
« Reply #3 on: 02 / December / 2016, 10:59:03 »
It would be good to have a C compiler for chdk
When you are on Windows, try this: https://chdk.setepontos.com/index.php?topic=12752.0

the only strange (is it?) thing is that i can't create a 360x240 rect (my monitor resolution), i have to create a 359x239 rect...no visible difference
That is normal. 360 is the dimension. From 0 to 359 are 360 steps.

is there any way to use C to create something for chdk?
What will you do? Most of the CHDK code is written in C. Look into the source code of CHDK, especially in the core part: https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk

msl
CHDK-DE:  CHDK-DE links


*

Offline otosclerosi

  • *
  • 22
  • Canon IXUS160 with CHDK 1.5
Re: LUA Drawing: how to set background color
« Reply #4 on: 03 / December / 2016, 05:27:19 »
yeah it's normal, didn't remember the fact that 0 exists... :P
regarding the C compiler...
i would like to develop programs in C working on my camera, that's the goal
will "Windows GUI for gcc toolchain" work?
it would be veeeery interesting
in fact i was looking at the codes and it means that it is actually possible to do, i was wondering how...

EDIT: Can i create a thread with my project to share progresses and sources? I would really like to share this project and to create something good (by now i have a red ball walking through the screen controlled by users and also solid walls... : 3 )
« Last Edit: 03 / December / 2016, 05:43:07 by otosclerosi »
Can a kangaroo jump higher than a house?
Of course, a house doesn’t jump at all.

LUA Drawing: how to set background color
« Reply #5 on: 03 / December / 2016, 07:37:42 »
will "Windows GUI for gcc toolchain" work?
Yes

Quote
EDIT: Can i create a thread with my project to share progresses and sources? I would really like to share this project and to create something good
You can.

Use an SVN compatible tool to obtain the CHDK source code.  Develop your application using that code.  When you are done, create a standard diff (or patch) file of the changes and post it here for testing and discussion by the forum members.  If there is general agreement of the value, it can be added to the general distribution.

Please note that CHDK is already almost too big to run on some cameras. So big additions are not easily accepted. However, something like a game can be compiled as a loadable module so it only takes memory space when it's actually used.  If you follow how the existing games are integrated into CHDK you will be off to a good start.  People here can help you with the rest.

Good luck! It will be interesting to see what you come up with.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: LUA Drawing: how to set background color
« Reply #6 on: 03 / December / 2016, 07:47:31 »
However, something like a game can be compiled as a loadable module so it only takes memory space when it's actually used.  If you follow how the existing games are integrated into CHDK you will be off to a good start.
I'd like to note that so-called "simple modules" can be developed without any integration to CHDK source. Since (AFAIK) I'm the only person doing that kind of development, I can only show what I have done: https://chdk.setepontos.com/index.php?topic=12899.0

Unfortunately, there's no SDK and no tutorial on module development.

Re: LUA Drawing: how to set background color
« Reply #7 on: 03 / December / 2016, 08:59:32 »
I'd like to note that so-called "simple modules" can be developed without any integration to CHDK source. Since (AFAIK) I'm the only person doing that kind of development, I can only show what I have done: https://chdk.setepontos.com/index.php?topic=12899.0
Finally gave this a try.  Very nice. 

If I understand the dependencies and my test results, it is possible to distribute a compiled .flt file for a module so people can use it without compiling anything themselves. As long as they are using the exact same CHDK build (e.g. g10-102a-1.4.1-4742-full.zip)?  Which makes user distributed .flt files a bit tricky to manage I guess.

(I guess further conversation about this really belongs in the other tread.)
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline otosclerosi

  • *
  • 22
  • Canon IXUS160 with CHDK 1.5
Re: LUA Drawing: how to set background color
« Reply #8 on: 03 / December / 2016, 11:13:58 »
Thanks for the info, i'll surely read the documentation and the sources you gave me...
meanwhile, i'll open the new thread
see you there :)
Can a kangaroo jump higher than a house?
Of course, a house doesn’t jump at all.

Re: LUA Drawing: how to set background color
« Reply #9 on: 03 / December / 2016, 11:27:07 »
Thanks for the info, i'll surely read the documentation and the sources you gave me...
If you want to read the history of loadable modules (.flt files) it's here :

new branch - CHDK : Elf Edition - Developers wanted

That might be the best (only) source of documentation as well. Other than this initial page : 

CHDK Wiki : Module System
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal