Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality comments #1993

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gameplay/src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions gameplay/src/Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions gameplay/src/Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ static void writeShaderToErrorFile(const char* filePath, const char* source)
}
}

/// <utilizes the openGL framework>
/// More information about the openGL click the link below
/// https://www.opengl.org/sdk/libs/
/// <utilizes the openGL framework>
Effect* Effect::createFromSource(const char* vshPath, const char* vshSource, const char* fshPath, const char* fshSource, const char* defines)
{
GP_ASSERT(vshSource);
Expand Down
5 changes: 5 additions & 0 deletions gameplay/src/Gamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<Control*> controls = container->getControls();
std::vector<Control*>::iterator itr = controls.begin();

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions gameplay/src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions gameplay/src/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions gameplay/src/RenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions gameplay/src/TileSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
Loading