diff --git a/button.cpp b/button.cpp index 4de82b7..5f67102 100644 --- a/button.cpp +++ b/button.cpp @@ -15,18 +15,19 @@ using namespace std; using namespace vb01; namespace vb01Gui{ - Button::Button(Vector2 pos, Vector2 size, string name, string fontPath, int trigger, bool separate, string imagePath){ - this->pos = pos; - this->size = size; - this->name = name; - this->separate = separate; - this->imagePath = imagePath; - this->trigger = trigger; - + Button::Button(Vector3 p, Vector2 s, string n, string fontPath, int t, bool sep, string ip) : + pos(p), + size(s), + name(n), + trigger(t), + separate(sep), + imagePath(ip), + textOffset(Vector3(0, s.y, .1)) + { Root *root = Root::getSingleton(); guiNode = root->getGuiNode(); rect = new Quad(Vector3(size.x, size.y, 0), false); - rectNode = new Node(Vector3(pos.x, pos.y, 0)); + rectNode = new Node(pos); Material *mat = new Material(root->getLibPath() + "gui"); if(imagePath == ""){ @@ -47,9 +48,9 @@ namespace vb01Gui{ if(separate){ text = new Text(fontPath, stringToWstring(name)); - text->setScale(.2); - textNode = new Node(Vector3(pos.x, pos.y + size.y, - .1)); + float sc = .2; + textNode = new Node(pos + textOffset, Quaternion::QUAT_W, Vector3(sc, sc, 1)); textNode->addText(text); Material *textMat = new Material(root->getLibPath() + "text"); @@ -79,14 +80,14 @@ namespace vb01Gui{ GLFWwindow *window = Root::getSingleton()->getWindow(); glfwGetWindowSize(window, &width, &height); - float posRatio[] = {pos.x / initWindowSize[0], pos.y / initWindowSize[1]}; - float sizeRatio[] = {size.x / initWindowSize[0], size.y / initWindowSize[1]}; + float posRatio[] = {pos.x / initWindowSize[0], pos.y / initWindowSize[1]}; + float sizeRatio[] = {size.x / initWindowSize[0], size.y / initWindowSize[1]}; - pos = Vector2(width * posRatio[0], height * posRatio[1]); - size = Vector2(width * sizeRatio[0], height * sizeRatio[1]); + pos = Vector3(width * posRatio[0], height * posRatio[1], pos.z); + size = Vector2(width * sizeRatio[0], height * sizeRatio[1]); - initWindowSize[0] = width; - initWindowSize[1] = height; + initWindowSize[0] = width; + initWindowSize[1] = height; if(textNode) textNode->setVisible(active); @@ -102,15 +103,13 @@ namespace vb01Gui{ mouseOver = false; } - void Button::setPos(Vector2 pos){ + void Button::setPos(Vector3 pos){ this->pos = pos; - float z1 = rectNode->getPosition().z; - rectNode->setPosition(Vector3(pos.x, pos.y, z1)); - if(textNode){ - float z2 = textNode->getPosition().z; - textNode->setPosition(Vector3(pos.x, pos.y + size.y, z2)); - } + rectNode->setPosition(pos); + + if(textNode) + textNode->setPosition(pos + textOffset); } void Button::setSize(Vector2 size){ @@ -123,16 +122,6 @@ namespace vb01Gui{ ((Material::Vector4Uniform*)rect->getMaterial()->getUniform(diffColUni))->value = color; } - void Button::setZOrder(float zOrder){ - Vector3 rectPos = rectNode->getPosition(); - rectNode->setPosition(Vector3(rectPos.x, rectPos.y, zOrder)); - - if(textNode){ - Vector3 textPos = textNode->getPosition(); - textNode->setPosition(Vector3(textPos.x, textPos.y, zOrder - .1)); - } - } - void Button::setImage(string image){ int texId = -1; Material *mat = rect->getMaterial(); diff --git a/button.h b/button.h index 224307a..dc340c9 100644 --- a/button.h +++ b/button.h @@ -18,14 +18,14 @@ namespace vb01{ namespace vb01Gui{ class Button{ public: - Button(vb01::Vector2, vb01::Vector2, std::string, std::string, int = -1, bool = true, std::string = ""); + Button(vb01::Vector3, vb01::Vector2, std::string, std::string, int = -1, bool = true, std::string = ""); virtual ~Button(); virtual void update(); virtual void onMouseOver(); virtual void onMouseOff(); virtual void onClick(){} - inline vb01::Vector2 getPos(){return pos;} - void setPos(vb01::Vector2); + inline vb01::Vector3 getPos(){return pos;} + void setPos(vb01::Vector3); inline vb01::Vector2 getSize(){return size;} void setSize(vb01::Vector2); inline std::string getName(){return name;} @@ -35,14 +35,14 @@ namespace vb01Gui{ inline vb01::Vector4 getColor(){return color;} inline int getTrigger(){return trigger;} void setColor(vb01::Vector4); - void setZOrder(float); void setImage(std::string); protected: int trigger, initWindowSize[2]; bool separate, active = true, mouseOver = false; vb01::Quad *rect; vb01::Node *rectNode, *textNode = nullptr, *guiNode; - vb01::Vector2 pos, size; + vb01::Vector3 pos, textOffset; + vb01::Vector2 size; vb01::Text *text = nullptr; std::string name, imagePath, texUni = "texturingEnabled", diffColUni = "diffuseColor"; std::vector textures; diff --git a/checkbox.cpp b/checkbox.cpp index 95dfdc9..79b0ec5 100644 --- a/checkbox.cpp +++ b/checkbox.cpp @@ -7,18 +7,15 @@ using namespace vb01; using namespace std; namespace vb01Gui{ - Checkbox::CheckboxButton::CheckboxButton(Checkbox *ch, Vector2 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate) { - checkbox = ch; - } + Checkbox::CheckboxButton::CheckboxButton(Checkbox *ch, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate), checkbox(ch) {} void Checkbox::CheckboxButton::onClick() { checkbox->check(); - float col = (checkbox->isChecked() ? .6 : .2); - setColor(Vector4(col, col, col, 1)); + float col = (checkbox->isChecked() ? .6 : .2); + setColor(Vector4(col, col, col, 1)); } - Checkbox::Checkbox(Vector2 pos, string fontPath){ - this->pos = pos; + Checkbox::Checkbox(Vector3 p, string fontPath) : pos(p){ checkboxButton = new CheckboxButton(this, pos, Vector2(length,length), "CheckboxButton", false); /* diff --git a/checkbox.h b/checkbox.h index e1d8bd6..f0f7125 100644 --- a/checkbox.h +++ b/checkbox.h @@ -12,7 +12,7 @@ namespace vb01{ namespace vb01Gui{ class Checkbox { public: - Checkbox(vb01::Vector2, std::string); + Checkbox(vb01::Vector3, std::string); ~Checkbox(); void update(){} virtual void check(); @@ -20,7 +20,7 @@ namespace vb01Gui{ private: class CheckboxButton : public Button { public: - CheckboxButton(Checkbox*, vb01::Vector2, vb01::Vector2, std::string, bool); + CheckboxButton(Checkbox*, vb01::Vector3, vb01::Vector2, std::string, bool); void onClick(); private: Checkbox *checkbox = nullptr; @@ -28,9 +28,9 @@ namespace vb01Gui{ const int length = 15; bool checked = false; - vb01::Vector2 pos; + vb01::Vector3 pos; CheckboxButton *checkboxButton; - vb01::Node *checkNode = nullptr; + vb01::Node *checkNode = nullptr; public: inline CheckboxButton* getCheckboxButton(){return checkboxButton;} }; diff --git a/listbox.cpp b/listbox.cpp index d37c347..5beec7e 100644 --- a/listbox.cpp +++ b/listbox.cpp @@ -12,7 +12,7 @@ using namespace vb01; using namespace std; namespace vb01Gui{ - Listbox::ListboxButton::ListboxButton(Listbox *l, Vector2 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false){listbox = l;} + Listbox::ListboxButton::ListboxButton(Listbox *l, Vector3 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false), listbox(l) {} void Listbox::ListboxButton::onClick(){ if(!listbox->isOpen()) @@ -29,18 +29,18 @@ namespace vb01Gui{ } } - Listbox::ScrollingButton::ScrollingButton(Vector2 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false){} + Listbox::ScrollingButton::ScrollingButton(Vector3 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false){} void Listbox::ScrollingButton::onClick(){} - Listbox::Listbox(Vector2 pos, Vector2 size, std::vector &lines, int maxDisplay, string fontPath, bool closeable){ - this->pos = pos; - this->size = size; - this->maxDisplay = maxDisplay; - this->fontPath = fontPath; - this->lineHeight = size.y; - this->closeable = closeable; - + Listbox::Listbox(Vector3 p, Vector2 s, std::vector &lines, int md, string fp, bool cl) : + pos(p), + size(s), + maxDisplay(md), + fontPath(fp), + closeable(cl), + textOffset(Vector3(0, 0, .3)) + { Root *root = Root::getSingleton(); Vector2 mousePos = getCursorPos(); guiNode = Root::getSingleton()->getGuiNode(); @@ -48,14 +48,14 @@ namespace vb01Gui{ for(int i = 0; i < lines.size(); i++){ Text *text = new Text(fontPath, stringToWstring(lines[i])); - text->setScale(.2); Material *textMat = new Material(root->getLibPath() + "text"); textMat->addBoolUniform(texUni, false); textMat->addVec4Uniform(diffColUni, Vector4::VEC_IJKL); text->setMaterial(textMat); - Node *node = new Node(Vector3(pos.x, pos.y + size.y * (i + 1), textZCoord)); + float sc = .2; + Node *node = new Node(pos + Vector3(0, size.y * (i + 1), 0) + textOffset, Quaternion::QUAT_W, Vector3(sc, sc, 1)); node->addText(text); guiNode->attachChild(node); node->setVisible(false); @@ -67,9 +67,8 @@ namespace vb01Gui{ listboxButton = new ListboxButton(this, pos, size, "ListboxButton"); - scrollingButton = new ScrollingButton(Vector2(pos.x + size.x - 20, pos.y + lineHeight), Vector2(20, lineHeight * (maxDisplay - 2) / (maxDisplay + 1)), "scrollingButton"); + scrollingButton = new ScrollingButton(Vector3(pos.x + size.x - 20, pos.y + lineHeight, pos.z - .05), Vector2(20, lineHeight * (maxDisplay - 2) / (maxDisplay + 1)), "scrollingButton"); scrollingButton->setColor(Vector4(.2, .2, .2, 1)); - scrollingButton->setZOrder(-.05); scrollingButton->setActive(false); Quad *selRect = new Quad(Vector3(size.x, size.y, 0), false); @@ -99,13 +98,14 @@ namespace vb01Gui{ delete selRectNode; } + //TODO selection rectangle Z offset void Listbox::update(){ scrollingButton->update(); listboxButton->update(); if(open){ Vector2 mousePos = getCursorPos(); - Vector2 p = pos; + Vector3 p = pos; if(mousePos.y > pos.y && mousePos.y < pos.y + size.y * maxDisplay){ selectedOption = scrollOffset + ((int)(mousePos.y - pos.y) / ((int)size.y)); @@ -122,7 +122,7 @@ namespace vb01Gui{ selRectNode->setPosition(Vector3(p.x, p.y, -.05)); - Vector2 scrollButtonPos = Vector2(pos.x + size.x - 20, pos.y + lineHeight + lineHeight * scrollOffset * (double(maxDisplay - 2) / (maxDisplay + 1))); + Vector3 scrollButtonPos = Vector3(pos.x + size.x - 20, pos.y + lineHeight + lineHeight * scrollOffset * (double(maxDisplay - 2) / (maxDisplay + 1)), pos.z - .05); scrollingButton->setPos(scrollButtonPos); } } @@ -142,7 +142,8 @@ namespace vb01Gui{ void Listbox::openUp(){ open = true; - lines[selectedOption]->getNode()->setPosition(Vector3(pos.x, pos.y + size.y * (selectedOption-scrollOffset + 1), textZCoord)); + Vector3 selOpPos = pos + Vector3(0, size.y * (selectedOption - scrollOffset + 1), 0) + textOffset; + lines[selectedOption]->getNode()->setPosition(selOpPos); lines[selectedOption]->getNode()->setVisible(false); Vector2 size = listboxButton->getSize(); size.y *= maxDisplay; @@ -167,7 +168,7 @@ namespace vb01Gui{ for(int i = scrollOffset; i < scrollOffset + maxDisplay; i++) lines[i]->getNode()->setVisible(false); - lines[selectedOption]->getNode()->setPosition(Vector3(pos.x, pos.y + size.y, textZCoord)); + lines[selectedOption]->getNode()->setPosition(pos + Vector3(0, size.y, 0) + textOffset); lines[selectedOption]->getNode()->setVisible(true); onClose(); @@ -222,7 +223,7 @@ namespace vb01Gui{ void Listbox::addLine(wstring line){ Text *t = new Text(fontPath, line); - Node *node = new Node(Vector3(pos.x, pos.y - size.y * lines.size(), textZCoord)); + Node *node = new Node(pos + Vector3(0, size.y * lines.size(), 0) + textOffset); node->addText(t); guiNode->attachChild(node); lines.push_back(t); diff --git a/listbox.h b/listbox.h index 49c361c..eda2879 100644 --- a/listbox.h +++ b/listbox.h @@ -16,13 +16,13 @@ namespace vb01Gui{ public: class ListboxButton : public Button{ public: - ListboxButton(Listbox*, vb01::Vector2, vb01::Vector2, std::string); + ListboxButton(Listbox*, vb01::Vector3, vb01::Vector2, std::string); void onClick(); private: Listbox *listbox = nullptr; }; - Listbox(vb01::Vector2, vb01::Vector2, std::vector&, int, std::string, bool = true); + Listbox(vb01::Vector3, vb01::Vector2, std::vector&, int, std::string, bool = true); ~Listbox(); void update(); void openUp(); @@ -43,23 +43,24 @@ namespace vb01Gui{ inline int getMaxDisplay(){return maxDisplay;} inline int getNumLines(){return lines.size();} std::vector getContents(); - inline vb01::Vector2 getPos(){return pos;} + inline vb01::Vector3 getPos(){return pos;} inline vb01::Vector2 getSize(){return size;} private: class ScrollingButton : public Button{ public: - ScrollingButton(vb01::Vector2, vb01::Vector2, std::string); + ScrollingButton(vb01::Vector3, vb01::Vector2, std::string); void onClick(); private: }; std::string convert(std::string); - float textZCoord = -.3, lineHeight; + float lineHeight; int maxDisplay, scrollOffset = 0; bool open = false, closeable = false; std::string fontPath; - vb01::Vector2 pos, size; + vb01::Vector3 pos, textOffset; + vb01::Vector2 size; ListboxButton *listboxButton; ScrollingButton *scrollingButton; vb01::Node *selRectNode, *guiNode; diff --git a/slider.cpp b/slider.cpp index 077e34e..4976359 100644 --- a/slider.cpp +++ b/slider.cpp @@ -12,9 +12,7 @@ using namespace std; using namespace vb01; namespace vb01Gui{ - Slider::MovableSliderButton::MovableSliderButton(Slider *slider, Vector2 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate) { - this->slider = slider; - } + Slider::MovableSliderButton::MovableSliderButton(Slider *sl, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate), slider(sl) {} void Slider::MovableSliderButton::onClick() { clicked = !clicked; @@ -33,9 +31,7 @@ namespace vb01Gui{ } } - Slider::StaticSliderButton::StaticSliderButton(Slider *slider, Vector2 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate) { - this->slider = slider; - } + Slider::StaticSliderButton::StaticSliderButton(Slider *sl, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, "", -1, separate), slider(sl) {} void Slider::StaticSliderButton::onClick() { Vector2 cursorPos = getCursorPos(); @@ -43,20 +39,14 @@ namespace vb01Gui{ slider->setValue(((double) buttonClickPoint / slider->getSize().x) * slider->getMaxValue()); } - Slider::Slider(Vector2 pos, Vector2 size, double minValue, double maxValue) { - this->pos = pos; - this->size = size; - this->minValue = minValue; - this->maxValue = maxValue; - + Slider::Slider(Vector3 p, Vector2 s, double min, double max) : pos(p), size(s), minValue(min), maxValue(max) { staticSliderButton = new StaticSliderButton(this, pos, size, "StaticSliderButton", false); - movableSliderButton = new MovableSliderButton(this, Vector2(pos.x + staticSliderButton->getSize().x / 1, pos.y - 15), Vector2(10, 40), "MovableSliderButton", false); + movableSliderButton = new MovableSliderButton(this, pos + Vector3(staticSliderButton->getSize().x, -15, 0), Vector2(10, 40), "MovableSliderButton", false); value = (maxValue - minValue) / 2; } - Slider::~Slider() { - } + Slider::~Slider() {} void Slider::update() { if (value < minValue) @@ -64,15 +54,16 @@ namespace vb01Gui{ else if (value > maxValue) value = maxValue; - Vector2 p = movableSliderButton->getPos(), s = movableSliderButton->getSize(); + Vector3 p = movableSliderButton->getPos(); + Vector2 s = movableSliderButton->getSize(); p.x = pos.x + (double) size.x / maxValue * value; movableSliderButton->update(); movableSliderButton->setPos(p); - if(textbox && !textbox->isEnabled()){ - ostringstream ss; - ss << value; - textbox->setEntry(stringToWstring(ss.str())); - } + if(textbox && !textbox->isEnabled()){ + ostringstream ss; + ss << value; + textbox->setEntry(stringToWstring(ss.str())); + } } } diff --git a/slider.h b/slider.h index ce629b5..6280fc4 100644 --- a/slider.h +++ b/slider.h @@ -8,7 +8,7 @@ namespace vb01Gui{ class Slider { public: - Slider(vb01::Vector2, vb01::Vector2, double, double); + Slider(vb01::Vector3, vb01::Vector2, double, double); ~Slider(); void update(); inline void setTextbox(Textbox *t){this->textbox=t;} @@ -16,13 +16,13 @@ namespace vb01Gui{ inline double getValue(){return value;} inline double getMaxValue(){return maxValue;} inline void setValue(double v){this->value=v;} - inline vb01::Vector2 getPos(){return pos;} + inline vb01::Vector3 getPos(){return pos;} inline vb01::Vector2 getSize(){return size;} inline Textbox* getTextbox(){return textbox;} private: class MovableSliderButton : public Button { public: - MovableSliderButton(Slider*, vb01::Vector2, vb01::Vector2, std::string, bool); + MovableSliderButton(Slider*, vb01::Vector3, vb01::Vector2, std::string, bool); void onClick(); void update(); private: @@ -32,7 +32,7 @@ namespace vb01Gui{ class StaticSliderButton : public Button { public: - StaticSliderButton(Slider*, vb01::Vector2, vb01::Vector2, std::string, bool); + StaticSliderButton(Slider*, vb01::Vector3, vb01::Vector2, std::string, bool); void onClick(); private: Slider *slider; @@ -41,7 +41,8 @@ namespace vb01Gui{ MovableSliderButton *movableSliderButton = nullptr; StaticSliderButton *staticSliderButton = nullptr; double minValue, value, maxValue; - vb01::Vector2 pos, size; + vb01::Vector3 pos; + vb01::Vector2 size; Textbox *textbox = nullptr; public: inline MovableSliderButton* getMovableSliderButton(){return movableSliderButton;} diff --git a/text.cpp b/text.cpp index eab2c7f..b04db8d 100755 --- a/text.cpp +++ b/text.cpp @@ -80,17 +80,19 @@ namespace vb01{ Vector2 size = glyph.size, bearing = glyph.bearing; if(horizontal) - advanceOffset.x += (size.x + bearing.x); + advanceOffset.x += node->getScale().x * (size.x + bearing.x); else - advanceOffset.y += size.y; + advanceOffset.y += node->getScale().y * size.y; } } void Text::prepareGlyphs(Glyph glyph, Vector2 advanceOffset){ Vector3 nodePos = node->getPosition(); Vector2 origin = Vector2(nodePos.x, nodePos.y) + (advanceOffset * scale); + Vector3 scale = node->getScale(); - Vector2 size = glyph.size * scale, bearing = glyph.bearing * scale; + Vector2 size = Vector2(glyph.size.x * scale.x, glyph.size.y * scale.y); + Vector2 bearing = Vector2(glyph.bearing.x * scale.x, glyph.bearing.y * scale.y); float data[] = { origin.x + bearing.x, origin.y - bearing.y, 0, 0, diff --git a/textbox.cpp b/textbox.cpp index b3da348..53feae7 100644 --- a/textbox.cpp +++ b/textbox.cpp @@ -14,7 +14,7 @@ using namespace vb01; using namespace std; namespace vb01Gui{ - Textbox::TextboxButton::TextboxButton(Textbox *t, Vector2 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false) {textbox = t;} + Textbox::TextboxButton::TextboxButton(Textbox *t, Vector3 pos, Vector2 size, string name) : Button(pos, size, name, "", -1, false), textbox(t) {} void Textbox::TextboxButton::onClick(){ if(!textbox->isEnabled()) @@ -23,28 +23,25 @@ namespace vb01Gui{ textbox->disable(); } - Textbox::Textbox(Vector2 pos, Vector2 size, string fontPath, wstring entry){ - this->pos = pos; - this->size = size; - this->fontPath = fontPath; - + Textbox::Textbox(Vector3 p, Vector2 s, string fp, wstring entry) : pos(p), size(s), fontPath(fp), cursorZCoord(.01){ textboxButton = new TextboxButton(this, pos, size, "TextboxButton"); string libPath = Root::getSingleton()->getLibPath(); guiNode = Root::getSingleton()->getGuiNode(); text = new Text(fontPath, entry); - text->setScale(.5); Material *textMat = new Material(libPath + "text"); textMat->addBoolUniform("texturingEnabled", false); textMat->addVec4Uniform("diffuseColor", Vector4(1, 1, 1, 1)); text->setMaterial(textMat); - textNode = new Node(Vector3(pos.x, pos.y + size.y, -.1)); + + float sc = .5; + textNode = new Node(Vector3(pos.x, pos.y + size.y, pos.z + cursorZCoord), Quaternion::QUAT_W, Vector3(sc, sc, 1)); textNode->addText(text); guiNode->attachChild(textNode); cursorPosOffset = entry.length(); cursorRect = new Quad(Vector3(cursorWidth, size.y, 0), false); - cursorNode = new Node(Vector3(pos.x + text->getLength(), pos.y, cursorZCoord)); + cursorNode = new Node(Vector3(pos.x + text->getLength(), pos.y, pos.z + cursorZCoord)); Material *mat = new Material(libPath + "gui"); mat->addBoolUniform("texturingEnabled", false); mat->addVec4Uniform("diffuseColor", Vector4(1, 1, 1, 1)); diff --git a/textbox.h b/textbox.h index ce7d18a..007e062 100644 --- a/textbox.h +++ b/textbox.h @@ -15,7 +15,7 @@ namespace vb01Gui{ class Textbox{ public: - Textbox(vb01::Vector2, vb01::Vector2, std::string, std::wstring = L""); + Textbox(vb01::Vector3, vb01::Vector2, std::string, std::wstring = L""); ~Textbox(); void update(); void enable(); @@ -33,7 +33,7 @@ namespace vb01Gui{ private: class TextboxButton : public Button{ public: - TextboxButton(Textbox*, vb01::Vector2, vb01::Vector2, std::string); + TextboxButton(Textbox*, vb01::Vector3, vb01::Vector2, std::string); void onClick(); private: Textbox *textbox; @@ -41,9 +41,10 @@ namespace vb01Gui{ inline bool canChangeCursor(){return vb01::getTime() - lastBlinkTime > 250;} inline bool canDeleteChar(){return vb01::getTime() - lastDeleteTime > 50;} - float cursorZCoord = -.2; + float cursorZCoord; const int cursorWidth = 5; - vb01::Vector2 pos, size; + vb01::Vector3 pos; + vb01::Vector2 size; std::wstring entry = L""; std::string fontPath = ""; bool enabled = false, canShowCursor = false, capitalLeters = false, deleteCharacters = false;