Skip to content

Instantly share code, notes, and snippets.

let color = PredefinedColor::Green.into();
let view = layout!(Component {
color: color
};
let view = layout!(Component {
color: "green"
};
// Rust
let uniform = UniformsStorage::new("matrix", [
[1.0, 0.0, x],
[0.0, 1.0, y],
[0.0, 0.0, 1f32]
]);
let uniform = uniform.add("tex", &self.texture);
let uniform = uniform.add("screen_size", [engine.width as f32, engine.height as f32]);
extern crate hlua;
const LUA: &'static str = r#"
data:extend({
{
type = "font",
name = "default",
from = "default",
size = 14
}
mod ffi {
extern "C" {
pub fn lua_newstate(f: ::lua_Alloc, ud: *mut ::libc::c_void)-> *mut ::lua_State;
pub fn lua_close(L: *mut ::lua_State);
pub fn lua_newthread(L: *mut ::lua_State)-> *mut ::lua_State;
pub fn lua_atpanic(L: *mut ::lua_State, panicf: ::lua_CFunction)-> ::lua_CFunction;
pub fn lua_version(L: *mut ::lua_State)-> *const ::lua_Number;
pub fn lua_absindex(L: *mut ::lua_State, idx: ::c_int)-> ::c_int;
pub fn lua_gettop(L: *mut ::lua_State)-> ::c_int;
pub fn lua_settop(L: *mut ::lua_State, idx: ::c_int);
#include "Operation.hpp"
#include <iostream>
Operation::Operation()
{
}
Operation::~Operation()
{
# This is a combination of 3 commits.
# This is the 1st commit message:
Removed debug text files
# This is the commit message #2:
Removed debug text files
# This is the commit message #3:
d:\Personal\rust_3d_viewer>git rebase -i HEAD~4 --preserve-merges
[detached HEAD 2e8c260] Removed debug text files
Date: Wed Oct 18 09:18:16 2017 +0200
3 files changed, 1 insertion(+), 13524 deletions(-)
delete mode 100644 out.txt
delete mode 100644 test.txt
Successfully rebased and updated refs/heads/master.
d:\Personal\rust_3d_viewer>git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
d:\Personal\rust_3d_viewer>git log --oneline
2e8c260 (HEAD -> master) Removed debug text files
e5a6b4b Rewriting it from scratch makes for cleaner code
c524f99 Ran rustfmt
ec00549 Stuff
1ee30c0 Initial release
// Old:
fn main() {
const SERVER: Token = Token(1);
let server = TcpListener::bind(&"0.0.0.0:13265".parse().unwrap()).unwrap();
let poll = Poll::new().unwrap();
poll.register(&server, SERVER, Ready::all(), PollOpt::edge()).unwrap();
let mut events = Events::with_capacity(1024);
let mut clients = HashMap::<Token, TcpStream>::new();
let mut token_id = 1;