Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!






Yesterday was the first day of ScrewGUI

Posted by TMKCodes, 19 July 2012 · 552 views

User interface Programming C++
So what is this?

I am going to start writing daily reports about what I do with ScrewGUI my new C++ project. I forgot yesterday to write the first report, but I will write it now before continuing programming. You will get today's report later today.

What I programmed yesterday?

I Wrote three templates which were Screw::Vertex, Screw::Line and Screw::Triangle.

First I wrote Screw::Vertex templates constructor to take 4 parameters x,y,z,w which are the 3 dimensional coordinates for vertex. Then I wrote constructor which does not take the parameters, but sets the coordinates to zero.

I also wrote functions to get and set the vertex data called:
  • T * GetVertexData()
  • void SetVertexData(T x, T y, T z, T w)
The GetVertexData function returns array which contains the four coordinates and the SetVertexData takes them as parameters and sets the values to the templates private members.

Then I programmed the Screw::Line template constructor which took two Screw::Vertex objects as parameter and another constructor which did not take these Screw::Vertex objects as parameter, but created two new empty Screw::Vertex objects. I wrote the destructor to delete the created Screw::Vertex objects, but not the ones which were passed to the Screw::Line object.

I also wrote the get and set public member functions:
  • T * GetVertexData()
  • void SetVertexData(T xOne, T yOne, T zOne, T wOne, T xTwo, T yTwo, T zTwo, T wTwo)
The inner functionality was little bit different from Screw::Vertex implementation, because I did not use private coordinate members in Screw::Line, but used two Screw::Vertex objects as the private members. So I wrote the implementation so that Screw::Line get and set called Screw::Vertex Get and Set functions.

Screw::Triangle was pretty much the same as Screw::Line, but as Triangle has three points I needed three Screw::Vertex objects. I programmed the constructor which took three Screw::Vertex objects as parameter and one which created three new empty Screw::Vertex objects and the destructor which deleted these created objects.

As with the previous templates I wrote the get and set functions:
  • T * GetVertexData()
  • void SetVertexData(T VertexID, T x, T y, T z, T w)
I opted to use T VertexID because having twelve parameters was kind of long and I did not want to pass array into the function, because that would require the library user to create the array when using Screw::Triangle template.

What problems I ran into.

When I was programming Screw::Triangles Set function I realized that twelve parameters was bit too much and opted to use VertexID and force the user of the library to call the SetVertexData function three times to set every vertex coordinates. Now I am thinking if I should apply the same functionality in Screw::Line and most likely I will.

What I am going to do today.

I am going to write template View which will construct glfw window and draw the given objects on screen.




December 2014 »

S M T W T F S
 123456
78910111213
14151617181920
2122232425 26 27
28293031   

Recent Comments

PARTNERS