diff --git a/2517597.jpg b/2517597.jpg
new file mode 100644
index 00000000..ebaa86ef
Binary files /dev/null and b/2517597.jpg differ
diff --git a/Kirby.png b/Kirby.png
new file mode 100644
index 00000000..66d294a3
Binary files /dev/null and b/Kirby.png differ
diff --git a/RoboCat/Chapter3.vcxproj b/RoboCat/Chapter3.vcxproj
index 8c859a81..753e15c6 100644
--- a/RoboCat/Chapter3.vcxproj
+++ b/RoboCat/Chapter3.vcxproj
@@ -31,12 +31,13 @@
{B3B75176-8D81-4E7B-A5D0-C2E5423844D3}
SimpleSample
Win32Proj
+ 10.0
Application
MultiByte
- v142
+ v143
Application
@@ -92,6 +93,9 @@
true
true
Bin\$(Configuration)\
+ true
+ true
+ true
true
@@ -128,7 +132,7 @@
ProgramDatabase
EnableFastChecks
..\SDL\include;Inc;..\
- Use
+ NotUsing
RoboCatPCH.h
@@ -370,10 +374,10 @@
-
+
+
+
-
-
@@ -385,12 +389,10 @@
-
-
-
-
-
+
+
+
@@ -405,7 +407,6 @@
Create
RoboCatPCH.h
-
diff --git a/RoboCat/Colour.cpp b/RoboCat/Colour.cpp
new file mode 100644
index 00000000..7a5ef3d1
--- /dev/null
+++ b/RoboCat/Colour.cpp
@@ -0,0 +1,32 @@
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+Colour.cpp
+*/
+
+#include "Colour.h"
+#include "RoboCatPCH.h"
+
+//Constructor - without alpha
+Colour::Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b)
+{
+ mR = r;
+ mG = g;
+ mB = b;
+ mA = 255;
+}
+
+//Constructor - with alpha
+Colour::Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, unsigned __int8 a)
+{
+ mR = r;
+ mG = g;
+ mB = b;
+ mA = a;
+}
+
+//Destructor
+Colour::~Colour()
+{
+
+}
\ No newline at end of file
diff --git a/RoboCat/Colour.h b/RoboCat/Colour.h
new file mode 100644
index 00000000..216b028c
--- /dev/null
+++ b/RoboCat/Colour.h
@@ -0,0 +1,43 @@
+#pragma once
+
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+Colour.h
+
+ File information:
+ This file contains data used for colours.
+*/
+
+class Colour
+{
+ //-------------------------Private data-------------------------
+
+ //Red channel
+ unsigned __int8 mR;
+
+ //Green channel
+ unsigned __int8 mG;
+
+ //Blue channel
+ unsigned __int8 mB;
+
+ //Alpha channel
+ unsigned __int8 mA;
+
+ //-------------------------Public data-------------------------
+public:
+
+ //Constructor(s)
+ Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b);
+ Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, unsigned __int8 a);
+
+ //Destructor
+ ~Colour();
+
+ //Accessor(s)
+ unsigned __int8 getR() { return mR; };
+ unsigned __int8 getG() { return mG; };
+ unsigned __int8 getB() { return mB; };
+ unsigned __int8 getA() { return mA; };
+};
diff --git a/RoboCat/GraphicsLibrary.cpp b/RoboCat/GraphicsLibrary.cpp
new file mode 100644
index 00000000..ea5254d6
--- /dev/null
+++ b/RoboCat/GraphicsLibrary.cpp
@@ -0,0 +1,126 @@
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+GraphicsLibrary.cpp
+*/
+
+#include "GraphicsLibrary.h"
+#include "RoboCatPCH.h"
+
+#include
+#include
+
+//Constructor
+GraphicsLibrary::GraphicsLibrary(float screenSizeX, float screenSizeY)
+{
+ //Setup data - screen size
+ mScreenSizeX = screenSizeX;
+ mScreenSizeY = screenSizeY;
+
+ //Allegro display
+ mpDisplay = nullptr;
+}
+
+//Destructor
+GraphicsLibrary::~GraphicsLibrary()
+{
+ //Delete bitmaps
+ std::vector>::iterator iterator;
+ for (iterator = mBitmapPointersVector.begin(); iterator != mBitmapPointersVector.end(); ++iterator)
+ {
+ al_destroy_bitmap(iterator->second);
+ }
+ mBitmapPointersVector.clear();
+
+ //Clean up display
+ al_destroy_display(mpDisplay);
+ mpDisplay = nullptr;
+}
+
+bool GraphicsLibrary::init(std::string backgroundFilePath)
+{
+ //Init allegro
+ if (!al_init())
+ {
+ std::cout << "error initting Allegro\n";
+ system("pause");
+ return false;
+ }
+
+ //Init image addon
+ if (!al_init_image_addon())
+ {
+ std::cout << "error initting image add-on\n";
+ system("pause");
+ return false;
+ }
+
+ //Init font add on
+ if (!al_init_font_addon())
+ {
+ std::cout << "error initting font add-on\n";
+ system("pause");
+ return false;
+ }
+
+ //Init ttf add on
+ if (!al_init_ttf_addon())
+ {
+ std::cout << "error initting ttf add-on\n";
+ system("pause");
+ return false;
+ }
+
+ //Setup display
+ mpDisplay = al_create_display(mScreenSizeX, mScreenSizeY);
+
+ if (mpDisplay == nullptr)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void GraphicsLibrary::render()
+{
+ //Flip display buffers
+ al_flip_display();
+}
+
+void GraphicsLibrary::loadImage(std::string imageFilePath, std::string imageIdentifier)
+{
+ //Add the name of the image and the loaded bitmap to the vector of pairs
+ mBitmapPointersVector.push_back(std::make_pair(imageIdentifier, al_load_bitmap(imageFilePath.c_str())));
+}
+
+void GraphicsLibrary::drawImage(std::string imageIdentifier, float posX, float posY)
+{
+ //Find the image and draw if it exists
+ std::vector>::iterator iterator;
+
+ for (iterator = mBitmapPointersVector.begin(); iterator != mBitmapPointersVector.end(); ++iterator)
+ {
+ if (iterator->first == imageIdentifier)
+ {
+ al_draw_bitmap(iterator->second, posX, posY, 0);
+ }
+ }
+}
+
+void GraphicsLibrary::drawTintedImage(std::string imageIdentifier, float posX, float posY, Colour col)
+{
+ //Find the image and draw if it exists
+ std::vector>::iterator iterator;
+
+ //Set colour
+ ALLEGRO_COLOR colour = al_map_rgba(col.getR(), col.getG(), col.getB(), col.getA());
+
+ for (iterator = mBitmapPointersVector.begin(); iterator != mBitmapPointersVector.end(); ++iterator)
+ {
+ if (iterator->first == imageIdentifier)
+ {
+ al_draw_tinted_bitmap(iterator->second, colour, posX, posY, 0);
+ }
+ }
+}
\ No newline at end of file
diff --git a/RoboCat/GraphicsLibrary.h b/RoboCat/GraphicsLibrary.h
new file mode 100644
index 00000000..a8a9519c
--- /dev/null
+++ b/RoboCat/GraphicsLibrary.h
@@ -0,0 +1,67 @@
+#pragma once
+
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+GraphicsLibrary.h
+
+ File information:
+ This file contains function abstractions from Allegro 5, wrapped up in my Graphics Library. This will
+ be used to render images and text to the screen.
+
+ Source I am consulting: Allegro 5.0.10 Manual - http://cdn.allegro.cc/file/library/allegro/5.0.10/allegro-5.0.10-manual.pdf
+*/
+
+#include
+#include
+
+#include "Colour.h"
+
+//https://github.com/liballeg/allegro_wiki/wiki/Allegro-in-Visual-Studio#using-nuget-within-visual-studio
+#include
+#include
+#include
+#include
+#include
+#include
+
+class GraphicsLibrary
+{
+ //-------------------------Private data-------------------------
+
+ //Screen data
+ float mScreenSizeX;
+ float mScreenSizeY;
+
+ //Allegro display
+ ALLEGRO_DISPLAY* mpDisplay;
+
+ //Other images to draw
+ std::vector> mBitmapPointersVector;
+
+ friend class InputSystem;
+
+ //-------------------------Public data-------------------------
+public:
+
+ //Constructor(s)
+ GraphicsLibrary(float screenSizeX, float screenSizeY);
+
+ //Destructor
+ ~GraphicsLibrary();
+
+ //Accessor(s)
+ float getScreenSizeX() { return mScreenSizeX; };
+ float getScreenSizeY() { return mScreenSizeY; };
+
+ //Mutator(s)
+
+ //Functions
+ bool init(std::string backgroundFilePath);
+ void render();
+ void loadImage(std::string imageFilePath, std::string imageIdentifier);
+
+ //Drawing functions
+ void drawImage(std::string imageIdentifier, float posX, float posY);
+ void drawTintedImage(std::string imageIdentifier, float posX, float posY, Colour col);
+};
\ No newline at end of file
diff --git a/RoboCat/Inc/RoboCatShared.h b/RoboCat/Inc/RoboCatShared.h
index d7eac1bc..bc232e1f 100644
--- a/RoboCat/Inc/RoboCatShared.h
+++ b/RoboCat/Inc/RoboCatShared.h
@@ -51,15 +51,10 @@ class GameObject;
#include "RoboMath.h"
-#include "TransmissionData.h"
-#include "InFlightPacket.h"
-
#include "LinkingContext.h"
#include "ByteSwap.h"
#include "MemoryBitStream.h"
-#include "AckRange.h"
-#include "Timing.h"
#include "StringUtils.h"
#include "SocketAddress.h"
#include "SocketAddressFactory.h"
@@ -67,4 +62,3 @@ class GameObject;
#include "TCPSocket.h"
#include "SocketUtil.h"
#include "OutputWindow.h"
-#include "DeliveryNotificationManager.h"
diff --git a/RoboCat/InputSystem.cpp b/RoboCat/InputSystem.cpp
new file mode 100644
index 00000000..3ab059ec
--- /dev/null
+++ b/RoboCat/InputSystem.cpp
@@ -0,0 +1,136 @@
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+InputSystem.cpp
+*/
+
+#include "InputSystem.h"
+#include "RoboCatPCH.h"
+
+#include
+
+//Constructor
+InputSystem::InputSystem()
+{
+ //Create an event queue
+ mpEventQueue = al_create_event_queue();
+}
+
+//Destructor
+InputSystem::~InputSystem()
+{
+ //Cleanup event queue
+ al_destroy_event_queue(mpEventQueue);
+ mpEventQueue = nullptr;
+}
+
+float InputSystem::getMouseX()
+{
+ //Update mouse state
+ ALLEGRO_MOUSE_STATE mouseState;
+ al_get_mouse_state(&mouseState);
+
+ return mouseState.x;
+}
+
+float InputSystem::getMouseY()
+{
+ //Update mouse state
+ ALLEGRO_MOUSE_STATE mouseState;
+ al_get_mouse_state(&mouseState);
+
+ return mouseState.y;
+}
+
+std::pair InputSystem::getMousePosition()
+{
+ //Update mouse state
+ ALLEGRO_MOUSE_STATE mouseState;
+ al_get_mouse_state(&mouseState);
+
+ return std::make_pair(mouseState.x, mouseState.y);
+}
+
+//Init
+bool InputSystem::init(GraphicsLibrary* pGraphicsLib)
+{
+ //Init keyboard
+ if (!al_install_keyboard())
+ {
+ std::cout << "error installing Allegro keyboard plugin\n";
+ system("pause");
+ return false;
+ }
+
+ //Init mouse
+ if (!al_install_mouse())
+ {
+ std::cout << "error installing Allegro mouse plugin\n";
+ system("pause");
+ return false;
+ }
+
+ //Register screen event source
+ al_register_event_source(mpEventQueue, al_get_display_event_source(pGraphicsLib->mpDisplay));
+
+ //Register keyboard event source
+ al_register_event_source(mpEventQueue, al_get_keyboard_event_source());
+
+ //Register mouse event source
+ al_register_event_source(mpEventQueue, al_get_mouse_event_source());
+
+ return true;
+}
+
+MouseButton InputSystem::getMouseInput()
+{
+ //If there is an event
+ al_wait_for_event(mpEventQueue, &mEvent);
+
+ if (mEvent.type == InputMode::MouseDown)
+ {
+ //Update mouse state
+ ALLEGRO_MOUSE_STATE mouseState;
+ al_get_mouse_state(&mouseState);
+
+ //Check the button pressed
+ if (mouseState.buttons & 1) //Left mouse held
+ {
+ return MouseButton::LeftMouse;
+ }
+ else if (mouseState.buttons & 2) //Right mouse held
+ {
+ return MouseButton::RightMouse;
+ }
+ else if (mouseState.buttons & 4) //Middle mouse held
+ {
+ return MouseButton::MiddleMouse;
+ }
+ }
+}
+
+KeyCode InputSystem::getKeyboardInput()
+{
+ //If there is an event
+ al_wait_for_event(mpEventQueue, &mEvent);
+
+ if (mEvent.type == InputMode::KeyPressed)
+ {
+ //Check the type
+ switch (mEvent.keyboard.keycode)
+ {
+ case KeyCode::Escape:
+ return KeyCode::Escape;
+ break;
+
+ case KeyCode::R:
+ return KeyCode::R;
+ break;
+
+ default:
+ /*return KeyCode::NONE*/;
+ }
+ }
+
+ //return KeyCode::NONE;
+}
\ No newline at end of file
diff --git a/RoboCat/InputSystem.h b/RoboCat/InputSystem.h
new file mode 100644
index 00000000..3a69029e
--- /dev/null
+++ b/RoboCat/InputSystem.h
@@ -0,0 +1,68 @@
+#pragma once
+
+/*
+Allegro Wrapper Functions
+Written by Adel Talhouk in FA21
+InputSystem.h
+
+ File information:
+ This file contains the keycodes for input, which can be used in any way desired by other classes
+ and files.
+*/
+
+#include "GraphicsLibrary.h"
+
+//Include allegro libraries for input
+#include
+
+enum KeyCode
+{
+ Escape = ALLEGRO_KEY_ESCAPE,
+ R = ALLEGRO_KEY_R
+};
+
+enum MouseButton
+{
+ LeftMouse = 0,
+ RightMouse = 1,
+ MiddleMouse = 2
+};
+
+enum InputMode
+{
+ NONE = -1,
+ KeyPressed = ALLEGRO_EVENT_KEY_DOWN,
+ KeyReleased = ALLEGRO_EVENT_KEY_UP,
+ MouseDown = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN,
+ MouseUp = ALLEGRO_EVENT_MOUSE_BUTTON_UP
+};
+
+class InputSystem
+{
+ //-------------------------Private data-------------------------
+
+ //Event queue
+ ALLEGRO_EVENT_QUEUE* mpEventQueue;
+
+ //Event
+ ALLEGRO_EVENT mEvent;
+
+ //-------------------------Public data-------------------------
+public:
+
+ //Constructor(s)
+ InputSystem();
+
+ //Destructor
+ ~InputSystem();
+
+ //Accessor(s)
+ float getMouseX();
+ float getMouseY();
+ std::pair getMousePosition();
+
+ //Functions
+ bool init(GraphicsLibrary* pGraphicsLib);
+ MouseButton getMouseInput();
+ KeyCode getKeyboardInput();
+};
\ No newline at end of file
diff --git a/RoboCat/Src/Main.cpp b/RoboCat/Src/Main.cpp
index 3b0ac9de..3078e25c 100644
--- a/RoboCat/Src/Main.cpp
+++ b/RoboCat/Src/Main.cpp
@@ -1,8 +1,531 @@
-
#include "RoboCatPCH.h"
+#include "allegro_wrapper_functions-main/GraphicsLibrary.h"
+#include "allegro_wrapper_functions-main/Colour.h"
+#include "allegro_wrapper_functions-main/InputSystem.h"
+
+#include
+#include
+#include