docs: setup todo list

This commit is contained in:
2024-03-12 07:00:53 +01:00
parent 6246ec0dd8
commit c651f37759
4 changed files with 48 additions and 4 deletions
+15
View File
@@ -0,0 +1,15 @@
# v0.1.0
-[x] contracts
-[x] loby
-[x] actions
-[x] game state
-[ ] way to define default controlls
-[ ] layers for controlls: if on (shift + space) action enable, ignore on (space) action
-[ ] warnings on actions collision
-[ ] basic example
# v0.2.0
-[ ] layers for controlls: user posibility give priority to controls
-[ ] controller support
-[ ] touch pad support
-[ ] posibility support more that one game state
+29 -3
View File
@@ -21,6 +21,7 @@ enum MyAction {
Left, Left,
Right, Right,
Up, Up,
Down,
} }
#[derive(States, PartialEq, Eq, Clone, Hash, Debug, Default, GameState)] #[derive(States, PartialEq, Eq, Clone, Hash, Debug, Default, GameState)]
@@ -55,9 +56,19 @@ struct JumpsCount(i32);
fn main() { fn main() {
App::new() App::new()
.add_plugins(( .add_plugins((
DefaultPlugins, DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
transparent: true,
decorations: false,
#[cfg(target_os = "macos")]
composite_alpha_mode: CompositeAlphaMode::PostMultiplied,
..default()
}),
..default()
}),
ControlsPlugin::<MyAction, MyInputsContainer, MyGameState>::default(), ControlsPlugin::<MyAction, MyInputsContainer, MyGameState>::default(),
)) ))
.insert_resource(ClearColor(Color::NONE))
.init_resource::<JumpsCount>() .init_resource::<JumpsCount>()
.add_systems(Startup, (add_bindings, setup)) .add_systems(Startup, (add_bindings, setup))
.add_systems(Update, text_update_system) .add_systems(Update, text_update_system)
@@ -127,6 +138,13 @@ fn add_bindings(mut controls: ResMut<Controls<MyAction, MyGameState>>) {
Keyboard::KeyCode(KeyCode::Space), Keyboard::KeyCode(KeyCode::Space),
))), ))),
); );
controls.force_push(
MyAction::Down,
Binding::new(ButtonCombination::Chord(vec![
InputType::Keyboard(Keyboard::KeyCode(KeyCode::ShiftLeft)),
InputType::Keyboard(Keyboard::KeyCode(KeyCode::Space)),
])),
);
} }
#[derive(Component)] #[derive(Component)]
@@ -140,7 +158,7 @@ fn setup(mut commands: Commands) {
commands.spawn(( commands.spawn((
TextBundle::from_sections([ TextBundle::from_sections([
TextSection::new( TextSection::new(
"\nAction: ", "Action: ",
TextStyle { TextStyle {
font_size: TEXT_SIZE, font_size: TEXT_SIZE,
..default() ..default()
@@ -181,7 +199,8 @@ fn setup(mut commands: Commands) {
..default() ..default()
}, },
), ),
]), ])
.with_background_color(Color::BLACK),
TextBlock, TextBlock,
)); ));
} }
@@ -215,6 +234,13 @@ fn text_update_system(
**jumps_count += 1; **jumps_count += 1;
text.sections[JUMP_INDEX].value = format!("Up (Space) - {}", **jumps_count); text.sections[JUMP_INDEX].value = format!("Up (Space) - {}", **jumps_count);
} }
if player_inputs
.get_just_pressed(MyAction::Down)
.unwrap_or(false)
{
**jumps_count -= 1;
text.sections[JUMP_INDEX].value = format!("Up (Space) - {}", **jumps_count);
}
} }
} }
+1 -1
View File
@@ -7,7 +7,7 @@ log "enable logging"
while [ "$#" -gt 0 ]; do while [ "$#" -gt 0 ]; do
case $1 in case $1 in
-h|-?|--help|help) -h|--help|help)
HELP=1 HELP=1
;; ;;
-*) -*)
+3
View File
@@ -0,0 +1,3 @@
<ul>
<li>[ ]</li>
</ul>