Skip to content

Instantly share code, notes, and snippets.

View piedoom's full-sized avatar
🦀
rust rust rust rust rust rust rust rust

doomy piedoom

🦀
rust rust rust rust rust rust rust rust
View GitHub Profile
let ray = screen_to_world(cursor_position, &windows, camera, camera_transform);
let plane = HalfSpace::new(Unit::new_normalize(Vec3::Z.to_vector3()));
if let Some(toi) = plane.cast_local_ray(&ray, Real::MAX, false) {
dbg!(ray.point_at(toi)); // <-- would expect values the same as bevy's units, but is instead y-1. to y1, and x-1.7 to x1.7 (I think this specific # has to do with the aspect ratio)
}
// From https://github.com/aevyrie/bevy_mod_raycast/blob/8b2ee7d015b9bb886684d7ad7796e404944bd5dd/src/primitives.rs
// MIT License
// Gets a ray from our camera to our mouse position on screen
pub fn screen_to_world(
kind: pipeline
name: default
steps:
- name: doc
image: rustlang/rust:nightly
commands:
- apt update
- apt install libasound2-dev -y
- cargo doc --no-deps --document-private-items
#![no_main]
#![no_std]
extern crate panic_semihosting;
extern crate stm32f1xx_hal as hal;
use cortex_m::singleton;
use rtic::app;
use rtic::cyccnt::U32Ext;
use stm32f1xx_hal::prelude::*;
#![no_main]
#![no_std]
use stm32f1xx_hal as hal;
extern crate panic_semihosting;
use cortex_m_semihosting::hprintln;
use hal::{prelude::*, stm32, stm32::{Peripherals}, delay::Delay, timer::Timer};
use ws2812_timer_delay as ws2812;
use smart_leds::{RGB8, brightness, SmartLedsWrite};
// response with items
{
"response": {
"posts": [ "etc" ]
},
}
// response without items
{
#![no_main]
#![no_std]
// set the panic handler
extern crate panic_semihosting;
pub mod midi;
use core::sync::atomic::{AtomicBool, Ordering};
use cortex_m::{
@piedoom
piedoom / dspG1.c
Created October 6, 2019 13:43 — forked from anonymous/dspG1.c
The dsp-G1 Analog Modeling Synthesizer Source Code
/*
Copyright 2016 DSP Synthesizers Sweden.
Author: Jan Ostman
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*/
 
#include "wiring.h"
#include "LPC8xx.h"
#[derive(Clone, Default, Deserialize, Serialize, PrefabData)]
#[serde(default, deny_unknown_fields)]
#[prefab(Component)]
pub struct CharacterData {
/// The speed at which projectiles from a basic attack move
pub basic_attack_speed: f32,
/// The range at which the projectile dies
pub basic_attack_range: f32,
/// Whether or not the character wants to attack
pub attack: bool,
//! Pong Tutorial 2
mod assets;
mod components;
mod data;
mod states;
mod systems;
use crate::systems as s;
use crate::assets::config::GameConfig;