Hello Segger community,
I used the bitmap converter to create an animated sprite from a gif file.
The .c file looks good, I got the picture data for 8 images, 1 array with delays between the pictures, a color and a log palette, a storage and a bitmap array. This is the usage proposal generated by the converter:
If I use this as proposed, the sprite is created successfully, but the function GUI_SPRITE_StartAnim fails. I suggest this is because the array aDelayPicture should have a length of GUI_COUNTOF(apbmPicture)-1 ?
Here is what I tried to make GUI_SPRITE_StartAnim work:
As I call the function GUI_SPRITE_CreateAnim with a period of 0, the sprite is created successfully.
StartAnim succeeds, but only the first of the eight pictures is displayed. This is what I expected to happen, because the period to be used to switch between the images is zero. As soon as I increase this value the function GUI_SPRITE_CreateAnim fails.
Can someone help me by providing information about which problems GUI_SPRITE_CreateAnim and GUI_SPRITE_StartAnim can encounter? Is this how GUI_SPRITE_StartAnim shall be used (start animation once and pictures are switched automatically?) or does it require to be called periodically?
Thank you very much in advance!
Greetings!
Edit:
emWin V5.22 is used
I used the bitmap converter to create an animated sprite from a gif file.
The .c file looks good, I got the picture data for 8 images, 1 array with delays between the pictures, a color and a log palette, a storage and a bitmap array. This is the usage proposal generated by the converter:
If I use this as proposed, the sprite is created successfully, but the function GUI_SPRITE_StartAnim fails. I suggest this is because the array aDelayPicture should have a length of GUI_COUNTOF(apbmPicture)-1 ?
Here is what I tried to make GUI_SPRITE_StartAnim work:
C Source Code
- const unsigned aDelayPicture[7] = {100, 100, 100, 100, 100, 100, 100};
- GUI_HSPRITE hSprite = GUI_SPRITE_CreateAnim(apbmPicture, 40, 40, 0, aDelayPicture, 8);
- int error=0;
- if (hSprite==0)
- error=1;
- error=GUI_SPRITE_SetLoop(hSprite, 1); //repeat infinitely
- GUI_SPRITE_Show(hSprite);
- error=GUI_SPRITE_StartAnim(hSprite);
As I call the function GUI_SPRITE_CreateAnim with a period of 0, the sprite is created successfully.
StartAnim succeeds, but only the first of the eight pictures is displayed. This is what I expected to happen, because the period to be used to switch between the images is zero. As soon as I increase this value the function GUI_SPRITE_CreateAnim fails.
Can someone help me by providing information about which problems GUI_SPRITE_CreateAnim and GUI_SPRITE_StartAnim can encounter? Is this how GUI_SPRITE_StartAnim shall be used (start animation once and pictures are switched automatically?) or does it require to be called periodically?
Thank you very much in advance!
Greetings!
Edit:
emWin V5.22 is used
The post was edited 1 time, last by Val-R ().