diff --git a/gameplay/src/Camera.cpp b/gameplay/src/Camera.cpp index 36b41c4d1d..567356e360 100644 --- a/gameplay/src/Camera.cpp +++ b/gameplay/src/Camera.cpp @@ -430,6 +430,7 @@ void Camera::pickRay(const Rectangle& viewport, float x, float y, Ray* dst) cons dst->set(nearPoint, direction); } +//used to copy one camera's object properties to another cameras properties Camera* Camera::clone(NodeCloneContext& context) { Camera* cameraClone = NULL; diff --git a/gameplay/src/Control.cpp b/gameplay/src/Control.cpp index ba935e7554..359c2d005e 100644 --- a/gameplay/src/Control.cpp +++ b/gameplay/src/Control.cpp @@ -244,6 +244,8 @@ const char* Control::getTypeName() const return "Control"; } +//Many game objects are tied to their specific ID such as buttons and textboxes. +//This functions gets that specific gameobject ID and returns it for use and display const char* Control::getId() const { return _id.c_str(); diff --git a/gameplay/src/Effect.cpp b/gameplay/src/Effect.cpp index 3ee2388693..1b45feaeea 100644 --- a/gameplay/src/Effect.cpp +++ b/gameplay/src/Effect.cpp @@ -226,6 +226,10 @@ static void writeShaderToErrorFile(const char* filePath, const char* source) } } +/// +/// More information about the openGL click the link below +/// https://www.opengl.org/sdk/libs/ +/// Effect* Effect::createFromSource(const char* vshPath, const char* vshSource, const char* fshPath, const char* fshSource, const char* defines) { GP_ASSERT(vshSource); diff --git a/gameplay/src/Gamepad.cpp b/gameplay/src/Gamepad.cpp index e8ccd670f4..5bfe4d794a 100644 --- a/gameplay/src/Gamepad.cpp +++ b/gameplay/src/Gamepad.cpp @@ -54,6 +54,7 @@ Gamepad::~Gamepad() SAFE_RELEASE(_form); } +//some gamepads can have more buttons or joysticks than others Gamepad* Gamepad::add(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount, const char* name) { Gamepad* gamepad = new Gamepad(handle, buttonCount, joystickCount, triggerCount, name); @@ -112,6 +113,7 @@ void Gamepad::remove(Gamepad* gamepad) void Gamepad::bindGamepadControls(Container* container) { + //some games have more or less controls than others so they can add or delete controls via a vector continaer std::vector controls = container->getControls(); std::vector::iterator itr = controls.begin(); @@ -207,11 +209,13 @@ Gamepad::ButtonMapping Gamepad::getButtonMappingFromString(const char* string) else if (strcmp(string, "L2") == 0 || strcmp(string, "BUTTON_L2") == 0) return BUTTON_L2; else if (strcmp(string, "L3") == 0 || strcmp(string, "BUTTON_L3") == 0) + //some joysticks can be pressed down as a buttons thus L3 return BUTTON_L3; else if (strcmp(string, "R1") == 0 || strcmp(string, "BUTTON_R1") == 0) return BUTTON_R1; else if (strcmp(string, "R2") == 0 || strcmp(string, "BUTTON_R2") == 0) return BUTTON_R2; + //some joysticks can be pressed down as a buttons thus R3 else if (strcmp(string, "R3") == 0 || strcmp(string, "BUTTON_R3") == 0) return BUTTON_R3; else if (strcmp(string, "UP") == 0 || strcmp(string, "BUTTON_UP") == 0) @@ -295,6 +299,7 @@ unsigned int Gamepad::getJoystickCount() const return _joystickCount; } +// joysticks have many values since they are circular void Gamepad::getJoystickValues(unsigned int joystickId, Vector2* outValue) const { if (joystickId >= _joystickCount) diff --git a/gameplay/src/Image.cpp b/gameplay/src/Image.cpp index 5e8af96104..1e1bb4b1a8 100644 --- a/gameplay/src/Image.cpp +++ b/gameplay/src/Image.cpp @@ -131,6 +131,7 @@ Image* Image::create(unsigned int width, unsigned int height, Image::Format form image->_height = height; image->_format = format; image->_data = new unsigned char[dataSize]; + //setting aside memory for image if (data) memcpy(image->_data, data, dataSize); diff --git a/gameplay/src/Model.cpp b/gameplay/src/Model.cpp index dcc61d491e..474449973a 100644 --- a/gameplay/src/Model.cpp +++ b/gameplay/src/Model.cpp @@ -280,6 +280,7 @@ static bool drawWireframe(Mesh* mesh) } } +//used to display wireframe in 3d environment static bool drawWireframe(MeshPart* part) { unsigned int indexCount = part->getIndexCount(); diff --git a/gameplay/src/RenderTarget.cpp b/gameplay/src/RenderTarget.cpp index 1281c1c07c..d900111fee 100644 --- a/gameplay/src/RenderTarget.cpp +++ b/gameplay/src/RenderTarget.cpp @@ -34,6 +34,7 @@ RenderTarget* RenderTarget::create(const char* id, unsigned int width, unsigned } RenderTarget* rt = create(id, texture); + //displayes the texture texture->release(); return rt; diff --git a/gameplay/src/TileSet.cpp b/gameplay/src/TileSet.cpp index 3e00dc4a21..56ac5f5043 100644 --- a/gameplay/src/TileSet.cpp +++ b/gameplay/src/TileSet.cpp @@ -24,6 +24,7 @@ TileSet& TileSet::operator=(const TileSet& set) return *this; } +//users can set a tile to an image with a specified w x h and have their set contain X rows and X columns TileSet* TileSet::create(const char* imagePath, float tileWidth, float tileHeight, unsigned int rowCount, unsigned int columnCount) @@ -33,6 +34,7 @@ TileSet* TileSet::create(const char* imagePath, GP_ASSERT(rowCount > 0 && columnCount > 0); SpriteBatch* batch = SpriteBatch::create(imagePath); + //CLAMP texture mode means that the user's image selected will be cut off as soon as it exceeds the w x h specified batch->getSampler()->setWrapMode(Texture::CLAMP, Texture::CLAMP); batch->getSampler()->setFilterMode(Texture::Filter::NEAREST, Texture::Filter::NEAREST); batch->getStateBlock()->setDepthWrite(false); diff --git a/gameplay/src/Transform.cpp b/gameplay/src/Transform.cpp index 04de0832df..3c0f64e4de 100644 --- a/gameplay/src/Transform.cpp +++ b/gameplay/src/Transform.cpp @@ -36,6 +36,7 @@ Transform::Transform(const Vector3& scale, const Matrix& rotation, const Vector3 set(scale, rotation, translation); } +//copies the Transform properties of an object such as scale, rotation, position Transform::Transform(const Transform& copy) : _matrixDirtyBits(0), _listeners(NULL) { @@ -274,7 +275,7 @@ void Transform::getRightVector(Vector3* dst) const void Transform::rotate(float qx, float qy, float qz, float qw) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion q(qx, qy, qz, qw); @@ -284,7 +285,7 @@ void Transform::rotate(float qx, float qy, float qz, float qw) void Transform::rotate(const Quaternion& rotation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _rotation.multiply(rotation); @@ -293,7 +294,7 @@ void Transform::rotate(const Quaternion& rotation) void Transform::rotate(const Vector3& axis, float angle) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -305,7 +306,7 @@ void Transform::rotate(const Vector3& axis, float angle) void Transform::rotate(const Matrix& rotation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -316,7 +317,7 @@ void Transform::rotate(const Matrix& rotation) void Transform::rotateX(float angle) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -327,7 +328,7 @@ void Transform::rotateX(float angle) void Transform::rotateY(float angle) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -338,7 +339,7 @@ void Transform::rotateY(float angle) void Transform::rotateZ(float angle) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -349,7 +350,7 @@ void Transform::rotateZ(float angle) void Transform::scale(float scale) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.scale(scale); @@ -358,7 +359,7 @@ void Transform::scale(float scale) void Transform::scale(float sx, float sy, float sz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.x *= sx; @@ -369,7 +370,7 @@ void Transform::scale(float sx, float sy, float sz) void Transform::scale(const Vector3& scale) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.x *= scale.x; @@ -380,7 +381,7 @@ void Transform::scale(const Vector3& scale) void Transform::scaleX(float sx) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.x *= sx; @@ -389,7 +390,7 @@ void Transform::scaleX(float sx) void Transform::scaleY(float sy) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.y *= sy; @@ -398,7 +399,7 @@ void Transform::scaleY(float sy) void Transform::scaleZ(float sz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.z *= sz; @@ -407,7 +408,7 @@ void Transform::scaleZ(float sz) void Transform::set(const Vector3& scale, const Quaternion& rotation, const Vector3& translation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(scale); @@ -418,7 +419,7 @@ void Transform::set(const Vector3& scale, const Quaternion& rotation, const Vect void Transform::set(const Vector3& scale, const Matrix& rotation, const Vector3& translation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(scale); @@ -431,7 +432,7 @@ void Transform::set(const Vector3& scale, const Matrix& rotation, const Vector3& void Transform::set(const Vector3& scale, const Vector3& axis, float angle, const Vector3& translation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(scale); @@ -442,7 +443,7 @@ void Transform::set(const Vector3& scale, const Vector3& axis, float angle, cons void Transform::set(const Transform& transform) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(transform._scale); @@ -453,7 +454,7 @@ void Transform::set(const Transform& transform) void Transform::setIdentity() { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(1.0f, 1.0f, 1.0f); @@ -464,7 +465,7 @@ void Transform::setIdentity() void Transform::setScale(float scale) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(scale, scale, scale); @@ -473,7 +474,7 @@ void Transform::setScale(float scale) void Transform::setScale(float sx, float sy, float sz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.set(sx, sy, sz); @@ -488,7 +489,7 @@ void Transform::setScale(const Vector3& scale) void Transform::setScaleX(float sx) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.x = sx; @@ -497,7 +498,7 @@ void Transform::setScaleX(float sx) void Transform::setScaleY(float sy) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.y = sy; @@ -506,7 +507,7 @@ void Transform::setScaleY(float sy) void Transform::setScaleZ(float sz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _scale.z = sz; @@ -515,7 +516,7 @@ void Transform::setScaleZ(float sz) void Transform::setRotation(const Quaternion& rotation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _rotation.set(rotation); @@ -524,7 +525,7 @@ void Transform::setRotation(const Quaternion& rotation) void Transform::setRotation(float qx, float qy, float qz, float qw) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _rotation.set(qx, qy, qz, qw); @@ -533,7 +534,7 @@ void Transform::setRotation(float qx, float qy, float qz, float qw) void Transform::setRotation(const Matrix& rotation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; Quaternion rotationQuat; @@ -544,7 +545,7 @@ void Transform::setRotation(const Matrix& rotation) void Transform::setRotation(const Vector3& axis, float angle) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _rotation.set(axis, angle); @@ -553,7 +554,7 @@ void Transform::setRotation(const Vector3& axis, float angle) void Transform::setTranslation(const Vector3& translation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.set(translation); @@ -562,7 +563,7 @@ void Transform::setTranslation(const Vector3& translation) void Transform::setTranslation(float tx, float ty, float tz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.set(tx, ty, tz); @@ -571,7 +572,7 @@ void Transform::setTranslation(float tx, float ty, float tz) void Transform::setTranslationX(float tx) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.x = tx; @@ -580,7 +581,7 @@ void Transform::setTranslationX(float tx) void Transform::setTranslationY(float ty) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.y = ty; @@ -589,7 +590,7 @@ void Transform::setTranslationY(float ty) void Transform::setTranslationZ(float tz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.z = tz; @@ -598,7 +599,7 @@ void Transform::setTranslationZ(float tz) void Transform::translate(float tx, float ty, float tz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.x += tx; @@ -609,7 +610,7 @@ void Transform::translate(float tx, float ty, float tz) void Transform::translate(const Vector3& translation) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.x += translation.x; @@ -620,7 +621,7 @@ void Transform::translate(const Vector3& translation) void Transform::translateX(float tx) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.x += tx; @@ -629,7 +630,7 @@ void Transform::translateX(float tx) void Transform::translateY(float ty) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.y += ty; @@ -638,7 +639,7 @@ void Transform::translateY(float ty) void Transform::translateZ(float tz) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; _translation.z += tz; @@ -647,7 +648,7 @@ void Transform::translateZ(float tz) void Transform::translateLeft(float amount) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; // Force the current transform matrix to be updated. @@ -663,7 +664,7 @@ void Transform::translateLeft(float amount) void Transform::translateUp(float amount) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; // Force the current transform matrix to be updated. @@ -679,7 +680,7 @@ void Transform::translateUp(float amount) void Transform::translateForward(float amount) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; // Force the current transform matrix to be updated. @@ -695,7 +696,7 @@ void Transform::translateForward(float amount) void Transform::translateSmooth(const Vector3& target, float elapsedTime, float responseTime) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; if (elapsedTime > 0) @@ -1000,7 +1001,7 @@ void Transform::cloneInto(Transform* transform, NodeCloneContext &context) const void Transform::applyAnimationValueRotation(AnimationValue* value, unsigned int index, float blendWeight) { - if (isStatic()) + if (isStatic()) //Objects that are set to static cannot be changed return; GP_ASSERT(value);