This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy_ecs::prelude::*; | |
use bevy_hierarchy::*; | |
use bevy_ecs::world::CommandQueue; | |
use std::hint::black_box; | |
use rand; | |
use std::time::{Instant}; | |
#[derive(Component)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "egui-pie-chart" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
egui = "0.21" | |
egui_extras = "0.21" | |
eframe = "0.21" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function to center arbitrary widgets. It works by measuring the width of the widgets after rendering, and | |
// then using that offset on the next frame. | |
fn centerer(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui)) { | |
ui.horizontal(|ui| { | |
let id = ui.id().with("_centerer"); | |
let last_width: Option<f32> = ui.memory_mut(|mem| mem.data.get_temp(id)); | |
if let Some(last_width) = last_width { | |
ui.add_space((ui.available_width() - last_width) / 2.0); | |
} | |
let res = ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent( typeof(Camera) )] | |
public class FlyCamera : MonoBehaviour { | |
public float acceleration = 50; // how fast you accelerate | |
public float accSprintMultiplier = 4; // how much faster you go when "sprinting" | |
public float lookSensitivity = 1; // mouse look sensitivity | |
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input | |
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Copyright & License | |
/************************************************************************* | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2014 Roman Atachiants ([email protected]) | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2016 StagPoint Software | |
namespace StagPoint.Networking | |
{ | |
using System; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
/// <summary> | |
/// Provides some commonly-used functions for transferring compressed data over the network using |