Beispiel #1
0
eolComponent *eol_line_entry_new(
    eolUint       id,
    eolWord       name,
    eolRectFloat  rect,
    eolRect       bounds,
    eolLine       output
)
{
  return eol_entry_new(
    id,
    name,
    rect,
    bounds,
    output,
    EOLLINELEN,
    eolJustifyLeft,
    eolFalse,
    3,
    "",
    eolFalse,
    eol_vec3d(0,1,0),
    1,
    eol_vec3d(0.1,0.1,0.1)
  );
}
Beispiel #2
0
int main(int argc, char *argv[])
{
  int done;
  eolLine fps;
  int i;
  for(i = 1;i < argc;i++)
  {
    if(strcmp(argv[i],"-fs")== 0)
    {
    }
    if(strcmp(argv[i],"-wm")== 0)
    {
    }
  }
  Init_All(argv[0]);
  Setup_All();
  done = 0;
  do
  {
    eol_input_update();
    eol_mouse_update();

    eol_level_update_active();

    eol_entity_think_all();
    eol_entity_update_all();

    eol_particle_update_all();
    eol_camera_update();
    eol_window_update_all();

    eol_graphics_frame_begin();
    {
      eol_window_draw_all();
      eol_mouse_draw();
    }

    sprintf(fps,"FPS: %f",eol_graphics_get_FPS());
    eol_font_draw_text_justify(
      fps,
      640,
      0,
      eol_vec3d(1,0,0),
      1,
      2,
      eolJustifyRight);

    eol_graphics_frame_end();

    
    if((eol_input_quit_check()) ||
      ((eol_input_is_key_released(SDLK_F4)) && (eol_input_is_mod_held(KMOD_ALT))) ||
      ((eol_input_is_key_released(SDLK_q)) && (eol_input_is_mod_held(KMOD_ALT))))
    {
      eol_dialog_quit();
    }
  }while(!done);
  exit(0);
  return 0;
}
void eol_component_list_draw(eolComponent *component)
{
  eolRect r;
  eolRect ir;   /*item rect*/
  eolVec2D itemPos = {0,0};
  eolVec2D scaleArea;
  int position = 0;
  GList *it = NULL;
  eolComponentListItem *item = NULL;
  eolComponentList *list = eol_component_get_list_data(component);
  if (list == NULL)return;
  r.x = component->bounds.x - 1;
  r.y = component->bounds.y - 1;
  r.w = component->bounds.w + 2;
  r.h = component->bounds.h + 2;
  if (list->showBackground)
    eol_draw_solid_rect(component->bounds,list->backgroundColor,list->backgroundAlpha);
  /*draw list items*/
  scaleArea = eol_component_list_scaleable_area(list);
  /*TODO make the iterator start at the top position of the scroll*/
  for (it = list->itemList,position = 0;it != NULL;it = it->next,position++)
  {
    if (!it->data)continue;
    item = (eolComponentListItem*)it->data;
    itemPos = eol_component_list_get_item_position(component,position);
    eol_rect_set(&ir,itemPos.x,itemPos.y,list->itemRect.w,list->itemRect.h);
    if (!eol_list_item_bound_check(list,ir))
    {
      continue;
    }
    eol_component_move(item->item,ir);
    if (item->selected)
    {
      eol_draw_solid_rect(ir,list->highlightColor,0.9);
    }
    eol_component_draw(item->item);
    if (item->highlight)
    {
      eol_draw_rect(ir,list->highlightColor,1);
    }
  }
  if (list->showBoarder)
  {
    eol_draw_rect(r,eol_vec3d(1,1,1),1);
  }
  if ((list->showVSlider) && (fabs(scaleArea.y) > 1))
  {
    eol_component_draw(list->vSlider);
  }
  if ((list->showHSlider) && (fabs(scaleArea.x) > 1))
  {
    eol_component_draw(list->hSlider);
  }
}
void eol_lighting_setup_rep_plot()
{
  eolLight *light;
  light = eol_light_ambient_new();
  if (!light)return;
  eol_light_set_color(light,eol_vec3d(0.5,0.5,0.5));
  eol_light_update(light);
  
  light = eol_light_area_new();
  if (!light)return;
  eol_light_set_color(light,eol_vec3d(1,0.7,0.7));
  eol_light_move(light,eol_vec3d(-8,4,1));
  eol_light_update(light);
  
  light = eol_light_area_new();
  if (!light)return;
  eol_light_set_color(light,eol_vec3d(0.7,0.7,1));
  eol_light_move(light,eol_vec3d(8,-4,1));
  eol_light_update(light);
}
eolLight *eol_light_directional_new()
{
  eolLight *light = eol_light_new();
  if (light != NULL)
  {
    light->type = eolLightDirectional;
    eol_light_move(light,eol_vec3d(0,0,1));
    light->on = eolTrue;
  }
  return light;
}
eolLight *eol_light_ambient_new()
{
  eolLight *light = eol_light_new();
  if (light != NULL)
  {
    light->type = eolLightAmbient;
    eol_light_move(light,eol_vec3d(0,0,1));
    light->on = eolTrue;
  }
  return light;
}
Beispiel #7
0
eolBool TestWindowUpdate(eolWindow *win,GList *updates)
{
  int i;
  GList *c;
  eolComponent *comp = NULL;
  eolComponent *labelComp = NULL;
  if ((win == NULL)||(updates == NULL))return eolFalse;
  
  for (c = updates;c != NULL;c = c->next)
  {
    if (c->data == NULL)continue;
    comp = (eolComponent *)c->data;
    labelComp = eol_window_get_component_by_id(win,0);
    switch (comp->id)
    {
      case 0:
        break;
      case 1:
        for (i = 0; i < 100; i ++)
        {
        eol_particle_make_point(eol_vec3d(crandom()*0.1,0,0),
                                eol_vec3d(crandom()*0.1,crandom()*0.1 + 0.1,crandom()*0.1),
                                eol_vec3d(0,-0.009,0) ,
                                5,
                                eol_vec3d(0,1,random()),
                                1,
                                100);
        }
        return eolTrue;
      case 3:
        spawnTestEnt(eol_vec3d(0,0,0));
        return eolTrue;
    }
  }
  return eolFalse;
}
void eol_level_draw_layer(eolLevelLayer * layer,eolFloat alpha)
{
  if (!layer)return;
  glPushMatrix();
  glTranslatef(layer->ori.position.x,layer->ori.position.y,layer->ori.position.z);
  glRotatef(layer->ori.rotation.x, 1.0f, 0.0f, 0.0f);
  glRotatef(layer->ori.rotation.y, 0.0f, 1.0f, 0.0f);
  glRotatef(layer->ori.rotation.z, 0.0f, 0.0f, 1.0f);
  glScalef(layer->ori.scale.x,
           layer->ori.scale.y,
           layer->ori.scale.z);
  /*draw all layer stuffs*/
  if (_eol_level_draw_backgrounds)
  {
    eol_level_draw_layer_backgrounds(layer,alpha);
  }
  if (_eol_level_draw_tiles)
  {
    eol_tile_map_draw(layer->tileMap);
  }
  if (_eol_level_draw_tilegrid)
  {
    eol_tile_grid_draw(layer->tileMap, eol_vec3d(0.5,0.5,0.5));
  }
  if (_eol_level_draw_clipmask)
  {
    eol_level_draw_layer_clipmask(layer);
  }
  if (_eol_level_draw_bounds)
  {
    eol_level_draw_layer_bounds(layer);
  }
  
  /*TODO: draw entities*/
  
  glPopMatrix();
}
void editor_orientation_draw(eolWindow *win)
{
  /*draw happend every frame, so here is where we update mouse based updates*/
  eolVec2D mouseNow;
  OriData *oriData;
  eolBool snapMode = eolFalse;
  eolBool  fineMode = eolFalse;
  eolFloat moveFactor = 0.01;
  eolFloat scaleLimit = 0.001;
  eolFloat mouseDistance = 0;
  eolFloat zeroDistance = 0;
  eolFloat rotAngle = 0;
  eolVec2D mouseVector = {0,0};
  oriData = editor_orientation_get_data(win);
  if (!oriData)return;
  if (oriData->omMode == OM_NONE)
  {
    /*no need to go further*/
    return;
  }
  /*TODO take camera distance into consideration as well*/
  if (eol_input_is_mod_down(KMOD_CTRL))/*snap to whole number*/
  {
    snapMode = eolTrue;
  }
  if (eol_input_is_mod_down(KMOD_SHIFT))
  {
    fineMode = eolTrue;
  }
  eol_mouse_get_position_vec2d(&mouseNow);
  eol_vec2d_set(mouseVector,(mouseNow.x - oriData->mouseBegin.x),(oriData->mouseBegin.y - mouseNow.y));
  switch(oriData->omMode)
  {
    case OM_GRAB:
      if (oriData->secondaryMode & OA_X)
      {
        oriData->ori.position.x = oriData->oldOri.position.x + (mouseVector.x * moveFactor);
        oriData->ori.position.x = editor_fine_snap(oriData->ori.position.x,fineMode, snapMode);
      }
      if (oriData->secondaryMode & OA_Y)
      {
        oriData->ori.position.y = oriData->oldOri.position.y + (mouseVector.y * moveFactor);
        oriData->ori.position.y = editor_fine_snap(oriData->ori.position.y,fineMode, snapMode);
      }
      if (oriData->secondaryMode & OA_Z)
      {
        oriData->ori.position.z = oriData->oldOri.position.z + (mouseVector.y * moveFactor);
        oriData->ori.position.z = editor_fine_snap(oriData->ori.position.z,fineMode, snapMode);
      }
      editor_orientation_ori_updated(win);
      break;
    case OM_ROT:
      eol_draw_line_2D(oriData->mouseBegin,mouseNow,1,eol_vec3d(0.5,1,0.5),1);
      eol_draw_line_2D(oriData->mouseBegin,eol_vec2d(oriData->mouseBegin.x + 100,oriData->mouseBegin.y),1,eol_vec3d(1,1,1),1);
      rotAngle = eol_vec2d_angle(mouseVector) - 180;
      rotAngle = editor_fine_snap(rotAngle * 0.2,fineMode,snapMode) * 5;
      if (fineMode && !snapMode)
      {
        rotAngle *= 0.1;
      }
      
      if (oriData->secondaryMode & OA_X)
      {
        oriData->ori.rotation.x = oriData->oldOri.rotation.x + rotAngle;
      }
      if (oriData->secondaryMode & OA_Y)
      {
        oriData->ori.rotation.y = oriData->oldOri.rotation.y + rotAngle;
      }
      if (oriData->secondaryMode & OA_Z)
      {
        oriData->ori.rotation.z = oriData->oldOri.rotation.z + rotAngle;
      }
      editor_orientation_ori_updated(win);
      eol_draw_cirlce_2D(oriData->mouseBegin,
                         100,
                         32,
                         eol_vec3d(1,1,1),
                         1);
      break;
    case OM_SCALE:
      eol_draw_line_2D(oriData->mouseBegin,mouseNow,1,eol_vec3d(1,0.5,0.5),1);
      mouseDistance = eol_vec2d_magnitude(mouseVector);
      zeroDistance = 100;
      if (fineMode && !snapMode)
      {
        moveFactor *= 0.1;
        mouseDistance *= 0.1;
      }
      mouseDistance -= zeroDistance;
      eol_draw_cirlce_2D(oriData->mouseBegin,
                         zeroDistance,
                         32,
                         eol_vec3d(1,1,1),
                         1);

      if (oriData->secondaryMode & OA_X)
      {
        oriData->ori.scale.x = oriData->oldOri.scale.x + (mouseDistance  * moveFactor);
        oriData->ori.scale.x = editor_fine_snap(oriData->ori.scale.x,fineMode, snapMode);
      }
      if (oriData->secondaryMode & OA_Y)
      {
        oriData->ori.scale.y = oriData->oldOri.scale.y + (mouseDistance  * moveFactor);
        oriData->ori.scale.y = editor_fine_snap(oriData->ori.scale.y,fineMode, snapMode);
      }
      if (oriData->secondaryMode & OA_Z)
      {
        oriData->ori.scale.z = oriData->oldOri.scale.z + (mouseDistance  * moveFactor);
        oriData->ori.scale.z = editor_fine_snap(oriData->ori.scale.z,fineMode, snapMode);
      }
      
      if ((oriData->ori.scale.x >=0) && (oriData->ori.scale.x < scaleLimit))
      {
        oriData->ori.scale.x = scaleLimit;
      }
      else if ((oriData->ori.scale.x < 0) && (oriData->ori.scale.x > -scaleLimit))
      {
        oriData->ori.scale.x = -scaleLimit;
      }

      if ((oriData->ori.scale.y >=0) && (oriData->ori.scale.y < scaleLimit))
      {
        oriData->ori.scale.y = scaleLimit;
      }
      else if ((oriData->ori.scale.y < 0) && (oriData->ori.scale.y > -scaleLimit))
      {
        oriData->ori.scale.y = -scaleLimit;
      }

      if ((oriData->ori.scale.z >=0) && (oriData->ori.scale.z < scaleLimit))
      {
        oriData->ori.scale.z = scaleLimit;
      }
      else if ((oriData->ori.scale.z < 0) && (oriData->ori.scale.z > -scaleLimit))
      {
        oriData->ori.scale.z = -scaleLimit;
      }
      
      
      editor_orientation_ori_updated(win);
      break;
    case OM_COLOR:
      break;
    case OM_TRANS:
      break;
  }
  /*draw axis*/
  if (oriData->secondaryMode & OA_X)
  {
    eol_draw_line_2D(eol_vec2d(oriData->mouseBegin.x - 100,oriData->mouseBegin.y),
                     eol_vec2d(oriData->mouseBegin.x + 100,oriData->mouseBegin.y),
                     1,
                     eol_vec3d(1,0,0),
                     1);
  }
  if (oriData->secondaryMode & OA_Y)
  {
    eol_draw_line_2D(eol_vec2d(oriData->mouseBegin.x,oriData->mouseBegin.y - 100),
                     eol_vec2d(oriData->mouseBegin.x,oriData->mouseBegin.y + 100),
                     1,
                     eol_vec3d(0,1,0),
                     1);
  }
  if (oriData->secondaryMode & OA_Z)
  {
    eol_draw_line_2D(eol_vec2d(oriData->mouseBegin.x + 50,oriData->mouseBegin.y - 50),
                     eol_vec2d(oriData->mouseBegin.x - 50,oriData->mouseBegin.y + 50),
                     1,
                     eol_vec3d(0,0,1),
                     1);
  }
}
Beispiel #10
0
void eol_dialog_text_block(eolLine title,
                           eolText text,
                           eolWord okText,
                           void    *data,
                           eolWindowCallback onOK)
{
  eolRect trect;  /*title dimensions*/
  eolRect brect;
  eolUint ww,wh;  /*window dimensions*/
  eolUint bw,bh;  /*button dimensions*/
  eolFloat bx,by;
  eolUint sw,sh;  /*screen dimensions*/
  eolWindow *win = eol_window_new();
  eolComponent *comp = NULL;
  if (!win)
  {
    eol_logger_message(
      EOL_LOG_ERROR,
      "eol_dialog:failed to make text block dialog.");
    return;
  }
  strncpy(win->name,"text_block",EOLLINELEN);

  eol_graphics_get_size(&sw, &sh);
  eol_button_get_stock_size(&bw, &bh);
  trect = eol_font_get_bounds(title,4);
  brect = eol_font_get_block_bounds(
    text,
    3,
    480,
    0
  );

  ww = MAX(trect.w + 10, brect.w + 8);
  wh = trect.h + brect.h + bh + 22;

  eol_rect_copy(&win->rect,eol_rect((sw/2) - (ww/2),(sh/2) - (wh/2),ww,wh));
  win->canHasFocus = eolTrue;
  win->drawGeneric = eolTrue;
  win->update = eol_dialog_text_block_update;

  by = eol_window_get_relative_position(2,win->rect.h);
  comp = eol_label_new(
    0,
    "text_title",
    eol_rectf(0.5,by,1,1),
    win->rect,
    eolTrue,
    title,
    eolJustifyCenter,
    eolFalse,
    4,
    NULL,
    eol_vec3d(1,1,1),
    1);
  eol_window_add_component(win,comp);

  
  bx = eol_window_get_relative_position(brect.w,win->rect.w);
  by = eol_window_get_relative_position(4 +trect.h,win->rect.h);
  comp = eol_label_new(
    1,
    "text_block",
    eol_rectf(0.5-(bx/2),by,1,1),
    win->rect,
    eolTrue,
    text,
    eolJustifyLeft,
    eolTrue,
    3,
    NULL,
    eol_vec3d(1,1,1),
    1);
  eol_window_add_component(win,comp);

  bx = eol_window_get_relative_position(win->rect.w - bw,win->rect.w);
  by = eol_window_get_relative_position(win->rect.h - bh,win->rect.h);
  comp = eol_button_stock_new(2,
                              "ok_button",
                              eol_rectf(bx,by,1,1),
                              win->rect,
                              okText,
                              -1,
                              SDLK_RETURN,
                              0,
                              eolFalse);
  eol_window_add_component(win,comp);

  win->customData = data;

  if (onOK != NULL)
  {
    eol_window_allocat_callbacks(win,1);
    if ((win->callbacks != NULL) && (win->callbackCount == 1))
    {
      win->callbacks[0] = onOK;
    }
  }
}
Beispiel #11
0
eolWindow *eol_dialog_text_prompt(char *output,
                                  eolUint bufferSize,
                                  eolUint lineWidth,  /*0 means no limit*/
                                  eolLine question,
                                  void * customData,
                                  eolWindowCallback onOk,
                                  eolWindowCallback onCancel)
{
  eolRect trect;  /*text dimensions*/
  eolRect brect;  /*buffer dimentions*/
  eolUint ww,wh;  /*window dimensions*/
  eolUint bw,bh;  /*button dimensions*/
  eolUint sw,sh;  /*screen dimensions*/
  eolBool wordWrap = eolFalse;
  eolEntryData *entryData;
  eolWindow *win = eol_window_new();
  eolComponent *comp = NULL;
  if (!output)
  {
    eol_logger_message(
      EOL_LOG_ERROR,
      "eol_dialog_text_prompt:no out parameter provided.");
    return NULL;
  }
  if (!win)
  {
    eol_logger_message(
      EOL_LOG_ERROR,
      "eol_dialog_text_prompt:failed to make test prompt dialog.");
    return NULL;
  }

  win->customData = malloc(sizeof(eolEntryData));
  if (!win->customData)
  {
    eol_logger_message(
      EOL_LOG_ERROR,
      "eol_dialog_text_prompt:failed to allocate window data");
    eol_window_free(&win);
    return NULL;
  }
  memset(win->customData,0,sizeof(eolEntryData));
  entryData = (eolEntryData*)win->customData;
  entryData->customData = customData;
  entryData->output = output;
  
  wordWrap = eolFalse;
  
  strncpy(win->name,"gettext",EOLLINELEN);
  eol_graphics_get_size(&sw, &sh);
  eol_button_get_stock_size(&bw, &bh);
  trect = eol_font_get_bounds(question,3);
  brect = eol_font_get_bounds("W",3);
  brect.w *= bufferSize;
  if (MAX(trect.w,brect.w) > ((bw*2) + 6))
  {
    ww = MAX(trect.w,brect.w) + 10;
  }
  else
  {
    ww = (bw*2) + 16;
  }
  if (ww > sw - 20)ww = sw - 20;
  wh = trect.h + brect.h + bh + 30;
  eol_rect_copy(&win->rect,eol_rect((sw/2) - (ww/2),(sh/2) - (wh/2),ww,wh));
  win->canHasFocus = eolTrue;
  win->drawGeneric = eolTrue;
  win->update = eol_dialog_text_prompt_update;
  win->custom_delete = eol_dialog_text_prompt_delete;
  
  comp = eol_label_new(0,"text_prompt_title",eol_rectf(0.5,0.1,1,1),win->rect,eolTrue,
                       question,eolJustifyCenter,eolFalse,3,NULL,eol_vec3d(1,1,1),1);
  eol_window_add_component(win,comp);
  
  comp = eol_button_stock_new(1,
                              "ok_button",
                              eol_rectf(0.25,0.7,1,1),
                              win->rect,
                              "OK",
                              -1,
                              SDLK_RETURN,
                              0,
                              eolTrue);
  eol_window_add_component(win,comp);
  
  comp = eol_button_stock_new(2,
                              "cancel_button",
                              eol_rectf(0.75,0.7,1,1),
                              win->rect,
                              "CANCEL",
                              -1,
                              SDLK_ESCAPE,
                              0,
                              eolTrue);
  eol_window_add_component(win,comp);
  
  comp = eol_entry_new(3,
                       "text_entry",
                       eol_rectf(0.025,0.25,0.95,0.25),
                       win->rect,
                       output,
                       bufferSize,
                       eolJustifyLeft,
                       wordWrap,
                       3,
                       "",
                       eolFalse,
                       eol_vec3d(1,1,1),
                       1,
                       eol_vec3d(0.2,0.2,0.2));
  comp->hasFocus = eolTrue;
  comp->canHasFocus = eolTrue;
  eol_window_add_component(win,comp);

  eol_window_allocat_callbacks(win,2);
  if ((win->callbacks != NULL) && (win->callbackCount == 2))
  {
    win->callbacks[0] = onOk;
    win->callbacks[1] = onCancel;
  }
  return win;
}
Beispiel #12
0
void eol_dialog_yes_no(eolLine question,
                       void * customData,
                       eolWindowCallback onYes,
                       eolWindowCallback onNo)
{
  eolRect trect;  /*text dimensions*/
  eolUint ww,wh;  /*window dimensions*/
  eolUint bw,bh;  /*button dimensions*/
  eolUint sw,sh;  /*screen dimensions*/
  eolWindow *win = eol_window_new();
  eolComponent *comp = NULL;
  if (!win)
  {
    eol_logger_message(
      EOL_LOG_ERROR,
      "eol_dialog:failed to make yes/no dialog.");
    return;
  }
  strncpy(win->name,"yesno",EOLLINELEN);
  eol_graphics_get_size(&sw, &sh);
  eol_button_get_stock_size(&bw, &bh);
  trect = eol_font_get_bounds(question,3);
  if (trect.w > ((bw*2) + 6))
  {
    ww = trect.w + 10;
  }
  else
  {
    ww = (bw*2) + 16;
  }
  wh = trect.h + bh + 16;
  eol_rect_copy(&win->rect,eol_rect((sw/2) - (ww/2),(sh/2) - (wh/2),ww,wh));
  win->canHasFocus = eolTrue;
  win->drawGeneric = eolTrue;
  win->update = eol_dialog_yes_no_update;
  comp = eol_label_new(0,"yes_title",eol_rectf(0.5,0.1,1,1),win->rect,eolTrue,
                       question,eolJustifyCenter,eolFalse,3,NULL,eol_vec3d(1,1,1),1);
  eol_window_add_component(win,comp);
  comp = eol_button_stock_new(1,
                              "yes_button",
                              eol_rectf(0.25,0.65,1,1),
                              win->rect,
                              "YES",
                              -1,
                              SDLK_y,
                              0,
                              eolTrue);
  eol_window_add_component(win,comp);
  comp = eol_button_stock_new(2,
                              "no_button",
                              eol_rectf(0.75,0.65,1,1),
                              win->rect,
                              "NO",
                              -1,
                              SDLK_n,
                              0,
                              eolTrue);
  eol_window_add_component(win,comp);
  win->customData = customData;
  eol_window_allocat_callbacks(win,2);
  if ((win->callbacks != NULL) && (win->callbackCount == 2))
  {
    win->callbacks[0] = onYes;
    win->callbacks[1] = onNo;
  }
}
eolComponent *eol_list_new(
    eolUint       id,
    eolWord       name,
    eolRectFloat  rect,
    eolRect       bounds,
    eolUint       listType,
    eolVec2D      itemDimensions,
    eolVec2D      itemPadding,
    eolBool       showVSlider,
    eolBool       showHSlider,
    eolUint       fontSize
  )
{
  eolRectFloat slideRect = {0,0,1,1};
  eolComponent *component = NULL;
  eolComponentList *list = NULL;
  component = eol_component_new();
  if (!component)return NULL;

  eol_rectf_copy(&component->rect,rect);
  eol_component_get_rect_from_bounds(&component->bounds,bounds, rect);

  eol_component_make_list(
    component,
    listType,
    showHSlider,
    showVSlider,
    itemDimensions,
    itemPadding,
    fontSize
  );

  list = eol_component_get_list_data(component);
  if (list == NULL)
  {
    eol_component_free(&component);
    return NULL;
  }
  component->id = id;
  eol_line_cpy(component->name,name);
  list->itemBounds.x = component->bounds.x;
  list->itemBounds.y = component->bounds.y;
  list->itemBounds.w = component->bounds.w;
  list->itemBounds.h = component->bounds.h;

  if (showVSlider)
  {
    list->vSliderBounds.h = component->bounds.h;
    list->vSliderBounds.y = component->bounds.y;
    list->vSliderBounds.w = 25;/*TODO: make a function for getting width of slider*/
    list->vSliderBounds.x = component->bounds.x + component->bounds.w;
    list->vSlider = eol_slider_common_new(
      0,
      "vertical_scroll",
      slideRect,
      list->vSliderBounds,
      eolTrue,
      eol_vec3d(0,0,0),
      0
    );
  }
  if (showHSlider)
  {
    list->hSliderBounds.w = component->bounds.w;
    list->hSliderBounds.x = component->bounds.x;
    list->hSliderBounds.h = 25;/*TODO: make a function for getting width of slider*/
    list->hSliderBounds.y = component->bounds.y + component->bounds.h;
    list->hSlider = eol_slider_common_new(
      0,
      "horizontal_scroll",
      slideRect,
      list->hSliderBounds,
      eolFalse,
      eol_vec3d(0,0,0),
      0
    );
  }
  return component;
}
Beispiel #14
0
void eol_component_entry_draw(eolComponent *component, eolRect bounds)
{
  eolRect r;
  eolComponentEntry *entry = eol_component_get_entry_data(component);
  if (entry == NULL)return;
  r.x = bounds.x - 1;
  r.y = bounds.y - 1;
  r.w = bounds.w + 2;
  r.h = bounds.h + 2;
  eol_draw_solid_rect(r,eol_vec3d(1,1,1),1);
  eol_draw_solid_rect(bounds,entry->bgcolor,1);
  if (entry->buffer->len <= 0)return;
  if (entry->font == NULL)
  {
    if (entry->wordWrap)
    {
      eol_font_draw_text_block(
      entry->buffer->str,
      bounds.x,
      bounds.y,
      bounds.w,
      0,
      entry->color,
      entry->alpha,
      entry->fontSize
      );
    }
    else
    {
      eol_font_draw_text_justify(
        entry->buffer->str,
        bounds.x,
        bounds.y,
        entry->color,
        entry->alpha,
        entry->fontSize,
        entry->justify
      );
    }
  }
  else
  {
    if (entry->wordWrap)
    {
      eol_font_draw_text_block_custom(
        entry->buffer->str,
        bounds,
        entry->color,
        entry->alpha,
        entry->font
      );
    }
    else
    {
      eol_font_draw_text_justify_custom(
        entry->buffer->str,
        bounds.x,
        bounds.y,
        entry->color,
        entry->alpha,
        entry->font,
        entry->justify
      );
    }
  }
}
Beispiel #15
0
int main(int argc, char *argv[])
{
  int done;
  int i;
  float radius = 0.00001;

  eolVec3D point = {0,0,-5};
  eolLine fps;
  eolLight *light = NULL;
  for(i = 1;i < argc;i++)
  {
    if(strcmp(argv[i],"-fs")== 0)
    {
    }
    if(strcmp(argv[i],"-wm")== 0)
    {
    }
  }
  Init_All(argv[0]);
  eol_camera_config();
  eol_camera_set_height(30);
  eol_camera_init();
  done = 0;
  MakeTestWindow();
  eol_mouse_show();
  light = eol_light_area_new();
  eol_light_set_color(light,eol_vec3d(0.5,0.5,0.5));
  eol_light_set_radius(light,radius);
  eol_lighting_setup_rep_plot();
  srandom(SDL_GetTicks());
  CreateTestLevel();
  
  do
  {
    eol_light_move(light,point);
    eol_light_update(light);

    eol_input_update();
    eol_mouse_update();

    eol_level_update_active();

    eol_entity_think_all();
    eol_entity_update_all();

    eol_particle_update_all();
    eol_window_update_all();

    eol_graphics_frame_begin();
    eol_window_draw_all();

    sprintf(fps,"FPS: %f",eol_graphics_get_FPS());
    eol_font_draw_text_justify(
      fps,
      640,
      0,
      eol_vec3d(1,0,0),
      1,
      2,
      eolJustifyRight);

    eol_mouse_draw();
    eol_graphics_frame_end();

    if((eol_input_quit_check()) ||
      ((eol_input_is_key_pressed(SDLK_F4)) && (eol_input_is_mod_held(KMOD_ALT))))
    {
      eol_dialog_quit();
    }
  }while(!done);
  exit(0);
  return 0;
}
Beispiel #16
0
void MakeTestWindow()
{
  eolFloat lineHeight;
  eolWindow *win = eol_window_new();
  eolComponent *comp = NULL;
  eolUint w,h;
  if (!win)
  {
    fprintf(stdout,"OH NO IT FAILED TO CREATE!\n");
    return;
  }
  eol_graphics_get_size(&w, &h);
  strncpy(win->name,"window",EOLLINELEN);
  eol_rect_copy(&win->rect,eol_rect(0,0,w,h));
  win->canHasFocus = eolTrue;
  win->hasFocus = eolTrue;
  win->drawGeneric = eolFalse;
  win->componentCount = 0;
  win->components = NULL;
  win->customData = NULL;
  win->custom_delete = NULL;
  win->draw = NULL;
  win->update = TestWindowUpdate;
  win->draw = TestWindowDraw;
  win->customData = malloc(sizeof(TestData));
  memset(win->customData,0,sizeof(TestData));
  eol_camera_set_height(30);
  comp = eol_label_new(
    0,
    "main_label",
    eol_rectf(0.05,0.05,1,1),
    win->rect,
    eolTrue,
    "Test Bed for Engine Of Lies",
    eolJustifyLeft,
    eolFalse,
    3,
    NULL,
    eol_vec3d(0.2,1,0.2),
    1
  );
  eol_window_add_component(win,comp);
  
  comp = eol_button_stock_new(
    1,
    "test_button",
    eol_rectf(0.7,0.8,1,1),
    win->rect,
    "Test Particle",
    0,
    0,
    eolFalse
  );
  eol_window_add_component(win,comp);
  
  lineHeight = eol_font_get_text_height_average(3);
  lineHeight += 4;
  comp = eol_line_entry_new(
    2,
    "test_entry",
    eol_rectf(0.1,0.85,0.5,lineHeight/win->rect.h),
    win->rect,
    ""
  );
  eol_window_add_component(win,comp);

  comp = eol_button_stock_new(
    3,
    "test_button2",
    eol_rectf(0.1,0.7,1,1),
    win->rect,
    "Test Entity",
    0,
    0,
    eolFalse
  );
  eol_window_add_component(win,comp);

}