Comments (8)
I couldn't repro this, but am curious if you are still having the problem.
from bevy-console.
Just checked and I am. It seems to only be occurring when the window is on my 4k monitor with 125% scaling, but not the 4k at 200% scaling, so maybe something to do with dpi?
from bevy-console.
Hi @cebarks, could you please provide a small code example + steps for reproducing this issue?
from bevy-console.
Here's the code. The only thing required to reproduce this is to open this app on a 4k screen with scaling that ends in 25% (mine is set to 125%, but 175% also causes this to happen.) Switching scaling to a multiple of 50% stops it from happening.
use bevy::render::camera::ScalingMode;
use bevy::window::{PresentMode, WindowMode};
use bevy_console::{ConsoleConfiguration, ConsolePlugin};
pub const A_RATIO: f32 = 16.0 / 9.0;
fn main() {
App::new()
.insert_resource(get_window_desc())
.insert_resource(ClearColor(Color::PURPLE))
.add_plugins(DefaultPlugins)
.add_plugin(ConsolePlugin)
.insert_resource(ConsoleConfiguration {
height: 200.0,
..Default::default()
})
.add_startup_system(spawn_camera)
.run();
println!("Exiting.");
}
fn get_window_desc() -> WindowDescriptor {
return WindowDescriptor{
title: "ConsoleTest".to_string(),
width: 1600.0,
height: 900.0,
present_mode: PresentMode::Fifo,
mode: WindowMode::Windowed,
resizable: true,
..Default::default()
};
}
fn spawn_camera(mut commands: Commands) {
let mut camera = OrthographicCameraBundle::new_2d();
camera.orthographic_projection.top = 1.0;
camera.orthographic_projection.bottom = -1.0;
camera.orthographic_projection.right = 1.0 * A_RATIO;
camera.orthographic_projection.left = -1.0 * A_RATIO;
camera.orthographic_projection.scaling_mode = ScalingMode::None;
commands.spawn_bundle(camera);
println!("Camera spawned.")
}
from bevy-console.
I had the same issue on a 2k (1440p) monitor with 125% scaling in windows settings.
I was able to fix it by editing :
Line 545 in fa09da3
from
let scroll_height = ui.available_height() - 30.0;
to
let scroll_height = ui.available_height() - 32.0;
from bevy-console.
@makspll is the above enough to get this fixed? I can prepare a pull request too if with the change highlighted by @Flapperkewiet if that would help.
from bevy-console.
I am not sure what the cause of this issue is, but if this change fixes it it might be to do with the way floating point is handled. If you can reproduce the issue and this fix works then I am happy to accept PR's for it although I would love to know why exactly this happens ideally!
from bevy-console.
I'm getting this issue too. I believe the problem is that console.rs
uses ui.vertical()
which puts the widgets in from top to bottom. Since the one that grows in size is the scroll area, you can put the widgets in bottom to top instead:
{
// ui.vertical(|ui| {
// let scroll_height = ui.available_height() - 30.0;
ui.with_layout(egui::Layout::bottom_up(egui::Align::Min), |ui| {
// Input
let text_edit = TextEdit::singleline(&mut state.buf)
.desired_width(f32::INFINITY)
.font(egui::TextStyle::Monospace);
let text_edit_response = ui.add(text_edit);
// Separator
ui.separator();
// Scroll area
ScrollArea::vertical()
.auto_shrink([false, false])
.stick_to_bottom(true)
// .max_height(scroll_height)
.show(ui, |ui| {
This way you don't need to pre-calculate the pixels for the available height. This also stops the large jump that happens to window size when you go to resize it using the grip on the bottom-right corner. Related talk here.
from bevy-console.
Related Issues (20)
- Can't open the console on a french keyboard HOT 5
- Bevy 0.9 support HOT 1
- Couldn't satisfy dependencies of my project with bevy-console = "0.4.0" HOT 3
- Update crates.io published code to support bevy 0.9 HOT 4
- Integration with `clap` HOT 7
- Possible licensing issue HOT 2
- Execute the examples all black. HOT 1
- Add support for customizing internal `egui::style::Style` HOT 1
- Some way to avoid having to wrap things in an `if` HOT 1
- Crash when exit_condition "DontExit" HOT 1
- Access to trait 'Parser' from this crate. HOT 1
- Run UI system depending on `run_if` instead of key press HOT 1
- Wrong command called problem! HOT 7
- Can we not fix the version of clap? HOT 1
- Update `bevy_egui` to v0.24 HOT 5
- Please add a config option to NOT init the egui plugin HOT 1
- bevy 0.13 support
- Support Bevy v0.14
- Better support for dynamically-generated commands?
- Example on how to make a console command trigger something in-game
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy-console.