Skip to content

Instantly share code, notes, and snippets.

//==================================================================
void Deserialize( RJSReader &r, BTT_Backtest::Params::WalletDef &v )
{
DESERIALIZE_MEMBER( r, v, currency );
DESERIALIZE_MEMBER( r, v, balance );
}
//==================================================================
void Deserialize( RJSReader &r, BTT_Backtest::Params &v )
{
//==================================================================
/// FM_LiftDrag.cpp
///
/// Created by Davide Pasca - 2017/6/12
/// See the file "license.txt" that comes with this project for
/// copyright info.
//==================================================================
#include "stdafx.h"
#include "FM_Utils.h"
//==================================================================
// curTimeUS: current time in micro-seconds
// idxB : index of the currency we're looking to buy (for BTC/USD: 0=BTC, 1=USD)
bool BTT_Agent::checkShouldBuyLineFit( TimeUS curTimeUS, const size_t idxB ) const
{
c_auto &tdis = mBTTask.GetCurTDIStream();
c_auto &entries = tdis.GetCurBatch().mTDEntries;
c_auto timeMaxS = TimeUSToSecs( curTimeUS );
c_auto timeMinS = timeMaxS - 60.0 * 60.0 * 12; // from previous N seconds
//==================================================================
/// DNET_Base.cpp
///
/// Created by Davide Pasca - 2009/8/2
/// See the file "license.txt" that comes with this project for
/// copyright info.
//==================================================================
#if defined(WIN32)
# include <WinSock2.h>
@dpasca
dpasca / SampleClamp2D.cpp
Created September 26, 2016 16:25
bilinear texture sample with clamping
//==================================================================
template <typename _T>
inline _T SampleClamp2D(
const DVec<_T> &samp,
int sampW,
int sampH,
float u,
float v )
{
u = std::max( u, _T(0) ); // only clamp to min.. max comes below
@dpasca
dpasca / CMakeLists.txt
Last active December 20, 2015 00:58
My entry for the IndieVault Code Contest 01 ( http://www.indievault.it/forum/showthread.php?tid=9536 )
cmake_minimum_required (VERSION 2.6)
project (ivcc01_thecrib)
if(MSVC) #((((((((((((((((
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /DWIN32 /MD /Ox /Ot /Oi /GL /Ob2 /Oy /arch:SSE2")
set(CMAKE_CXX_FLAGS_RELEASE "/DNDEBUG /DWIN32 /MD /Ox /Ot /Oi /GL /Ob2 /Oy /arch:SSE2")
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /DWIN32 /Zi /MDd /Od /arch:SSE2")
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /DWIN32 /Zi /MDd /Od /arch:SSE2")
add_definitions( "/D_CRT_SECURE_NO_WARNINGS /wd4996 /nologo" ) # disable annoying secure CRT warnings
namespace DGLUT
{
//==================================================================
void CheckGLErr( const char *pFileName, int line )
{
GLenum err = glGetError();
while (err != GL_NO_ERROR)
{
const char *pErr = NULL;
//==================================================================
class RandPool
{
DVec<U32> mVals;
size_t mIterIdx;
public:
RandPool( size_t size, U32 seed=0 )
: mIterIdx(0)
{
@dpasca
dpasca / gist:4332700
Created December 18, 2012 22:32
Vector with objects ownership
//==================================================================
template <class _T>
class VecOwn
{
DVec<_T> mVec;
public:
~VecOwn()
{
clear_free();
@dpasca
dpasca / gist:4242855
Created December 9, 2012 01:02
Some UI logic
// are we waiting for the introduction to go away ?
if ( mStater[STATE_IN_COMM_INTRODUCTION].IsActive() )
{
if NOT( moCharDlgWin->IsActive() ) // is finally the dialog gone ?
{
mStater[STATE_IN_COMM_INTRODUCTION].Deactivate(); // the wait has ended
updateHomeButtonsState(); // set the fighters button on hover
}
}
else