// Copyright (c) 2023 Alex Diener. All rights reserved.

#ifndef __EntityComponent_position_H__
#define __EntityComponent_position_H__

typedef struct EntityComponent_position EntityComponent_position;
#define EntityComponent_position_superclass GameEntityComponent

#include "gamemath/Vector2i.h"
#include "PROJECT_NAME/GameEntityComponent.h"

#define EntityComponent_position_ivars \
	GameEntityComponent_ivars \
	\
	Vector2i position; \
	Vector2i lastPosition; \
	Vector2i lastBumpDirection;

#define EntityComponent_position_vtable(self_type) \
	GameEntityComponent_vtable(self_type) \
	\
	void (* moveTo)(self_type * self, Vector2i newPosition); \
	void (* teleportTo)(self_type * self, Vector2i newPosition);

stemobject_declare(EntityComponent_position)

bool EntityComponent_position_init(EntityComponent_position * self, Vector2i position);
void EntityComponent_position_dispose(EntityComponent_position * self);
void EntityComponent_position_initCopy(EntityComponent_position * self, compat_type(GameEntityComponent *) original);
void EntityComponent_position_update(EntityComponent_position * self, struct GameEntity * entity);
void EntityComponent_position_moveTo(EntityComponent_position * self, Vector2i newPosition);
void EntityComponent_position_teleportTo(EntityComponent_position * self, Vector2i newPosition);

#endif
