Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1957e40
add new code for assignment
sabarrett Feb 25, 2022
75a1ece
add allegro package, update gitignore
sabarrett Feb 25, 2022
3359377
remove unused code
sabarrett Feb 25, 2022
d767a7e
Adding changes from class.
npreis Feb 25, 2022
d85e8be
See previous commit.
npreis Feb 25, 2022
511a364
Started working in main. Added some threads to client and server func…
npreis Mar 4, 2022
5dec406
Added join to threads.
npreis Mar 4, 2022
742a5e5
Added game and Graphics Lib files.
npreis Mar 16, 2022
52f6c09
Fixed include errors for socket demo.
npreis Mar 16, 2022
76d0888
Added DeanLib files and assets.
npreis Mar 16, 2022
3d5610d
Fixed the majority of errors.
npreis Mar 16, 2022
e90c784
Too many linker errors.
npreis Mar 28, 2022
75cd1ec
Fixed some errors. Linker errors are still there.
npreis Mar 28, 2022
3132303
Reduced number of errors to 12.
npreis Mar 29, 2022
1057a37
initial state for assignment 3
sabarrett Apr 1, 2022
2d59061
Reset the project, and starting over.
npreis Apr 1, 2022
d6c9af2
Added Adel's files to the project.
npreis Apr 1, 2022
4c45ce7
Fixed linker errors and moved TCP file.
npreis Apr 1, 2022
f7c61eb
Moved TCP again, and now it works.
npreis Apr 1, 2022
b1327e6
Included input system in main.
npreis Apr 1, 2022
0d4b9c6
Misc changes.
npreis Apr 4, 2022
11a64f3
Misc changes.
npreis Apr 4, 2022
69dc890
Background finally renders.
npreis Apr 5, 2022
26254a0
Started working on the game loop.
npreis Apr 5, 2022
f0c91e5
Began working on game loop initialization.
npreis Apr 5, 2022
0a7c04e
Testing build.
npreis Apr 8, 2022
182064b
Re-installed allegro -_-
npreis Apr 8, 2022
650687c
Made changes to the input system in game.
npreis Apr 8, 2022
a4a80b9
Starting over with old architecture.
npreis Apr 15, 2022
65adadd
Moved deanlib files, and eliminated most linker errors.
npreis Apr 15, 2022
260b549
Fixed all errors.
npreis Apr 15, 2022
3ac26a4
Fixed the game so it runs properly, and added it to main.
npreis Apr 19, 2022
e418590
Changed the order of some code, and changed TCP threads to UDP threads.
npreis Apr 19, 2022
e394fc5
Started working on some networking connection stuff.
npreis Apr 26, 2022
db90075
Not having a good time.
npreis Apr 28, 2022
8a315fb
Idk why I'm still up, it's almost 5am
npreis Apr 28, 2022
c5bc128
Dying, but at least I have a network basis, and am starting the actua…
npreis Apr 29, 2022
357536d
Tons of errors, and I have no clue what I'm doing wrong, but at least…
npreis Apr 29, 2022
6513d28
Assignment done. Please grade this.
npreis Apr 29, 2022
ffc5b00
Errors fixed, but program doesn't run.
npreis Apr 29, 2022
11e2c78
...I tried. I'm moving on to assignment 3. Hopefully I'll get some po…
npreis Apr 30, 2022
0d96c3a
Fixed merge conflict.
npreis May 2, 2022
3ef3504
Made some code for dropping packets, and recollecting them.
npreis May 2, 2022
c510738
Integrated new assignment2 code.
npreis May 4, 2022
7053e76
Fixed an error, and rebuilt.
npreis May 4, 2022
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*.pdb

Debug/
packages/
115 changes: 115 additions & 0 deletions RoboCat/Animation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#include"Animation.h"
#include"GraphicsBuffer.h"
#include"Sprite.h"

/*
Author: Nicholas Preis
Class : Game Architecture <250-71>
Assignment : Assignment 3
Certification of Authenticity :
I certify that this assignment is entirely my own work.
*/

Animation::Animation()
{
mIsInitialized = false;
mIsLooping = false;

mCurrentSprite = 16;
mNumSprites = 0;
mFramerate = 60;
mElapsedTime = 0.0;
mBetweenFrames = 0.0;

mWidth = 0;
mHeight = 0;

mpSpriteArray = nullptr;
}

void Animation::animInit( int rows, int columns, GraphicsBuffer* buffer, bool isLooping )
{
mIsInitialized = true;

mWidth = buffer->getWidth() / columns;
mHeight = buffer->getHeight() / rows;
mNumSprites = rows * columns;
mIsLooping = isLooping;

mpSpriteArray = new Sprite[mNumSprites]();
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
mpSpriteArray[j + (i * columns)].spriteInit( mWidth, mHeight, (mWidth * j), (mHeight * i), buffer );
}
}

mCurrentSprite = 0;
mElapsedTime = 0.0;
mFramerate = 60;
mBetweenFrames = 1 / mFramerate;
}

Animation::Animation(int rows, int columns, GraphicsBuffer* buffer, bool isLooping)
{
animInit(rows, columns, buffer, isLooping);
}

Animation::~Animation()
{
cleanup();
}

void Animation::init(int numSprites, bool isInitialized, Sprite* spriteArray)
{
mNumSprites = numSprites;
mIsInitialized = isInitialized;
mpSpriteArray = spriteArray;

if (mIsInitialized == false)
{
mIsInitialized = true;
}
}


void Animation::cleanup()
{
if (mIsInitialized == true)
{
delete [] mpSpriteArray;
mpSpriteArray = nullptr;

mIsInitialized = false;
mIsLooping = false;
}
}

Sprite* Animation::getCurrentSprite()
{
return &mpSpriteArray[mCurrentSprite];
}

void Animation::changeFPS(int fps)
{
mBetweenFrames = 1.0 / fps;
mFramerate = fps;
}

void Animation::animationUpdate(float elapsedTime)
{
mElapsedTime += elapsedTime;

if (mElapsedTime > mBetweenFrames)
{
mElapsedTime -= mBetweenFrames;
mCurrentSprite++;

// loop back to first sprite
if (mCurrentSprite == mNumSprites)
{
mCurrentSprite = 0;
}
}
}
53 changes: 53 additions & 0 deletions RoboCat/Animation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once
#include<iostream>
#include<vector>
#include"../common/DeanLib/include/Trackable.h"

/*
Author: Nicholas Preis
Class : Game Architecture <250-71>
Assignment : Assignment 3
Certification of Authenticity :
I certify that this assignment is entirely my own work.
*/

class Sprite;
class GraphicsBuffer;

class Animation : public Trackable
{
public:
Animation();
Animation(int rows, int columns, GraphicsBuffer* buffer, bool isLooping);
~Animation();

void init(int numSprites, bool isInitialized, Sprite* spriteArray);
void animInit(int rows, int columns, GraphicsBuffer* buffer, bool isLooping);
void cleanup();

Sprite* getCurrentSprite();
int getSpriteWidth() { return mWidth; }
int getSpriteHeight() { return mHeight; }

void changeFPS(int fps);
int getAnimationSpeed() { return mFramerate; }

void setAnimate(bool initialized) { mIsInitialized = initialized; }

void animationUpdate(float elapsedTime);

private:
bool mIsInitialized;
bool mIsLooping;

int mCurrentSprite;
int mNumSprites;
int mFramerate;
float mElapsedTime;
float mBetweenFrames;

int mWidth;
int mHeight;

Sprite* mpSpriteArray;
};
Loading