Formatting

This commit is contained in:
Piotr 2020-09-27 14:39:02 +02:00
parent d916cf3c18
commit 50e791a3fb
7 changed files with 41 additions and 13 deletions

View File

@ -164,7 +164,7 @@ impl Client for ExampleClient {
if self.show_camera_info { if self.show_camera_info {
Window::new(im_str!("CameraInfo")) Window::new(im_str!("CameraInfo"))
.size([260.0, 430.0], Condition::Always) .size([260.0, 430.0], Condition::Always)
.position([40.0, 40.0], Condition::Always) .position([20.0, 40.0], Condition::Always)
.title_bar(false) .title_bar(false)
.scroll_bar(false) .scroll_bar(false)
.no_inputs() .no_inputs()

View File

@ -1,9 +1,9 @@
use crate::gaia::mesh::Texture; use crate::gaia::mesh::Texture;
use crate::gaia::model::Model; use crate::gaia::model::Model;
use crate::gaia::utils::load_texture_from_dir; use crate::gaia::utils::load_texture_from_dir;
use log::{info, trace, warn};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use log::{info, trace, warn};
#[derive(Default)] #[derive(Default)]
pub struct AssetsCache { pub struct AssetsCache {

View File

@ -91,6 +91,34 @@ impl Engine {
ui.separator(); ui.separator();
ui.text(format!("Mouse position: ({:4.1},{:4.1})", last_x, last_y)); ui.text(format!("Mouse position: ({:4.1},{:4.1})", last_x, last_y));
}); });
Window::new(im_str!("Logs"))
.size([670.0, 215.0], Condition::Always)
.bg_alpha(0.8)
.position(
[offset, self.window_size.1 - 215.0 - offset],
Condition::Always,
)
.no_decoration()
.no_inputs()
.bg_alpha(0.8)
.save_settings(false)
.build(&ui, || {
use std::fs;
use std::io::prelude::*;
use std::io::BufReader;
let buf = BufReader::new(fs::File::open("log.log").expect("no such file"));
let lines: Vec<String> = buf
.lines()
.map(|l| l.expect("Could not parse line"))
.collect();
let mut output = String::new();
lines.iter().rev().take(10).rev().for_each(|line| {
output.push_str(&line);
output.push('\n');
});
ui.text(output);
});
self.imgui_glfw.draw(ui, &mut self.window); self.imgui_glfw.draw(ui, &mut self.window);
} }

View File

@ -1,9 +1,9 @@
use crate::gaia::shader::*; use crate::gaia::shader::*;
use gl::types::*; use gl::types::*;
use log::{info, trace, warn};
use std::mem; use std::mem;
use std::os::raw::c_void; use std::os::raw::c_void;
use std::ptr; use std::ptr;
use log::{info, trace, warn};
#[derive(Debug)] #[derive(Debug)]
pub struct FramebufferSystem { pub struct FramebufferSystem {
@ -49,7 +49,10 @@ impl FramebufferSystem {
gl::DrawArrays(gl::TRIANGLES, 0, 6); gl::DrawArrays(gl::TRIANGLES, 0, 6);
} }
pub unsafe fn generate(scr_width: i32, scr_height: i32) -> Self { pub unsafe fn generate(scr_width: i32, scr_height: i32) -> Self {
info!("Generating new framebuffer with dimensions {}x{}",scr_width,scr_height); info!(
"Generating new framebuffer with dimensions {}x{}",
scr_width, scr_height
);
let screenShader = Shader::from_file( let screenShader = Shader::from_file(
"resources/shaders/framebuffers_screen.vs", "resources/shaders/framebuffers_screen.vs",
"resources/shaders/framebuffers_screen.fs", "resources/shaders/framebuffers_screen.fs",
@ -143,7 +146,7 @@ impl FramebufferSystem {
gl::BindFramebuffer(gl::FRAMEBUFFER, 0); gl::BindFramebuffer(gl::FRAMEBUFFER, 0);
info!("New framebuffer generated"); info!("New framebuffer generated");
FramebufferSystem { FramebufferSystem {
texture_color_buffer: textureColorbuffer, texture_color_buffer: textureColorbuffer,
shader: screenShader, shader: screenShader,

View File

@ -6,9 +6,9 @@ use crate::gaia::mesh::{Mesh, Texture, Vertex};
use crate::gaia::shader::Shader; use crate::gaia::shader::Shader;
use crate::gaia::utils::*; use crate::gaia::utils::*;
use cgmath::{vec2, vec3}; use cgmath::{vec2, vec3};
use log::{info, trace, warn};
use std::path::Path; use std::path::Path;
use tobj; use tobj;
use log::{info, trace, warn};
#[derive(Clone)] #[derive(Clone)]
pub struct Model { pub struct Model {

View File

@ -1,14 +1,11 @@
use gl; use gl;
use image2::image::Image; use image2::image::Image;
use image2::{io, ImagePtr, Rgb, Rgba}; use image2::{io, ImagePtr, Rgb, Rgba};
use std::os::raw::c_void;
use log::{info, trace, warn}; use log::{info, trace, warn};
use std::os::raw::c_void;
pub unsafe fn load_texture(path: &str, file_format: &str) -> u32 { pub unsafe fn load_texture(path: &str, file_format: &str) -> u32 {
info!( info!("Loading texture: {}", path);
"Loading texture: {}",
path
);
let mut id = 0; let mut id = 0;
gl::GenTextures(1, &mut id); gl::GenTextures(1, &mut id);

View File

@ -9,10 +9,10 @@ extern crate simple_logging;
mod gaia; mod gaia;
mod example_client; mod example_client;
use crate::gaia::engine::Engine;
use human_panic::setup_panic;
use log::LevelFilter; use log::LevelFilter;
use log::{info, trace, warn}; use log::{info, trace, warn};
use human_panic::setup_panic;
use crate::gaia::engine::Engine;
pub fn main() { pub fn main() {
setup_panic!(); setup_panic!();