Skip to content

Commit

Permalink
feat: modular ui 💕
Browse files Browse the repository at this point in the history
fix: upload to itch
  • Loading branch information
eerii committed Dec 1, 2023
1 parent 64cafab commit 76ad8df
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 169 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,29 +251,30 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

check-upload-to-itch:
check-if-upload-to-itch-is-configured:
runs-on: ubuntu-latest
outputs:
should-upload: ${{ steps.check-env.outputs.has-itch-target }}
steps:
- id: check-env
run: |
if [[ -z "$itch_target" ]]; then
echo "has-itch-target == no >> $GITHUB_OUTPUT"
echo "has-itch-target=no" >> $GITHUB_OUTPUT
else
echo "has-itch-target == yes >> $GITHUB_OUTPUT"
echo "has-itch-target=yes" >> $GITHUB_OUTPUT
fi
upload-to-itch:
runs-on: ubuntu-latest
needs:
- get-version
- check-upload-to-itch
- check-if-upload-to-itch-is-configured
- release-wasm
- release-linux
- release-windows
- release-macos
if: ${{ needs.check-upload-to-itch.outputs.should-upload == 'yes' }}
# [CHANGE]: Uncomment this if you also want to push windows and macos builds to itch automatically
# It is disabled by default because these take a looong time (specially macos)
# - release-windows
# - release-macos
if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }}

env:
version: ${{needs.get-version.outputs.version}}
Expand Down
11 changes: 9 additions & 2 deletions examples/dvd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bevy::{prelude::*, window::WindowResolution};
use bevy_kira_audio::prelude::*;
use bevy_persistent::Persistent;
use hello_bevy::{
config::GameOptions,
load::{GameAssets, SampleAssets},
GamePlugin, GameState,
};
Expand Down Expand Up @@ -75,7 +77,12 @@ struct CollisionEvent(Entity);
// Systems
// ·······

fn init_sample(mut cmd: Commands, assets: Res<GameAssets>, info: Option<Res<GameInfo>>) {
fn init_sample(
mut cmd: Commands,
assets: Res<GameAssets>,
opts: Res<Persistent<GameOptions>>,
info: Option<Res<GameInfo>>,
) {
cmd.spawn((Camera2dBundle::default(), GameCamera));

if info.is_some() {
Expand Down Expand Up @@ -110,7 +117,7 @@ fn init_sample(mut cmd: Commands, assets: Res<GameAssets>, info: Option<Res<Game
TextStyle {
font: assets.font.clone(),
font_size: 192.,
color: Color::WHITE,
color: opts.color.mid,
},
),
..default()
Expand Down
16 changes: 13 additions & 3 deletions examples/jump.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use bevy::{prelude::*, window::WindowResolution};
use bevy_persistent::Persistent;
use hello_bevy::{config::Keybinds, input::InputState, load::GameAssets, GamePlugin, GameState};
use hello_bevy::{
config::{GameOptions, Keybinds},
input::InputState,
load::GameAssets,
GamePlugin, GameState,
};

fn main() {
App::new()
Expand Down Expand Up @@ -73,7 +78,12 @@ struct GameCamera;
// Systems
// ·······

fn init_sample(mut cmd: Commands, assets: Res<GameAssets>, info: Option<Res<GameInfo>>) {
fn init_sample(
mut cmd: Commands,
assets: Res<GameAssets>,
opts: Res<Persistent<GameOptions>>,
info: Option<Res<GameInfo>>,
) {
cmd.spawn((Camera2dBundle::default(), GameCamera));

if info.is_some() {
Expand Down Expand Up @@ -104,7 +114,7 @@ fn init_sample(mut cmd: Commands, assets: Res<GameAssets>, info: Option<Res<Game
TextStyle {
font: assets.font.clone(),
font_size: 192.,
color: Color::WHITE,
color: opts.color.mid,
},
),
..default()
Expand Down
6 changes: 2 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ use crate::{input::Bind, GameState};

pub use bevy_persistent::prelude::*;

// TODO: Accesibility
// - Change font size
// - Change color palette

// ······
// Plugin
// ······
Expand All @@ -35,13 +31,15 @@ impl Plugin for ConfigPlugin {
pub struct FontSize {
pub title: f32,
pub text: f32,
pub button_text: f32,
}

impl Default for FontSize {
fn default() -> Self {
Self {
title: 48.0,
text: 24.0,
button_text: 20.0,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mod only_in_debug {

cmd.spawn((Camera2dBundle {
camera_2d: Camera2d {
clear_color: ClearColorConfig::Custom(Color::rgba(0., 0., 0., 0.)),
clear_color: ClearColorConfig::Custom(Color::WHITE),
},
camera: Camera {
order: -10,
Expand Down
4 changes: 2 additions & 2 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub enum Bind {
Gamepad(GamepadButton),
}

impl Bind {
pub fn name(&self) -> String {
impl ToString for Bind {
fn to_string(&self) -> String {
match self {
Bind::Key(key) => format!("{:?}", key),
Bind::Mouse(button) => format!("{:?}", button),
Expand Down
Loading

0 comments on commit 76ad8df

Please sign in to comment.