Skip to content

NathanSWard/GameTime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#WIP Game Engine

Example Usage:

void my_startup_system(Commands cmds, Resource<AssetServer const> server)
{
	auto texture_handle = server.load<Texture>("my-image.png"); // async loading of the image
	cmds.spawn(SpriteBundle {
			.sprite = Sprite {
				.size = Vec2(10.f, 10.f),
			},
			.texture = texture_handle,
		});
}

void my_system(
	Query<With<Transform, Visible const>> query,
	Resource<Input<KeyCode>> inputs)
{
	query.each([&](Transform& tform) {
		if (inputs->pressed(KeyCode::A)) {
			tform.translation.x() -= 5; 
		}
		else if (inputs->pressed(KeyCode::D)) {
			tform.translation.x() += 5;
		}
	});
}

int main()
{
	GameBuilder
		.add_plugin(DefaultPlugins{}) // adds pluings such as: Sprite, Render, Asset, Input, (and more...)
		.add_system(my_system)
		.add_startup_system(my_startup_system)
		.build()
		.run();
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •