bevy/crates/bevy_ui/src
patrickariel 3efef59d83
Enable/disable UI anti-aliasing (#15170)
# Objective

Currently, UI is always rendered with anti-aliasing. This makes bevy's
UI completely unsuitable for art-styles that demands hard pixelated
edges, such as retro-style games.

## Solution

Add a component for disabling anti-aliasing in UI.

## Testing

In
[`examples/ui/button.rs`](15e246eff8/examples/ui/button.rs),
add the component to the camera like this:

```rust
use bevy::{prelude::*, ui::prelude::*};

commands.spawn((Camera2dBundle::default(), UiAntiAlias::Off));
```

The rounded button will now render without anti-aliasing.

## Showcase

An example of a rounded UI node rendered without anti-aliasing, with and
without borders:


![image](https://github.com/user-attachments/assets/ea797e40-bdaa-4ede-a0d3-c9a7eab95b6e)
2024-09-16 23:06:23 +00:00
..
layout fix spelling mistake (#15146) 2024-09-10 20:21:40 +00:00
render Enable/disable UI anti-aliasing (#15170) 2024-09-16 23:06:23 +00:00
widget Reflect derived traits on all components and resources: bevy_ui (#15231) 2024-09-15 17:52:38 +00:00
accessibility.rs Return Results from Camera's world/viewport conversion methods (#14989) 2024-09-03 19:45:15 +00:00
focus.rs Reflect derived traits on all components and resources: bevy_ui (#15231) 2024-09-15 17:52:38 +00:00
geometry.rs Reflect derived traits on all components and resources: bevy_ui (#15231) 2024-09-15 17:52:38 +00:00
lib.rs Reflect derived traits on all components and resources: bevy_ui (#15231) 2024-09-15 17:52:38 +00:00
measurement.rs Optimize UI text measurement (#15003) 2024-09-01 11:50:54 +00:00
node_bundles.rs Remove deprecated SpriteSheetBundle and AtlasImageBundle (#15062) 2024-09-09 15:36:09 +00:00
picking_backend.rs Fix bevy_ui compile error when bevy_picking feature is disabled (#15053) 2024-09-05 19:16:57 +00:00
stack.rs Merge BuildWorldChildren and BuildChildren traits. (#14052) 2024-07-01 14:29:39 +00:00
ui_material.rs Fix incorrect link in UiMaterial documentation (#12361) 2024-03-07 22:09:57 +00:00
ui_node.rs Enable/disable UI anti-aliasing (#15170) 2024-09-16 23:06:23 +00:00
update.rs fix: use try_insert instead of insert in bevy_ui to prevent panics when despawning ui nodes (#13000) 2024-04-19 18:12:08 +00:00