This file contains hidden or 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::prelude::*; | |
use std::collections::HashSet; | |
/// Example demonstrating despawning all entities that were spawned during a specific state | |
fn main() { | |
let mut app = App::new(); | |
app | |
.add_state::<AppState>() | |
.insert_resource(EntityRecord(HashSet::new())) |
This file contains hidden or 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::prelude::*; | |
use bevy::reflect::{ReflectFromPtr, ReflectMut}; | |
/// Example demonstrating how to print and mutate the resources of a world using reflection | |
fn main() { | |
App::new() | |
.init_resource::<AppTypeRegistry>() | |
.register_type::<Foo>() | |
.register_type::<Bar>() | |
.insert_resource(Foo::A) |
This file contains hidden or 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::app::ScheduleRunnerPlugin; | |
use bevy::ecs::schedule::{ExecutorKind, ScheduleLabel}; | |
use bevy::prelude::*; | |
fn main() { | |
let mut app = App::empty(); | |
let mut schedule = Schedule::new(); | |
schedule.set_executor_kind(ExecutorKind::SingleThreaded); |
This file contains hidden or 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
<!-- Avilable under MIT, Apache-2.0, The Unlicense, or the WTFPL at your choice --> | |
<svg class="eye" class:eye-open={$is_connected} viewBox="0 -150 400 300" width="80" xmlns="http://www.w3.org/2000/svg"> | |
<g stroke-width="32" fill="none"> | |
<path d={top_path} stroke="currentColor"> | |
<animate bind:this={eyecon_close_top_anim} dur="0.2s" attributeName="d" from={top_path} to={path_closed} fill="freeze" begin="indefinite" /> | |
<animate bind:this={eyecon_open_top_anim} dur="0.2s" attributeName="d" from={path_closed} to={top_path} fill="freeze" begin="indefinite" /> | |
</path> | |
<path d={bottom_path} stroke="currentColor"> | |
<animate bind:this={eyecon_close_bottom_anim} dur="0.2s" attributeName="d" from={bottom_path} to={path_closed} fill="freeze" begin="indefinite" /> | |
<animate bind:this={eyecon_open_bottom_anim} dur="0.2s" attributeName="d" from={path_closed} to={bottom_path} fill="freeze" begin="indefinite" /> |
This file contains hidden or 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
//! A shader that uses "shaders defs", which selectively toggle parts of a shader. | |
use std::time::Duration; | |
use bevy::{ | |
pbr::{MaterialPipeline, MaterialPipelineKey}, | |
prelude::*, | |
reflect::{TypePath, TypeUuid}, | |
render::{ | |
mesh::MeshVertexBufferLayout, | |
render_resource::{ |
This file contains hidden or 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 chrono::{NaiveDate, NaiveDateTime}; | |
use serde::{Deserialize, Serialize}; | |
use tsync::tsync; | |
fn main() { | |
let msg = serde_json::to_string(&Message::Response(Response { | |
id: "Foo".into(), | |
result: NaiveDate::from_ymd(2016, 7, 8).and_hms(9, 10, 11), | |
})).unwrap(); |
This file contains hidden or 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::prelude::*; | |
use bevy_inspector_egui::quick::WorldInspectorPlugin; | |
use std::{env, fs}; | |
use std::path::Path; | |
fn main() { | |
App::new() | |
.add_plugin(DevAssetPlugin::default()) | |
.add_plugins(DefaultPlugins) | |
.add_plugin(WorldInspectorPlugin::new()) |
This file contains hidden or 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
<template> | |
<header class="titlebar"> | |
<div class="spacer"> | |
<div :class="maximized ? 'drag drag-max' : 'drag drag-min'"/> | |
</div> | |
<div class="system-bar"> | |
<button class="sys-btn" @click.stop="onMinimize()"> | |
<img src="/caption-buttons.svg#minimize"> | |
</button> | |
<button class="sys-btn" @click.stop="onMaximize()"> |
This file contains hidden or 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::prelude::*; | |
use bevy::{input::keyboard::KeyboardInput, prelude::*}; | |
use bevy::winit::WinitWindows; | |
use winit::platform::windows::WindowExtWindows; | |
use bevy::window::WindowCreated; | |
use bevy::app::{Events, ManualEventReader}; | |
use winapi::{ | |
DEFINE_GUID, | |
ctypes::c_void, | |
shared::{ |
This file contains hidden or 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::{prelude::*, asset::LoadState}; | |
fn main() { | |
App::build() | |
.add_resource(GameState::Loading) | |
.add_resource(PendingAssets(Vec::new())) | |
.add_plugins(DefaultPlugins) | |
.add_startup_system(load_some_assets.system()) | |
.add_system(loading.system()) | |
.add_system(loaded.system()) |