Skip to content

Instantly share code, notes, and snippets.

View kimsama's full-sized avatar
🐢
I may be slow to respond.

Kim, Hyoun Woo kimsama

🐢
I may be slow to respond.
  • Bohemia Interactive Simulations
  • Seoul, Korea
View GitHub Profile
#
# Modified echo example of https://github.com/python-telegram-bot
#
# - print message in the terminal
# - send back echo message in the telegram channel
#
import logging
from telegram import ForceReply, Update
struct packet
{
char name[16];
unsigned short id;
char state_01; // 0: safety / 1: fire / 2: reload :==> safety / reload는 무시.
char state_02; // reserved.
unsigned short buttonState; // buttons
};
const int ButtonCount = 14;
struct packet
{
char name[16];
unsigned short id;
char state_01; // 0: safety / 1: fire / 2: reload :==> safety / reload는 무시.
char state_02; // reserved.
unsigned short buttonState; // buttons
float thumb_x; // joystick x-axis
float thumb_y; // joystick y-axis
};
@kimsama
kimsama / SimpleTimer.cpp
Last active May 18, 2020 05:15
A simpler timer class and its demo, using QueryPerformanceCounter. (therefore works only on windows platform)
#include "SimpleTimer.h"
/**
Initialize, call application start time before updating frame.
*/
void SimpleTimer::start()
{
// from MSDN: On systems that run Windows XP or later,
// the function will always succeed and will thus never return zero.
(void)QueryPerformanceFrequency(&freq);
@kimsama
kimsama / EnumFlagAttribute.cs
Created March 13, 2017 02:27 — forked from ChemiKhazi/EnumFlagAttribute.cs
Unity3d property drawer for automatically making enums flags into mask fields in the inspector.
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{
public static class CustomGUI {
public static bool CustomButton(Rect position, GUIContent label, GUIStyle style) {
bool wasClicked = false;
int controlID = GUIUtility.GetControlID(FocusType.Passive);
switch (Event.current.GetTypeForControl(controlID)) {
case EventType.MouseDown:
if (Event.current.button == 0 && position.Contains(Event.current.mousePosition)) {
GUIUtility.hotControl = controlID;
Event.current.Use();
@kimsama
kimsama / T4TemplatePostProcessor.cs
Last active March 8, 2017 08:33
T4Template post processor due to Unity does not support T4Template. (copied from http://pastebin.com/vmGQJeLk)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
namespace UnityEditor.T4Templating
{
public sealed class T4TemplatePostProcessor : AssetPostprocessor
{
[MenuItem("Assets/Force T4 Detection", priority=1000)]
@kimsama
kimsama / WebViewEditorWindow.cs
Created February 16, 2017 05:28
Open WebView window within Unity editor. It runs fine with Unity 5.5.x and no crash when closing Unity editor.
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
/// <summary>
/// Open a webview within Unity editor. (similar as AssetStore window)
/// </summary>
public class WebViewEditorWindow : EditorWindow
{
@kimsama
kimsama / .gitattributes
Created February 13, 2017 04:53 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@kimsama
kimsama / GreyScale.shader
Created September 27, 2016 06:34
Unity shader file for unlit transparent texture with greyscale effect.
//////////////////////////////////////////////////////////////////////////
// GreyScale.shader
//
// unlit transparent texture with greyscale effect.
//
// (c) 2014 hwkim
//////////////////////////////////////////////////////////////////////////
Shader "Extension/GrayScale"
{
Properties