Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Bevy Forks
Bevy Cosmic Edit
Commits
348a09b5
Commit
348a09b5
authored
1 year ago
by
sam edelsten
Browse files
Options
Downloads
Patches
Plain Diff
fix attrs colors not being used
parent
3123ef00
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/bevy_api_testing.rs
+6
-2
6 additions, 2 deletions
examples/bevy_api_testing.rs
src/lib.rs
+12
-1
12 additions, 1 deletion
src/lib.rs
with
18 additions
and
3 deletions
examples/bevy_api_testing.rs
+
6
−
2
View file @
348a09b5
use
bevy
::
prelude
::
*
;
use
bevy_cosmic_edit
::{
change_active_editor_sprite
,
change_active_editor_ui
,
ActiveEditor
,
Cosmic
EditPlugin
,
CosmicEditSpriteBundle
,
CosmicEditUiBundle
,
change_active_editor_sprite
,
change_active_editor_ui
,
ActiveEditor
,
Cosmic
Attrs
,
CosmicEditPlugin
,
CosmicEditSpriteBundle
,
CosmicEditUiBundle
,
};
use
cosmic_text
::{
Attrs
,
AttrsOwned
};
fn
setup
(
mut
commands
:
Commands
)
{
commands
.spawn
(
Camera2dBundle
::
default
());
...
...
@@ -17,6 +18,9 @@ fn setup(mut commands: Commands) {
top
:
Val
::
Px
(
100.
),
..
default
()
},
cosmic_attrs
:
CosmicAttrs
(
AttrsOwned
::
new
(
Attrs
::
new
()
.color
(
cosmic_text
::
Color
::
rgb
(
0
,
255
,
0
)),
)),
..
default
()
});
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
12
−
1
View file @
348a09b5
...
...
@@ -1009,6 +1009,7 @@ fn redraw_buffer_common(
images
:
&
mut
ResMut
<
Assets
<
Image
>>
,
swash_cache_state
:
&
mut
ResMut
<
SwashCacheState
>
,
editor
:
&
mut
Editor
,
attrs
:
&
CosmicAttrs
,
background_image
:
Option
<
Handle
<
Image
>>
,
background_color
:
Color
,
cosmic_canvas_img_handle
:
&
mut
Handle
<
Image
>
,
...
...
@@ -1026,7 +1027,11 @@ fn redraw_buffer_common(
editor
.buffer_mut
()
.set_size
(
&
mut
font_system
.0
,
width
,
height
);
let
font_color
=
cosmic_text
::
Color
::
rgb
(
0
,
0
,
0
);
let
font_color
=
attrs
.0
.color_opt
.unwrap_or
(
cosmic_text
::
Color
::
rgb
(
0
,
0
,
0
));
let
mut
pixels
=
vec!
[
0
;
width
as
usize
*
height
as
usize
*
4
];
if
let
Some
(
bg_image
)
=
background_image
{
...
...
@@ -1116,6 +1121,7 @@ fn cosmic_edit_redraw_buffer_ui(
mut
swash_cache_state
:
ResMut
<
SwashCacheState
>
,
mut
cosmic_edit_query
:
Query
<
(
&
mut
CosmicEditor
,
&
CosmicAttrs
,
&
CosmicBackground
,
&
BackgroundColor
,
&
CosmicTextPosition
,
...
...
@@ -1128,6 +1134,7 @@ fn cosmic_edit_redraw_buffer_ui(
let
primary_window
=
windows
.single
();
for
(
mut
editor
,
attrs
,
background_image
,
background_color
,
text_position
,
...
...
@@ -1144,6 +1151,7 @@ fn cosmic_edit_redraw_buffer_ui(
&
mut
images
,
&
mut
swash_cache_state
,
&
mut
editor
.0
,
attrs
,
background_image
.0
.clone
(),
background_color
.0
,
&
mut
img
.texture
,
...
...
@@ -1168,6 +1176,7 @@ fn cosmic_edit_redraw_buffer(
mut
swash_cache_state
:
ResMut
<
SwashCacheState
>
,
mut
cosmic_edit_query
:
Query
<
(
&
mut
CosmicEditor
,
&
CosmicAttrs
,
&
Sprite
,
&
CosmicBackground
,
&
BackgroundColor
,
...
...
@@ -1180,6 +1189,7 @@ fn cosmic_edit_redraw_buffer(
let
primary_window
=
windows
.single
();
for
(
mut
editor
,
attrs
,
sprite
,
background_image
,
background_color
,
...
...
@@ -1196,6 +1206,7 @@ fn cosmic_edit_redraw_buffer(
&
mut
images
,
&
mut
swash_cache_state
,
&
mut
editor
.0
,
attrs
,
background_image
.0
.clone
(),
background_color
.0
,
&
mut
handle
,
...
...
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