Creating Sprite using gx_sprite_create

I am not able to view or see the created sprite using gx_sprite_create.

I have a draw function for a window that calls the below:

VOID draw_sprite(GX_WINDOW *window)
    GX_RECTANGLE sprite_size;
    GX_SPRITE *sprite;
    GX_SPRITE_FRAME frame_list[4];
    int sprite_id=1;
    ULONG brush_style = 0;

    brush_style |= GX_BRUSH_ALIAS;
    brush_style |= GX_BRUSH_SOLID_FILL;

    line_color = GX_COLOR_ID_RED;
    fill_color = GX_COLOR_ID_RED;

    gx_context_brush_define(line_color, fill_color, brush_style);
    brush_width = 4;

    frame_list[0].gx_sprite_frame_pixelmap = GX_PIXELMAP_ID_FLOW1;
    frame_list[1].gx_sprite_frame_pixelmap = GX_PIXELMAP_ID_FLOW2;
    frame_list[2].gx_sprite_frame_pixelmap = GX_PIXELMAP_ID_FLOW3;
    frame_list[3].gx_sprite_frame_pixelmap = GX_PIXELMAP_ID_FLOW4;



    gx_utility_rectangle_define(&sprite_size, 110, 236, 110+88, 236+68);   

    gx_sprite_create(sprite, "my_sprite", (GX_WIDGET*)&main_screen.main_screen_flow_display, frame_list, 4, GX_STYLE_SPRITE_AUTO|GX_STYLE_SPRITE_LOOP, sprite_id, &sprite_size);




The window appears blank without the sprite. I have verified the pixel map is in the GUIX project.

Not sure what I am missing at this point.



SSP 1.6.3




  • Hi Sam,

    How's this issue? Were able to make the sprite appear now?

    RenesasRulz Forum Moderator

  • In reply to JB:

    No I am still not able to view the sprite if I create using gx_sprite_create

    So, I switched to populate it statically on the GUIX but the problem now is that I have 64 sprites in a window and each sprite has a timer associated with it .. as a result, I am getting "running out of timer " error.


    Is there a way to use one timer in the back end for all sprites?

  • In reply to Sam:

    I found a way to get the same functionality out of icon.

    I am using just a regular icon widget to change pixelmap every 1 sec using 1 timer.


  • In reply to Sam:

    Hello Sam,

    In your original code, pointer "sprite" points to whatever was left on the stack at that address. When creating widgets you need to allocate memory (preferably statically) and provide pointer to the widget structure allocated in RAM. In this particular case, it means creating a static GX_SPRITE symbol and providing its address to the _create function.