drawable.h - #ifndef DRAWABLE_H#define DRAWABLE_H#include...

Info icon This preview shows page 1. Sign up to view the full content.

#ifndef DRAWABLE__H #define DRAWABLE__H #include <SDL.h> #include <iostream> #include <string> #include "vector2f.h" #include "image.h" // Drawable is an Abstract Base Class (ABC) that specifies the methods // that derived classes may or must have. class Drawable { public: Drawable(const std::string& n, const Vector2f& pos, const Vector2f& vel): name(n), position(pos), velocity(vel), scale(1.0) {} Drawable(const Drawable& s) : name(s.name), position(s.position), velocity(s.velocity), scale(s.scale) { } virtual ~Drawable() {} virtual void draw() const = 0; virtual void update(Uint32 ticks) = 0; float getScale() const { return scale; } void setScale(float s) { scale = s; } virtual int getScaledWidth() const = 0; virtual int getScaledHeight() const = 0; virtual const SDL_Surface* getSurface() const = 0; const std::string& getName() const { return name; }
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '17
  • Ibrarulhaq
  • Marketing, Return statement, Void type, const

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern