Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Micro Game Macros
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Micro Game Macros
Commits
071b535a
Verified
Commit
071b535a
authored
11 months ago
by
Louis
Browse files
Options
Downloads
Patches
Plain Diff
Bump version
parent
0ce86f7e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
src/event_system/components.rs
+11
-18
11 additions, 18 deletions
src/event_system/components.rs
tests/mod.rs
+2
-2
2 additions, 2 deletions
tests/mod.rs
with
14 additions
and
21 deletions
Cargo.toml
+
1
−
1
View file @
071b535a
[package]
name
=
"micro_games_macros"
version
=
"0.
3.1
"
version
=
"0.
4.0
"
edition
=
"2021"
authors
=
[
"Louis Capitanchik <contact@louiscap.co>"
]
description
=
"Utility macros to make it easier to build complex systems with Bevy"
...
...
This diff is collapsed.
Click to expand it.
src/event_system/components.rs
+
11
−
18
View file @
071b535a
...
...
@@ -55,24 +55,17 @@ fn define_structs(data: &DataEnum) -> TokenStream {
let
event_name
=
ident_suffix
(
ident
,
"Event"
);
let
fields
:
TokenStream
=
fields
.iter
()
.map
(
|
fl
@
Field
{
ident
,
ty
,
mutability
,
..
}|
{
let
f
=
Field
{
ident
:
ident
.clone
(),
ty
:
ty
.clone
(),
vis
:
parse_quote!
(
pub
),
..
fl
.clone
()
}
.to_token_stream
();
quote!
(
#
f
,)
},
)
.map
(|
fl
@
Field
{
ident
,
ty
,
..
}|
{
let
f
=
Field
{
ident
:
ident
.clone
(),
ty
:
ty
.clone
(),
vis
:
parse_quote!
(
pub
),
..
fl
.clone
()
}
.to_token_stream
();
quote!
(
#
f
,)
})
.collect
();
quote!
{
...
...
This diff is collapsed.
Click to expand it.
tests/mod.rs
+
2
−
2
View file @
071b535a
use
micro_games_macros
::
event_system
;
use
std
::
sync
::
Mutex
;
#[test]
fn
event_system_correctly_generates_and_dispatches_events
()
{
...
...
@@ -22,7 +22,7 @@ fn event_system_correctly_generates_and_dispatches_events() {
app
.add_plugins
(
MyEventsPlugin
);
app
.add_systems
(
Update
,
|
mut
has_run
:
ResMut
<
HasRun
>
,
mut
events
:
EventReader
<
WaitEvent
>
|
{
|
mut
has_run
:
ResMut
<
HasRun
>
,
events
:
EventReader
<
WaitEvent
>
|
{
has_run
.0
=
true
;
let
event_length
=
events
.len
();
assert_eq!
(
event_length
,
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment