示例#1
0
//
// main_window_load
//
static void main_window_load(Window *window) {
  
  int i = 0;
  for( i = 0; i < MAX_DOTS;i++ ) {
     dotX[i] = -1;
     dotY[i] = -1;
     dotVelocity[i] = 1;
  }
  
   comms_init();  // 

  // Create black background ...
  s_bmap_bg = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_EARTH);
  // bitmap_layer_set_background_color( s_bmap_bg, GColorBlack );
  
  s_canvas = layer_create(GRect(0, 0, 144, 168));   
  s_sprite = sprite_add( RESOURCE_ID_IMAGE_ROCKET, 30, 42, 50, 100 );
  s_sprite->offset_y = 40;
  
  Layer* motherLayer = window_get_root_layer(s_main_window);
  layer_set_update_proc(s_canvas, updateFast);
  
  // Black background.
  // yer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_bmap_bg));
  // Fast animation layer.
  layer_add_child(motherLayer, s_canvas);
  
  TICK_RATE_MS = FPS30;
  app_timer_register( TICK_RATE_MS , tick_fast_handler, NULL);
}
示例#2
0
int sprite_add(string filename, int imgnumb, bool transparent, bool smooth, int x_offset, int y_offset)
{
    return sprite_add(filename, imgnumb, false, transparent, smooth, true, x_offset, y_offset);
}