Skip to content

Instantly share code, notes, and snippets.

@nibasya
nibasya / DE10Controller.cs
Last active Aug 13, 2019
An example using the grouped data
View DE10Controller.cs
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 Aug 13, 2019
A class representing an group of data
View DE10Controller.cs
[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
}
View InfoProgressCtrl.cpp
// InfoProgressCtrl.cpp : インプリメンテーション ファイル
//
/*
03/08/03 CRgn を用いてクリッピングするようにした
3D表示に対応した
18/08/29 クラス名をCInfoProgressBarからCInfoProgressCtrlに変更。
CProgressCtrlのバー表示機能を残したまま、上にテキストを表示するよう変更。
独自のバー表示機能は削除。SetColorをSetTxtColorに変更。
@nibasya
nibasya / InfoProgressCtrl.cpp
Created Sep 1, 2018
Add text on progress control
View InfoProgressCtrl.cpp
/****************************************************************************
Name: InfoProgresssCtrl.h
Desc: CProgressCtrlに文字情報表示機能を追加.
Author: donadona
reidphoaさんのInfoProgressBar.hより改変
*********************************************************************/
View SettingSave.cpp
void CSettingSave::OnCancel()
{
// Empty function to avoid closure by ESC key
}
@nibasya
nibasya / KCSSDlg.cpp
Created Aug 29, 2018
Disabling Progress Bar Animation and let SetState Affect Immediately
View KCSSDlg.cpp
// 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 Aug 29, 2018
Updating CProgressCtrl State
View KCSSDlg.cpp
// 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) {
View KCSSDlg.cpp
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);
}
}
@nibasya
nibasya / Example.cpp
Last active Feb 22, 2020
Get CString object from GetLastError information
View Example.cpp
#include "stdafx.h"
#include "CGetLastError.h"
void main()
{
// snip
SetLastError(111); // create a error 111 (ERROR_BUFFER_OVERFLOW) for demo
// Message Box with a text associated to 111(ERROR_BUFFER_OVERFLOW) appears.
// In English: "The file name is too long."
@nibasya
nibasya / ConvertString
Created Jun 23, 2018
Example of converting from Unicode to ANSI
View ConvertString
extern void MyOpen(LPCSTR name);
void MyFunc(CStringW name){
MyOpen(CW2A(name));
}
You can’t perform that action at this time.