I have added the headers and source files for the RGSS classes in ARC. I have added them under the zer0::RGSS namespace because our final implementations of those classes will be different in the end.
I will have to implement some of the tricky classes (and later you guys), but for now you guys can already sit down and work on the basic classes if you want. The following classes need to be implemented:
- Color
- Font
- Rect
- RGSSError
- Table
- Tone
I have declared that some of those classes already use existing implementations in April & Friends so in those cases you only have to interface the already existing functionality and extend them with RGSS's additional stuff. Refer to the headers of the already existing classes.
Note: Even though Tone has nothing to do with Color, I think that we should use the april::Color class because it's already there.
what should we do about the _dump and _load methods. I'm thinking that those should be left out of the C++ classes and be implemented on the ruby side.
Leave them out for now. We'll decide later. We can always first go with the Ruby implementation and later substitute it with a faster C++ version.
Which of these classes have _dump and _load? Color, Tone and Table have it for sure. I don't think the others do.
Me still confused on how C++ fully works, are we placing this in Color.cpp or Color.h?
Color.h has only the declaration of the methods, Color.cpp has the implementation.
You can take a look at april::Color, you should get the idea.
Am I doing it right?
RGSS/Color.h
Method I am cloning Color.red = value
namespace zer0
{
namespace RGSS
{
class zer0Export Color : public april::Color
{
public:
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
void red operator=(unsigned int value)
};
}
}
You won't be able to clone that one. You actually don't even have to. Just make getRed and setRed methods and return and set r from april::Color. We will make the .red and .red= interface later with Ruby.
EDIT: Eh. I just remember that RGSS's Color use float values from -255 to 255. :/ Nvm about the inheritance, just implement the whole class. Same with Tone. BTW, you can use hclamp(value, -255.0f, 255.0f) to limit the value. Remember to include <hltypes/util.h>.
Oh okay so something like this then?
namespace zer0
{
namespace RGSS
{
class zer0Export Color : public april::Color
{
public:
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
void setRed(unsigned int value);
void setRed(unsigned char value);
float getRed();
};
}
}
Then in Color.cpp in the actual methods use the clamp method to keep the values in bound. Ooh I think I'm getting the hang of this >:3
EDIT: Offtopic, but if this is done before I go to college, does anyone mind if I include it in my portfolio? Or hell even if its not done?
should we use a 1d or an 3d hlist for the Table class?
I suggest we make it work with normal arrays. It's the most optimized way.
short*** data;
...
this->data = new short[][][xsize];
*this->data = new short[][ysize];
**this->data = new short[zsize];
I'm not entirely sure about the syntax, but this is the idea.
@G_G: You can include it in your portfolio even while it is in development. You are a developer of this project, you are entitled to credit as much as anybody of us. :)
BTW, setRed(float) is enough.
EDIT: @Ryex: We can also use one 1D array for that and use coordinate translation.
Alright, committed final Color.h. Now from my understanding when I type up Color.cpp we are using the color class from April right? How am I going to do that exactly without conflicts?
No, just remove the inheritance. Code the class from scratch. April's Color class does not support negative values and it uses unsigned char (basically a 1-byte int) instead of float.
EDIT: Actually I quickly did the edits. You can continue the implementation.
Alright, color should be done, thanks to blizzard for fixing some of my code and for adding the set method that I forgot to >.<
EDIT: Working on Tone right now.
EDIT: Do I remove the inheritance of april's color in Tone too?
Okay, I finally got the files. SVN is still very buggy, so I may have to wait until tomorrow to commit, but I'll start on Rect. Nice easy one to learn on...
the Table class is done. I would work on the Font class but atres doesn't make sense to me. unless I'm over thinking it and we just need a general data structure.
I'm also not sure about RGSSError. I'm thinking that it should inherent from an april error class.
Tone is also done.
Quote from: game_guy on March 09, 2011, 06:26:50 pm
EDIT: Do I remove the inheritance of april's color in Tone too?
Yes.
Quote from: Ryex on March 09, 2011, 10:31:36 pm
the Table class is done. I would work on the Font class but atres doesn't make sense to me. unless I'm over thinking it and we just need a general data structure.
I'm also not sure about RGSSError. I'm thinking that it should inherent from an april error class.
You don't have to understand atres for that. Just make a replica of RGSS's Font class. I don't think it actually provides any functionality except containing data. I will bind those things together later.
As for RGSSError, you have a generic exception class in hltypes.
Quote from: Blizzard on March 10, 2011, 02:45:24 am
You don't have to understand atres for that. Just make a replica of RGSS's Font class. I don't think it actually provides any functionality except containing data. I will bind those things together later.
As for RGSSError, you have a generic exception class in hltypes.
I knew I was over thinking it. now why didn't I notice the exception class?
EDIT: I committed the Font class, I come on here and noticed that you had posed some coding conventions and I havn;t faollows some of them so I'll update my work tomorrow.
Was there a reason the get methods were removed?
Yes. If a class has a trivial get and set method, there is no real need for a get and set method. The variable can simply be made public because in Ruby it will be accessed as if it was public. It will make exposing our temporary RGSS classes to Ruby simpler. I realized that while reviewing the code.
Mkay. :)