X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/830829dec0596760d0cba38d959ab2646112f61b..0cafec445af0a97d96feb1a1daefa1486142c73f:/src/actor.c?ds=sidebyside diff --git a/src/actor.c b/src/actor.c deleted file mode 100644 index 32028a1..0000000 --- a/src/actor.c +++ /dev/null @@ -1,44 +0,0 @@ -// -// actor.c -// Super Polarity -// -// Created by Ruben Beltran del Rio on 8/14/13. -// Copyright (c) 2013 Abuguet. All rights reserved. -// - -#include -#include "actor.h" - -SDL_Renderer *renderer; - -void actorUpdate(Actor *this, Uint32 dt) { - this->textureBox.x = this->pos.x; - this->textureBox.y = this->pos.y; - this->angle = (Uint32)(this->angle + dt / 5) % 360; -} - -void actorDraw(Actor *this) { - SDL_RenderCopyEx(renderer, this->texture, NULL, &this->textureBox, this->angle, NULL, SDL_FLIP_NONE); -} - -// This constructor is pretty much dumb. So, don't take it as anything final. -Actor* createActor () { - Actor *actor = malloc(sizeof(Actor*)); - actor->pos.x = 0; - actor->pos.y = 0; - actor->update = actorUpdate; - actor->draw = actorDraw; - actor->angle = 0.0; - - // Load the surface. - SDL_Surface *benSurface; - benSurface = IMG_Load("data/img/static/ben.png"); - actor->texture = SDL_CreateTextureFromSurface(renderer, benSurface); - actor->textureBox.x = 230; - actor->textureBox.y = 150; - actor->textureBox.w = 180; - actor->textureBox.h = 180; - SDL_FreeSurface(benSurface); - - return actor; -} \ No newline at end of file