Skip to content

scripts_system::destroy()

Paweł Waligóra edited this page May 8, 2024 · 1 revision

Example

#pragma once
#include "scripts_system.h"
#include "input_system.h"
#include "key_bind.h"
#include "wall.h"

namespace game {
	class spawn_test : public scripts_system::script {
	private:

		game::wall* wall_ptr = nullptr;
		input_system::key_bind wall_spawn = input_system::key_bind([&, this](){
				this->wall_ptr = scripts_system::instantiate<game::wall, glm::vec3, glm::vec3, glm::vec3>(glm::vec3(0.0f, 10.0f, 0.0f), glm::vec3(0.0f), glm::vec3(10.0f, 1.0f, 10.0f));
		}, GLFW_KEY_P, GLFW_PRESS);

		input_system::key_bind wall_remove = input_system::key_bind([&, this](){
			if (wall_ptr != nullptr) scripts_system::destroy(wall_ptr);
			wall_ptr = nullptr;
		}, GLFW_KEY_O, GLFW_PRESS);
	};
}

Home

Git Workflow

Issues

Coding Rules

Skrypty-Tutorial

Useful resources

Game Structure

Code Structure

Clone this wiki locally