Skip to content

Instantly share code, notes, and snippets.

Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
CPU Family: 0x6
@Toqozz
Toqozz / Cargo.toml
Last active April 3, 2019 08:53
glutin + gfx-rs simple rotating cube
[package]
name = "example"
version = "0.1.0"
authors = ["Michael Palmos <[email protected]>"]
edition = "2018"
[dependencies]
gfx = "0.18"
gfx_core = "*"
gfx_device_gl = "*"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "x.h"
#include "datatypes.h"
@Toqozz
Toqozz / Pool.cs
Created October 6, 2019 06:22
Unity Generic Object Pool. Allows `Pool.Get</SomeMonoBehaviour/>`. Useful for avoiding `GetComponent` in a pool.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pool : MonoBehaviour {
public List<PooledObject> objectsToPool;
private Dictionary<Type, Queue<PooledObject>> dict;
(
max_notifications: 0,
min_window_width: 1,
min_window_height: 1,
timeout: 10000,
poll_interval: 6,
debug: true,
debug_color: Color(r: 0.0, g: 1.0, b: 0.0, a: 1.0),
@Toqozz
Toqozz / bevy_screen_to_world.rs
Created March 6, 2021 06:29
Basic screen to world bevy code. Missing some stuff like the distance calculation.
pub fn screen_to_world(
cursor: Res<Events<CursorMoved>>,
windows: Res<Windows>,
mut input_state: ResMut<GlobalInputState>,
camera_query: Query<(&Camera, &Transform)>,
) {
// Calculate world space mouse ray. If there's no new mouse move event, then continue.
let pos = match input_state.cursor.latest(&cursor) {
Some(ev) => ev.position,
None => return,