Esempio n. 1
0
eolLevelLayer *eol_level_build_layer_from_key(eolKeychain *key,eolLevel *level)
{
  eolLevelLayer *layer = NULL;
  eolKeychain *bkey = NULL;
  if (!key)return NULL;
  layer = eol_level_layer_new();
  if (!layer)return NULL;
  if (!level)return NULL;
  
  eol_keychain_get_hash_value_as_line(layer->idName,key,"idName");
  eol_keychain_get_hash_value_as_orientation(&layer->ori,key,"ori");
  eol_keychain_get_hash_value_as_rectfloat(&layer->bounds,key,"bounds");
  eol_keychain_get_hash_value_as_bool(&layer->usesClipMesh,key,"usesClipMesh");
  eol_keychain_get_hash_value_as_bool(&layer->usesTileMap,key,"usesTileMap");

  layer->keys = eol_keychain_clone(eol_keychain_get_hash_value(key,"keys"));
  
  bkey = eol_keychain_get_hash_value(key,"backgrounds");
  if (bkey)
  {
    eol_level_build_backgrounds_from_keychain(layer,bkey);
  }
  bkey = eol_keychain_get_hash_value(key,"tileMap");
  if (bkey)
  {
    layer->tileMap = 
      eol_tile_map_build_from_definition(bkey,level->tileSet);
  }
    /*
  GList       * spawnList;
*/
  return layer;
}
Esempio n. 2
0
void eol_spawn_delete_key_list_item(eolSpawn *spawn,eolWord key,eolUint n)
{
  eolKeychain *list;
  if (!spawn)return;
  if (spawn->keys == NULL)return;
  list = eol_keychain_get_hash_value(spawn->keys,key);
  eol_keychain_list_remove_nth(list,n);
}
Esempio n. 3
0
GString * eol_spawn_get_key(eolSpawn *spawn, eolWord key)
{
  eolKeychain *value;
  if (!spawn)return NULL;
  value = eol_keychain_get_hash_value(spawn->keys,key);
  if (value == NULL)return NULL;
  if (value->keyType != eolKeychainString)return NULL;
  return (GString *)value->keyValue;
}
Esempio n. 4
0
eolBool eol_config_get_keychain_by_tag(eolKeychain **output,
                                       eolConfig *conf,
                                       eolLine tag)
{
  g_return_val_if_fail(conf->_node, eolFalse);
  g_return_val_if_fail(output, eolFalse);
  *output = eol_keychain_get_hash_value(conf->_node, tag);
  if (*output == NULL)return eolFalse;
  return eolTrue;
}
Esempio n. 5
0
GString * eol_spawn_get_key_list_item(eolSpawn *spawn, eolWord key,eolUint n)
{
  eolKeychain *value;
  eolKeychain *list;
  if (!spawn)return NULL;
  list = eol_keychain_get_hash_value(spawn->keys,key);
  value = eol_keychain_get_list_nth(list,n);
  if (value == NULL)return NULL;
  if (value->keyType != eolKeychainString)return NULL;
  return (GString *)value->keyValue;
}
Esempio n. 6
0
eolSpawn *eol_spawn_create_from_keychain(eolKeychain *conf)
{
  eolSpawn *spawn;
  if (!conf)return NULL;
  spawn = eol_spawn_new();
  if (!spawn)return NULL;
  spawn->keys = eol_keychain_get_hash_value(conf,"keys");
  eol_keychain_get_hash_value_as_orientation(&spawn->ori, conf, "ori");
  eol_keychain_get_hash_value_as_uint(&spawn->id, conf, "id");
  eol_keychain_get_hash_value_as_line(spawn->type, conf, "type");
  return spawn;
}
Esempio n. 7
0
eolBool eol_keychain_get_hash_value_as_line(eolLine output, eolKeychain *hash, eolLine key)
{
  eolKeychain *chain;
  if ((!hash) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)
  {
    return eolFalse;
  }
  if (chain->keyType != eolKeychainString)return eolFalse;
  eol_line_cpy(output,chain->keyValue);
  return eolTrue;
}
Esempio n. 8
0
eolBool eol_keychain_get_hash_value_as_rectfloat(eolRectFloat *output, eolKeychain *hash, eolLine key)
{
  eolRectFloat temp = {0,0,0,0};
  eolLine keyValue;
  eolKeychain *chain;
  if ((!hash) || (!output) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)return eolFalse;
  if (chain->keyType != eolKeychainString)return eolFalse;
  eol_line_cpy(keyValue,chain->keyValue);
  if (sscanf(keyValue,"%lf,%lf,%lf,%lf",&temp.x,&temp.y,&temp.w,&temp.h) != 4)return eolFalse;
  eol_rectf_copy(output,temp);
  return eolTrue;
}
Esempio n. 9
0
eolBool eol_keychain_get_hash_value_as_vec2d(eolVec2D *output, eolKeychain *hash, eolLine key)
{
  eolVec2D temp = {0,0};
  eolLine keyValue;
  eolKeychain *chain;
  if ((!hash) || (!output) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)return eolFalse;
  if (chain->keyType != eolKeychainString)return eolFalse;
  eol_line_cpy(keyValue,chain->keyValue);
  if (sscanf(keyValue,"%lf,%lf",&temp.x,&temp.y) != 2)return eolFalse;
  eol_vec2d_copy((*output),temp);
  return eolTrue;
}
Esempio n. 10
0
eolBool eol_keychain_get_hash_value_as_float(eolFloat *output, eolKeychain *hash, eolLine key)
{
  eolFloat temp = 0;
  eolLine keyValue;
  eolKeychain *chain;
  if ((!hash) || (!output) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)return eolFalse;
  if (chain->keyType != eolKeychainString)return eolFalse;
  eol_line_cpy(keyValue,chain->keyValue);
  if (sscanf(keyValue,"%f",&temp) != 1)return eolFalse;
  *output = temp;
  return eolTrue;
}
Esempio n. 11
0
eolBool eol_keychain_get_hash_value_as_orientation(eolOrientation *output, eolKeychain *hash, eolLine key)
{
  eolKeychain *chain;
  if ((!hash) || (!output) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)return eolFalse;
  if (chain->keyType != eolKeychainHash)return eolFalse;
  /*now parse the hash further*/
  eol_keychain_get_hash_value_as_vec3d(&output->position,chain,"position");
  eol_keychain_get_hash_value_as_vec3d(&output->rotation,chain,"rotation");
  eol_keychain_get_hash_value_as_vec3d(&output->scale,chain,"scale");
  eol_keychain_get_hash_value_as_vec3d(&output->scale,chain,"color");
  eol_keychain_get_hash_value_as_float(&output->alpha,chain,"alpha");
  return eolTrue;
}
Esempio n. 12
0
eolBool eol_spawn_get_key_uint(eolUint *out, eolSpawn *spawn,eolWord key,eolInt *n)
{
  eolUint temp;
  GString *string;
  eolKeychain *value;
  eolKeychain *list;
  if (!spawn)return eolFalse;
  if (!out)return eolFalse;
  if (n != NULL)
  {
    list = eol_keychain_get_hash_value(spawn->keys,key);
    value = eol_keychain_get_list_nth(list,*n);
  }
  else
  {
    value = eol_keychain_get_hash_value(spawn->keys,key);
  }
  if (value == NULL)return eolFalse;
  if (value->keyType != eolKeychainString)return eolFalse;
  string = (GString *)value->keyValue;
  if (sscanf(string->str,"%ui",&temp) == 0)return eolFalse;
  *out = temp;
  return eolTrue;
}
Esempio n. 13
0
void eol_spawn_add_key_list(eolSpawn *spawn,eolWord key,eolLine value)
{
  eolKeychain *valuePointer;
  eolKeychain *list;
  if (!spawn)return;
  if (spawn->keys == NULL)return;
  valuePointer = eol_keychain_new_string(value);
  list = eol_keychain_get_hash_value(spawn->keys,key);
  if (!list)
  {
    list = eol_keychain_new_list();
    eol_keychain_hash_insert(spawn->keys,key,list);
  }
  eol_keychain_list_append(list,valuePointer);
}
Esempio n. 14
0
eolBool eol_keychain_get_hash_value_as_bool(eolBool *output, eolKeychain *hash, eolLine key)
{
  eolKeychain *chain;
  eolInt boo;
  if ((!hash) || (strlen(key) == 0))return eolFalse;
  chain = eol_keychain_get_hash_value(hash,key);
  if (!chain)
  {
    return eolFalse;
  }
  if (chain->keyType != eolKeychainString)return eolFalse;
  boo = eol_bool_from_string(chain->keyValue);
  if (boo == -1)return eolFalse;/*tag was not boolean*/
  *output = boo;
  return eolTrue;
}
Esempio n. 15
0
eolBool eol_spawn_has_key(eolSpawn *spawn, eolWord key)
{
  if (!spawn)return eolFalse;
  if (eol_keychain_get_hash_value(spawn->keys,key) == NULL)return eolFalse;
  return eolTrue;
}
eolComponent * eol_list_create_from_config(eolRect winRect,eolKeychain *def)
{
  int i;
  eolUint       id;
  eolLine       name;
  eolUint       fontSize = 3;
  eolRectFloat  rect;
  eolUint       listType = 0;
  eolLine       listTypeLine = "text";
  eolKeychain * chain = NULL;
  eolKeychain * item = NULL;
  eolBool       showVslider = eolTrue,showHslider = eolTrue;
  eolVec2D      itemDim = {16,16},itemPadding = {8,8};
  eolComponent * list = NULL;
  eolComponent * itemComp = NULL;
  eolComponentList *listData = NULL;
  if (!def)return NULL;
  eol_keychain_get_hash_value_as_line(name, def, "name");
  
  if (eol_keychain_get_hash_value_as_line(listTypeLine, def, "listType"))
  {
      if (eol_line_cmp(listTypeLine,"text") == 0)
      {
        listType = 0;
      }
      else if (eol_line_cmp(listTypeLine,"lines") == 0)
      {
        listType = 1;
      }
      else if (eol_line_cmp(listTypeLine,"block") == 0)
      {
        listType = 2;
      }
      else if (eol_line_cmp(listTypeLine,"dock") == 0)
      {
        listType = 3;
      }
  }
  
  eol_keychain_get_hash_value_as_uint(&id, def, "id");
  eol_keychain_get_hash_value_as_rectfloat(&rect, def, "rect");
  eol_keychain_get_hash_value_as_bool(&showVslider, def, "showVSlider");
  eol_keychain_get_hash_value_as_bool(&showHslider, def, "showHSlider");
  eol_keychain_get_hash_value_as_uint(&fontSize, def, "fontSize");
  eol_keychain_get_hash_value_as_vec2d(&itemDim, def, "itemDimensions");
  eol_keychain_get_hash_value_as_vec2d(&itemPadding, def, "itemPadding");
  
  list = eol_list_new(
    id,
    name,
    rect,
    winRect,
    listType,
    itemDim,
    itemPadding,
    showVslider,
    showHslider,
    fontSize
  );
  listData = eol_component_get_list_data(list);
  if (!listData)
  {
    eol_component_list_free(list);
    return NULL;
  }
  eol_rect_copy(&listData->itemRect,list->bounds);
  eol_keychain_get_hash_value_as_vec3d(&listData->backgroundColor, def, "backgroundColor");
  eol_keychain_get_hash_value_as_float(&listData->backgroundAlpha, def, "backgroundAlpha");
  eol_keychain_get_hash_value_as_bool(&listData->showBackground, def, "showBackground");
  eol_keychain_get_hash_value_as_bool(&listData->showBoarder, def, "showBoarder");
  eol_keychain_get_hash_value_as_bool(&listData->allowSelection, def, "allowSelection");
  eol_rect_set(&listData->itemRect,0,0,listData->displayItems.x,listData->displayItems.y);
  chain = eol_keychain_get_hash_value(def,"items");
  if (chain)
  {
    if (chain->keyType == eolKeychainList)
    {
      for (i = 0; i < chain->itemCount; i++)
      {
        item = eol_keychain_get_list_nth(chain, i);
        if (item != NULL)
        {
          itemComp = eol_component_make_from_config(item,listData->itemRect);
          if (itemComp )
          {
            eol_list_add_item(list,itemComp );
          }
        }
      }        
    }
  }
  return list;
}