Head Lecturer & Tutor
Dr. Amit Resh
Asaf Algawi
Contributers
Shay Rubach
Idan Lazimi
Alon Golan
Pseudo Graphics is a static library API for developing User Interface on windows terminal envirnment. This API consists of creating all needed components and access their content at any time via code.
The API is open source !(c) and can be modified to meet any devs need.
- Windows 7 or higher (Unix a-like users can use Wine)
- C++ 11 and above
- Visual Studio (we used 2017 Community addition)
- note: if you use VS, you'll need to define the following value on project preprocessor definitions
Every component can be created with no values passed to constructor. These can be modified and set later - avoiding this will be resulted with undefined behavior.
Here are some good practices for instantiating the components:
#include "Graphics.h"
#include "ControlFactory.h"
#include "EventEngine.h"
int main(int argc, char** argv)
{
Panel p;
Control& panel = p;
p.setColor(Color::Purple, Color::Black);
p.setLeft(5);
p.setTop(5);
p.setWidth(50);
p.setHeight(40);
p.setFrameType(DOUBLE_SOLID);
Button b("Exit");
b.setLeft(42);
b.setTop(1);
b.setColor(Color::Blue, Color::Green);
p.add(&b);
TextBox tb(1, 2, 12, 5);
tb.setColor(Color::Black, Color::White);
p.add(&tb);
Label l1("TextBox Title");
l1.setColor(Color::Cyan, Color::Red);
l1.setLeft(0);
l1.setTop(0);
p.add(&l1);
Label l2("I'm a label. Below me there's a NumericBox!");
l2.setColor(Color::Black, Color::Orange);
l2.setLeft(3);
l2.setTop(17);
p.add(&l2);
NumericBox nb;
nb.setLeft(20);
nb.setTop(20);
p.add(&nb);
string s("Press me to pop a msg");
MyMessageBox msg(s, s);
msg.setLeft(12);
msg.setTop(30);
p.add(&msg);
EventEngine e;
e.run(panel);
}
Missing .exe file for PseudoGraphics? make sure the PseudoGraphics project Properties->Configuration Type is Application(.exe) Can't run the tests? read the section below.
We used Google Tests framework to perform our unit testings. Here's the official documentation for how to set up GoogleTests in Visuak Studio 2017. You can also use the framework independently with no restriction to any IDE with this guide if you like.
Here is a common linker issue you might experience after trying to run your test cases. We recommand set up the Configuration Type (Project Properties->General->Configuration Type) of your tested program as Static Lib (.lib) and only then run your tests.
How to run the tests?
- In PsuedoGraphic Solution, right click PseudoGraphics project->Properties->General->Configuration Type-> switch from Application(.exe) to Static Lib (.lib)
- In PsuedoGraphic Solution, right click UnitTests project->Properties->Linker->General->Additional Library Directories-> <Edit..> -> New Line (ctrl + insert_) -> browse to the PseudoGraphics project (in our case path\to\VisualStudioProjects\PseudoGraphics\PseudoGraphics) -> click Ok
- clean solution & build again
- On visual studio top toolbar go to Tests -> Windows -> Tests Explorer (Ctrl+E). The test explorer will open up on your right side of the screen. Click 'Runn All' and u're done.