Skip to content

Instantly share code, notes, and snippets.

@nibasya
nibasya / MessageSpeeedTestDlg.cpp
Created February 8, 2020 02:45
SendMessage / PostMessage speed test
UINT __cdecl TestThread(LPVOID pData)
{
CMessageSpeedTestDlg* p = static_cast<CMessageSpeedTestDlg*>(pData);
QueryPerformanceCounter(&p->m_Begin);
p->SendMessage(WM_USER_COMPLETE);
return 0;
}
void CMessageSpeedTestDlg::OnBnClickedButtonStart()
@nibasya
nibasya / DE10Controller.cs
Last active August 13, 2019 03:29
An example using local class which groups some data
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DE10Controller : MonoBehaviour
{
[System.Serializable]
public class Wheel
{
public List<Rigidbody> wheels;
@nibasya
nibasya / DE10Controller.cs
Last active August 13, 2019 03:30
An example using the grouped data
public float targetVelocity; // target speed of rotation
public float torque; // a torque to be applied to each wheel
public Wheel wheel; // a group of setting related to wheels
// Start is called before the first frame update
void Start()
{
foreach(Rigidbody rb in wheel.wheels)
{
rb.mass = wheel.wheelMass;
@nibasya
nibasya / DE10Controller.cs
Last active August 13, 2019 03:30
A class representing an group of data
[System.Serializable]
public class Wheel
{
public List<Rigidbody> wheels;
public float wheelMass = 600; // mass of each wheel pair without flange mass; i.e. twice the mass of 1 wheel without flange mass
}
// InfoProgressCtrl.cpp : インプリメンテーション ファイル
//
/*
03/08/03 CRgn を用いてクリッピングするようにした
3D表示に対応した
18/08/29 クラス名をCInfoProgressBarからCInfoProgressCtrlに変更。
CProgressCtrlのバー表示機能を残したまま、上にテキストを表示するよう変更。
独自のバー表示機能は削除。SetColorをSetTxtColorに変更。
@nibasya
nibasya / InfoProgressCtrl.cpp
Created September 1, 2018 06:31
Add text on progress control
/****************************************************************************
Name: InfoProgresssCtrl.h
Desc: CProgressCtrlに文字情報表示機能を追加.
Author: donadona
reidphoaさんのInfoProgressBar.hより改変
*********************************************************************/
void CSettingSave::OnCancel()
{
// Empty function to avoid closure by ESC key
}
@nibasya
nibasya / KCSSDlg.cpp
Created August 29, 2018 16:10
Disabling Progress Bar Animation and let SetState Affect Immediately
// Updates progress bar and text
void CKCSSDlg::UpdateInfo()
{
double mem = m_MemUse;
mem = mem / m_MemMax;
if (mem > 0.9){
m_CtrlProgressMemory.SetState(PBST_ERROR);
}
else if (mem >= 0.8) {
@nibasya
nibasya / KCSSDlg.cpp
Last active August 29, 2018 15:04
Updating CProgressCtrl State
// Updates progress bar
void CKCSSDlg::UpdateInfo()
{
double mem = m_MemUse;
mem = mem / m_MemMax;
if (mem > 0.8){
m_CtrlProgressMemory.SetState(PBST_PAUSED);
}
else if (mem > 0.95) {
LRESULT CKCSSDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_SETCURSOR) {
if (HIWORD(lParam) == WM_RBUTTONUP) {
CPoint p;
GetCursorPos(&p);
ScreenToClient(&p);
ShowPopupMenu(p);
}
}