Exemplo n.º 1
0
//! the assign texture button
void Menu::assignTexture(Gui::GuiElement* elem){
  //Dialog
  Dialog* dia = new Dialog();
  //Textures
  ListBox* lb = new ListBox();
  lb->setPosition(Vector2D(50, 100));
  lb->setSpan(Vector2D(400,600));
  vector<Texture*> textures = Graphic::instance()->getScene().getTextures();
  for (unsigned i = 0; i < textures.size(); i++){
    lb->addEntry(textures[i]->getName());
  }
  dia->addElement(lb);
  //Texture stages
  DropDownButton* stages = new DropDownButton();
  stages->setPosition(Vector2D(500, 680));
  dia->addUnscaledElement(stages);
  stages->calcDDPos(1);
  stages->setText("Stage 0");
  stages->addEntry("Stage 0");
  stages->addEntry("Stage 1");
  stages->addEntry("Stage 2");
  stages->addEntry("Stage 3");
  stages->addEntry("Stage 4");
  stages->addEntry("Stage 5");
  stages->addEntry("Stage 6");
  stages->addEntry("Stage 7");
  //OK button
  PDButton* ok = new PDButton();
  ok->setPosition(Vector2D(575, 50));
  ok->setSpan(Vector2D(75,18));
  ok->setText("  OK");
  ok->setCbFunc(assignTextureDialog);
  dia->addUnscaledElement(ok);
  CGE::Engine::instance()->addGuiListener(dia);
}
Exemplo n.º 2
0
Editor::Editor(){
  arcball_ = new CGE::Arcball();
  lastPos_ = Vector2D();
  gridStep_ = 8;
  gridOffset_ = 4;
  rotationStep_ = (float)M_PI/2.0f;
  editPlane_ = XZ;
  editMode_ = Translation;
  std::string path = Filesystem::getCwd();
  std::cerr << path;
  std::ifstream in((path+"/data/attributes.dat").c_str());
  assert(in);
  std::string attrib;
  char buffer[1024];
  while(in >> attrib){
    if (attrib[0] == '#'){
      in.getline(buffer, 1024);
      continue;
    }
    int value;
    in >> value;
    aTov_[attrib] = value;
    vToa_[value] = attrib;
  }
}
Exemplo n.º 3
0
//! The add model callback
void Menu::addModel(Gui::GuiElement* elem){
  //Dialog
  Dialog* dia = new Dialog();
  //Meshes
  ListBox* lb = new ListBox();
  lb->setPosition(Vector2D(50, 100));
  lb->setSpan(Vector2D(400,600));
  vector<Mesh*> meshes = Graphic::instance()->getScene().getMeshes();
  for (unsigned i = 0; i < meshes.size(); i++){
    lb->addEntry(meshes[i]->getName());
  }
  dia->addElement(lb);
  //OK button
  PDButton* ok = new PDButton();
  ok->setPosition(Vector2D(575, 50));
  ok->setSpan(Vector2D(75,18));
  ok->setText("  OK");
  ok->setCbFunc(setModel);
  dia->addUnscaledElement(ok);
  CGE::Engine::instance()->addGuiListener(dia);
}
Exemplo n.º 4
0
void Menu::options(Gui::GuiElement* elem){
  //Dialog
  Dialog* dia = new Dialog();
  CGE::Engine::instance()->addGuiListener(dia);

  //The plane chooser
  DropDownButton* planes = new DropDownButton();
  planes->setPosition(Vector2D(20, 680));
  dia->addUnscaledElement(planes);
  planes->calcDDPos(1);
  Editor::Plane plane = Editor::instance()->getEditPlane();
  string label;
  if (plane == Editor::XZ)
    label = "XZ Plane";
  else if (plane == Editor::XY)
    label = "XY Plane";
  else if (plane == Editor::YZ)
    label = "YZ Plane";
  planes->setText(label);
  planes->addEntry("XZ Plane");
  planes->addEntry("XY Plane");
  planes->addEntry("YZ Plane");

  //The translation step
  InputField* input = new InputField();
  input->setPosition(Vector2D(20, 650));
  float step = Editor::instance()->getGridStep();
  input->setText(toStr(step));
  dia->addUnscaledElement(input);

  //OK button
  PDButton* ok = new PDButton();
  ok->setPosition(Vector2D(575, 50));
  ok->setSpan(Vector2D(75,18));
  ok->setText("  OK");
  ok->setCbFunc(changeOptions);
  dia->addUnscaledElement(ok);
}
Exemplo n.º 5
0
//! the model properties callback
void Menu::properties(Gui::GuiElement* elem){
  //Dialog
  Dialog* dia = new Dialog();
  CGE::Engine::instance()->addGuiListener(dia);
  //Assign texture button
  PDButton* assTex = new PDButton();
  assTex->setPosition(Vector2D(20, 730));
  assTex->setText("Assign Texture");
  assTex->setCbFunc(assignTexture);
  dia->addUnscaledElement(assTex);

  Model* mdl = Graphic::instance()->getCurrModel();
  
  //Attributes
  InputField* in = new InputField();
  in->setPosition(Vector2D(20, 690));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(0)));
  dia->addUnscaledElement(in);
  
  in = new InputField();
  in->setPosition(Vector2D(20, 660));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(1)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 630));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(2)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 600));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(3)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 570));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(4)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 540));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(5)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 510));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(6)));
  dia->addUnscaledElement(in);

  in = new InputField();
  in->setPosition(Vector2D(20, 480));
  if (!mdl)
    in->setText("-1");
  else
    in->setText(Editor::instance()->attribString(mdl->getAttrib(7)));
  dia->addUnscaledElement(in);
  
  //Close button
  PDButton* close = new PDButton();
  close->setPosition(Vector2D(575, 50));
  close->setSpan(Vector2D(75,18));
  close->setText(" Close");
  close->setCbFunc(evaluateAttribs);
  dia->addUnscaledElement(close);
}