blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eb31814aafd50ce4907fc9c17589813b742eef3e
|
037faae47a5b22d3e283555e6b5ac2a0197faf18
|
/pcsx2v2/VU0.cpp
|
0a12a5d903b57ed70db045e049bd7d354e90610e
|
[] |
no_license
|
isabella232/pcsx2-sourceforge
|
6e5aac8d0b476601bfc8fa83ded66c1564b8c588
|
dbb2c3a010081b105a8cba0c588f1e8f4e4505c6
|
refs/heads/master
| 2023-03-18T22:23:15.102593 | 2008-11-17T20:10:17 | 2008-11-17T20:10:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 15,799 |
cpp
|
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* TODO
-Fix the flags Proper as they aren't handle now..
-Add BC Table opcodes
-Add Interlock in QMFC2,QMTC2,CFC2,CTC2
-Finish instruction set
-Bug Fixes!!!
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "Common.h"
#include "DebugTools/Debug.h"
#include "R5900.h"
#include "InterTables.h"
#include "VUops.h"
#include "VUmicro.h"
#define _Ft_ _Rt_
#define _Fs_ _Rd_
#define _Fd_ _Sa_
#define _X (cpuRegs.code>>24) & 0x1
#define _Y (cpuRegs.code>>23) & 0x1
#define _Z (cpuRegs.code>>22) & 0x1
#define _W (cpuRegs.code>>21) & 0x1
#define _Fsf_ ((cpuRegs.code >> 21) & 0x03)
#define _Ftf_ ((cpuRegs.code >> 23) & 0x03)
#include "VUflags.h"
PCSX2_ALIGNED16(VURegs VU0);
void COP2() {
Int_COP2PrintTable[_Rs_]();
}
void COP2_BC2() { Int_COP2BC2PrintTable[_Rt_]();}
void COP2_SPECIAL() { Int_COP2SPECIAL1PrintTable[_Funct_]();}
void COP2_SPECIAL2() {
Int_COP2SPECIAL2PrintTable[(cpuRegs.code & 0x3) | ((cpuRegs.code >> 4) & 0x7c)]();
}
void COP2_Unknown()
{
#ifdef CPU_LOG
CPU_LOG("Unknown COP2 opcode called\n");
#endif
}
void LQC2() {
u32 addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)cpuRegs.code;
if (_Ft_) {
memRead128(addr, &VU0.VF[_Ft_].UD[0]);
} else {
u64 val[2];
memRead128(addr, val);
}
}
// Asadr.Changed
void SQC2() {
u32 addr = _Imm_ + cpuRegs.GPR.r[_Rs_].UL[0];
memWrite64(addr, VU0.VF[_Ft_].UD[0]);
memWrite64(addr+8,VU0.VF[_Ft_].UD[1]);
}
//****************************************************************************
void _vu0WaitMicro() {
int startcycle;
if ((VU0.VI[REG_VPU_STAT].UL & 0x1) == 0) {
return;
}
FreezeXMMRegs(1);
startcycle = VU0.cycle;
VU0.flags|= VUFLAG_BREAKONMFLAG;
VU0.flags&= ~VUFLAG_MFLAGSET;
do {
Cpu->ExecuteVU0Block();
// knockout kings 2002 loops here
if( VU0.cycle-startcycle > 0x1000 ) {
SysPrintf("VU0 wait stall (email zero if gfx are bad)\n");
break;
}
} while ((VU0.VI[REG_VPU_STAT].UL & 0x1) && (VU0.flags & VUFLAG_MFLAGSET) == 0);
FreezeXMMRegs(0);
//NEW
cpuRegs.cycle += (VU0.cycle-startcycle)*2;
VU0.flags&= ~VUFLAG_BREAKONMFLAG;
}
void QMFC2() {
if (cpuRegs.code & 1) {
_vu0WaitMicro();
}
if (_Rt_ == 0) return;
cpuRegs.GPR.r[_Rt_].UD[0] = VU0.VF[_Fs_].UD[0];
cpuRegs.GPR.r[_Rt_].UD[1] = VU0.VF[_Fs_].UD[1];
}
void QMTC2() {
if (cpuRegs.code & 1) {
_vu0WaitMicro();
}
if (_Fs_ == 0) return;
VU0.VF[_Fs_].UD[0] = cpuRegs.GPR.r[_Rt_].UD[0];
VU0.VF[_Fs_].UD[1] = cpuRegs.GPR.r[_Rt_].UD[1];
}
void CFC2() {
if (cpuRegs.code & 1) {
_vu0WaitMicro();
}
if (_Rt_ == 0) return;
cpuRegs.GPR.r[_Rt_].UL[0] = VU0.VI[_Fs_].UL;
if(VU0.VI[_Fs_].UL & 0x80000000)
cpuRegs.GPR.r[_Rt_].UL[1] = 0xffffffff;
else
cpuRegs.GPR.r[_Rt_].UL[1] = 0;
}
void CTC2() {
if (cpuRegs.code & 1) {
_vu0WaitMicro();
}
if (_Fs_ == 0) return;
switch(_Fs_) {
case REG_MAC_FLAG: // read-only
case REG_TPC: // read-only
case REG_VPU_STAT: // read-only
break;
case REG_FBRST:
VU0.VI[REG_FBRST].UL = cpuRegs.GPR.r[_Rt_].UL[0] & 0x0C0C;
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x1) { // VU0 Force Break
SysPrintf("fixme: VU0 Force Break\n");
}
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x2) { // VU0 Reset
//SysPrintf("fixme: VU0 Reset\n");
vu0ResetRegs();
}
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x100) { // VU1 Force Break
SysPrintf("fixme: VU1 Force Break\n");
}
if (cpuRegs.GPR.r[_Rt_].UL[0] & 0x200) { // VU1 Reset
// SysPrintf("fixme: VU1 Reset\n");
vu1ResetRegs();
}
break;
case REG_CMSAR1: // REG_CMSAR1
if (!(VU0.VI[REG_VPU_STAT].UL & 0x100) ) {
VU1.VI[REG_TPC].UL = cpuRegs.GPR.r[_Rt_].US[0];
//FreezeXMMRegs(1);
vu1ExecMicro(VU1.VI[REG_TPC].UL); // Execute VU1 Micro SubRoutine
//FreezeXMMRegs(0);
}
break;
default:
VU0.VI[_Fs_].UL = cpuRegs.GPR.r[_Rt_].UL[0];
break;
}
}
//---------------------------------------------------------------------------------------
#define SYNCMSFLAGS() VU0.VI[REG_STATUS_FLAG].UL = VU0.statusflag; VU0.VI[REG_MAC_FLAG].UL = VU0.macflag;
#define SYNCFDIV() VU0.VI[REG_Q].UL = VU0.q.UL; VU0.VI[REG_STATUS_FLAG].UL = VU0.statusflag;
void VABS() { VU0.code = cpuRegs.code; _vuABS(&VU0); }
void VADD() { VU0.code = cpuRegs.code; _vuADD(&VU0); SYNCMSFLAGS(); }
void VADDi() { VU0.code = cpuRegs.code; _vuADDi(&VU0); SYNCMSFLAGS(); }
void VADDq() { VU0.code = cpuRegs.code; _vuADDq(&VU0); SYNCMSFLAGS(); }
void VADDx() { VU0.code = cpuRegs.code; _vuADDx(&VU0); SYNCMSFLAGS(); }
void VADDy() { VU0.code = cpuRegs.code; _vuADDy(&VU0); SYNCMSFLAGS(); }
void VADDz() { VU0.code = cpuRegs.code; _vuADDz(&VU0); SYNCMSFLAGS(); }
void VADDw() { VU0.code = cpuRegs.code; _vuADDw(&VU0); SYNCMSFLAGS(); }
void VADDA() { VU0.code = cpuRegs.code; _vuADDA(&VU0); SYNCMSFLAGS(); }
void VADDAi() { VU0.code = cpuRegs.code; _vuADDAi(&VU0); SYNCMSFLAGS(); }
void VADDAq() { VU0.code = cpuRegs.code; _vuADDAq(&VU0); SYNCMSFLAGS(); }
void VADDAx() { VU0.code = cpuRegs.code; _vuADDAx(&VU0); SYNCMSFLAGS(); }
void VADDAy() { VU0.code = cpuRegs.code; _vuADDAy(&VU0); SYNCMSFLAGS(); }
void VADDAz() { VU0.code = cpuRegs.code; _vuADDAz(&VU0); SYNCMSFLAGS(); }
void VADDAw() { VU0.code = cpuRegs.code; _vuADDAw(&VU0); SYNCMSFLAGS(); }
void VSUB() { VU0.code = cpuRegs.code; _vuSUB(&VU0); SYNCMSFLAGS(); }
void VSUBi() { VU0.code = cpuRegs.code; _vuSUBi(&VU0); SYNCMSFLAGS(); }
void VSUBq() { VU0.code = cpuRegs.code; _vuSUBq(&VU0); SYNCMSFLAGS(); }
void VSUBx() { VU0.code = cpuRegs.code; _vuSUBx(&VU0); SYNCMSFLAGS(); }
void VSUBy() { VU0.code = cpuRegs.code; _vuSUBy(&VU0); SYNCMSFLAGS(); }
void VSUBz() { VU0.code = cpuRegs.code; _vuSUBz(&VU0); SYNCMSFLAGS(); }
void VSUBw() { VU0.code = cpuRegs.code; _vuSUBw(&VU0); SYNCMSFLAGS(); }
void VSUBA() { VU0.code = cpuRegs.code; _vuSUBA(&VU0); SYNCMSFLAGS(); }
void VSUBAi() { VU0.code = cpuRegs.code; _vuSUBAi(&VU0); SYNCMSFLAGS(); }
void VSUBAq() { VU0.code = cpuRegs.code; _vuSUBAq(&VU0); SYNCMSFLAGS(); }
void VSUBAx() { VU0.code = cpuRegs.code; _vuSUBAx(&VU0); SYNCMSFLAGS(); }
void VSUBAy() { VU0.code = cpuRegs.code; _vuSUBAy(&VU0); SYNCMSFLAGS(); }
void VSUBAz() { VU0.code = cpuRegs.code; _vuSUBAz(&VU0); SYNCMSFLAGS(); }
void VSUBAw() { VU0.code = cpuRegs.code; _vuSUBAw(&VU0); SYNCMSFLAGS(); }
void VMUL() { VU0.code = cpuRegs.code; _vuMUL(&VU0); SYNCMSFLAGS(); }
void VMULi() { VU0.code = cpuRegs.code; _vuMULi(&VU0); SYNCMSFLAGS(); }
void VMULq() { VU0.code = cpuRegs.code; _vuMULq(&VU0); SYNCMSFLAGS(); }
void VMULx() { VU0.code = cpuRegs.code; _vuMULx(&VU0); SYNCMSFLAGS(); }
void VMULy() { VU0.code = cpuRegs.code; _vuMULy(&VU0); SYNCMSFLAGS(); }
void VMULz() { VU0.code = cpuRegs.code; _vuMULz(&VU0); SYNCMSFLAGS(); }
void VMULw() { VU0.code = cpuRegs.code; _vuMULw(&VU0); SYNCMSFLAGS(); }
void VMULA() { VU0.code = cpuRegs.code; _vuMULA(&VU0); SYNCMSFLAGS(); }
void VMULAi() { VU0.code = cpuRegs.code; _vuMULAi(&VU0); SYNCMSFLAGS(); }
void VMULAq() { VU0.code = cpuRegs.code; _vuMULAq(&VU0); SYNCMSFLAGS(); }
void VMULAx() { VU0.code = cpuRegs.code; _vuMULAx(&VU0); SYNCMSFLAGS(); }
void VMULAy() { VU0.code = cpuRegs.code; _vuMULAy(&VU0); SYNCMSFLAGS(); }
void VMULAz() { VU0.code = cpuRegs.code; _vuMULAz(&VU0); SYNCMSFLAGS(); }
void VMULAw() { VU0.code = cpuRegs.code; _vuMULAw(&VU0); SYNCMSFLAGS(); }
void VMADD() { VU0.code = cpuRegs.code; _vuMADD(&VU0); SYNCMSFLAGS(); }
void VMADDi() { VU0.code = cpuRegs.code; _vuMADDi(&VU0); SYNCMSFLAGS(); }
void VMADDq() { VU0.code = cpuRegs.code; _vuMADDq(&VU0); SYNCMSFLAGS(); }
void VMADDx() { VU0.code = cpuRegs.code; _vuMADDx(&VU0); SYNCMSFLAGS(); }
void VMADDy() { VU0.code = cpuRegs.code; _vuMADDy(&VU0); SYNCMSFLAGS(); }
void VMADDz() { VU0.code = cpuRegs.code; _vuMADDz(&VU0); SYNCMSFLAGS(); }
void VMADDw() { VU0.code = cpuRegs.code; _vuMADDw(&VU0); SYNCMSFLAGS(); }
void VMADDA() { VU0.code = cpuRegs.code; _vuMADDA(&VU0); SYNCMSFLAGS(); }
void VMADDAi() { VU0.code = cpuRegs.code; _vuMADDAi(&VU0); SYNCMSFLAGS(); }
void VMADDAq() { VU0.code = cpuRegs.code; _vuMADDAq(&VU0); SYNCMSFLAGS(); }
void VMADDAx() { VU0.code = cpuRegs.code; _vuMADDAx(&VU0); SYNCMSFLAGS(); }
void VMADDAy() { VU0.code = cpuRegs.code; _vuMADDAy(&VU0); SYNCMSFLAGS(); }
void VMADDAz() { VU0.code = cpuRegs.code; _vuMADDAz(&VU0); SYNCMSFLAGS(); }
void VMADDAw() { VU0.code = cpuRegs.code; _vuMADDAw(&VU0); SYNCMSFLAGS(); }
void VMSUB() { VU0.code = cpuRegs.code; _vuMSUB(&VU0); SYNCMSFLAGS(); }
void VMSUBi() { VU0.code = cpuRegs.code; _vuMSUBi(&VU0); SYNCMSFLAGS(); }
void VMSUBq() { VU0.code = cpuRegs.code; _vuMSUBq(&VU0); SYNCMSFLAGS(); }
void VMSUBx() { VU0.code = cpuRegs.code; _vuMSUBx(&VU0); SYNCMSFLAGS(); }
void VMSUBy() { VU0.code = cpuRegs.code; _vuMSUBy(&VU0); SYNCMSFLAGS(); }
void VMSUBz() { VU0.code = cpuRegs.code; _vuMSUBz(&VU0); SYNCMSFLAGS(); }
void VMSUBw() { VU0.code = cpuRegs.code; _vuMSUBw(&VU0); SYNCMSFLAGS(); }
void VMSUBA() { VU0.code = cpuRegs.code; _vuMSUBA(&VU0); SYNCMSFLAGS(); }
void VMSUBAi() { VU0.code = cpuRegs.code; _vuMSUBAi(&VU0); SYNCMSFLAGS(); }
void VMSUBAq() { VU0.code = cpuRegs.code; _vuMSUBAq(&VU0); SYNCMSFLAGS(); }
void VMSUBAx() { VU0.code = cpuRegs.code; _vuMSUBAx(&VU0); SYNCMSFLAGS(); }
void VMSUBAy() { VU0.code = cpuRegs.code; _vuMSUBAy(&VU0); SYNCMSFLAGS(); }
void VMSUBAz() { VU0.code = cpuRegs.code; _vuMSUBAz(&VU0); SYNCMSFLAGS(); }
void VMSUBAw() { VU0.code = cpuRegs.code; _vuMSUBAw(&VU0); SYNCMSFLAGS(); }
void VMAX() { VU0.code = cpuRegs.code; _vuMAX(&VU0); }
void VMAXi() { VU0.code = cpuRegs.code; _vuMAXi(&VU0); }
void VMAXx() { VU0.code = cpuRegs.code; _vuMAXx(&VU0); }
void VMAXy() { VU0.code = cpuRegs.code; _vuMAXy(&VU0); }
void VMAXz() { VU0.code = cpuRegs.code; _vuMAXz(&VU0); }
void VMAXw() { VU0.code = cpuRegs.code; _vuMAXw(&VU0); }
void VMINI() { VU0.code = cpuRegs.code; _vuMINI(&VU0); }
void VMINIi() { VU0.code = cpuRegs.code; _vuMINIi(&VU0); }
void VMINIx() { VU0.code = cpuRegs.code; _vuMINIx(&VU0); }
void VMINIy() { VU0.code = cpuRegs.code; _vuMINIy(&VU0); }
void VMINIz() { VU0.code = cpuRegs.code; _vuMINIz(&VU0); }
void VMINIw() { VU0.code = cpuRegs.code; _vuMINIw(&VU0); }
void VOPMULA() { VU0.code = cpuRegs.code; _vuOPMULA(&VU0); SYNCMSFLAGS(); }
void VOPMSUB() { VU0.code = cpuRegs.code; _vuOPMSUB(&VU0); SYNCMSFLAGS(); }
void VNOP() { VU0.code = cpuRegs.code; _vuNOP(&VU0); }
void VFTOI0() { VU0.code = cpuRegs.code; _vuFTOI0(&VU0); }
void VFTOI4() { VU0.code = cpuRegs.code; _vuFTOI4(&VU0); }
void VFTOI12() { VU0.code = cpuRegs.code; _vuFTOI12(&VU0); }
void VFTOI15() { VU0.code = cpuRegs.code; _vuFTOI15(&VU0); }
void VITOF0() { VU0.code = cpuRegs.code; _vuITOF0(&VU0); }
void VITOF4() { VU0.code = cpuRegs.code; _vuITOF4(&VU0); }
void VITOF12() { VU0.code = cpuRegs.code; _vuITOF12(&VU0); }
void VITOF15() { VU0.code = cpuRegs.code; _vuITOF15(&VU0); }
void VCLIPw() { VU0.code = cpuRegs.code; _vuCLIP(&VU0); VU0.VI[REG_CLIP_FLAG].UL = VU0.clipflag; }
void VDIV() { VU0.code = cpuRegs.code; _vuDIV(&VU0); SYNCFDIV(); }
void VSQRT() { VU0.code = cpuRegs.code; _vuSQRT(&VU0); SYNCFDIV(); }
void VRSQRT() { VU0.code = cpuRegs.code; _vuRSQRT(&VU0); SYNCFDIV(); }
void VIADD() { VU0.code = cpuRegs.code; _vuIADD(&VU0); }
void VIADDI() { VU0.code = cpuRegs.code; _vuIADDI(&VU0); }
void VIADDIU() { VU0.code = cpuRegs.code; _vuIADDIU(&VU0); }
void VIAND() { VU0.code = cpuRegs.code; _vuIAND(&VU0); }
void VIOR() { VU0.code = cpuRegs.code; _vuIOR(&VU0); }
void VISUB() { VU0.code = cpuRegs.code; _vuISUB(&VU0); }
void VISUBIU() { VU0.code = cpuRegs.code; _vuISUBIU(&VU0); }
void VMOVE() { VU0.code = cpuRegs.code; _vuMOVE(&VU0); }
void VMFIR() { VU0.code = cpuRegs.code; _vuMFIR(&VU0); }
void VMTIR() { VU0.code = cpuRegs.code; _vuMTIR(&VU0); }
void VMR32() { VU0.code = cpuRegs.code; _vuMR32(&VU0); }
void VLQ() { VU0.code = cpuRegs.code; _vuLQ(&VU0); }
void VLQD() { VU0.code = cpuRegs.code; _vuLQD(&VU0); }
void VLQI() { VU0.code = cpuRegs.code; _vuLQI(&VU0); }
void VSQ() { VU0.code = cpuRegs.code; _vuSQ(&VU0); }
void VSQD() { VU0.code = cpuRegs.code; _vuSQD(&VU0); }
void VSQI() { VU0.code = cpuRegs.code; _vuSQI(&VU0); }
void VILW() { VU0.code = cpuRegs.code; _vuILW(&VU0); }
void VISW() { VU0.code = cpuRegs.code; _vuISW(&VU0); }
void VILWR() { VU0.code = cpuRegs.code; _vuILWR(&VU0); }
void VISWR() { VU0.code = cpuRegs.code; _vuISWR(&VU0); }
void VRINIT() { VU0.code = cpuRegs.code; _vuRINIT(&VU0); }
void VRGET() { VU0.code = cpuRegs.code; _vuRGET(&VU0); }
void VRNEXT() { VU0.code = cpuRegs.code; _vuRNEXT(&VU0); }
void VRXOR() { VU0.code = cpuRegs.code; _vuRXOR(&VU0); }
void VWAITQ() { VU0.code = cpuRegs.code; _vuWAITQ(&VU0); }
void VFSAND() { VU0.code = cpuRegs.code; _vuFSAND(&VU0); }
void VFSEQ() { VU0.code = cpuRegs.code; _vuFSEQ(&VU0); }
void VFSOR() { VU0.code = cpuRegs.code; _vuFSOR(&VU0); }
void VFSSET() { VU0.code = cpuRegs.code; _vuFSSET(&VU0); }
void VFMAND() { VU0.code = cpuRegs.code; _vuFMAND(&VU0); }
void VFMEQ() { VU0.code = cpuRegs.code; _vuFMEQ(&VU0); }
void VFMOR() { VU0.code = cpuRegs.code; _vuFMOR(&VU0); }
void VFCAND() { VU0.code = cpuRegs.code; _vuFCAND(&VU0); }
void VFCEQ() { VU0.code = cpuRegs.code; _vuFCEQ(&VU0); }
void VFCOR() { VU0.code = cpuRegs.code; _vuFCOR(&VU0); }
void VFCSET() { VU0.code = cpuRegs.code; _vuFCSET(&VU0); }
void VFCGET() { VU0.code = cpuRegs.code; _vuFCGET(&VU0); }
void VXITOP() { VU0.code = cpuRegs.code; _vuXITOP(&VU0); }
#define CP2COND (/*(VU0.VI[REG_VPU_STAT].US[0] & 1) | */((VU0.VI[REG_VPU_STAT].US[0] >> 8) & 1))
#define BC2(cond) \
if (CP2COND cond) { \
intDoBranch(_BranchTarget_); \
}
void BC2F() { BC2(== 0);}
void BC2T() { BC2(== 1);}
#define BC2L(cond) \
if (CP2COND cond) { \
intDoBranch(_BranchTarget_); \
} else cpuRegs.pc+= 4;
void BC2FL() { BC2L(== 0);}
void BC2TL() { BC2L(== 1);}
void vu0Finish()
{
if( (VU0.VI[REG_VPU_STAT].UL & 0x1) ) {
int i = 0;
FreezeXMMRegs(1);
while(i++ < 32) {
Cpu->ExecuteVU0Block();
if(!(VU0.VI[REG_VPU_STAT].UL & 0x1))
break;
}
FreezeXMMRegs(0);
if(VU0.VI[REG_VPU_STAT].UL & 0x1) {
VU0.VI[REG_VPU_STAT].UL &= ~1;
#ifdef PCSX2_DEVBUILD
SysPrintf("VU0 stall\n");
#endif
}
}
}
void VCALLMS() {
//FreezeXMMRegs(1);
vu0Finish();
vu0ExecMicro(((cpuRegs.code >> 6) & 0x7FFF) * 8);
//FreezeXMMRegs(0);
}
void VCALLMSR() {
//FreezeXMMRegs(1);
vu0Finish();
vu0ExecMicro(VU0.VI[REG_CMSAR0].US[0] * 8);
//FreezeXMMRegs(0);
}
#ifndef _MSC_VER
u32* GET_VU_MEM(VURegs* VU, u32 addr)
{
if( VU == g_pVU1 ) return (u32*)(VU1.Mem+(addr&0x3fff));
if( addr >= 0x4200 ) return &VU1.VI[(addr>>2)&0x1f].UL;
return (u32*)(VU0.Mem+(addr&0x0fff));
}
#endif
|
[
"saqibakhtar@23c756db-88ba-2448-99d7-e6e4c676ec84"
] |
[
[
[
1,
400
]
]
] |
9f3a4e7cfb05a7193161164af53c09b61db0923b
|
62874cd4e97b2cfa74f4e507b798f6d5c7022d81
|
/src/Midi-Me/ProcessorItem.h
|
6d5bc001971270c689aec658721947a94b442428
|
[] |
no_license
|
rjaramih/midi-me
|
6a4047e5f390a5ec851cbdc1b7495b7fe80a4158
|
6dd6a1a0111645199871f9951f841e74de0fe438
|
refs/heads/master
| 2021-03-12T21:31:17.689628 | 2011-07-31T22:42:05 | 2011-07-31T22:42:05 | 36,944,802 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,860 |
h
|
#ifndef MIDIME_PROCESSORITEM_H
#define MIDIME_PROCESSORITEM_H
// Includes
#include "global.h"
#include <QtGui/QGraphicsRectItem>
#include <map>
// Forward declarations
class QGraphicsScene;
namespace MidiMe
{
// Forward declarations
class ChainWidget;
class PropertiesEditor;
class Processor;
class Input; class InputItem;
class Output; class OutputItem;
typedef std::map<Input *, InputItem *> InputItemMap;
typedef std::map<Output *, OutputItem *> OutputItemMap;
/** This widget displays the state of an input device. */
class ProcessorItem: public QGraphicsRectItem
{
//Q_OBJECT
public:
// Constructors and destructor
ProcessorItem(ChainWidget *pChainWidget, Processor *pProcessor, QGraphicsItem *pParent = 0);
virtual ~ProcessorItem();
// Input items
const InputItemMap &getAllInputs() const { return m_inputItems; }
// Output items
const OutputItemMap &getAllOutputs() const { return m_outputItems; }
// Properties
PropertiesEditor *getPropertyEditor() const { return m_pPropertyEditor; }
void setPropertyEditor(PropertiesEditor *pEditor) { m_pPropertyEditor = pEditor; }
// Other functions
void adjustPosition();
protected:
// Events
void mousePressEvent(QGraphicsSceneMouseEvent *pEvent);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
// Other functions
void createInputs();
void destroyInputs();
void createOutputs();
void destroyOutputs();
void createInfo();
void destroyInfo();
void adjustPosition(QPointF &position);
QGraphicsScene *getScene() const;
// Member variables
ChainWidget *m_pChainWidget;
PropertiesEditor *m_pPropertyEditor;
Processor *m_pProcessor;
InputItemMap m_inputItems;
OutputItemMap m_outputItems;
};
}
#endif // MIDIME_PROCESSORITEM_H
|
[
"Jeroen.Dierckx@d8a2fbcc-2753-0410-82a0-8bc2cd85795f"
] |
[
[
[
1,
75
]
]
] |
9c104f72a7e9a68bc31663306c3a0006bc236aca
|
9e00e3827904177e7ae74a95c2b4694b39a35aca
|
/include/traits/static_check.h
|
6a3c0f5537a92a3f024a5ae8284c22c9118c0cab
|
[] |
no_license
|
windreamer/cppgc
|
398dbfdd5c5c73138799932f67347fe35440d1e5
|
9df085aaca78d28538853cc1a50326177c4c5ef0
|
refs/heads/master
| 2016-09-06T09:01:56.106376 | 2010-12-14T04:44:19 | 2010-12-14T04:44:19 | 1,290,072 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 237 |
h
|
#ifndef __STATIC_CHECK__
#define __STATIC_CHECK__
namespace windreamer
{
namespace traits
{
template <bool>
struct CompileTimeChecker;
template <>
struct CompileTimeChecker<true>{};
}
}
#endif//__STATIC_CHECK__
|
[
"[email protected]"
] |
[
[
[
1,
13
]
]
] |
dbc7e80a3d6fb10deaecc74b98366ffd0b521df8
|
208475bcab65438eed5d8380f26eacd25eb58f70
|
/ComuServ/ComuServ.cpp
|
204920f006f9c146c4a28907093a82f9a0da5af7
|
[] |
no_license
|
awzhang/MyWork
|
83b3f0b9df5ff37330c0e976310d75593f806ec4
|
075ad5d0726c793a0c08f9158080a144e0bb5ea5
|
refs/heads/master
| 2021-01-18T07:57:03.219372 | 2011-07-05T02:41:55 | 2011-07-05T02:46:30 | 15,523,223 | 1 | 2 | null | null | null | null |
GB18030
|
C++
| false | false | 13,570 |
cpp
|
#include "../GlobalShare/ComuServExport.h"
#include "ComuServDef.h"
#include "CfgMng.h"
#include "IO.h"
#include "Gps.h"
#include "MsgQueMng.h"
#include "TimeMng.h"
#include "Dog.h"
//CComuServ g_objComuServ;
// CMsgQueue g_objMsgQueDiaodu( int(KEY_SEM_DIAODU), int(KEY_MSG_DIAODU), int(KEY_SHM_DIAODU_1), QUEUESIZE_QIAN );
// CMsgQueue g_objMsgQueLed( int(KEY_SEM_LED), int(KEY_MSG_LED), int(KEY_SHM_LED_1), QUEUESIZE_LED );
// CMsgQueue g_objMsgQuePhone( int(KEY_SEM_PHONE), int(KEY_MSG_PHONE), int(KEY_SHM_PHONE_1), QUEUESIZE_PHONE );
// CMsgQueue g_objMsgQueQian( int(KEY_SEM_QIAN), int(KEY_MSG_QIAN), int(KEY_SHM_QIAN_1), QUEUESIZE_QIAN );
// CMsgQueue g_objMsgQueLiu( int(KEY_SEM_LIU), int(KEY_MSG_LIU), int(KEY_SHM_LIU_1), QUEUESIZE_LIU );
// CMsgQueue g_objMsgQueDvr( int(KEY_SEM_DVR), int(KEY_MSG_DVR), int(KEY_SHM_DVR_1), QUEUESIZE_DVR );
// CMsgQueue g_objMsgQueSockQian( int(KEY_SEM_SOCK_QIAN), int(KEY_MSG_SOCK_QIAN), int(KEY_SHM_SOCKQIAN_1), QUEUESIZE_SOCK_QIAN );
// CMsgQueue g_objMsgQueSockLiu( int(KEY_SEM_SOCK_LIU), int(KEY_MSG_SOCK_LIU), int(KEY_SHM_SOCKLIU_1), QUEUESIZE_SOCK_LIU );
// CMsgQueue g_objMsgQueSockDvr( int(KEY_SEM_SOCK_DVR), int(KEY_MSG_SOCK_DVR), int(KEY_SHM_SOCKDVR_1), QUEUESIZE_SOCK_DVR );
//CMsgQueue g_objMsgQueIO( int(KEY_SEM_QUEUEIO), int(KEY_MSG_QUEUEIO), int(KEY_SHM_QUEUEIO_1), QUEUESIZE_IO );
int PHONE_MODTYPE = 0;
int NETWORK_TYPE = 0;
char USB_DEV_INSMOD[128] = {0};
char USB_DEV_CHECKPATH_AT[128] = {0};
char USB_DEV_CHECKPATH_PPP[128] = {0};
char PPP_DIAL_NUM[128] = {0};
char PPP_USER_NAME[128] = {0};
char PPP_PASSWORD[128] = {0};
DWORD COMMUX_DEVPATH_AT = 0;
DWORD COMMUX_DEVPATH_PPP = 0;
CTimeMng g_objTmMng; // 放在最前
CMsgQueMng g_objMsgQueMng;
CCfgMng g_objCfgMng;
CIO g_objIO;
CGps g_objGps;
CDog g_objDog;
void DogClr( DWORD v_dwSymb )
{
return g_objDog.DogClr(v_dwSymb);
}
DWORD DogQuery()
{
return g_objDog.DogQuery();
}
DWORD DogQueryOnly()
{
return g_objDog.DogQueryOnly();
}
void DogInit()
{
return g_objDog.DogInit();
}
int DataPush( void* v_pPushData, DWORD v_dwPushLen, DWORD v_dwPushSymb, DWORD v_dwPopSymb, BYTE v_bytLvl )
{
return g_objMsgQueMng.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_dwPopSymb, v_bytLvl );
// int iRet = 0;
// int iResult = 0;
//
// if( v_dwPopSymb & DEV_DIAODU )
// {
// iResult = g_objMsgQueDiaodu.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_LED )
// {
// g_objMsgQueLed.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_PHONE )
// {
// g_objMsgQuePhone.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_QIAN )
// {
// g_objMsgQueQian.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_UPDATE )
// {
// g_objMsgQueLiu.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_DVR )
// {
// g_objMsgQueDvr.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_SOCK_QIAN )
// {
// g_objMsgQueSockQian.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_SOCK_LIU )
// {
// g_objMsgQueSockLiu.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// if( v_dwPopSymb & DEV_SOCK_DVR )
// {
// g_objMsgQueSockDvr.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
// if( v_dwPopSymb & DEV_IO )
// {
// g_objMsgQueIO.DataPush( v_pPushData, v_dwPushLen, v_dwPushSymb, v_bytLvl );
// if( !iRet ) iRet = iResult;
// }
//
// return iRet;
}
int DataPop( void* v_pPopData, DWORD v_dwPopSize, DWORD *v_p_dwPopLen, DWORD *v_p_dwPushSymb, DWORD v_dwPopSymb, BYTE *v_p_bytLvl )
{
return g_objMsgQueMng.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_dwPopSymb, v_p_bytLvl );
// switch( v_dwPopSymb )
// {
// case DEV_DIAODU:
// return g_objMsgQueDiaodu.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_LED:
// return g_objMsgQueLed.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_PHONE:
// return g_objMsgQuePhone.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_QIAN:
// return g_objMsgQueQian.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_UPDATE:
// return g_objMsgQueLiu.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_DVR:
// return g_objMsgQueDvr.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_SOCK_QIAN:
// return g_objMsgQueSockQian.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_SOCK_LIU:
// return g_objMsgQueSockLiu.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// case DEV_SOCK_DVR:
// return g_objMsgQueSockDvr.DataPop( v_pPopData, v_dwPopSize, v_p_dwPopLen, v_p_dwPushSymb, v_p_bytLvl );
// break;
//
// default:
// return ERR_PAR;
// }
}
int DataDel( DWORD v_dwPopSymb, void* v_pCmpDataFunc )
{
return g_objMsgQueMng.DataDel( v_dwPopSymb, v_pCmpDataFunc );
// switch( v_dwPopSymb )
// {
// case DEV_DIAODU:
// return g_objMsgQueDiaodu.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_LED:
// return g_objMsgQueLed.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_PHONE:
// return g_objMsgQuePhone.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_QIAN:
// return g_objMsgQueQian.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_UPDATE:
// return g_objMsgQueLiu.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_DVR:
// return g_objMsgQueDvr.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_SOCK_QIAN:
// return g_objMsgQueSockQian.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_SOCK_LIU:
// return g_objMsgQueSockLiu.DataDel( v_pCmpDataFunc );
// break;
//
// case DEV_SOCK_DVR:
// return g_objMsgQueSockDvr.DataDel( v_pCmpDataFunc );
// break;
//
// default:
// return ERR_PAR;
// }
}
int DataWaitPop( DWORD v_dwPopSymb )
{
return g_objMsgQueMng.DataWaitPop( v_dwPopSymb );
// switch( v_dwPopSymb )
// {
// case DEV_DIAODU:
// return g_objMsgQueDiaodu.DataWaitPop();
// break;
//
// case DEV_LED:
// return g_objMsgQueLed.DataWaitPop();
// break;
//
// case DEV_PHONE:
// return g_objMsgQuePhone.DataWaitPop();
// break;
//
// case DEV_QIAN:
// return g_objMsgQueQian.DataWaitPop();
// break;
//
// case DEV_UPDATE:
// return g_objMsgQueLiu.DataWaitPop();
// break;
//
// default:
// return ERR_PAR;
// }
}
int DataSkipWait( DWORD v_dwPopSymb )
{
return g_objMsgQueMng.DataSkipWait( v_dwPopSymb );
// switch( v_dwPopSymb )
// {
// case DEV_DIAODU:
// return g_objMsgQueDiaodu.DataSkipWait();
// break;
//
// case DEV_LED:
// return g_objMsgQueLed.DataSkipWait();
// break;
//
// case DEV_PHONE:
// return g_objMsgQuePhone.DataSkipWait();
// break;
//
// case DEV_QIAN:
// return g_objMsgQueQian.DataSkipWait();
// break;
//
// case DEV_UPDATE:
// return g_objMsgQueLiu.DataSkipWait();
// break;
//
// default:
// return ERR_PAR;
// }
}
int GetImpCfg( void *v_pDes, unsigned int v_uiDesSize, unsigned int v_uiGetBegin, unsigned int v_uiGetSize )
{
return g_objCfgMng.GetImpCfg( v_pDes, v_uiDesSize, v_uiGetBegin, v_uiGetSize );
}
int SetImpCfg( void *v_pSrc, unsigned int v_uiSaveBegin, unsigned int v_uiSaveSize )
{
return g_objCfgMng.SetImpCfg( v_pSrc, v_uiSaveBegin, v_uiSaveSize );
}
int GetSecCfg( void *v_pDes, unsigned int v_uiDesSize, unsigned int v_uiGetBegin, unsigned int v_uiGetSize )
{
return g_objCfgMng.GetSecCfg( v_pDes, v_uiDesSize, v_uiGetBegin, v_uiGetSize );
}
int SetSecCfg( void *v_pSrc, unsigned int v_uiSaveBegin, unsigned int v_uiSaveSize )
{
return g_objCfgMng.SetSecCfg( v_pSrc, v_uiSaveBegin, v_uiSaveSize );
}
int ResumeCfg( bool v_bReservTel, bool v_bReservIP )
{
return g_objCfgMng.ResumeCfg( v_bReservTel, v_bReservIP );
}
int IOGet( unsigned char v_ucIOSymb, unsigned char *v_p_ucIOSta )
{
return g_objIO.IOGet( v_ucIOSymb, v_p_ucIOSta );
}
int IOSet( unsigned char v_ucIOSymb, unsigned char v_ucIOSta, void* v_pReserv, unsigned int v_uiReservSiz )
{
return g_objIO.IOSet( v_ucIOSymb, v_ucIOSta, v_pReserv, v_uiReservSiz );
}
int IOCfgGet( unsigned char v_ucIOSymb, void *v_pCfg, DWORD v_dwCfgSize )
{
return g_objIO.IOCfgGet( v_ucIOSymb, v_pCfg, v_dwCfgSize );
}
int IOIntInit( unsigned char v_ucIOSymb, void* v_pIntFunc )
{
return g_objIO.IOIntInit( v_ucIOSymb, v_pIntFunc );
}
// int IOIntFuncSet( unsigned char v_ucIOSymb, void* v_pIntFunc )
// {
// return g_objIO.IOIntFuncSet( v_ucIOSymb, v_pIntFunc );
// }
int GetCurGps( void* v_pGps, const unsigned int v_uiSize, BYTE v_bytGetType )
{
return g_objGps.GetCurGps( v_pGps, v_uiSize, v_bytGetType );
}
int SetCurGps( const void* v_pGps, BYTE v_bytSetType )
{
return g_objGps.SetCurGps( v_pGps, v_bytSetType );
}
int CrtVerFile()
{
int i, j;
FILE *pfVersion = NULL;
for(i = 0; i < 3; i++)
{
if(access("/root/Version", F_OK) != 0)
{
if(!(pfVersion = fopen("/root/Version", "w+")))
{
PRTMSG(MSG_ERR, "Create Version File Fail\n");
sleep(1);
continue;
}
else
{
for(j = 0; j < 3; j++)
{
if(sizeof(SYSTEM_VER) != fwrite(SYSTEM_VER, 1, sizeof(SYSTEM_VER), pfVersion))
{
PRTMSG(MSG_ERR, "Write Version File Fail\n");
fseek(pfVersion, 0, SEEK_SET);
sleep(1);
continue;
}
fclose(pfVersion);
return 0;
}
fclose(pfVersion);
unlink("/root/Version");
sleep(1);
continue;
}
}
return 0;
}
return -1;
}
int DelVerFile()
{
// int i;
//
// for(i = 0; i < 3; i++)
// {
// if(!access("/root/Version", F_OK))
// {
// if(unlink("/root/Version"))
// {
// PRTMSG(MSG_ERR, "Delete Version File Fail\n");
// sleep(1);
// continue;
// }
//
// return 0;
// }
//
// return 0;
// }
//
return -1;
}
int ReadVerFile(char *v_pszVersion)
{
int i, j;
FILE *pfVersion = NULL;
for(i = 0; i < 3; i++)
{
if(access("/root/Version", F_OK) == 0)
{
if(!(pfVersion = fopen("/root/Version", "r+")))
{
PRTMSG(MSG_ERR, "Open Version File Fail\n");
sleep(1);
continue;
}
else
{
for(j = 0; j < 3; j++)
{
if(sizeof(SYSTEM_VER) != fread(v_pszVersion, 1, sizeof(SYSTEM_VER), pfVersion))
{
PRTMSG(MSG_ERR, "Read Version File Fail\n");
fseek(pfVersion, 0, SEEK_SET);
sleep(1);
continue;
}
fclose(pfVersion);
return 0;
}
fclose(pfVersion);
sleep(1);
continue;
}
}
return -1;
}
return -1;
}
void ChkSoftVer(char *v_pszVersion)
{
char *p = NULL;
strcpy(v_pszVersion, SOFT_VER);
#if VEHICLE_TYPE == VEHICLE_M
p = strstr(v_pszVersion, "110m");
if(p != NULL)
{
if(NETWORK_TYPE == NETWORK_TD)
memcpy(p, "110mt", 5);
else if(NETWORK_TYPE == NETWORK_EVDO)
memcpy(p, "110mk", 5);
else if(NETWORK_TYPE == NETWORK_WCDMA)
memcpy(p, "110mw", 5);
}
#endif
#if VEHICLE_TYPE == VEHICLE_V8
p = strstr(v_pszVersion, "110v8");
if(p != NULL)
{
if(NETWORK_TYPE == NETWORK_TD)
memcpy(p, "110v8t", 6);
else if(NETWORK_TYPE == NETWORK_EVDO)
memcpy(p, "110v8k", 6);
else if(NETWORK_TYPE == NETWORK_WCDMA)
memcpy(p, "110v8w", 6);
}
#endif
#if VEHICLE_TYPE == VEHICLE_M2
p = strstr(v_pszVersion, "110m2");
if(p != NULL)
{
if(NETWORK_TYPE == NETWORK_TD)
memcpy(p, "110m2t", 6);
else if(NETWORK_TYPE == NETWORK_EVDO)
memcpy(p, "110m2k", 6);
else if(NETWORK_TYPE == NETWORK_WCDMA)
memcpy(p, "110m2w", 6);
}
#endif
}
bool GetDevID( char* v_szDes, unsigned int v_uiDesSize )
{
if( v_uiDesSize > 0 )
{
*v_szDes = 0;
return true;
}
else
{
return false;
}
}
bool GetAppVer( char* v_szDes, unsigned int v_uiDesSize )
{
char szSoftVer[64] = {0};
ChkSoftVer(szSoftVer);
char szSysVer[64] = {0};
ReadVerFile(szSysVer);
char szVer[64] = {0};
sprintf(szVer, "%s-%s", szSoftVer, szSysVer);
if( v_uiDesSize >= strlen(szVer) )
{
memcpy( v_szDes, szVer, strlen(szVer) );
return true;
}
else
{
return false;
}
}
int SetCurTime( void* v_pTmSet ) // 传入参数应是tm类型对象的指针
{
return g_objTmMng.SetCurTime( v_pTmSet );
}
unsigned int GetTickCount()
{
return g_objTmMng.GetTickCount();
}
|
[
"[email protected]"
] |
[
[
[
1,
555
]
]
] |
352eec4b3408a6cc55abfc404363e97616b3e045
|
6e4f9952ef7a3a47330a707aa993247afde65597
|
/PROJECTS_ROOT/SmartWires/SystemUtils/SysService.cpp
|
32ee7643307dcc8db47e9f5a9a803e66acaa9d64
|
[] |
no_license
|
meiercn/wiredplane-wintools
|
b35422570e2c4b486c3aa6e73200ea7035e9b232
|
134db644e4271079d631776cffcedc51b5456442
|
refs/heads/master
| 2021-01-19T07:50:42.622687 | 2009-07-07T03:34:11 | 2009-07-07T03:34:11 | 34,017,037 | 2 | 1 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 32,889 |
cpp
|
#include "stdafx.h"
#include "SysService.h"
//////////////////////////////////////////////////////////////////////////////////
//
// CSysService Class
//
//////////////////////////////////////////////////////////////////////////////////
//
// Written by Jay Wheeler
// EarthWalk Software
//
// Version 1 - October, 2000.
//
//////////////////////////////////////////////////////////////////////////////////
//
// CSysService is copyright © 2000. EarthWalk Software.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//////////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////
//
// Constructor
//
// Clear result, error and state flags
// Set open state = false
//
// Extend this method with constructor for
// extended class. The code here will execute
// prior to the new class constructor
//
// Parameter:
// p_HostName
// Name of target host.
//
//////////////////////////////////////////////////////////
CSysService::CSysService(CString p_HostName)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_Open = false;
g_ServiceHostName = LocalHostName();
if (p_HostName.IsEmpty())
return;
g_Open = Open(p_HostName);
}
//////////////////////////////////////////////////////////
//
// Destructor
//
//////////////////////////////////////////////////////////
//
// Extend this method with destructor for
// extended class. The code here will execute
// prior to the new class destructor
//
//////////////////////////////////////////////////////////
CSysService::~CSysService()
{
if (g_ServiceHandle != NULL)
CloseServiceHandle(g_ServiceHandle);
}
//////////////////////////////////////////////////////////
//
// Open
//
//////////////////////////////////////////////////////////
//
// Return Value:
// true if successful
// Parameters:
// p_HostName
// Name of host to connect to.
// Remarks:
// Opens a connection to the service control
// manager on the specified host.
//
// Sets g_ServiceHandle.
// Sets g_ServiceHostName to p_HostName.
//
//////////////////////////////////////////////////////////
bool CSysService::Open(CString p_HostName)
{
if (g_Open)
return true;
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
if (p_HostName.IsEmpty())
p_HostName = LocalHostName();
g_ServiceHostName = p_HostName;
g_ServiceHandle = OpenSCManager((LPCTSTR)g_ServiceHostName,
SERVICES_ACTIVE_DATABASE,
GENERIC_READ |
GENERIC_WRITE |
GENERIC_EXECUTE);
if (g_ServiceHandle != NULL)
return true;
g_ServiceRequestError = SYSSERVICE_OPEN_SC_MANAGER;
g_Error = GetLastError();
g_Result++;
return false;
}
//////////////////////////////////////////////////////////
//
// ServiceDisplayName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// CString containing ServiceDisplayName.
// Parameters:
// p_ServiceName
// CString containing name of service to query.
// Remarks:
// Returns the ServiceDisplayName corresponding to
// p_ServiceName.
//
// Sets g_ServiceDisplayName and g_ServiceName.
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceDisplayName(CString p_ServiceName)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceDisplayName.Empty();
if (p_ServiceName.IsEmpty())
{
g_ServiceRequestError = SYSSERVICE_NULL_SERVICENAME;
return p_ServiceName;
}
g_ServiceName = p_ServiceName;
memset(&g_Buffer, 0, MAX_SERVICE_BUFFER);
g_ServiceBufferSize = MAX_SERVICE_BUFFER;
if (GetServiceDisplayName(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
g_Buffer.Data,
&g_ServiceBufferSize) == 0)
{
g_ServiceRequestError = SYSSERVICE_GET_DISPLAY_NAME;
g_Result++;
g_Error = GetLastError();
return g_ServiceDisplayName;
}
g_ServiceDisplayName.Format("%s", g_Buffer.Data);
return g_ServiceDisplayName;
}
//////////////////////////////////////////////////////////
//
// GetServiceInformation
//
//////////////////////////////////////////////////////////
//
// Return Value:
// true if successful.
// Parameters:
// p_ServiceName
// CString containing name of service to query.
// Remarks:
// Sets g_ServiceName to parameter.
// Sets g_ServiceType, g_StartType, g_ServiceStartName,
// and g_ServiceState to returned values.
//
//////////////////////////////////////////////////////////
bool CSysService::GetServiceInformation(CString p_ServiceName)
{
DWORD l_BytesNeeded = 0;
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
if (p_ServiceName.IsEmpty())
p_ServiceName = g_ServiceName;
g_ServiceName = p_ServiceName;
SC_HANDLE l_ServiceHandle;
l_ServiceHandle = OpenService(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
SERVICE_ALL_ACCESS);
if (l_ServiceHandle == NULL)
{
g_Result++;
g_Error = GetLastError();
return false;
}
if (! QueryServiceConfig(l_ServiceHandle,
&g_Buffer.Structures.ServiceConfig,
sizeof(QUERY_SERVICE_CONFIG),
&l_BytesNeeded))
{
g_Error = GetLastError();
if (g_Error != ERROR_INSUFFICIENT_BUFFER)
{
g_ServiceRequestError = SYSSERVICE_QUERY_SERVICE_CONFIG;
CloseServiceHandle(l_ServiceHandle);
return false;
}
if (! QueryServiceConfig(l_ServiceHandle,
&g_Buffer.Structures.ServiceConfig,
l_BytesNeeded,
&l_BytesNeeded))
{
g_ServiceRequestError = SYSSERVICE_INSUFFICIENT_BUFFER;
CloseServiceHandle(l_ServiceHandle);
return false;
}
}
g_ServiceType = g_Buffer.Structures.ServiceConfig.dwServiceType;
if ((g_ServiceType == SERVICE_KERNEL_DRIVER) ||
(g_ServiceType == SERVICE_FILE_SYSTEM_DRIVER))
{
g_ServiceRequestError = SYSSERVICE_NOT_SERVICE;
CloseServiceHandle(l_ServiceHandle);
return false;
}
g_StartType = g_Buffer.Structures.ServiceConfig.dwStartType;
g_ServiceStartName.Empty();
if (g_Buffer.Structures.ServiceConfig.lpServiceStartName[0] != (char)0)
g_ServiceStartName.Format("%s",
g_Buffer.Structures.ServiceConfig.lpServiceStartName);
if (g_Buffer.Structures.ServiceConfig.lpDisplayName[0] != (char)0)
g_ServiceDisplayName.Format("%s",
g_Buffer.Structures.ServiceConfig.lpDisplayName);
if(! QueryServiceStatus(l_ServiceHandle,
&g_Buffer.Structures.ServiceStatus))
{
g_ServiceRequestError = SYSSERVICE_QUERY_SERVICE_STATUS;
CloseServiceHandle(l_ServiceHandle);
return false;
}
g_ServiceState = g_Buffer.Structures.ServiceStatus.dwCurrentState;
g_ErrorControl = g_Buffer.Structures.ServiceConfig.dwErrorControl;
g_Path = g_Buffer.Structures.ServiceConfig.lpBinaryPathName;
CloseServiceHandle(l_ServiceHandle);
return true;
}
//////////////////////////////////////////////////////////
//
// Control
//
//////////////////////////////////////////////////////////
//
// Return Value:
// DWORD value containing the result of the
// operation.
// Parameters:
// p_ServiceName
// CString containing name of service to control.
// p_ServiceRequest
// DWORD containing function to perform:
// SERVICE_CONTROL_STOP
// SERVICE_CONTROL_CONTINUE
// SERVICE_CONTROL_PAUSE
// Remarks:
// Returns the service state resulting from the
// operation.
//
//////////////////////////////////////////////////////////
DWORD CSysService::Control(CString p_ServiceName, DWORD p_ServiceRequest)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
if (p_ServiceName.IsEmpty())
p_ServiceName = g_ServiceName;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceRequest = p_ServiceRequest;
ServiceState(g_ServiceName);
if ((g_ServiceState != SERVICE_STOPPED) &&
(g_ServiceState != SERVICE_RUNNING) &&
(g_ServiceState != SERVICE_PAUSED))
{
g_ServiceRequestError = SYSSERVICE_STATE_ERROR;
return NULL;
}
if ((p_ServiceRequest == SERVICE_CONTROL_STOP) &&
(g_ServiceState != SERVICE_RUNNING))
{
g_ServiceRequestError = SYSSERVICE_NOT_RUNNING;
return NULL;
}
if ((p_ServiceRequest == SERVICE_CONTROL_CONTINUE) &&
(g_ServiceState != SERVICE_STOPPED) &&
(g_ServiceState != SERVICE_PAUSED))
{
g_ServiceRequestError = SYSSERVICE_NOT_STOPPED;
return NULL;
}
if ((p_ServiceRequest == SERVICE_CONTROL_PAUSE) &&
(g_ServiceState != SERVICE_RUNNING))
{
g_ServiceRequestError = SYSSERVICE_NOT_STOPPED;
return NULL;
}
SC_HANDLE l_ServiceHandle;
l_ServiceHandle = OpenService(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
GENERIC_READ | GENERIC_EXECUTE);
if (l_ServiceHandle == NULL)
{
g_Result++;
g_Error = GetLastError();
g_ServiceRequestError = SYSSERVICE_OPEN_ERROR;
return NULL;
}
switch (g_ServiceRequest)
{
case SERVICE_CONTROL_PAUSE:
if (! ControlService(l_ServiceHandle,
g_ServiceRequest,
&g_Buffer.Structures.ServiceStatus))
{
g_ServiceRequestError = SYSSERVICE_UNABLE_TO_PAUSE;
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
break;
case SERVICE_CONTROL_STOP:
if (! ControlService(l_ServiceHandle,
g_ServiceRequest,
&g_Buffer.Structures.ServiceStatus))
{
g_ServiceRequestError = SYSSERVICE_UNABLE_TO_STOP;
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
break;
case SERVICE_CONTROL_CONTINUE:
if (g_ServiceState == SERVICE_PAUSED)
{
if (! ControlService(l_ServiceHandle,
g_ServiceRequest,
&g_Buffer.Structures.ServiceStatus))
{
g_ServiceRequestError = SYSSERVICE_UNABLE_TO_CONTINUE;
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
}
else
{
g_Result = StartService(l_ServiceHandle, 0, NULL);
if (g_Result == 0)
{
g_ServiceRequestError = SYSSERVICE_UNABLE_TO_START;
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
}
break;
default:
g_ServiceRequestError = SYSSERVICE_INVALID_REQUEST;
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
CloseServiceHandle(l_ServiceHandle);
return ServiceState(g_ServiceName);
}
//////////////////////////////////////////////
//////////////////////////////////////////////
//////////////////////////////////////////////
//
// SetPath
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// path to service
// Remarks:
// g_Path is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetPath(CString p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_Path = p_Param;
}
//////////////////////////////////////////////
//
// SetAccount
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// service account
// Remarks:
// g_ServiceStartName is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetAccount(CString p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceStartName = p_Param;
}
//////////////////////////////////////////////
//
// SetDisplayName
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// Service display name
// Remarks:
// g_ServiceDisplayName is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetDisplayName(CString p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceDisplayName = p_Param;
}
//////////////////////////////////////////////
//
// SetPassword
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_ChangePassword
// true = set password
// false = don't set password
// p_Param
// password
// Remarks:
// g_Password is set to p_Param
// g_ChangePassword is set to p_ChangePassword
//
//////////////////////////////////////////////
void CSysService::SetPassword(bool p_ChangePassword, CString p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ChangePassword = p_ChangePassword;
g_Password = p_Param;
}
//////////////////////////////////////////////
//
// SetServiceName
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// service name
// Remarks:
// g_ServiceName is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetServiceName(CString p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceName = p_Param;
}
//////////////////////////////////////////////
//
// SetServiceType
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// service type to set
// Remarks:
// g_ServiceType is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetServiceType(DWORD p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ServiceType = p_Param;
}
//////////////////////////////////////////////
//
// SetStartType
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// start type
// Remarks:
// g_StartType is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetStartType(DWORD p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_StartType = p_Param;
}
//////////////////////////////////////////////
//
// SetErrorControl
//
//////////////////////////////////////////////
//
// Return Value:
// None.
// Parameters:
// p_Param
// error control
// Remarks:
// g_ErrorControl is set to p_Param
//
//////////////////////////////////////////////
void CSysService::SetErrorControl(DWORD p_Param)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
g_ErrorControl = p_Param;
}
//////////////////////////////////////////////////////////
//
// SetServiceConfig
//
//////////////////////////////////////////////////////////
//
// Return Value:
// true if successful
// Parameters:
// None.
// Remarks:
// The following global variables must be set
// prior to calling this method:
// g_Path
// g_ServiceStartName
// g_ServiceDisplayName
// g_Password
// g_ServiceName
// g_ServiceType
// g_StartType
// g_ErrorControl
// Changes an existing service entry with the specified
// parameters.
//
//////////////////////////////////////////////////////////
bool CSysService::SetServiceConfig()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
SC_HANDLE l_ServiceHandle;
l_ServiceHandle = OpenService(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
SERVICE_ALL_ACCESS);
if (l_ServiceHandle == NULL)
{
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return false;
}
BOOL l_Result;
if (g_ChangePassword)
l_Result = ChangeServiceConfig(l_ServiceHandle,
g_ServiceType,
g_StartType,
g_ErrorControl,
g_Path,
NULL,
0,
NULL,
g_ServiceStartName,
g_Password,
g_ServiceDisplayName);
else
l_Result = ChangeServiceConfig(l_ServiceHandle,
g_ServiceType,
g_StartType,
g_ErrorControl,
g_Path,
NULL,
0,
NULL,
g_ServiceStartName,
NULL,
g_ServiceDisplayName);
if (! l_Result)
{
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return false;
}
CloseServiceHandle(l_ServiceHandle);
return true;
}
//////////////////////////////////////////////////////////
//
// NewService
//
//////////////////////////////////////////////////////////
//
// Return Value:
// true if successful
// Parameters:
// None.
// Remarks:
// The following global variables must be set
// prior to calling this method:
// g_Path
// g_ServiceStartName
// g_ServiceDisplayName
// g_Password
// g_ServiceName
// g_ServiceType
// g_StartType
// g_ErrorControl
// Creates a new service entry with the specified
// parameters.
//
//////////////////////////////////////////////////////////
bool CSysService::NewService()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
SC_HANDLE l_ServiceHandle;
l_ServiceHandle = CreateService(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
(LPCTSTR)g_ServiceDisplayName,
SERVICE_ALL_ACCESS,
g_ServiceType,
g_StartType,
g_ErrorControl,
(LPCTSTR)g_Path,
NULL,
0,
NULL,
g_ServiceStartName,
g_Password);
if (l_ServiceHandle == NULL)
{
g_Result++;
g_Error = GetLastError();
return false;
}
CloseServiceHandle(l_ServiceHandle);
return true;
}
//////////////////////////////////////////////////////////
//
// RemoveService
//
//////////////////////////////////////////////////////////
//
// Return Value:
// true if successful
// Parameters:
// p_ServiceName
// Name of service to delete.
// Remarks:
// Deletes an existing service entry.
//
//////////////////////////////////////////////////////////
bool CSysService::RemoveService(CString p_ServiceName)
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
if (p_ServiceName.IsEmpty())
return false;
SC_HANDLE l_ServiceHandle;
l_ServiceHandle = OpenService(g_ServiceHandle,
(LPCTSTR)p_ServiceName,
DELETE);
if (l_ServiceHandle == NULL)
{
g_Result++;
g_Error = GetLastError();
return false;
}
if (! DeleteService(l_ServiceHandle))
{
g_Result++;
g_Error = GetLastError();
CloseServiceHandle(l_ServiceHandle);
return false;
}
CloseServiceHandle(l_ServiceHandle);
return true;
}
//////////////////////////////////////////////////////////
//
// LocalHostName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Local host name if successful, empty if not.
// Parameters:
// None.
// Remarks:
// Returns the name of the local host.
//
//////////////////////////////////////////////////////////
CString CSysService::LocalHostName()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
char l_MachineName [MAX_COMPUTERNAME_LENGTH+1];
DWORD l_NameSize = sizeof(l_MachineName);
g_LocalHostName.Empty();
if (! GetComputerName(l_MachineName, &l_NameSize))
{
g_Result++;
g_Error = GetLastError();
return g_LocalHostName;
}
g_LocalHostName.Format("%s", l_MachineName);
return g_LocalHostName;
}
//////////////////////////////////////////////////////////
//
// ServiceHostName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Name of host connected to.
// Parameters:
// None.
// Remarks:
// Returns the name of the connected host.
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceHostName()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_ServiceHostName;
}
//////////////////////////////////////////////////////////
//
// Result
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Result of last operation.
// Parameters:
// None.
// Remarks:
// Result of last operation, for operations which
// return a result.
//
//////////////////////////////////////////////////////////
long CSysService::Result()
{
return g_Result;
}
//////////////////////////////////////////////////////////
//
// Error
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Error value from last operation.
// Parameters:
// None.
// Remarks:
// Value of GetLastError from last operation which
// had an error and returned a value.
//
//////////////////////////////////////////////////////////
DWORD CSysService::Error()
{
return g_Error;
}
//////////////////////////////////////////////////////////
//
// ErrorMessage
//
//////////////////////////////////////////////////////////
//
// Return Value:
// CString value of p_Error.
// Parameters:
// p_Error
// Value of error to decode
// Remarks:
// Translates p_Error to a printable CString.
//
//////////////////////////////////////////////////////////
CString CSysService::ErrorMessage(DWORD p_Error)
{
char l_ErrorBuffer[4096];
CString l_ErrorString;
memset (l_ErrorBuffer, 0, sizeof(l_ErrorBuffer));
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
p_Error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
l_ErrorBuffer,
sizeof(l_ErrorBuffer),
NULL);
l_ErrorString.Format(l_ErrorBuffer);
return l_ErrorString;
}
//////////////////////////////////////////////////////////
//
// ServiceError
//
//////////////////////////////////////////////////////////
//
// Return Value:
// DWORD result of last method.
// Parameters:
// None.
// Remarks:
// Result of last CSysService method.
//
//////////////////////////////////////////////////////////
DWORD CSysService::ServiceError()
{
return g_ServiceRequestError;
}
//////////////////////////////////////////////////////////
//
// ServiceErrorMessage
//
//////////////////////////////////////////////////////////
//
// Return Value:
// CString value of result of last operation.
// Parameters:
// p_Error
// value of error to decode.
// Remarks:
// Translates p_Error to a printable string.
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceErrorMessage(DWORD p_Error)
{
CString l_ErrorString;
switch (p_Error)
{
case SYSSERVICE_NOERROR:
l_ErrorString = "No error.";
break;
case SYSSERVICE_STATE_ERROR:
l_ErrorString = "Unknown service status.";
break;
case SYSSERVICE_NOT_RUNNING:
l_ErrorString = "Requested service is not currently running.";
break;
case SYSSERVICE_NOT_STOPPED:
l_ErrorString = "Requested service is not stopped.";
break;
case SYSSERVICE_OPEN_ERROR:
l_ErrorString = "Unable to open requested service.";
break;
case SYSSERVICE_UNABLE_TO_PAUSE:
l_ErrorString = "Unable to pause requested service.";
break;
case SYSSERVICE_UNABLE_TO_STOP:
l_ErrorString = "Unable to stop requested service.";
break;
case SYSSERVICE_UNABLE_TO_CONTINUE:
l_ErrorString = "Unable to resume requested service.";
break;
case SYSSERVICE_UNABLE_TO_START:
l_ErrorString = "Unable to start requested service.";
break;
case SYSSERVICE_INVALID_REQUEST:
l_ErrorString = "Invalid service request.";
break;
case SYSSERVICE_QUERY_SERVICE_CONFIG:
l_ErrorString = "Unable to query service configuration.";
break;
case SYSSERVICE_INSUFFICIENT_BUFFER:
l_ErrorString = "Unable to allocate query service configuration buffer.";
break;
case SYSSERVICE_NOT_SERVICE:
l_ErrorString = "Not a service entry.";
break;
case SYSSERVICE_QUERY_SERVICE_STATUS:
l_ErrorString = "Unable to query service status.";
break;
case SYSSERVICE_NULL_SERVICENAME:
l_ErrorString = "Service name cannot be null.";
break;
case SYSSERVICE_GET_DISPLAY_NAME:
l_ErrorString = "Unable to get service display name.";
break;
case SYSSERVICE_OPEN_SC_MANAGER:
l_ErrorString = "Unable to open service control manager.";
break;
default:
l_ErrorString = "Unknown error.";
}
return l_ErrorString;
}
//////////////////////////////////////////////////////////
//
// ServiceName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// g_ServiceName
// Parameters:
// None.
// Remarks:
// Returns current setting of g_ServiceName
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceName()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_ServiceName;
}
//////////////////////////////////////////////////////////
//
// ServiceDisplayName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// g_ServiceDisplayName
// Parameters:
// None.
// Remarks:
// Returns current setting of g_ServiceDisplayName
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceDisplayName()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_ServiceDisplayName;
}
//////////////////////////////////////////////////////////
//
// ServiceStartName
//
//////////////////////////////////////////////////////////
//
// Return Value:
// g_ServiceStartName
// Parameters:
// None.
// Remarks:
// Returns current setting of g_ServiceStartName
//
//////////////////////////////////////////////////////////
CString CSysService::ServiceStartName()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_ServiceStartName;
}
//////////////////////////////////////////////////////////
//
// ServiceType
//
//////////////////////////////////////////////////////////
//
// Return Value:
// g_ServiceType
// Parameters:
// None.
// Remarks:
// Returns current setting of g_ServiceType
//
//////////////////////////////////////////////////////////
DWORD CSysService::ServiceType()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_ServiceType;
}
//////////////////////////////////////////////////////////
//
// StartType
//
//////////////////////////////////////////////////////////
//
// Return Value:
// g_StartType
// Parameters:
// None.
// Remarks:
// Returns current setting of g_StartType
//
//////////////////////////////////////////////////////////
DWORD CSysService::StartType()
{
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
return g_StartType;
}
//////////////////////////////////////////////////////////
//
// ServiceState
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Current service state code.
// Parameters:
// p_ServiceName
// Name of service to query.
// Remarks:
// Returns current status of p_ServiceName.
// Sets g_ServiceState.
//
//////////////////////////////////////////////////////////
DWORD CSysService::ServiceState(CString p_ServiceName)
{
SC_HANDLE l_ServiceHandle;
g_Result = 0;
g_Error = ERROR_SUCCESS;
g_ServiceRequestError = SYSSERVICE_NOERROR;
if (p_ServiceName.IsEmpty())
p_ServiceName = g_ServiceName;
g_ServiceName = p_ServiceName;
l_ServiceHandle = OpenService(g_ServiceHandle,
(LPCTSTR)g_ServiceName,
SERVICE_ALL_ACCESS);
if(! QueryServiceStatus(l_ServiceHandle,
&g_Buffer.Structures.ServiceStatus))
{
CloseServiceHandle(l_ServiceHandle);
return NULL;
}
CloseServiceHandle(l_ServiceHandle);
g_ServiceState = g_Buffer.Structures.ServiceStatus.dwCurrentState;
return g_ServiceState;
}
//////////////////////////////////////////////////////////
//
// ServiceConfig
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Pointer to QUERY_SERVICE_CONFIG
// Parameters:
// None.
// Remarks:
// Returns a pointer to the global
// QUERY_SERVICE_CONFIG structure.
//
//////////////////////////////////////////////////////////
QUERY_SERVICE_CONFIG * CSysService::ServiceConfig()
{
return &g_Buffer.Structures.ServiceConfig;
}
//////////////////////////////////////////////////////////
//
// ServiceStatus
//
//////////////////////////////////////////////////////////
//
// Return Value:
// Pointer to SERVICE_STATUS
// Parameters:
// None.
// Remarks:
// Returns a pointer to the global
// SERVICE_STATUS structure.
//
//////////////////////////////////////////////////////////
SERVICE_STATUS * CSysService::ServiceStatus()
{
return &g_Buffer.Structures.ServiceStatus;
}
//////////////////////////////////////////////////////////
//
// StatusString
//
//////////////////////////////////////////////////////////
//
// Return Value:
// CString value of p_ServiceStatus.
// Parameters:
// p_ServiceStatus
// Value of status to lookup.
// Remarks:
// Translates p_ServiceStatus to a printable
// string.
//
//////////////////////////////////////////////////////////
CString CSysService::StatusString(DWORD p_ServiceStatus)
{
CString l_Status;
switch(p_ServiceStatus)
{
case SERVICE_STOPPED:
l_Status = _T("Stopped");
break;
case SERVICE_START_PENDING:
l_Status = _T("Starting");
break;
case SERVICE_STOP_PENDING:
l_Status = _T("Stopping");
break;
case SERVICE_RUNNING:
l_Status = _T("Running");
break;
case SERVICE_CONTINUE_PENDING:
l_Status = _T("Continuing");
break;
case SERVICE_PAUSE_PENDING:
l_Status = _T("Pausing");
break;
case SERVICE_PAUSED:
l_Status = _T("Paused");
break;
default:
l_Status = _T("Unknown");
break;
}
return l_Status;
}
//////////////////////////////////////////////
//
// GetStartupString
//
//////////////////////////////////////////////
//
// Return Value:
// CString value of p_StartupType.
// Parameters:
// p_StartupType
// Value of status to lookup.
// Remarks:
// Translates p_StartupType to a printable
// string.
//
//////////////////////////////////////////////////////////
CString CSysService::StartupString(DWORD p_StartupType)
{
CString l_Startup;
switch(p_StartupType)
{
case SERVICE_BOOT_START:
l_Startup = _T("Boot");
break;
case SERVICE_SYSTEM_START:
l_Startup = _T("System");
break;
case SERVICE_AUTO_START:
l_Startup = _T("Automatic");
break;
case SERVICE_DEMAND_START:
l_Startup = _T("Manual");
break;
case SERVICE_DISABLED:
l_Startup = _T("Disabled");
break;
default:
l_Startup = _T("Unknown");
break;
}
return l_Startup;
}
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
|
[
"wplabs@3fb49600-69e0-11de-a8c1-9da277d31688"
] |
[
[
[
1,
1325
]
]
] |
eb5ae23ce40d95f5906b876004ac80ee2bf635dd
|
a1117d878cdcbd2756512ce29ad4dfd2b5709dac
|
/OneSnap/snapperdialog.h
|
61ac6b6706b1db7abba72ecc54c811efe47f8370
|
[] |
no_license
|
nicklepede/onesnap
|
e423f6565fcc557af10618dc74bcaa941057f1d9
|
95631cb208721c97e74488d4633afaf6f63e5c00
|
refs/heads/master
| 2021-01-13T01:48:01.401096 | 2006-06-27T16:30:12 | 2006-06-27T16:30:12 | 102,732 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,494 |
h
|
#pragma once
#include "afxwin.h"
#include "SnapperXml.h"
class CSnapperConfig;
// SnapperDialog dialog
struct UserSettings
{
CString strTitle;
CString strComment;
CString strSectionFilepath;
};
class CSnapperDialog : public CDialog
{
DECLARE_DYNAMIC(CSnapperDialog)
public:
CSnapperDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CSnapperDialog();
virtual BOOL OnInitDialog();
// modal processing
INT_PTR DoModalEx(UserSettings* pSettings, CSnapperConfig* pCfg);
// Dialog Data
enum { IDD = IDD_SNAPPERDIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnCbnSelchangeDirectory();
afx_msg void OnCbnSelchangeSection();
CString m_strCategory;
CString m_strSection;
CString m_strFilepath;
afx_msg void OnBnClickedConfigure();
private:
void SelectCategory(CString& strCategory);
void PopulateCb(CComboBox& cb, CStringArray& rgStrings);
void SetUserSettings(UserSettings* psSettings);
void GetUserSettings(UserSettings* psSettings);
void InitDialog();
void SaveConfig();
CComboBox m_cbDirectory;
CComboBox m_cbSection;
CString m_strTitle;
CString m_strComment;
CString m_strUrl;
CString m_strConfigFilepath;
CString m_strSectionFilepath;
CSnapperConfig* m_pCfg;
public:
afx_msg void OnBnClickedOk();
public:
afx_msg void OnBnClickedOk2();
public:
afx_msg void OnBnClickedScan();
};
|
[
"nicklepede@2c095272-fa16-0410-abf3-d1f1c5240653"
] |
[
[
[
1,
67
]
]
] |
068a4c96e38c5ab09b7be35386749136f5cb7360
|
cc289ce16e5ce34c8842d1c0e5983c7541a91bc3
|
/Installation/jssh_code_1.5.x/jssh/nsJSShServer.h
|
cc579fac71ea783c9e39948ba2b219a3b222ab31
|
[] |
no_license
|
collin/firewatir
|
50f41749460f9ca14a91c285e819f953a497c98b
|
0dc29ae8eebeb33701167ed156d2debc09e066ce
|
refs/heads/master
| 2021-01-19T16:58:44.936815 | 2008-08-13T17:55:07 | 2008-08-13T17:55:07 | 42,352 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,335 |
h
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla JavaScript Shell project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <[email protected]>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __NS_JSSHSERVER_H__
#define __NS_JSSHSERVER_H__
#include "nsIJSShServer.h"
#include "nsCOMPtr.h"
#include "nsIServerSocket.h"
#include "nsString.h"
class nsJSShServer : public nsIJSShServer
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIJSSHSERVER
nsJSShServer();
~nsJSShServer();
private:
nsCOMPtr<nsIServerSocket> mServerSocket;
PRUint32 mServerPort;
nsCString mServerStartupURI;
PRBool mServerLoopbackOnly;
};
#endif // __NS_JSSHSERVER_H__
|
[
"angrez@2c8948d5-9e19-0410-bb25-d1963fc456a0"
] |
[
[
[
1,
62
]
]
] |
1f11db056540bff8268ed71feadd743539a9dc59
|
b4d726a0321649f907923cc57323942a1e45915b
|
/CODE/NETWORK/FS2OX.CPP
|
2c9422a4a953ae015fd0d467c4d3aa5a772a009b
|
[] |
no_license
|
chief1983/Imperial-Alliance
|
f1aa664d91f32c9e244867aaac43fffdf42199dc
|
6db0102a8897deac845a8bd2a7aa2e1b25086448
|
refs/heads/master
| 2016-09-06T02:40:39.069630 | 2010-10-06T22:06:24 | 2010-10-06T22:06:24 | 967,775 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 17,990 |
cpp
|
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/*
* $Logfile$
* $Revision: 1.1.1.1 $
* $Date: 2004/08/13 22:47:42 $
* $Author: Spearhawk $
*
* C file for implementing PXO-substitute (FS2OX -- "fs2_open exchange") screen
*
* $Log: FS2OX.CPP,v $
* Revision 1.1.1.1 2004/08/13 22:47:42 Spearhawk
* no message
*
* Revision 1.1.1.1 2004/08/13 21:20:38 Darkhill
* no message
*
* Revision 1.9 2004/04/03 18:11:21 Kazan
* FRED fixes
*
* Revision 1.8 2004/04/03 06:22:32 Goober5000
* fixed some stub functions and a bunch of compile warnings
* --Goober5000
*
* Revision 1.7 2004/03/31 05:42:27 Goober5000
* got rid of all those nasty warnings from xlocale and so forth; also added comments
* for #pragma warning disable to indicate the message being disabled
* --Goober5000
*
* Revision 1.6 2004/03/10 20:51:16 Kazan
* irc
*
* Revision 1.5 2004/03/10 18:45:09 Kazan
* partially complete IRC - so i can work on it on my laptop
*
* Revision 1.4 2004/03/08 22:02:39 Kazan
* Lobby GUI screen restored
*
* Revision 1.3 2004/03/05 09:02:02 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 1.2 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 1.1 2002/07/29 22:24:26 penguin
* First attempt at "fs2_open exchange" (PXO substitute) screen
*
* $NoKeywords: $
*/
#pragma warning(disable:4786) // identifier truncated in the debug information
#pragma warning(disable:4710) // function not inlined
#include "globalincs/pstypes.h"
#include "ui/ui.h"
#include "bmpman/bmpman.h"
#include "gamesnd/gamesnd.h"
#include "io/key.h"
#include "gamesequence/gamesequence.h"
#include "network/fs2ox.h"
#include "gamehelp/contexthelp.h"
#include "network/multi_log.h"
#include "cmdline/cmdline.h"
//#define RATHAVEN
#if defined(RATHAVEN)
#include "fs2open_pxo/TCP_Socket.h"
TCP_Socket ServerConnection;
#else
#include "irc/irc.h"
irc_client IRCConn;
#endif
// LOCAL function definitions
void fs2ox_check_buttons();
void fs2ox_button_pressed(int n);
//XSTR:OFF
// bitmaps defs
static char *fs2ox_bitmap_fname[GR_NUM_RESOLUTIONS] = {
"PXOChat", // GR_640
"2_PXOChat" // GR_1024
};
static char *fs2ox_bitmap_mask_fname[GR_NUM_RESOLUTIONS] = {
"PXOChat-M", // GR_640
"2_PXOChat-M" // GR_1024
};
//XSTR:ON
UI_WINDOW fs2ox_window; // the window object for the FS2OX screen
int fs2ox_bitmap; // the background bitmap
int fs2ox_frame_count; // keep a count of frames displayed
// button defs
#define FS2OX_NUM_BUTTONS 15
#define FS2OX_USERS_SCROLL_UP 0
#define FS2OX_USERS_SCROLL_DOWN 1
#define FS2OX_WEB_RANKING 2
#define FS2OX_PILOT_INFO 3
#define FS2OX_PILOT_FIND 4
#define FS2OX_MOTD 5
#define FS2OX_CHANNELS_XXX1 6 // ?
#define FS2OX_CHANNELS_XXX2 7 // ?
#define FS2OX_CHANNELS_SCROLL_UP 8
#define FS2OX_CHANNELS_SCROLL_DOWN 9
#define FS2OX_CHATBOX_SCROLL_UP 10
#define FS2OX_CHATBOX_SCROLL_DOWN 11
#define FS2OX_EXIT 12
#define FS2OX_HELP 13
#define FS2OX_ACCEPT 14
//XSTR:OFF
ui_button_info fs2ox_buttons[GR_NUM_RESOLUTIONS][FS2OX_NUM_BUTTONS] = {
{ // GR_640
// filename x y xt yt hotspot
ui_button_info( "pxb_00", 1, 103, -1, -1, 0 ), // users scroll up
ui_button_info( "pxb_01", 1, 334, -1, -1, 1 ), // users scroll down
ui_button_info( "pxb_02", 17, 386, -1, -1, 2 ), // web ranking
ui_button_info( "pxb_03", 71, 385, -1, -1, 3 ), // pilot info
ui_button_info( "pxb_04", 115, 385, -1, -1, 4 ), // find pilot
ui_button_info( "pxb_05", 1, 443, -1, -1, 5 ), // show_motd
ui_button_info( "pxb_06", 330, 96, -1, -1, 6 ), // channels xxx1
ui_button_info( "pxb_07", 330, 131, -1, -1, 7 ), // channels xxx2
ui_button_info( "pxb_08", 618, 92, -1, -1, 8 ), // channels scroll up
ui_button_info( "pxb_09", 618, 128, -1, -1, 9 ), // channels scroll down
ui_button_info( "pxb_10", 615, 171, -1, -1, 10 ), // chatbox scroll up
ui_button_info( "pxb_11", 615, 355, -1, -1, 11 ), // chatbox scroll down
ui_button_info( "pxb_12", 481, 435, -1, -1, 12 ), // exit
ui_button_info( "pxb_13", 533, 433, -1, -1, 13 ), // help
ui_button_info( "pxb_14", 573, 432, -1, -1, 14 ), // accept
},
{ // GR_1024
// Positions fixed by Kazan 3/8/04
ui_button_info( "2_pxb_00", 1, 164, -1, -1, 0 ), // users scroll up
ui_button_info( "2_pxb_01", 1, 534, -1, -1, 1 ), // users scroll down
ui_button_info( "2_pxb_02", 27, 617, -1, -1, 2 ), // web ranking
ui_button_info( "2_pxb_03", 113, 616, -1, -1, 3 ), // pilot info
ui_button_info( "2_pxb_04", 184, 616, -1, -1, 4 ), // find pilot
ui_button_info( "2_pxb_05", 1, 708, -1, -1, 5 ), // show_motd
ui_button_info( "2_pxb_06", 528, 119, -1, -1, 6 ), // channels xxx1
ui_button_info( "2_pxb_07", 528, 175, -1, -1, 7 ), // channels xxx2
ui_button_info( "2_pxb_08", 988, 112, -1, -1, 8 ), // channels scroll up
ui_button_info( "2_pxb_09", 988, 168, -1, -1, 9 ), // channels scroll down
ui_button_info( "2_pxb_10", 984, 241, -1, -1, 10 ), // chatbox scroll up
ui_button_info( "2_pxb_11", 984, 568, -1, -1, 11 ), // chatbox scroll down
ui_button_info( "2_pxb_12", 771, 695, -1, -1, 12 ), // exit
ui_button_info( "2_pxb_13", 852, 692, -1, -1, 13 ), // help
ui_button_info( "2_pxb_14", 916, 691, -1, -1, 14 ), // accept
}
};
//XSTR:ON
// text def
#define FS2OX_NUM_TEXT 9
UI_XSTR fs2ox_text[GR_NUM_RESOLUTIONS][FS2OX_NUM_TEXT] = {
{ // GR_640
// string xstr x y color font UI_GADGET
{"Web", 1313, 18, 415, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_WEB_RANKING].button},
{"Ranking", 1314, 5, 425, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_WEB_RANKING].button},
{"Pilot", 1310, 71, 415, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_PILOT_INFO].button},
{"Info", 1311, 74, 425, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_PILOT_INFO].button},
{"Find", 1315, 120, 415, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_PILOT_FIND].button},
{"Motd", 1316, 34, 455, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_MOTD].button},
{"Exit", 1416, 495, 420, UI_XSTR_COLOR_PINK, -1, &fs2ox_buttons[0][FS2OX_EXIT].button},
{"Help", 928, 540, 415, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_HELP].button},
{"Games", 1319, 590, 415, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[0][FS2OX_ACCEPT].button},
},
{ // GR_1024
// Positions fixed by Kazan 3/8/04
{"Web", 1313, 28, 664, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_WEB_RANKING].button},
{"Ranking", 1314, 8, 680, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_WEB_RANKING].button},
{"Pilot", 1310, 113, 664, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_PILOT_INFO].button},
{"Info", 1311, 118, 680, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_PILOT_INFO].button},
{"Find", 1315, 192, 664, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_PILOT_FIND].button},
{"Motd", 1316, 54, 728, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_MOTD].button},
{"Exit", 1416, 792, 672, UI_XSTR_COLOR_PINK, -1, &fs2ox_buttons[1][FS2OX_EXIT].button},
{"Help", 928, 864, 664, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_HELP].button},
{"Games", 1319, 944, 664, UI_XSTR_COLOR_GREEN, -1, &fs2ox_buttons[1][FS2OX_ACCEPT].button},
}
};
UI_INPUTBOX Chat_input;
#define NUM_LISTS 3
#define LIST_CHANS 0
#define LIST_USERS 1
#define LIST_MESGS 2
UI_LISTBOX ListBoxen[NUM_LISTS];
int Listbox_coordinates[GR_NUM_RESOLUTIONS][NUM_LISTS][4] =
{
{ // GR_640
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{ // GR_1024
{ 590 ,120, 380, 85 },
{ 45, 190, 215, 385 },
{ 310, 265, 660, 315 }
}
};
//*void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _numitem, char **_list);
int Chat_input_coords[GR_NUM_RESOLUTIONS][4] = {
{ // GR_640 -- NOT YET CONFIRMED!
196, 280, 412, 56
},
{ // GR_1024
315, 615, 660, 90
}
};
#define MAX_CHAT_MSGS 256
//#define MAX_CHAT_MSGLEN 127
char **MessageList[NUM_LISTS];
extern char Multi_tracker_login[100];
extern char Multi_tracker_passwd[100];
extern char Multi_tracker_squad_name[100];
/**
* Initialize the FS2OX screen.
*/
void fs2ox_init()
{
#if defined(RATHAVEN)
ServerConnection.InitSocket("207.215.71.69", 4616);
#else
// mgo.maxgaming.org server A
//IRCConn.connect(Multi_tracker_login, Multi_tracker_passwd, "65.85.207.108", 6667);
// mgo.maxgaming.org server b
IRCConn.connect(Multi_tracker_login, Multi_tracker_passwd, "68.76.67.228", 6667);
// irc.sevarg.net
//IRCConn.connect(Multi_tracker_login, Multi_tracker_passwd, "65.110.255.247", 6667);
#endif
int idx;
// TODO - init local variable
// clear the message list
for (idx=0; idx<NUM_LISTS; idx++)
MessageList[idx] = new char*[MAX_CHAT_MSGS];
// reset frame count
fs2ox_frame_count = 0;
// create the interface window
fs2ox_window.create(0,0,gr_screen.max_w,gr_screen.max_h,0);
fs2ox_window.set_mask_bmap(fs2ox_bitmap_mask_fname[gr_screen.res]);
// load the background bitmap
fs2ox_bitmap = bm_load(fs2ox_bitmap_fname[gr_screen.res]);
if(fs2ox_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
// create the interface buttons
for(idx=0; idx < FS2OX_NUM_BUTTONS; idx++){
// create the object
fs2ox_buttons[gr_screen.res][idx].button.create(&fs2ox_window,"", fs2ox_buttons[gr_screen.res][idx].x, fs2ox_buttons[gr_screen.res][idx].y, 1, 1, 0, 1);
// set the sound to play when highlighted
fs2ox_buttons[gr_screen.res][idx].button.set_highlight_action(common_play_highlight_sound);
// set the ani for the button
fs2ox_buttons[gr_screen.res][idx].button.set_bmaps(fs2ox_buttons[gr_screen.res][idx].filename);
// set the hotspot
fs2ox_buttons[gr_screen.res][idx].button.link_hotspot(fs2ox_buttons[gr_screen.res][idx].hotspot);
}
for (idx=0; idx < NUM_LISTS; idx++){
ListBoxen[idx].create(&fs2ox_window, Listbox_coordinates[gr_screen.res][idx][0], Listbox_coordinates[gr_screen.res][idx][1],
Listbox_coordinates[gr_screen.res][idx][2], Listbox_coordinates[gr_screen.res][idx][3],
0, MessageList[idx], NULL, MAX_CHAT_MSGS);
ListBoxen[idx].set_drawframe(0);
}
// create all xstrs
for(idx=0; idx < FS2OX_NUM_TEXT; idx++){
fs2ox_window.add_XSTR(&fs2ox_text[gr_screen.res][idx]);
}
//
Chat_input.create(&fs2ox_window, Chat_input_coords[gr_screen.res][0], Chat_input_coords[gr_screen.res][1], Chat_input_coords[gr_screen.res][2], Chat_input_coords[gr_screen.res][3], "", /*UI_INPUTBOX_FLAG_INVIS |*/ UI_INPUTBOX_FLAG_ESC_FOC);
Chat_input.set_text("");
// TODO - load the help overlay
//help_overlay_load(FS2OX_OVERLAY);
//help_overlay_set_state(FS2OX_OVERLAY,0);
}
/**
* Close the FS2OX screen.
*/
void fs2ox_close()
{
// unload any bitmaps
if(!bm_unload(fs2ox_bitmap)){
nprintf(("General","WARNING : could not unload background bitmap %s\n",fs2ox_bitmap_fname[gr_screen.res]));
}
// unload the help overlay
//help_overlay_unload(FS2OX_OVERLAY);
// destroy the UI_WINDOW
fs2ox_window.destroy();
for (int idx=0; idx<NUM_LISTS; idx++)
{
delete[] MessageList[idx];
}
#if defined(RATHAVEN)
ServerConnection.Close();
#else
if (IRCConn.isConnected())
IRCConn.Disconnect("Exiting");
#endif
}
std::string strip_pattern(std::string needle, std::string haystack)
{
int index = haystack.find(needle);
while (index != (int)std::string::npos)
{
haystack.erase(index, needle.length());
index = haystack.find(needle);
}
return haystack;
}
std::string strip_ansi_codes(std::string str)
// Function to strip ANSI color codes
// search for '\27'
{
const int num_codes = 66;
std::string color_codes[66] =
{ "\033[0;1m", "\033[1;1m", "\033[2;1m", "\033[3;1m", "\033[4;1m", "\033[5;1m", "\033[6;1m", "\033[7;1m",
"\033[9;1m", "\033[22;1m", "\033[23;1m", "\033[24;1m", "\033[27;1m", "\033[29;1m", "\033[30;1m", "\033[31;1m",
"\033[32;1m", "\033[33;1m", "\033[34;1m", "\033[35;1m", "\033[36;1m", "\033[37;1m", "\033[39;1m", "\033[40;1m",
"\033[41;1m", "\033[42;1m", "\033[43;1m", "\033[44;1m", "\033[45;1m", "\033[46;1m", "\033[47;1m", "\033[49;1m",
"\033[0m", "\033[1m", "\033[2m", "\033[3m", "\033[4m", "\033[5m", "\033[6m", "\033[7m",
"\033[9m", "\033[22m", "\033[23m", "\033[24m", "\033[27m", "\033[29m", "\033[30m", "\033[31m",
"\033[32m", "\033[33m", "\033[34m", "\033[35m", "\033[36m", "\033[37m", "\033[39m", "\033[40m",
"\033[41m", "\033[42m", "\033[43m", "\033[44m", "\033[45m", "\033[46m", "\033[47m", "\033[49m",
"\377\374\01", "\377\374\03" };
for (int i = 0; i < num_codes; i++)
str = strip_pattern(color_codes[i], str);
return str;
}
/**
* Frame processing for FS2OX screen.
*/
void fs2ox_do_frame()
{
static bool firstrecv = true;
char text[128];
memset(text, 0, 128);
#if defined(RATHAVEN)
if (Chat_input.pressed())
{
Chat_input.get_text(text);
Chat_input.set_text("");
text[strlen(text)] = '\n';
ServerConnection.SendData(text, strlen(text)+1);
/*
if (text[0] == '+')
ListBoxen[LIST_CHANS].add_string(text);
else if (text[0] == '@')
ListBoxen[LIST_USERS].add_string(text);
else
ListBoxen[LIST_MESGS].add_string(text);
*/
}
while (ServerConnection.DataReady())
{
char input[1024]; // there probably won't be a transfer longer than this
char temp[256]; //maximum line length
int i = 0, j;
int transfer = ServerConnection.GetData(input, 1024);
while (i < transfer)
{
j=0;
while (input[i] != '\n' && input[i] != '\r' && i < transfer)
{
temp[j] = input[i];
j++;
i++;
}
temp[j] = '\0';
if (ListBoxen[LIST_MESGS].CurSize() == ListBoxen[LIST_MESGS].MaxSize()-1)
{
ml_printf("Removed first line");
ListBoxen[LIST_MESGS].RemoveFirstItem();
}
std::string text = strip_ansi_codes(temp);
if (text.length() > 0 && text != "\n")
ListBoxen[LIST_MESGS].add_string((char *)text.c_str());
ml_printf("Lines Used: %d / %d", ListBoxen[LIST_MESGS].CurSize(), ListBoxen[LIST_MESGS].MaxSize());
ListBoxen[LIST_MESGS].ScrollEnd();
i++;
}
}
#else
if (Chat_input.pressed())
{
Chat_input.get_text(text);
Chat_input.set_text("");
IRCConn.ParseForCommand(text);
}
/*
std::vector<std::string> lines = IRCConn.Maybe_GetRawLines();
if (lines.size() != 0)
{
for (int i = 0; i < (int)lines.size(); i++)
{
if (ListBoxen[LIST_MESGS].CurSize() == ListBoxen[LIST_MESGS].MaxSize()-1)
{
ml_printf("Removed first line");
ListBoxen[LIST_MESGS].RemoveFirstItem();
}
if (lines[i].length() > 0 && lines[i] != "\n")
ListBoxen[LIST_MESGS].add_string((char *)lines[i].c_str());
ml_printf("Lines Used: %d / %d", ListBoxen[LIST_MESGS].CurSize(), ListBoxen[LIST_MESGS].MaxSize());
ListBoxen[LIST_MESGS].ScrollEnd();
}
}
*/
IRCConn.Interpret_Commands_Do();
ListBoxen[LIST_MESGS].clear_all_items();
int start = IRCConn.GetCurrentChannel()->NumMessages() - ListBoxen[LIST_MESGS].MaxSize();
if (start < 0)
start = 0;
for (int i = start; i < IRCConn.GetCurrentChannel()->NumMessages(); i++)
ListBoxen[LIST_MESGS].add_string((char *)IRCConn.GetCurrentChannel()->GetMessage(i).c_str());
ListBoxen[LIST_MESGS].ScrollEnd();
#endif
int k = fs2ox_window.process();
// process any keypresses
switch(k){
case KEY_ESC :
//if(help_overlay_active(FS2OX_OVERLAY)){
// help_overlay_set_state(FS2OX_OVERLAY,0);
//} else {
gameseq_post_event(GS_EVENT_MAIN_MENU);
gamesnd_play_iface(SND_USER_SELECT);
//}
break;
}
// process any button clicks
fs2ox_check_buttons();
// draw the background, etc
gr_reset_clip();
GR_MAYBE_CLEAR_RES(fs2ox_bitmap);
if(fs2ox_bitmap != -1){
gr_set_bitmap(fs2ox_bitmap);
gr_bitmap(0,0);
}
fs2ox_window.draw();
// flip the buffer
gr_flip();
// increment the frame count
fs2ox_frame_count++;
}
void fs2ox_check_buttons()
{
int idx;
for(idx=0;idx<FS2OX_NUM_BUTTONS;idx++){
// we only really need to check for one button pressed at a time, so we can break after
// finding one.
if(fs2ox_buttons[gr_screen.res][idx].button.pressed()){
fs2ox_button_pressed(idx);
break;
}
}
}
void fs2ox_button_pressed(int n)
{
std::string partmsg;
switch(n){
// help overlay
case FS2OX_HELP:
//if(!help_overlay_active(FS2OX_OVERLAY)){
// help_overlay_set_state(FS2OX_OVERLAY,1);
//} else {
// help_overlay_set_state(FS2OX_OVERLAY,0);
//}
break;
// go to the games list
case FS2OX_ACCEPT:
#if !defined(RATHAVEN)
partmsg = "Going to play game";
if (Cmdline_mod)
{
partmsg += " (With Mod \"";
partmsg += Cmdline_mod;
partmsg += "\")";
}
IRCConn.Disconnect(partmsg);
#endif
gameseq_post_event(GS_EVENT_MULTI_JOIN_GAME);
break;
case FS2OX_EXIT:
#if !defined(RATHAVEN)
IRCConn.Disconnect("Leaving");
#endif
gameseq_post_event(GS_EVENT_MAIN_MENU);
break;
default :
//multi_common_add_notify(XSTR("Not implemented yet!",760));
gamesnd_play_iface(SND_GENERAL_FAIL);
break;
}
}
|
[
"[email protected]"
] |
[
[
[
1,
600
]
]
] |
0bc4beff1ebd771cf100410f54c23df3649b5792
|
9e79b20463b122df1d83a1e394f54689a949fb4e
|
/mojo.h
|
9197a85d6b9bfbe0a3787895f1d5d64caa97806d
|
[] |
no_license
|
michaelvandam/mojoduino
|
4870c522b7be77a33cb19d1a6448dbee9ca9c148
|
57233cadde626b5b9a7accf941d78470ebe17000
|
refs/heads/master
| 2021-01-02T22:51:23.392713 | 2010-10-23T01:45:30 | 2010-10-23T01:45:30 | 32,952,233 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,392 |
h
|
#ifndef Mojo_h
#define Mojo_h
#undef DEBUG
#include "WProgram.h"
#include "HardwareSerial.h"
#include "mojodefs.h"
#include "mojomsg.h"
#include "mojodispatch.h"
#include "mojocallbacks.h"
#include "mojoresponses.h"
#include <avr/pgmspace.h>
#include <inttypes.h>
const int DEVTYPELEN = 15;
class Mojo
{
public:
Mojo();
Mojo(HardwareSerial &S, char address);
HardwareSerial *serial;
void setSerial(HardwareSerial &S);
boolean recieve();
uint8_t messageReady();
Message *getMessage();
void setAddress(char address);
void loadAddressEEPROM();
char getAddress();
void setBaudrate(char index);
void loadBaudrate();
long getBaudrate();
void loadBaudrateEEPROM();
void saveBaudrateEEPROM();
void setDeviceType(char *s);
void setDeviceType_P(PGM_P s);
char *getDeviceType();
void readyForNext();
void run();
void dispatch();
void reply();
private:
enum { _WAITING,
_STARTCHAR1,
_STARTCHAR2,
_NEWMSG,
_COMPLETEMSG
};
void init();
void reset();
uint8_t _messageState;
Message msg;
char msgBuffer[MAXMSGSIZE];
char deviceType[DEVTYPELEN];
char *current;
char *last;
unsigned char addy;
char baudIndex;
uint8_t bufferIndex;
uint8_t bufferLength;
};
extern Mojo mojo;
#endif
|
[
"henry.herman@2cfd8b6e-c46e-11de-b12b-e93134c88cf6"
] |
[
[
[
1,
75
]
]
] |
83060cc793479100d014d9b8c72606af8216da2a
|
b8ac0bb1d1731d074b7a3cbebccc283529b750d4
|
/Vision/benchmarker/cpp/alg4/GarbageRecognition.cpp
|
8b76324d733d808f4a38624e6bee9dfa8d38d312
|
[] |
no_license
|
dh-04/tpf-robotica
|
5efbac38d59fda0271ac4639ea7b3b4129c28d82
|
10a7f4113d5a38dc0568996edebba91f672786e9
|
refs/heads/master
| 2022-12-10T18:19:22.428435 | 2010-11-05T02:42:29 | 2010-11-05T02:42:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,126 |
cpp
|
#include "GarbageRecognition.h"
#include <highgui.h>
#include <stdio.h>
#include <string>
#include "Contours.h"
#include "Histogram.h"
#include "Garbage.h"
#include "MinimalBoundingRectangle.h"
// image preprocessing values
#define THRESHOLD_VALUE 240
#define MORPH_KERNEL_SIZE 2
#define MORPH_DILATE_ITER 2
#define MORPH_ERODE_ITER 2
#define _RED cvScalar (0, 0, 255, 0)
#define _GREEN cvScalar (0, 255, 0, 0)
//contour filters constants
#define MINCONTOUR_AREA 1000
#define MAXCONTOUR_AREA 10000
#define BOXFILTER_TOLERANCE 0.55
#define MINCONTOUR_PERIMETER 80
#define MAXCONTOUR_PERIMETER 1000
#define CONTOUR_RECTANGULAR_MIN_RATIO 1.2
#define CONTOUR_RECTANGULAR_MAX_RATIO 3.0
#define HIST_S_BINS 8
#define HIST_H_BINS 8
#define HIST_MIN 0.7
#define TIME_THRESHOLD 15 //seconds
/*
int main(void)
{
utils::GarbageRecognition * gr= new utils::GarbageRecognition();
IplImage * src = cvLoadImage("./colilla-scene.png",1);
gr->getGarbageList(src);
}
*/
namespace utils {
std::list<utils::Garbage*> garbages;
std::list<Garbage*>
GarbageRecognition::getGarbageList(IplImage * src)
{
IplImage * model = cvLoadImage("./colilla-sinBlanco.png",1);
garbages = this->garbageList(src,model);
cvReleaseImage(&model);
return garbages;
}
std::list<Garbage*>
GarbageRecognition::garbageList(IplImage * src, IplImage * model){
std::list<Garbage*> garbageList;
//cvNamedWindow("output",CV_WINDOW_AUTOSIZE);
//object model
//image for the histogram-based filter
//could be a parameter
utils::Histogram * h = new Histogram(HIST_H_BINS,HIST_S_BINS);
CvHistogram * testImageHistogram = h->getHShistogramFromRGB(model);
//~ int frameWidth=cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH);
//~ int frameHeight=cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT);
//gets a frame for setting image size
//CvSize srcSize = cvSize(frameWidth,frameHeight);
CvSize srcSize = cvGetSize(src);
//images for HSV conversion
IplImage* hsv = cvCreateImage( srcSize, 8, 3 );
IplImage* h_plane = cvCreateImage( srcSize, 8, 1 );
IplImage* s_plane = cvCreateImage( srcSize, 8, 1 );
IplImage* v_plane = cvCreateImage( srcSize, 8, 1 );
//Image for thresholding
IplImage * threshImage=cvCreateImage(srcSize,8,1);
//image for equalization
IplImage * equalizedImage=cvCreateImage(srcSize,8,1);
//image for Morphing operations(Dilate-erode)
IplImage * morphImage=cvCreateImage(srcSize,8,1);
//image for image smoothing
IplImage * smoothImage=cvCreateImage(srcSize,8,1);
//image for contour-finding operations
IplImage * contourImage=cvCreateImage(srcSize,8,3);
int frameCounter=1;
int cont_index=0;
//convolution kernel for morph operations
IplConvKernel* element;
CvRect boundingRect;
//contours
CvSeq * contours;
//Main loop
frameCounter++;
// printf("frame number:%d\n",frameCounter);
//convert image to hsv
cvCvtColor( src, hsv, CV_BGR2HSV );
cvCvtPixToPlane( hsv, h_plane, s_plane, v_plane, 0 );
//equalize Saturation Channel image
cvEqualizeHist(s_plane,equalizedImage);
//threshold the equalized Saturation channel image
cvThreshold(equalizedImage,threshImage,THRESHOLD_VALUE,255,
CV_THRESH_BINARY);
//apply morphologic operations
element = cvCreateStructuringElementEx( MORPH_KERNEL_SIZE*2+1,
MORPH_KERNEL_SIZE*2+1, MORPH_KERNEL_SIZE, MORPH_KERNEL_SIZE,
CV_SHAPE_RECT, NULL);
cvDilate(threshImage,morphImage,element,MORPH_DILATE_ITER);
cvErode(morphImage,morphImage,element,MORPH_ERODE_ITER);
//apply smooth gaussian-filter
cvSmooth(morphImage,smoothImage,CV_GAUSSIAN,3,0,0,0);
//get all contours
contours=myFindContours(smoothImage);
cont_index=0;
cvCopy(src,contourImage,0);
while(contours!=NULL){
CvSeq * aContour=getPolygon(contours);
utils::Contours * ct = new Contours(aContour);
/*int pf = ct->perimeterFilter(MINCONTOUR_PERIMETER,MAXCONTOUR_PERIMETER);
int raf = ct->rectangularAspectFilter(CONTOUR_RECTANGULAR_MIN_RATIO, CONTOUR_RECTANGULAR_MAX_RATIO);
// int af = ct->areaFilter(MINCONTOUR_AREA,MAXCONTOUR_AREA);
int baf = ct->boxAreaFilter(BOXFILTER_TOLERANCE);
int hmf = ct->histogramMatchingFilter(src,testImageHistogram, HIST_H_BINS,HIST_S_BINS,HIST_MIN);
*/
//apply filters
if( ct->perimeterFilter(MINCONTOUR_PERIMETER,MAXCONTOUR_PERIMETER) &&
ct->rectangularAspectFilter(CONTOUR_RECTANGULAR_MIN_RATIO, CONTOUR_RECTANGULAR_MAX_RATIO) &&
ct->boxAreaFilter(BOXFILTER_TOLERANCE) &&
ct->histogramMatchingFilter(src,testImageHistogram, HIST_H_BINS,HIST_S_BINS,HIST_MIN)){
//if passed filters
ct->printContour(3,cvScalar(127,127,0,0),
contourImage);
//get contour bounding box
boundingRect=cvBoundingRect(ct->getContour(),0);
cvRectangle(contourImage,cvPoint(boundingRect.x,boundingRect.y),
cvPoint(boundingRect.x+boundingRect.width,
boundingRect.y+boundingRect.height),
_GREEN,1,8,0);
//build garbage List
//printf(" c %d,%d\n",boundingRect.x,boundingRect.y);
utils::MinimalBoundingRectangle * r = new utils::MinimalBoundingRectangle(boundingRect.x,
boundingRect.y,boundingRect.width,boundingRect.height);
utils::Garbage * aGarbage = new utils::Garbage(r);
garbageList.push_back(aGarbage);
}
delete ct;
cvReleaseMemStorage( &aContour->storage );
contours=contours->h_next;
cont_index++;
}
// cvShowImage("output",contourImage);
// cvWaitKey(0);
delete h;
cvReleaseHist(&testImageHistogram);
//Image for thresholding
//cvReleaseMemStorage( &contours->storage );
cvReleaseImage(&threshImage);
cvReleaseImage(&equalizedImage);
cvReleaseImage(&morphImage);
cvReleaseImage(&smoothImage);
cvReleaseImage(&contourImage);
cvReleaseImage(&hsv);
cvReleaseImage(&h_plane);
cvReleaseImage(&s_plane);
cvReleaseImage(&v_plane);
return garbageList;
}
} /* End of namespace utils */
|
[
"NulDiego@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a"
] |
[
[
[
1,
232
]
]
] |
842208b8de26a8b4d26ab7715f4ca3ea7e3d84cd
|
f177993b13e97f9fecfc0e751602153824dfef7e
|
/ImProSln/DXRender/DXRenderDisplay.cpp
|
43f406e5ef0201082131cd7ef6fadb74fde3b06b
|
[] |
no_license
|
svn2github/imtophooksln
|
7bd7412947d6368ce394810f479ebab1557ef356
|
bacd7f29002135806d0f5047ae47cbad4c03f90e
|
refs/heads/master
| 2020-05-20T04:00:56.564124 | 2010-09-24T09:10:51 | 2010-09-24T09:10:51 | 11,787,598 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,160 |
cpp
|
#include "StdAfx.h"
#include "DXRenderDisplay.h"
DXRenderDisplay::DXRenderDisplay(IDirect3D9* pD3D, UINT rtWidth, UINT rtHeight)
: MS3DDisplay(pD3D, rtWidth, rtHeight)
{
HRESULT hr = S_OK;
m_bDrawFPS = false;
m_bFlipX = false;
m_bFlipY = false;
m_sampleType = 0;
m_pD3DFont = NULL;
hr = D3DXCreateFont(m_pDevice, 35, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, L"System", &m_pD3DFont );
lasttime = timeGetTime();
currtime = timeGetTime();
count = 0;
fps = 0;
imgW = 0;
imgH = 0;
}
DXRenderDisplay::DXRenderDisplay(IDirect3DDevice9* pDevice, UINT rtWidth, UINT rtHeight)
: MS3DDisplay(pDevice, rtWidth, rtHeight)
{
HRESULT hr = S_OK;
m_bDrawFPS = false;
m_bFlipX = false;
m_bFlipY = false;
m_sampleType = 0;
m_pD3DFont = NULL;
hr = D3DXCreateFont(m_pDevice, 35, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, L"System", &m_pD3DFont );
lasttime = timeGetTime();
currtime = timeGetTime();
count = 0;
fps = 0;
imgW = 0;
imgH = 0;
}
DXRenderDisplay::~DXRenderDisplay(void)
{
if (m_pD3DFont != NULL)
{
m_pD3DFont->Release();
m_pD3DFont = NULL;
}
}
BOOL DXRenderDisplay::Render()
{
CAutoLock lck(&m_csResetDevice);
if (m_pDisplayPlane == NULL)
{
return FALSE;
}
HRESULT hr = S_OK;
hr = m_pDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(50,50,50), 1.0f, 0 );
m_pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
ID3DXEffect* pEffect = GetEffect();
if (pEffect == NULL)
{
return FALSE;
}
m_pCamera->CameraOn();
UINT iPass, cPasses = 0;
if( SUCCEEDED( m_pDevice->BeginScene() ) )
{
hr = pEffect->SetTexture("g_Texture", m_pTexture);
hr = pEffect->SetTechnique("technique0");
hr = pEffect->SetBool("bFlipX", m_bFlipX);
hr = pEffect->SetBool("bFlipY", m_bFlipY);
hr = pEffect->SetInt("g_sampleType", m_sampleType);
hr = pEffect->Begin(&cPasses, 0);
for (iPass = 0; iPass < cPasses; iPass++)
{
hr = pEffect->BeginPass(iPass);
m_pDisplayPlane->Render();
hr = pEffect->EndPass();
}
hr = pEffect->End();
if (m_bDrawFPS)
{
if (imgW == 0 && imgH == 0)
{
LPDIRECT3DSURFACE9 pBackBuffer = NULL;
D3DSURFACE_DESC desc;
m_pDevice->GetRenderTarget(0,&pBackBuffer);
pBackBuffer->GetDesc(&desc);
imgW = desc.Width;
imgH = desc.Height;
pBackBuffer->Release();
pBackBuffer = NULL;
}
count++;
if (count%30 == 0)
{
currtime = timeGetTime();
float dt = max(1, currtime - lasttime) / 1000.0;
fps = 30.0 / dt;
count = 0;
lasttime = currtime;
}
WCHAR str[MAX_PATH] = {0};
RECT rect;
rect.left = 0.05*imgW; rect.right = rect.left + 0.1*imgW; rect.top = 0.05*imgH; rect.bottom = rect.top + 0.1*imgH;
swprintf_s(str, MAX_PATH, L"FPS: %.1f", fps);
if (m_pD3DFont != NULL)
{
hr = m_pD3DFont->DrawTextW(NULL, str, -1, &rect, DT_NOCLIP | DT_LEFT | DT_TOP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
}
}
hr = m_pDevice->EndScene();
}
m_pDevice->Present(NULL,NULL,NULL,NULL);
m_pCamera->CameraOff();
m_pDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
return TRUE;
}
BOOL DXRenderDisplay::Render(IDirect3DBaseTexture9* pTexture)
{
return FALSE;
}
BOOL DXRenderDisplay::Render(IDirect3DBaseTexture9* pTexture, ID3DXEffect* pEffect)
{
return FALSE;
}
ID3DXEffect* DXRenderDisplay::GetEffect()
{
if (m_pEffect == NULL)
{
extern HMODULE GetModule();
DWORD dwShaderFlags = D3DXFX_NOT_CLONEABLE ;
D3DCAPS9 cap;
m_pDevice->GetDeviceCaps(&cap);
if (cap.PixelShaderVersion < D3DPS_VERSION(2,0))
{
dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
}
if (cap.VertexShaderVersion < D3DVS_VERSION(2,0))
{
dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
}
WCHAR str[MAX_PATH] = {0};
HMODULE module = GetModule();
GetModuleFileName(module, str, MAX_PATH);
// Gets filename
WCHAR* pszFile = wcsrchr(str, '\\');
pszFile++; // Moves on from \
// Get path
WCHAR szPath[MAX_PATH] = L"";
_tcsncat(szPath, str, pszFile - str);
swprintf_s(str, MAX_PATH, L"%s\\..\\fx\\DXRenderer.fx", szPath);
HRESULT hr = D3DXCreateEffectFromFileW( m_pDevice, str, NULL, NULL, dwShaderFlags, NULL, &m_pEffect, NULL );
if (FAILED(hr))
{
OutputDebugStringW(L"@@@@ D3DXCreateEffectFromFileW Failed in DXRenderDisplay::GetEffect()\n");
return NULL;
}
}
return m_pEffect;
}
HRESULT DXRenderDisplay::OnBeforeResetDevice(IDirect3DDevice9 * pd3dDevice,
void* pUserContext)
{
HRESULT hr = S_OK;
if (m_pD3DFont != NULL)
{
hr = m_pD3DFont->OnLostDevice();
}
return __super::OnBeforeResetDevice(pd3dDevice, pUserContext);
}
HRESULT DXRenderDisplay::OnAfterResetDevice(IDirect3DDevice9 * pd3dDevice,
void* pUserContext)
{
HRESULT hr = S_OK;
if (m_pD3DFont != NULL)
{
hr = m_pD3DFont->OnResetDevice();
}
return __super::OnAfterResetDevice(pd3dDevice, pUserContext);
}
|
[
"ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a"
] |
[
[
[
1,
196
]
]
] |
18534aa9c273bcb3f84a93c9b5bd9364152e24e0
|
478570cde911b8e8e39046de62d3b5966b850384
|
/apicompatanamdw/bcdrivers/app/location/landmarks_ui_selector_api/BcAppLmkSelector/src/LmkEngine.cpp
|
c7e2e0d3180c7056a89383f7414d913effec7270
|
[] |
no_license
|
SymbianSource/oss.FCL.sftools.ana.compatanamdw
|
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
|
1169475bbf82ebb763de36686d144336fcf9d93b
|
refs/heads/master
| 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,843 |
cpp
|
/*
* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: ?Description
*
*/
// INCLUDE FILES
#include "LmkEngine.h"
// EXTERNAL DATA STRUCTURES
//extern ?external_data;
// EXTERNAL FUNCTION PROTOTYPES
//extern ?external_function( ?arg_type,?arg_type );
// CONSTANTS
//const ?type ?constant_var = ?constant;
// MACROS
//#define ?macro ?macro_def
// LOCAL CONSTANTS AND MACROS
//const ?type ?constant_var = ?constant;
//#define ?macro_name ?macro_def
// MODULE DATA STRUCTURES
//enum ?declaration
//typedef ?declaration
// LOCAL FUNCTION PROTOTYPES
//?type ?function_name( ?arg_type, ?arg_type );
// FORWARD DECLARATIONS
//class ?FORWARD_CLASSNAME;
// ============================= LOCAL FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// ?function_name ?description.
// ?description
// Returns: ?value_1: ?description
// ?value_n: ?description_line1
// ?description_line2
// -----------------------------------------------------------------------------
//
/*
?type ?function_name(
?arg_type arg, // ?description
?arg_type arg) // ?description
{
?code // ?comment
// ?comment
?code
}
*/
TTypeUid::Ptr CLmkEngine::MopSupplyObject(TTypeUid /*aId*/)
{
}
MObjectProvider* CLmkEngine::MopNext()
{
return NULL;
}
// End of File
|
[
"none@none"
] |
[
[
[
1,
83
]
]
] |
c4f196daaf3586ac6b17422d87b2ed35efa607f5
|
7b379862f58f587d9327db829ae4c6493b745bb1
|
/JuceLibraryCode/modules/juce_gui_basics/buttons/juce_HyperlinkButton.h
|
1501f3f9fd54d7d47457b2f69fe57f1f643c13ca
|
[] |
no_license
|
owenvallis/Nomestate
|
75e844e8ab68933d481640c12019f0d734c62065
|
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
|
refs/heads/master
| 2021-01-19T07:35:14.301832 | 2011-12-28T07:42:50 | 2011-12-28T07:42:50 | 2,950,072 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,424 |
h
|
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_HYPERLINKBUTTON_JUCEHEADER__
#define __JUCE_HYPERLINKBUTTON_JUCEHEADER__
#include "juce_Button.h"
//==============================================================================
/**
A button showing an underlined weblink, that will launch the link
when it's clicked.
@see Button
*/
class JUCE_API HyperlinkButton : public Button
{
public:
//==============================================================================
/** Creates a HyperlinkButton.
@param linkText the text that will be displayed in the button - this is
also set as the Component's name, but the text can be
changed later with the Button::getButtonText() method
@param linkURL the URL to launch when the user clicks the button
*/
HyperlinkButton (const String& linkText,
const URL& linkURL);
/** Destructor. */
~HyperlinkButton();
//==============================================================================
/** Changes the font to use for the text.
If resizeToMatchComponentHeight is true, the font's height will be adjusted
to match the size of the component.
*/
void setFont (const Font& newFont,
bool resizeToMatchComponentHeight,
const Justification& justificationType = Justification::horizontallyCentred);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the link.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
textColourId = 0x1001f00, /**< The colour to use for the URL text. */
};
//==============================================================================
/** Changes the URL that the button will trigger. */
void setURL (const URL& newURL) noexcept;
/** Returns the URL that the button will trigger. */
const URL& getURL() const noexcept { return url; }
//==============================================================================
/** Resizes the button horizontally to fit snugly around the text.
This won't affect the button's height.
*/
void changeWidthToFitText();
protected:
//==============================================================================
/** @internal */
void clicked();
/** @internal */
void colourChanged();
/** @internal */
void paintButton (Graphics& g,
bool isMouseOverButton,
bool isButtonDown);
private:
//==============================================================================
URL url;
Font font;
bool resizeFont;
Justification justification;
Font getFontToUse() const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HyperlinkButton);
};
#endif // __JUCE_HYPERLINKBUTTON_JUCEHEADER__
|
[
"ow3nskip"
] |
[
[
[
1,
117
]
]
] |
6f1148a3b1041136f1cd79384e33fc4039d3bebd
|
0c930838cc851594c9eceab6d3bafe2ceb62500d
|
/src/jflow/bridge.cpp
|
33a9cdcbc2a748c875b5ce23e4d2d07d4bb0a807
|
[
"BSD-3-Clause"
] |
permissive
|
quantmind/jflib
|
377a394c17733be9294bbf7056dd8082675cc111
|
cc240d2982f1f1e7e9a8629a5db3be434d0f207d
|
refs/heads/master
| 2021-01-19T07:42:43.692197 | 2010-04-19T22:04:51 | 2010-04-19T22:04:51 | 439,289 | 4 | 3 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,023 |
cpp
|
#include <jflib/timeseries/brownian_bridge.hpp>
#include <cmath>
namespace jflib {
BrownianBridge::BrownianBridge(unsigned siz):
m_index(siz),m_left(siz),m_right(siz),
m_leftWeight(siz),m_rightWeight(siz),m_stdev(siz) {
QM_REQUIRE(siz>0,"There must be at least a step");
doit();
}
void BrownianBridge::doit() {
unsigned steps = this->size();
indextype map(steps);
for(unsigned i=0;i<steps;++i) map[i] = 0;
unsigned i,j,k,l;
double den,rw;
map[steps-1] = 1;
m_index[0] = steps-1;
m_stdev[0] = std::sqrt(double(steps));
m_left[0] = m_right[0] = 0;
m_leftWeight[0] = m_rightWeight[0] = 0.;
for(j=0,i=1;i<steps;++i) {
while(map[j]) ++j;
k = j;
while(!map[k]) ++k;
l = j + ((k-1-j)>>1);
map[l] = i;
den = 1./(k+1.-j);
rw = (l+1.-j)*den;
m_index[i] = l;
m_left[i] = j;
m_right[i] = k;
m_leftWeight[i] = (k-l)*den;
m_rightWeight[i] = rw;
m_stdev[i] = std::sqrt(rw*(k-l));
j = k+1;
if(j>=steps) j=0;
}
}
}
|
[
"[email protected]"
] |
[
[
[
1,
49
]
]
] |
f1a0256309e5b75cc364bc1d2a855727a82138ca
|
808759cae03d5092e440209826ed1a4c6d7e3982
|
/projects/physics/gafferongames/Integration.cpp
|
f6cd51af373f08e5eb58d925e36ef716e92261a4
|
[] |
no_license
|
michelemendel/misc
|
9244b3a32b05b74a5fc59a84432f9121022bb574
|
b0919ce839f35e9ac894ae7a5336f2e4f4513be4
|
refs/heads/master
| 2023-06-25T01:45:36.310134 | 2009-12-18T08:17:44 | 2009-12-18T08:17:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,557 |
cpp
|
// Simple RK4 integration framework
// Copyright (c) 2004, Glenn Fiedler
// http://www.gaffer.org/articles
#include <stdio.h>
#include <math.h>
struct State
{
float x;
float v;
};
struct Derivative
{
float dx;
float dv;
};
void integrate(State &state, float t, float dt)
{
Derivative a = evaluate(state, t);
Derivative b = evaluate(state, t, dt*0.5f, a);
Derivative c = evaluate(state, t, dt*0.5f, b);
Derivative d = evaluate(state, t, dt, c);
const float dxdt = 1.0f/6.0f * (a.dx + 2.0f*(b.dx + c.dx) + d.dx);
const float dvdt = 1.0f/6.0f * (a.dv + 2.0f*(b.dv + c.dv) + d.dv);
state.x = state.x + dxdt*dt;
state.v = state.v + dvdt*dt;
}
Derivative evaluate(const State &initial, float t)
{
Derivative output;
output.dx = initial.v;
output.dv = acceleration(initial, t);
return output;
}
Derivative evaluate(const State &initial, float t, float dt, const Derivative &d)
{
State state;
state.x = initial.x + d.dx*dt;
state.v = initial.v + d.dv*dt;
Derivative output;
output.dx = state.v;
output.dv = acceleration(state, t+dt);
return output;
}
float acceleration(const State &state, float t)
{
const float k = 10;
const float b = 1;
return - k*state.x - b*state.v;
}
int main()
{
State state;
state.x = 100;
state.v = 0;
float t = 0;
float dt = 0.1f;
while (fabs(state.x)>0.001f || fabs(state.v)>0.001f)
{
printf("%.2f, %.2f\n", state.x, state.v);
integrate(state, t, dt);
t += dt;
}
getc(stdin);
return 0;
}
|
[
"[email protected]"
] |
[
[
[
1,
82
]
]
] |
4b8104d857e399be959d4c5e2d855bf81737032d
|
3bfc30f7a07ce0f6eabcd526e39ba1030d84c1f3
|
/BlobbyWarriors/Source/BlobbyWarriors/UI/Graphics/MouseHandler.cpp
|
cec0801d2b92aeebf7e1bb6f954d331d2999e4da
|
[] |
no_license
|
visusnet/Blobby-Warriors
|
b0b70a0b4769b60d96424b55ad7c47b256e60061
|
adec63056786e4e8dfcb1ed7f7fe8b09ce05399d
|
refs/heads/master
| 2021-01-19T14:09:32.522480 | 2011-11-29T21:53:25 | 2011-11-29T21:53:25 | 2,850,563 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,501 |
cpp
|
#include "MouseHandler.h"
MouseHandler* MouseHandler::getInstance()
{
static Guard guard;
if(MouseHandler::instance == 0) {
MouseHandler::instance = new MouseHandler();
}
return MouseHandler::instance;
}
void MouseHandler::onMouseButton(int button, int state, int x, int y)
{
this->buttonStates[button] = state == 0;
MouseEventArgs *eventArgs = new MouseEventArgs();
eventArgs->type = MOUSE_BUTTON_STATE_CHANGED;
eventArgs->button = button;
eventArgs->state = state;
eventArgs->x = x;
eventArgs->y = y;
this->notify(static_cast<UpdateData*>(eventArgs));
if (eventArgs != 0) {
delete eventArgs;
}
}
void MouseHandler::onMouseMove(int x, int y)
{
this->position.Set(float(x), float(y));
MouseEventArgs *eventArgs = new MouseEventArgs();
eventArgs->type = MOUSE_POSITION_CHANGED;
eventArgs->button = -1;
eventArgs->state = -1;
eventArgs->x = x;
eventArgs->y = y;
this->notify(static_cast<UpdateData*>(eventArgs));
if (eventArgs != 0) {
delete eventArgs;
}
}
bool MouseHandler::isButtonPressed(int button)
{
return this->buttonStates[button];
}
b2Vec2 MouseHandler::getPosition()
{
return this->position;
}
MouseHandler::MouseHandler()
{
this->position = b2Vec2(0.0f, 0.0f);
this->buttonStates[MOUSE_BUTTON_LEFT] = false;
this->buttonStates[MOUSE_BUTTON_MIDDLE] = false;
this->buttonStates[MOUSE_BUTTON_RIGHT] = false;
}
MouseHandler::~MouseHandler()
{
}
MouseHandler* MouseHandler::instance = 0;
|
[
"[email protected]"
] |
[
[
[
1,
65
]
]
] |
056cf95e765c9ff22b8aeab9c763b3dd815d8b4f
|
580738f96494d426d6e5973c5b3493026caf8b6a
|
/Include/Vcl/pagitems.hpp
|
af599b7b26f67d97962d28b0b57571d2ae9b102a
|
[] |
no_license
|
bravesoftdz/cbuilder-vcl
|
6b460b4d535d17c309560352479b437d99383d4b
|
7b91ef1602681e094a6a7769ebb65ffd6f291c59
|
refs/heads/master
| 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,003 |
hpp
|
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'PagItems.pas' rev: 6.00
#ifndef PagItemsHPP
#define PagItemsHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <HTTPProd.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <CompProd.hpp> // Pascal unit
#include <WebComp.hpp> // Pascal unit
#include <HTTPApp.hpp> // Pascal unit
#include <Classes.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Pagitems
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TBasePageItemsProducer;
class PASCALIMPLEMENTATION TBasePageItemsProducer : public Compprod::TComponentsPageProducer
{
typedef Compprod::TComponentsPageProducer inherited;
private:
Webcomp::TWebComponentList* FWebPageItems;
protected:
System::TObject* __fastcall GetComponentList(void);
System::TObject* __fastcall GetDefaultComponentList(void);
DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root);
DYNAMIC void __fastcall SetChildOrder(Classes::TComponent* Component, int Order);
public:
__fastcall virtual TBasePageItemsProducer(Classes::TComponent* AOwner);
__fastcall virtual ~TBasePageItemsProducer(void);
__property Webcomp::TWebComponentList* WebPageItems = {read=FWebPageItems};
private:
void *__IGetWebComponentList; /* Webcomp::IGetWebComponentList */
void *__ITopLevelWebComponent; /* Webcomp::ITopLevelWebComponent */
public:
operator ITopLevelWebComponent*(void) { return (ITopLevelWebComponent*)&__ITopLevelWebComponent; }
operator IGetWebComponentList*(void) { return (IGetWebComponentList*)&__IGetWebComponentList; }
};
class DELPHICLASS TPageItemsProducer;
class PASCALIMPLEMENTATION TPageItemsProducer : public TBasePageItemsProducer
{
typedef TBasePageItemsProducer inherited;
private:
AnsiString FHTMLFile;
Classes::TStrings* FHTMLDoc;
void __fastcall SetHTMLFile(const AnsiString Value);
void __fastcall SetHTMLDoc(Classes::TStrings* Value);
protected:
virtual Classes::TStream* __fastcall GetTemplateStream(/* out */ bool &AOwned);
public:
__fastcall virtual TPageItemsProducer(Classes::TComponent* AOwner);
__fastcall virtual ~TPageItemsProducer(void);
__property Classes::TStrings* HTMLDoc = {read=FHTMLDoc, write=SetHTMLDoc};
__property AnsiString HTMLFile = {read=FHTMLFile, write=SetHTMLFile};
};
//-- var, const, procedure ---------------------------------------------------
} /* namespace Pagitems */
using namespace Pagitems;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // PagItems
|
[
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
] |
[
[
[
1,
87
]
]
] |
4a682c50dd42f56907454c06e1f6c5508f69601f
|
8315d01814ff9b5994ba0543cd504f16a8f471ca
|
/src/interface.h
|
90345fd201e99ed0f680aa34afa69ab7e8b8c7a5
|
[] |
no_license
|
vivek0626/iPhoneBackupRestore
|
4cde7e79ace9ce8fe8d10819d006369e427c64ed
|
09a7c2c861718abca4e7e83f9871e247c6d24d27
|
refs/heads/master
| 2021-01-15T20:13:25.989576 | 2011-02-08T16:24:19 | 2011-02-08T16:24:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 801 |
h
|
/*
* interface.h
*
* Created on: 4 jan. 2011
* Author: martijn
*/
#ifndef INTERFACE_H_
#define INTERFACE_H_
#include <iostream>
#include <gtkmm.h>
class MainWindow : public Gtk::Window{
public:
MainWindow();
~MainWindow();
private:
void OnRowToggled(const Glib::ustring& path);
bool FillTree();
class ModelColumns : public Gtk::TreeModel::ColumnRecord{
public:
Gtk::TreeModelColumn<Glib::ustring> m_col_name;
Gtk::TreeModelColumn<bool> m_col_active;
ModelColumns(){
add(m_col_active);
add(m_col_name);
}
};
ModelColumns m_Columns;
Gtk::TreeModel::Row row;
Gtk::ScrolledWindow m_ScrolledWindow;
Gtk::TreeView m_TreeView;
Glib::RefPtr<Gtk::TreeStore> m_refTreeModel;
Gtk::VBox m_VBox;
};
#endif /* INTERFACE_H_ */
|
[
"[email protected]"
] |
[
[
[
1,
42
]
]
] |
174752268a066c1946b977593abf6174698a7938
|
205069c97095da8f15e45cede1525f384ba6efd2
|
/Casino/Code/Server/Tool/DataBaseTool/BackupRestorePage.cpp
|
ed507aa772b6329f159f0aef472cef4d7fe4bd10
|
[] |
no_license
|
m0o0m/01technology
|
1a3a5a48a88bec57f6a2d2b5a54a3ce2508de5ea
|
5e04cbfa79b7e3cf6d07121273b3272f441c2a99
|
refs/heads/master
| 2021-01-17T22:12:26.467196 | 2010-01-05T06:39:11 | 2010-01-05T06:39:11 | null | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 5,898 |
cpp
|
// BackupRestorePage.cpp : 实现文件
//
#include "stdafx.h"
#include "DataBaseTool.h"
#include "BackupRestorePage.h"
#include ".\backuprestorepage.h"
// CBackupRestorePage 对话框
IMPLEMENT_DYNAMIC(CBackupRestorePage, CDialog)
CBackupRestorePage::CBackupRestorePage(CWnd* pParent /*=NULL*/)
: CDialog(CBackupRestorePage::IDD, pParent)
{
m_pInitParamter = NULL;
}
CBackupRestorePage::~CBackupRestorePage()
{
}
void CBackupRestorePage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CBackupRestorePage, CDialog)
ON_BN_CLICKED(IDC_BUTTON_BROWSEBKPATH, OnBnClickedButtonBrowsebkpath)
ON_BN_CLICKED(IDC_BUTTON_BROWSERTPATH, OnBnClickedButtonBrowsertpath)
ON_BN_CLICKED(IDC_BUTTON_BACKUP, OnBnClickedButtonBackup)
ON_BN_CLICKED(IDC_BUTTON_RESTORE, OnBnClickedButtonRestore)
END_MESSAGE_MAP()
// CBackupRestorePage 消息处理程序
void CBackupRestorePage::InitPage(CInitParamter *pInitParamter)
{
m_pInitParamter = pInitParamter;
CString strBackupPath = CString(m_pInitParamter->m_szDatabaseBackupPath) + CTime::GetCurrentTime().Format(TEXT("%Y-%m-%d %H_%M_%S.bak"));
SetDlgItemText(IDC_EDIT_BACKUPPATH, strBackupPath);
}
void CBackupRestorePage::OnBnClickedButtonBrowsebkpath()
{
CString strFilePath;
GetDlgItemText(IDC_EDIT_BACKUPPATH, strFilePath);
int pos = strFilePath.ReverseFind('\\');
if(pos != -1)
strFilePath = strFilePath.Left(pos) + "\\" ;
TCHAR szFileName[512];
_tcscpy(szFileName, CTime::GetCurrentTime().Format(TEXT("%Y-%m-%d %H_%M_%S.bak")));
CFileDialog fd(FALSE, TEXT("*.bak"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("backup files(*.bak)|*.bak|All files (*.*)|*.*||"));
fd.m_ofn.lpstrInitialDir=strFilePath;
fd.m_ofn.lpstrFile =szFileName;
fd.m_ofn.nMaxFile = 512;
if(fd.DoModal() == IDOK)
{
SetDlgItemText(IDC_EDIT_BACKUPPATH, fd.GetPathName());
}
}
void CBackupRestorePage::OnBnClickedButtonBrowsertpath()
{
CString strFilePath;
GetDlgItemText(IDC_EDIT_BACKUPPATH, strFilePath);
int pos = strFilePath.ReverseFind('\\');
if(pos != -1)
strFilePath = strFilePath.Left(pos) + "\\" ;
CFileDialog fd(TRUE, TEXT("*.bak"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("backup files(*.bak)|*.bak|All files (*.*)|*.*||"));
fd.m_ofn.lpstrInitialDir=strFilePath;
if(fd.DoModal() == IDOK)
{
SetDlgItemText(IDC_EDIT_RESTOREPATH, fd.GetPathName());
}
}
void CBackupRestorePage::OnBnClickedButtonBackup()
{
CString strFilePath;
GetDlgItemText(IDC_EDIT_BACKUPPATH, strFilePath);
if(strFilePath.GetLength() == 0)
return;
if(Database_Backup((LPCSTR)strFilePath, strFilePath.GetLength()) == 0)
{
int pos = strFilePath.ReverseFind('\\');
if(pos != -1)
strFilePath = strFilePath.Left(pos) + "\\" ;
_tcscpy(m_pInitParamter->m_szDatabaseBackupPath, (LPCSTR)strFilePath);
AfxMessageBox("备份数据成功");
}
}
void CBackupRestorePage::OnBnClickedButtonRestore()
{
if(AfxMessageBox(TEXT("还原数据库将丢失现有数据,确认执行吗?"), MB_YESNO) != IDYES)
return;
CString strFilePath;
GetDlgItemText(IDC_EDIT_RESTOREPATH, strFilePath);
if(strFilePath.GetLength() == 0)
return;
if(Database_Restore((LPCSTR)strFilePath, strFilePath.GetLength()) == 0)
{
AfxMessageBox("还原数据成功");
}
}
LONG CBackupRestorePage::Database_Backup(LPCSTR lpszPath, WORD dwPathSize)
{
//创建数据库
CDataBaseHelper ServerInfoDB;
if (ServerInfoDB.CreateInstance()==false)
{
AfxMessageBox(TEXT("数据库组件创建失败,无法获取数据库信息"));
return -1;
}
try
{
//连接数据库
ServerInfoDB->SetConnectionInfo(m_pInitParamter->m_szServerDataBaseAddr,m_pInitParamter->m_szServerDataBasePipeName,m_pInitParamter->m_wServerDataBasePort,
m_pInitParamter->m_szServerDataBaseName,m_pInitParamter->m_szServerDataBaseUser,m_pInitParamter->m_szServerDataBasePass);
if (ServerInfoDB->OpenConnection()==false)
{
AfxMessageBox(TEXT("信息数据库连接失败,无法获取数据库信息"));
return -1;
}
::DeleteFile((LPTSTR)lpszPath);
TCHAR szSQL[1024];
_sntprintf(szSQL, sizeof(szSQL),"USE master; "
"EXEC sp_dropdevice \'GServerInfo_Bak\';"
"EXEC sp_addumpdevice \'disk\', \'GServerInfo_Bak\', '%s'; "
"BACKUP DATABASE %s TO GServerInfo_Bak; ",
lpszPath,szServerInfoDB);
//执行查询
ServerInfoDB->ClearAllParameters();
ServerInfoDB->Execute(szSQL);
return 0;
}
catch (IADOError * pIADOError)
{
AfxMessageBox(pIADOError->GetErrorDescribe());
}
return -1;
}
LONG CBackupRestorePage::Database_Restore(LPCSTR lpszPath, WORD dwPathSize)
{
//创建数据库
CDataBaseHelper ServerInfoDB;
if (ServerInfoDB.CreateInstance()==false)
{
AfxMessageBox(TEXT("数据库组件创建失败,无法获取数据库信息"));
return -1;
}
try
{
//连接数据库
ServerInfoDB->SetConnectionInfo(m_pInitParamter->m_szServerDataBaseAddr,m_pInitParamter->m_szServerDataBasePipeName,
m_pInitParamter->m_wServerDataBasePort,
"master",m_pInitParamter->m_szServerDataBaseUser,m_pInitParamter->m_szServerDataBasePass);
if (ServerInfoDB->OpenConnection()==false)
{
AfxMessageBox(TEXT("信息数据库连接失败,无法获取数据库信息"));
return -1;
}
TCHAR szSQL[1024];
_sntprintf(szSQL, sizeof(szSQL),"USE master; "
"EXEC sp_dropdevice \'GServerInfo_Bak\';"
"EXEC sp_addumpdevice \'disk\', \'GServerInfo_Bak\', '%s'; "
"RESTORE DATABASE %s FROM GServerInfo_Bak WITH REPLACE; ",
lpszPath,szServerInfoDB,szServerInfoDB,szServerInfoDB);
//执行查询
ServerInfoDB->ClearAllParameters();
ServerInfoDB->Execute(szSQL);
return 0;
}
catch (IADOError * pIADOError)
{
AfxMessageBox(pIADOError->GetErrorDescribe());
}
return -1;
}
|
[
"[email protected]"
] |
[
[
[
1,
200
]
]
] |
aac4c62155b4a8cc5a876975a3d6741d78f04ff0
|
f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0
|
/Depend/MyGUI/MyGUIEngine/src/MyGUI_ResourceManualFont.cpp
|
a08f56e129dfbc79eff7bef0be4bfdacd2f095ed
|
[] |
no_license
|
lxinhcn/starworld
|
79ed06ca49d4064307ae73156574932d6185dbab
|
86eb0fb8bd268994454b0cfe6419ffef3fc0fc80
|
refs/heads/master
| 2021-01-10T07:43:51.858394 | 2010-09-15T02:38:48 | 2010-09-15T02:38:48 | 47,859,019 | 2 | 1 | null | null | null | null |
WINDOWS-1251
|
C++
| false | false | 5,386 |
cpp
|
/*!
@file
@author Albert Semenov
@date 06/2009
*/
/*
This file is part of MyGUI.
MyGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MyGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MyGUI_Precompiled.h"
#include "MyGUI_ResourceManualFont.h"
#include "MyGUI_SkinManager.h"
#include "MyGUI_RenderManager.h"
#include "MyGUI_TextureUtility.h"
namespace MyGUI
{
ResourceManualFont::ResourceManualFont() :
mDefaultHeight(0),
mTexture(nullptr)
{
}
ResourceManualFont::~ResourceManualFont()
{
}
GlyphInfo* ResourceManualFont::getGlyphInfo(Char _id)
{
for (VectorRangeInfo::iterator iter = mVectorRangeInfo.begin(); iter != mVectorRangeInfo.end(); ++iter)
{
GlyphInfo* info = iter->getInfo(_id);
if (info == nullptr) continue;
return info;
}
// при ошибках возвращаем пробел
return &mSpaceGlyphInfo;
}
void ResourceManualFont::checkTexture()
{
if (mTexture == nullptr)
{
RenderManager& render = RenderManager::getInstance();
mTexture = render.getTexture(mSource);
if (mTexture == nullptr)
{
mTexture = render.createTexture(mSource);
mTexture->loadFromFile(mSource);
}
}
}
void ResourceManualFont::addGlyph(GlyphInfo* _info, Char _index, int _left, int _top, int _right, int _bottom, int _finalw, int _finalh, float _aspect, int _addHeight)
{
_info->codePoint = _index;
_info->uvRect.left = (float)_left / (float)_finalw; // u1
_info->uvRect.top = (float)(_top + _addHeight) / (float)_finalh; // v1
_info->uvRect.right = (float)( _right ) / (float)_finalw; // u2
_info->uvRect.bottom = ( _bottom + _addHeight ) / (float)_finalh; // v2
_info->width = _right - _left;
}
void ResourceManualFont::addGlyph(Char _code, const IntCoord& _coord)
{
mVectorPairCodeCoord.push_back(PairCodeCoord(_code, _coord));
}
void ResourceManualFont::initialise()
{
if (mVectorPairCodeCoord.empty()) return;
std::sort(mVectorPairCodeCoord.begin(), mVectorPairCodeCoord.end());
const IntSize& size = texture_utility::getTextureSize(mSource);
float aspect = (float)size.width / (float)size.height;
Char code = mVectorPairCodeCoord.front().code;
size_t count = mVectorPairCodeCoord.size();
size_t first = 0;
for (size_t pos = 1; pos < count; ++pos)
{
// диапазон оборвался
if (code + 1 != mVectorPairCodeCoord[pos].code)
{
addRange(mVectorPairCodeCoord, first, pos - 1, size.width, size.height, aspect);
code = mVectorPairCodeCoord[pos].code;
first = pos;
}
else
{
code ++;
}
}
addRange(mVectorPairCodeCoord, first, count - 1, size.width, size.height, aspect);
// уничтожаем буфер
VectorPairCodeCoord tmp;
std::swap(tmp, mVectorPairCodeCoord);
checkTexture();
}
void ResourceManualFont::addRange(VectorPairCodeCoord& _info, size_t _first, size_t _last, int _width, int _height, float _aspect)
{
RangeInfo range = RangeInfo(_info[_first].code, _info[_last].code);
for (size_t pos = _first; pos <= _last; ++pos)
{
GlyphInfo* info = range.getInfo(_info[pos].code);
const IntCoord& coord = _info[pos].coord;
addGlyph(info, _info[pos].code, coord.left, coord.top, coord.right(), coord.bottom(), _width, _height, _aspect);
if (_info[pos].code == FontCodeType::Space)
mSpaceGlyphInfo = *info;
}
mVectorRangeInfo.push_back(range);
}
void ResourceManualFont::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Property")
{
const std::string& key = node->findAttribute("key");
const std::string& value = node->findAttribute("value");
if (key == "Source") mSource = value;
else if (key == "DefaultHeight") mDefaultHeight = utility::parseInt(value);
}
else if (node->getName() == "Codes")
{
xml::ElementEnumerator range = node->getElementEnumerator();
while (range.next("Code"))
{
std::string range_value;
std::vector<std::string> parse_range;
// описане глифов
if (range->findAttribute("index", range_value))
{
Char id = 0;
if (range_value == "cursor")
id = FontCodeType::Cursor;
else if (range_value == "selected")
id = FontCodeType::Selected;
else if (range_value == "selected_back")
id = FontCodeType::SelectedBack;
else
id = utility::parseUInt(range_value);
addGlyph(id, utility::parseValue<IntCoord>(range->findAttribute("coord")));
}
}
}
}
// инициализируем
initialise();
}
} // namespace MyGUI
|
[
"albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c"
] |
[
[
[
1,
180
]
]
] |
8b7c42b65d432b7649fc350fc842970d19dd1a88
|
070b26919a6adff4f7d0e97c6e44d7b98272892c
|
/src/bitboard_reversi_functions.h
|
ce6ad4827be4de05f0fbceb7f69bd1036949ad63
|
[] |
no_license
|
tosik/BitboardReversi
|
9cb07aaf661cbedf70b1da27fa4afadbb8899e33
|
c12824231d80b65dca9e59a6af4410ced089971a
|
refs/heads/master
| 2021-01-25T03:48:05.004956 | 2011-08-27T16:02:49 | 2011-08-27T16:03:50 | 388,290 | 4 | 0 | null | null | null | null |
SHIFT_JIS
|
C++
| false | false | 6,440 |
h
|
/** @file
* @brief Bitboard Reversi 関数のヘッダファイル
*
* @author Toshiyuki Hirooka
*/
#pragma once
#include <stack>
#include "setting.h"
/** 藤田研究室 */
namespace Fujitalab
{
/** リバーシ */
namespace Reversi
{
// ボードの最大サイズ(Bitboard は最大 64bits の変数を用いるため、これ以上は不可能。将来的な拡張のための定数)
/** ボードのX軸最大サイズ */
const int MAX_SIZE_X = 8;
/** ボードのY軸最大サイズ */
const int MAX_SIZE_Y = 8;
/** ボードの最大サイズ */
const int MAX_SIZE = (MAX_SIZE_X*MAX_SIZE_Y);
/** Bitboard型の定義
*
* 各ビットは局面の1マスに対応している。
* 64bitを縦8横8のビット列と考える\n
* 00000000\n
* 00000000\n
* 00000000\n
* 00000000\n
* 00000000\n
* 00000000\n
* 00000000\n
* 00000000\n
*
* これは様々な場面で使われている。たとえば局面を表現するには黒のビットボードと白のビットボードの二つを用いる。
* 着手可能な座標を示す場合もビットボードで表現できる。詳しくは各定義箇所を参照のこと。
*/
typedef unsigned long long int Bitboard;
/** 簡易版Board型の定義(局面の状態)*/
typedef struct
{
/** 黒石のビットボード */
Bitboard black;
/** 白石のビットボード */
Bitboard white;
/** 手番(先手ならtrue, 後手ならfalse) */
bool current_color;
} SimpleBoard;
/** Board型の定義(局面の状態)*/
typedef struct
{
/** 黒石のビットボード */
Bitboard black;
/** 白石のビットボード */
Bitboard white;
/** 手番(先手ならtrue, 後手ならfalse) */
bool current_color;
/** 演算処理を高速に行うために使うフラグ(難しいことしてます) */
Bitboard left, right, top, bottom, lefttop, leftbottom, righttop, rightbottom;
} Board;
/** UNDOなどに用いるボードの状態を保存するスタック */
typedef std::stack<Board> BoardStack; // [TODO] 標準ライブラリを使わず、自力で実装して高速化する
/** 底2の対数を取得する
*
* @param b 対数に変換したい数値
* @return 対数に変換された値*/
int log2(Bitboard b);
/** 座標を Bitboard にする
*
* 与えた座標のビットが1,その他が0のビットボードを取得
* @param x X座標の値
* @param y Y座標の値
* @return X,Yを元に変換したビットボード
*/
Bitboard toBitboard(int x, int y);
/** ビット列のうちはじめに出現するビットだけを取得
*
* 例:01101000 -> 00001000
* @param bits ビット列
* @return はじめに出現するビットだけが1のビットボード
*/
Bitboard getFirstBit(Bitboard bits);
/** ビット列の 1 の数を取得
*
* @param n 1の数をカウントしたいビット列
* @return カウントした1の数
*/
int count(Bitboard n);
//
/** ビットボードを表示する
*
* @param b 表示したいビットボード
*/
void view(Bitboard b);
/** 着手可能な手を取得(左方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityLeft(Bitboard black, Bitboard white);
/** 着手可能な手を取得(右方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityRight(Bitboard black, Bitboard white);
/** 着手可能な手を取得(上方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityTop(Bitboard black, Bitboard white);
/** 着手可能な手を取得(下方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityBottom(Bitboard black, Bitboard white);
/** 着手可能な手を取得(左上方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityLeftTop(Bitboard black, Bitboard white);
/** 着手可能な手を取得(左下方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityLeftBottom(Bitboard black, Bitboard white);
/** 着手可能な手を取得(右上方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityRightTop(Bitboard black, Bitboard white);
/** 着手可能な手を取得(右下方向にひっくり返せる)
*
* @param black 局面の黒の状態
* @param white 局面の白の状態
* @return 着手可能な座標が1のビットボード
*/
Bitboard getMobilityRightBottom(Bitboard black, Bitboard white);
/** ビットボードを90度に回転
*
* @param board 回転させたいビットボード
* @return 回転されたビットボード
*/
Bitboard rotate(Bitboard board);
/** ビットボードをある方向へ移動する(マスキング処理を兼ねる)*/
Bitboard transferLeft(Bitboard b);
Bitboard transferRight(Bitboard b);
Bitboard transferTop(Bitboard b);
Bitboard transferBottom(Bitboard b);
Bitboard transferLeftTop(Bitboard b);
Bitboard transferLeftBottom(Bitboard b);
Bitboard transferRightTop(Bitboard b);
Bitboard transferRightBottom(Bitboard b);
// MMX が使えるか
bool isMMXEnable();
}
}
|
[
"[email protected]"
] |
[
[
[
1,
190
]
]
] |
121abeca3e95568026b9040fe8bce2e0e683aea8
|
79bee80d33168cdf24cd3ce47ecedbc7a4129ea7
|
/wiiinputTest/wiiinputTest.cpp
|
57a82682eff0a4749054ab26f07da91108790515
|
[] |
no_license
|
shuncox/wiimoteinput
|
d27d272f2621f9ee299001cd35f71b8ff18a553b
|
9a264e9ff9d578ad44b72342a76456a0940bb1c7
|
refs/heads/master
| 2020-05-17T08:31:49.341171 | 2008-06-21T04:50:11 | 2008-06-21T04:50:11 | 33,865,756 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,995 |
cpp
|
// Name: wiiinputTest.cpp
// Purpose: Wiiinput Test
// Author: Shun Cox
// $Id: wiiinputTest.cpp,v 1.2 2007/01/26 13:19:15 zhangshun Exp $
#include <wx/wx.h>
#include "wiimoteInput.h"
#include "wiiinputTest.h"
IMPLEMENT_APP(wiiinputTest)
bool wiiinputTest::OnInit()
{
// Create the main application window
wtFrame *frame = new wtFrame(_T("Wiiinput Test"));
// Show it
frame->Show(true);
// Start the event loop
return true;
}
int wiiinputTest::OnExit()
{
return 0;
}
// Event table for wtFrame
BEGIN_EVENT_TABLE(wtFrame, wxFrame)
EVT_MENU(wxID_ABOUT, wtFrame::OnAbout)
EVT_MENU(wxID_EXIT, wtFrame::OnQuit)
END_EVENT_TABLE()
wtFrame::wtFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
createControls();
initWiiinput();
}
void wtFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox(_T("Wiiinput Test 1.0"), _T("About Wiiinput Test"),
wxOK | wxICON_INFORMATION, this);
}
void wtFrame::OnQuit(wxCommandEvent& event)
{
// Destroy the frame
Close();
}
// icon file
#include "wiiinputTest.xpm"
void wtFrame::createControls(void)
{
// Set the frame icon
SetIcon(wxIcon(wiiinputTest_xpm));
// Create a menu bar
wxMenu *fileMenu = new wxMenu;
// The "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"),
wxT("About Wiiinput Test"));
fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"),
wxT("Quit Wiiinput Test"));
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help"));
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
// Create a status bar just for fun
CreateStatusBar();
SetStatusText(wxT("Welcome to Wiiinput Test!"));
// Create a text control
txtInfo = new wxTextCtrl(this, -1, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
}
void wtFrame::initWiiinput()
{
if (!wiiInput.init(static_cast<HWND>(GetHandle()))) {
txtInfo->AppendText(wxT("wiimoteInput initialization faild."));
return;
}
wiiInput[0]->setThreshold(1);
wiiInput[0]->setMode(WIIMOTE_MODE_ACC);
}
WXLRESULT wtFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
wxString str;
UINT index = wParam;
WIIMOTE_ACCELEROMETER acc;
switch (nMsg) {
case WM_WIIMOTE_BUTTON:
*txtInfo << _T("Stick[") << (long)wParam << _T("] = ") << (long)lParam << _T("\n");
break;
case WM_WIIMOTE_ACCELER:
wiiInput[index]->getAcceleration(acc);
str.Printf(_T("Xacc = %+1.4f, Yacc = %+1.4f, Zacc = %+1.4f"), acc.x, acc.y, acc.z);
SetStatusText(str);
break;
case WM_INPUT:
wiiInput.processInputMessage(wParam, lParam);
break;
}
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
|
[
"shuncox@c17cc608-022b-0410-9bd0-9d622084cd79"
] |
[
[
[
1,
123
]
]
] |
21d6d4a4a1d3b83fe73e5e6607d5f960d59969de
|
f838c6ad5dd7ffa6d9687b0eb49d5381e6f2e776
|
/branches/initial_debug/src/libwic/subbands.cpp
|
d768899d074db70e2e32c87bb1707d7754b52f33
|
[] |
no_license
|
BackupTheBerlios/wiccoder-svn
|
e773acb186aa9966eaf7848cda454ab0b5d948c5
|
c329182382f53d7a427caec4b86b11968d516af9
|
refs/heads/master
| 2021-01-11T11:09:56.248990 | 2009-08-19T11:28:23 | 2009-08-19T11:28:23 | 40,806,440 | 0 | 0 | null | null | null | null |
WINDOWS-1251
|
C++
| false | false | 6,904 |
cpp
|
/*! \file subbands.cpp
\version 0.0.1
\author mice, ICQ: 332-292-380, mailto:[email protected]
\brief Реализация класса wic::subbands для работы с саббендами
\todo Более подробно описать файл subbands.cpp
*/
////////////////////////////////////////////////////////////////////////////////
// headers
// standard C++ library headers
// none
// libwic headers
#include <wic/libwic/subbands.h>
////////////////////////////////////////////////////////////////////////////////
// wic namespace
namespace wic {
////////////////////////////////////////////////////////////////////////////////
// subbands class public definitions
/*! \param[in] width Ширина изображения
\param[in] height Высота изображения
\param[in] lvls Количество уровней вейвлет преобразования
*/
subbands::subbands(const sz_t width, const sz_t height, const sz_t lvls):
_width(width), _height(height), _lvls(lvls)
{
// сохранение параметров изображения
assert(0 < _width);
assert(0 < _height);
assert(0 < _lvls);
// вычисление количества саббендов
_mcount = SUBBANDS_ON_LEVEL * _lvls;
_count = _mcount + SUBBANDS_ON_0_LEVEL;
// выделение памяти под информацию о саббендах
_sb = new subband_t[_count];
assert(0 != _sb); // для отладки
if (0 == _sb) throw std::bad_alloc();
// координаты HH саббенда
sz_t x_min = _width / 2;
sz_t y_min = _height / 2;
sz_t x_max = _width - 1;
sz_t y_max = _height - 1;
// заполнения информации о саббендах (кроме LL)
for (sz_t lvl = _lvls; 0 < lvl; --lvl) {
_mk_lvl(lvl, x_min, y_min, x_max, y_max);
x_max = x_min - 1;
y_max = y_min - 1;
x_min /= 2;
y_min /= 2;
}
// количество деревьев в разложении
_LL_width = (x_max + 1);
_LL_height = (y_max + 1);
const sz_t trees_count = _LL_width * _LL_height;
// заполнения информации о LL саббенде
subband_t &sb_ll = subbands::get_LL();
sb_ll.x_min = 0;
sb_ll.y_min = 0;
sb_ll.x_max = x_max;
sb_ll.y_max = y_max;
sb_ll.count = trees_count;
sb_ll.prnt = 0;
sb_ll.lvl = 0;
sb_ll.i = 0;
// подсчёт количества узлов приходяшегося на одно дерево в саббенде
for (sz_t i = 0; _count > i; ++i) {
subband_t &sb = subbands::get(i);
sb.width = (sb.x_max - sb.x_min + 1);
sb.height = (sb.y_max - sb.y_min + 1);
sb.tree_w = sb.width / _LL_width;
sb.tree_h = sb.height / _LL_height;
sb.npt = sb.tree_w * sb.tree_h;
}
}
/*! Освобождает память, выделенную под информацию о саббендах
*/
subbands::~subbands() {
if (0 != _sb) delete[] _sb;
}
/*! \param[in] lvl Номер уровня, количество саббендов на котором необходимо
узнать.
\return Количество саббендов на уровне
*/
sz_t subbands::subbands_on_lvl(const sz_t lvl) const
{
assert(0 <= lvl && lvl <= _lvls);
if (LVL_0 == lvl) return SUBBANDS_ON_0_LEVEL;
return SUBBANDS_ON_LEVEL;
}
////////////////////////////////////////////////////////////////////////////////
// subbands class protected definitions
/*! \param[in] i Номер (индекс) саббенда
\return Указатель на саббенд с указанным индексом
Саббенды индексируются по рекурсивному зигзагу. LL саббенд имеет
индекс 0, самый большой HH саббенд имеет наибольший индекс.
*/
subbands::subband_t *subbands::_get(const sz_t i) const {
assert(0 <= i && i < _count);
if (0 == i) return (_sb + _mcount);
return (_sb + (i - SUBBANDS_ON_0_LEVEL));
}
/*! \param[in] lvl Уровень разложения
\param[in] i Номер саббеда на уровня <i>lvl</i>
Уровень разложения - число от 0 до количества уровней разложения
(включительно). На уровне 0 находится только один LL саббенд и
параметр \c i не учитывается. Чем больше размер уровня (площадь его
саббендов), тем больше его номер.
Саббенды внутри уровня нумеруются по зигзагу:
- HL саббенд имеет индекс 0 (константа subbands::SUBBAND_HL)
- LH саббенд имеет индекс 1 (константа subbands::SUBBAND_LH)
- HH саббенд имеет индекс 2 (константа subbands::SUBBAND_HH)
*/
subbands::subband_t *subbands::_get(const sz_t lvl, const sz_t i) const
{
assert(LVL_0 <= lvl && lvl <= _lvls);
assert(0 <= i && i < SUBBANDS_ON_LEVEL);
if (0 == lvl) return (_sb + _mcount);
const sz_t k = (lvl - 1) * SUBBANDS_ON_LEVEL + i;
assert(0 <= k && k <= _count);
return (_sb + k);
}
/*! \param[in] lvl Уровень вейвлет преобразования
\param[in] x_min Координата HH саббенда
\param[in] y_min Координата HH саббенда
\param[in] x_max Координата HH саббенда
\param[in] y_max Координата HH саббенда
*/
void subbands::_mk_lvl(const sz_t lvl,
const sz_t x_min, const sz_t y_min,
const sz_t x_max, const sz_t y_max)
{
// количество коэффициентов в саббендах на этом уровне
const sz_t count = x_min * y_min;
// ссылки на HL, LH и HH саббенды этого уровня соответственно
subband_t &sb_hl = get(lvl, SUBBAND_HL);
subband_t &sb_lh = get(lvl, SUBBAND_LH);
subband_t &sb_hh = get(lvl, SUBBAND_HH);
// саббенд HL
sb_hl.x_min = x_min;
sb_hl.y_min = 0;
sb_hl.x_max = x_max;
sb_hl.y_max = y_min - 1;
sb_hl.count = count;
sb_hl.prnt = _get(lvl + LVL_PREV, SUBBAND_HL);
sb_hl.lvl = lvl;
sb_hl.i = SUBBAND_HL;
// саббенд LH
sb_lh.x_min = 0;
sb_lh.y_min = y_min;
sb_lh.x_max = x_min - 1;
sb_lh.y_max = y_max;
sb_lh.count = count;
sb_lh.prnt = _get(lvl + LVL_PREV, SUBBAND_LH);
sb_lh.lvl = lvl;
sb_lh.i = SUBBAND_LH;
// саббенд HH
sb_hh.x_min = x_min;
sb_hh.y_min = y_min;
sb_hh.x_max = x_max;
sb_hh.y_max = y_max;
sb_hh.count = count;
sb_hh.prnt = _get(lvl + LVL_PREV, SUBBAND_HH);
sb_hh.lvl = lvl;
sb_hh.i = SUBBAND_HH;
}
} // namespace wic
|
[
"wonder_mice@b1028fda-012f-0410-8370-c1301273da9f"
] |
[
[
[
1,
212
]
]
] |
7ffa7d0f3ede24767ace591ca8795877b95a4617
|
91b964984762870246a2a71cb32187eb9e85d74e
|
/SRC/OFFI SRC!/WORLDSERVER/vmlog.cpp
|
4059c7c12d25b554a3df034c68c38d7f5c149a9d
|
[] |
no_license
|
willrebuild/flyffsf
|
e5911fb412221e00a20a6867fd00c55afca593c7
|
d38cc11790480d617b38bb5fc50729d676aef80d
|
refs/heads/master
| 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,958 |
cpp
|
#include "stdafx.h"
#include "vmlog.h"
#include "ar.h"
#include "buffer.h"
#include "aibear.h"
#include "aibigmuscle.h"
#include "aiclockworks.h"
#include "aiguard.h"
#include "aikrrr.h"
#include "aimonster.h"
#include "aipet.h"
#include "chatting.h"
#include "guild.h"
#include "party.h"
#include "clientsock.h"
#include "clientsocke.h"
#include "user.h"
CVMLog* CVMLog::Instance()
{
static CVMLog sVMLog;
return &sVMLog;
}
void CVMLog::Log()
{
#ifndef __VM_0820
SYSTEMTIME time;
GetLocalTime( &time );
FILEOUT( "../vm.txt", "\n%d/%02d/%02d\t%02d:%02d:%02d\n", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond );
if( CBuffer::m_pHeapMng )
CBuffer::m_pHeapMng->Log();
if( CAr::m_pHeapMng )
CAr::m_pHeapMng->Log();
if( CAIBear::m_pPool )
CAIBear::m_pPool->Log( "" );
if( CAIBigMuscle::m_pPool )
CAIBigMuscle::m_pPool->Log( "" );
if( CAIClockWorks::m_pPool )
CAIClockWorks::m_pPool->Log( "" );
if( CAIGuard::m_pPool )
CAIGuard::m_pPool->Log( "" );
if( CAIKrrr::m_pPool )
CAIKrrr::m_pPool->Log( "" );
if( CAIMonster::m_pPool )
CAIMonster::m_pPool->Log( "" );
if( CAIPet::m_pPool )
CAIPet::m_pPool->Log( "" );
if( CChatting::m_pPool )
CChatting::m_pPool->Log( "" );
if( CGuildMember::sm_pPool )
CGuildMember::sm_pPool->Log( "" );
if( CGuild::sm_pPool )
CGuild::sm_pPool->Log( "" );
if( CParty::m_pPool )
CParty::m_pPool->Log( "" );
if( CBuffer2::m_pPool2 )
CBuffer2::m_pPool2->Log( "" );
if( CBuffer::m_pPool )
CBuffer::m_pPool->Log( "" );
if( CClientSock::m_pPool )
CClientSock::m_pPool->Log( "" );
if( CClientSockE::m_pPool )
CClientSockE::m_pPool->Log( "" );
if( CUser::m_pPool )
CUser::m_pPool->Log( "" );
if( CMover::m_pPool )
CMover::m_pPool->Log( "" );
if( CActionMover::m_pPool )
CActionMover::m_pPool->Log( "" );
if( CItem::m_pPool )
CItem::m_pPool->Log( "" );
#endif // __VM_0820
}
|
[
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] |
[
[
[
1,
75
]
]
] |
7204bdf73757a8f77f1bd1425d30e9563b87c70c
|
353bd39ba7ae46ed521936753176ed17ea8546b5
|
/src/layer1_system/randomizer/src/axrd_jitter.cpp
|
87ad41eafb4506d803155aa49a20aef6d06987f1
|
[] |
no_license
|
d0n3val/axe-engine
|
1a13e8eee0da667ac40ac4d92b6a084ab8a910e8
|
320b08df3a1a5254b776c81775b28fa7004861dc
|
refs/heads/master
| 2021-01-01T19:46:39.641648 | 2007-12-10T18:26:22 | 2007-12-10T18:26:22 | 32,251,179 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 696 |
cpp
|
/**
* @file
* Simple functions to add jitter to numbers
*/
#include "axrd_stdafx.h"
/**
* Apply a +-jitter to a single value
*/
AXRD_API void axrd_jitter( float& value, const float jitter, const long pos ) {
value = ( value - jitter ) + ( (float) state.get_d(pos) * (jitter * 2.0f) );
}
/**
* Apply a jitter to an array of values
*/
AXRD_API void axrd_jitter_array( float* values, const int values_count, const float jitter, const long pos ) {
register int i;
for( i = 0; i < values_count; ++i ) {
values[i] = ( values[i] - jitter ) + ( (float) state.get_d(pos) * (jitter * 2.0f) );
}
}
/* $Id: axrd_jitter.cpp,v 1.1 2004/05/02 16:32:32 doneval Exp $ */
|
[
"d0n3val@2cff7946-3f3c-0410-b79f-f9b517ddbf54"
] |
[
[
[
1,
25
]
]
] |
bf914a392b2c9a711101b0b12123c56272d8eb46
|
bef7d0477a5cac485b4b3921a718394d5c2cf700
|
/dingus/dingus/gfx/skeleton/SkinMesh.cpp
|
d19a34c8e68efcee33b5dc30c394363ec8378115
|
[
"MIT"
] |
permissive
|
TomLeeLive/aras-p-dingus
|
ed91127790a604e0813cd4704acba742d3485400
|
22ef90c2bf01afd53c0b5b045f4dd0b59fe83009
|
refs/heads/master
| 2023-04-19T20:45:14.410448 | 2011-10-04T10:51:13 | 2011-10-04T10:51:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,204 |
cpp
|
// --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------
#include "stdafx.h"
#include "SkinMesh.h"
#include "../../kernel/D3DDevice.h"
using namespace dingus;
CSkinMesh::CSkinMesh()
: mMesh(0), mSkeleton(0),
mBonesPerVertex(0)
{
mMesh = new CMesh();
}
CSkinMesh::~CSkinMesh()
{
ASSERT_MSG( !isCreated(), "skin mesh not cleaned up" );
delete mMesh;
}
void CSkinMesh::createResource( const CMesh& srcMesh, const CSkeletonInfo& skelInfo )
{
ASSERT_MSG( !isCreated(), "skin mesh not cleaned up" );
mSkeleton = &skelInfo;
//
// calculate bone palette size
mPaletteSize = 25; // TBD: better calculation of this, based on VS constant count
if( skelInfo.getBoneCount() < mPaletteSize )
mPaletteSize = skelInfo.getBoneCount();
HRESULT hr;
int ngroups = srcMesh.getGroupCount();
//
// create ID3DXMesh from our mesh
ID3DXMesh* dxSrcMesh = 0;
DWORD meshOpts = D3DXMESH_SYSTEMMEM;
if( srcMesh.getIndexStride() == 4 )
meshOpts |= D3DXMESH_32BIT;
// get declaration
D3DVERTEXELEMENT9 decl[MAX_FVF_DECL_SIZE];
UINT numElements;
srcMesh.getVertexDecl().getObject()->GetDeclaration( decl, &numElements );
// re-cast d3dcolor in decl into ubyte4
D3DVERTEXELEMENT9* declP = decl;
while( declP->Stream != 0xFF ) {
if( declP->Usage == D3DDECLUSAGE_BLENDINDICES && declP->UsageIndex == 0 )
declP->Type = D3DDECLTYPE_UBYTE4;
++declP;
}
// create mesh
hr = D3DXCreateMesh(
srcMesh.getIndexCount()/3, srcMesh.getVertexCount(), meshOpts,
decl, &CD3DDevice::getInstance().getDevice(), &dxSrcMesh );
// copy VB
{
const void* srcVB = srcMesh.lockVBRead();
void* dxVB = 0;
hr = dxSrcMesh->LockVertexBuffer( 0, &dxVB );
memcpy( dxVB, srcVB, srcMesh.getVertexCount() * srcMesh.getVertexStride() );
hr = dxSrcMesh->UnlockVertexBuffer();
srcMesh.unlockVBRead();
}
// copy IB
{
const void* srcIB = srcMesh.lockIBRead();
void* dxIB = 0;
hr = dxSrcMesh->LockIndexBuffer( 0, &dxIB );
memcpy( dxIB, srcIB, srcMesh.getIndexCount() * srcMesh.getIndexStride() );
hr = dxSrcMesh->UnlockIndexBuffer();
srcMesh.unlockIBRead();
}
// copy groups and set up src bone combo table
D3DXBONECOMBINATION* srcBoneCombs = new D3DXBONECOMBINATION[ngroups];
DWORD* boneArray = new DWORD[skelInfo.getBoneCount()];
for( int b = 0; b < skelInfo.getBoneCount(); ++b )
boneArray[b] = b;
{
D3DXATTRIBUTERANGE* attrs = new D3DXATTRIBUTERANGE[ngroups];
DWORD* attrBuf = 0;
dxSrcMesh->LockAttributeBuffer( 0, &attrBuf );
for( int g = 0; g < ngroups; ++g ) {
attrs[g].AttribId = g;
const CMesh::CGroup& group = srcMesh.getGroup(g);
attrs[g].VertexStart = group.getFirstVertex();
attrs[g].VertexCount = group.getVertexCount();
attrs[g].FaceStart = group.getFirstPrim();
attrs[g].FaceCount = group.getPrimCount();
srcBoneCombs[g].AttribId = g;
srcBoneCombs[g].FaceStart = group.getFirstPrim();
srcBoneCombs[g].FaceCount = group.getPrimCount();
srcBoneCombs[g].VertexStart = group.getFirstVertex();
srcBoneCombs[g].VertexCount = group.getVertexCount();
srcBoneCombs[g].BoneId = boneArray;
for( int f = 0; f < group.getPrimCount(); ++f )
*attrBuf++ = g;
}
dxSrcMesh->UnlockAttributeBuffer();
hr = dxSrcMesh->SetAttributeTable( attrs, ngroups );
delete[] attrs;
}
//
// create ID3DXSkinInfo from the created mesh
ID3DXSkinInfo* dxSkin;
hr = D3DXCreateSkinInfoFromBlendedMesh( dxSrcMesh, skelInfo.getBoneCount(), srcBoneCombs, &dxSkin );
delete[] boneArray;
delete[] srcBoneCombs;
//
// convert to indexed blended mesh, with possibly multiple bone palettes
DWORD* srcMeshAdjacency = new DWORD[srcMesh.getIndexCount()/3*3];
hr = dxSrcMesh->GenerateAdjacency( 1.0e-6f, srcMeshAdjacency );
DWORD* resMeshAdjacency = new DWORD[srcMesh.getIndexCount()/3*3];
DWORD maxBonesPerVertUsed = 0;
DWORD boneComboCount = 0;
ID3DXBuffer* boneCombos = 0;
ID3DXMesh* dxResMesh = 0;
dxSkin->ConvertToIndexedBlendedMesh(
dxSrcMesh, /*meshOpts*/0, mPaletteSize,
srcMeshAdjacency, resMeshAdjacency, NULL, NULL,
&maxBonesPerVertUsed, &boneComboCount, &boneCombos, &dxResMesh );
mBonesPerVertex = maxBonesPerVertUsed;
delete[] srcMeshAdjacency;
// re-cast ubyte4 in decl into d3dcolor
hr = dxResMesh->GetDeclaration( decl );
declP = decl;
while( declP->Stream != 0xFF ) {
if( declP->Usage == D3DDECLUSAGE_BLENDINDICES && declP->UsageIndex == 0 )
declP->Type = D3DDECLTYPE_D3DCOLOR;
++declP;
}
hr = dxResMesh->UpdateSemantics( decl );
assert( dxSrcMesh->GetNumBytesPerVertex() == dxResMesh->GetNumBytesPerVertex() );
//
// optimize resulting dx mesh
hr = dxResMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_VERTEXCACHE,
resMeshAdjacency, NULL, NULL, NULL );
delete[] resMeshAdjacency;
//
// create partitioned mesh
mMesh->createResource( dxResMesh->GetNumVertices(), dxResMesh->GetNumFaces()*3,
srcMesh.getVertexFormat(), srcMesh.getIndexStride(), srcMesh.getVertexDecl(), CMesh::BUF_STATIC );
// copy VB
{
void* resVB = mMesh->lockVBWrite();
void* dxVB = 0;
hr = dxResMesh->LockVertexBuffer( D3DLOCK_READONLY, &dxVB );
memcpy( resVB, dxVB, mMesh->getVertexCount() * mMesh->getVertexStride() );
hr = dxResMesh->UnlockVertexBuffer();
mMesh->unlockVBWrite();
}
// copy IB
{
void* resIB = mMesh->lockIBWrite();
void* dxIB = 0;
hr = dxResMesh->LockIndexBuffer( D3DLOCK_READONLY, &dxIB );
memcpy( resIB, dxIB, mMesh->getIndexCount() * mMesh->getIndexStride() );
hr = dxResMesh->UnlockIndexBuffer();
mMesh->unlockIBWrite();
}
// copy groups
{
DWORD ngroups;
hr = dxResMesh->GetAttributeTable( NULL, &ngroups );
assert( ngroups == boneComboCount );
D3DXATTRIBUTERANGE* attrs = new D3DXATTRIBUTERANGE[ngroups];
hr = dxResMesh->GetAttributeTable( attrs, &ngroups );
for( DWORD g = 0; g < ngroups; ++g ) {
const D3DXATTRIBUTERANGE& gr = attrs[g];
mMesh->addGroup( CMesh::CGroup(gr.VertexStart, gr.VertexCount, gr.FaceStart, gr.FaceCount) );
}
delete[] attrs;
}
mMesh->computeAABBs();
// copy palette infos
{
const D3DXBONECOMBINATION* boneComb = reinterpret_cast<const D3DXBONECOMBINATION*>( boneCombos->GetBufferPointer() );
for( DWORD bc = 0; bc < boneComboCount; ++bc ) {
mPalettes.push_back( CSkinBonePalette() );
CSkinBonePalette& bpal = mPalettes.back();
bpal.beginPalette( boneComb->AttribId );
for( int b = 0; b < mPaletteSize; ++b )
bpal.setBone( b, boneComb->BoneId[b] );
bpal.endPalette();
++boneComb;
}
}
//
// release stuff
ULONG rc;
rc = dxSrcMesh->Release();
rc = dxSkin->Release();
rc = dxResMesh->Release();
rc = boneCombos->Release();
}
void CSkinMesh::deleteResource()
{
ASSERT_MSG( isCreated(), "skin mesh not created" );
mMesh->deleteResource();
mSkeleton = 0;
mBonesPerVertex = 0;
mPalettes.clear();
}
|
[
"[email protected]"
] |
[
[
[
1,
233
]
]
] |
07e2e6a1f5a0e051e9933ee409c812d8f92d2452
|
5ac13fa1746046451f1989b5b8734f40d6445322
|
/minimangalore/Nebula2/code/contrib/nluaserver/src/lua/ltm.cc
|
1e9c7195f1d032bbea24229312473cba862f40dc
|
[] |
no_license
|
moltenguy1/minimangalore
|
9f2edf7901e7392490cc22486a7cf13c1790008d
|
4d849672a6f25d8e441245d374b6bde4b59cbd48
|
refs/heads/master
| 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,665 |
cc
|
/*
** $Id: ltm.cc 567 2004-03-26 00:39:30Z enlight $
** Tag methods
** See Copyright Notice in lua.h
*/
#include <string.h>
#define ltm_c
#include "lua/lua.h"
#include "lua/lobject.h"
#include "lua/lstate.h"
#include "lua/lstring.h"
#include "lua/ltable.h"
#include "lua/ltm.h"
const char *const luaT_typenames[] = {
"nil", "boolean", "userdata", "number",
"string", "table", "function", "userdata", "thread"
};
void luaT_init (lua_State *L) {
static const char *const luaT_eventname[] = { /* ORDER TM */
"__index", "__newindex",
"__gc", "__mode", "__eq",
"__add", "__sub", "__mul", "__div",
"__pow", "__unm", "__lt", "__le",
"__concat", "__call"
};
int i;
for (i=0; i<TM_N; i++) {
G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
luaS_fix(G(L)->tmname[i]); /* never collect these names */
}
}
/*
** function to be used with macro "fasttm": optimized for absence of
** tag methods
*/
const TObject *luaT_gettm (Table *events, TMS event, TString *ename) {
const TObject *tm = luaH_getstr(events, ename);
lua_assert(event <= TM_EQ);
if (ttisnil(tm)) { /* no tag method? */
events->flags |= cast(lu_byte, 1u<<event); /* cache this fact */
return NULL;
}
else return tm;
}
const TObject *luaT_gettmbyobj (lua_State *L, const TObject *o, TMS event) {
TString *ename = G(L)->tmname[event];
switch (ttype(o)) {
case LUA_TTABLE:
return luaH_getstr(hvalue(o)->metatable, ename);
case LUA_TUSERDATA:
return luaH_getstr(uvalue(o)->uv.metatable, ename);
default:
return &luaO_nilobject;
}
}
|
[
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
] |
[
[
[
1,
70
]
]
] |
a6ec017c631f4274729d3428796d3b2bf35f6279
|
c4e72d23b34be6673abd66c8e4012ed524c29dda
|
/iialib/test/socktest2.cpp
|
ea2c4b55c1905531a143ac73debfc8fe051eced3
|
[] |
no_license
|
Sevalecan/IIA
|
3fbf95dd7102ba3251ccac6d7ed6e6827cb929b1
|
3ac82e2dc11b695020ad038e7389b44c22c288d8
|
refs/heads/master
| 2020-04-25T12:35:32.665435 | 2006-05-21T01:15:29 | 2006-05-21T01:15:29 | 31,803,164 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,379 |
cpp
|
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <socket/Socket.hpp>
#include <fstream>
#include <time.h>
#include <curses.h>
#ifdef UNIX
#include <sys/time.h>
#endif
using namespace std;
using namespace IIALib::Socket;
#ifdef WINDOWS
int gettimeofday(struct timeval *tp, void *tzp)
{
LARGE_INTEGER llA, llB;
QueryPerformanceFrequency(&llA);
QueryPerformanceCounter(&llB);
tp->tv_sec = (int)(llB.QuadPart/llA.QuadPart);
//tp->tv_usec = (int)(((long double)(llB.QuadPart-(long long)tp->tv_sec)*llA.QuadPart)*((long double)1000000.0/(long double)llA.QuadPart));
tp->tv_usec = (llB.QuadPart * 1000000ull / llA.QuadPart) % 1000000ull;
return 0;
}
#endif
class TestSend
{
public:
Socket sSock;
void Send(string filename);
void Connect(string dest);
int32_t SLoop(fstream &iInFile, uint32_t iInLen);
};
void TestSend::Connect(string dest)
{
SockAddrIn v;
HostEnt he;
he.GetHostByName(dest);
v.sinAddr.sAddr = *(uint32_t *)(he.hAddrList[0].iData);
v.sinPort = htons(50500);
v.saFamily = AF_INET;
sSock.Create();
sSock.Connect(v);
return;
}
void TestSend::Send(string filename)
{
fstream out;
uint32_t len;
uint32_t loc;
uint32_t tmp;
vector<uint8_t> dat;
out.open(filename.c_str(), fstream::in | fstream::binary | fstream::out);
out.seekg(0, ios::end);
len = (uint32_t)out.tellg();
out.seekg(0, ios::beg);
//dat.resize(8*1024);
//out.read((char *)(&dat[0]), len);
tmp = filename.size()+1;
sSock.SendT(&len, 4);
sSock.SendT(&tmp, 4);
sSock.SendT((void *)filename.c_str(), tmp);
loc = 0;
SLoop(out, len);
dat.resize(0);
out.close();
return;
}
#define MBUFSIZE 8192*10
int32_t TestSend::SLoop(fstream &iInFile, uint32_t iInLen)
{
clock_t clFirst, clSecond, clFinal;
double dlFinal;
struct timeval tlFirst, tlSecond;
struct timeval tlBeg;
uint32_t ilBufLen;
uint32_t ilCurLen;
uint32_t ilCurBuf;
uint32_t ilSince;
uint32_t ilRetf;
int32_t ilError;
vector<uint8_t> vlDat;
uint8_t *alDat;
ilSince = 0;
vlDat.resize(MBUFSIZE);
alDat = &vlDat[0];
gettimeofday(&tlFirst, NULL);
tlBeg = tlFirst;
for (ilCurBuf=0;ilCurBuf<iInLen;)
{
// blargh
if ((iInLen-ilCurBuf) < MBUFSIZE)
ilCurLen = iInLen-ilCurBuf;
else
ilCurLen = MBUFSIZE;
ilBufLen = 0;
//iInFile.read((char *)&vlDat[0], ilCurLen);
iInFile.read((char *)alDat, ilCurLen);
while (ilBufLen < ilCurLen)
{
//ilRetf = sSock.Send((char *)(&vlDat[0]+ilBufLen), ilCurLen-ilBufLen);
ilRetf = sSock.Send(((char *)alDat)+ilBufLen, ilCurLen-ilBufLen);
if (ilRetf > 0)
ilBufLen += ilRetf;
else
{
#ifdef UNIX
if (errno != EWOULDBLOCK && errno != ENOBUFS && errno != EINTR)
return ilCurBuf + ilBufLen;
#elif WINDOWS
ilError = WSAGetLastError();
if (ilError != WSAEINPROGRESS && ilError != WSAEWOULDBLOCK && ilError != WSAEMSGSIZE && ilError != WSAEINTR)
return ilCurBuf + ilBufLen;
#endif
}
}
ilCurBuf += ilCurLen;
gettimeofday(&tlSecond, NULL);
if (tlSecond.tv_sec-tlFirst.tv_sec)
{
dlFinal = (double)(tlSecond.tv_sec-tlFirst.tv_sec)+(double)(tlSecond.tv_usec-tlFirst.tv_usec)/1000000;
dlFinal = (((double)ilCurBuf-(double)ilSince)/1024.0)/dlFinal;
erase();
mvprintw(0, 0, "Speed: %06.2f KB/s", dlFinal);
mvprintw(1, 0, "Progress: %02.1f%%", ((double)ilCurBuf/(double)iInLen)*100.0);
mvprintw(2, 0, "Time Elapsed: %02u:%02u", (tlSecond.tv_sec-tlBeg.tv_sec)/60, ((tlSecond.tv_sec-tlBeg.tv_sec)-((tlSecond.tv_sec-tlBeg.tv_sec)/60)*60));
refresh();
tlFirst.tv_sec = tlSecond.tv_sec;
tlFirst.tv_usec = tlSecond.tv_usec;
ilSince = ilCurBuf;
}
/*
erase();
mvprintw(0, 0, "Speed: %06.2f KB/s", dlFinal);
mvprintw(1, 0, "Progress: %02.1f%%", ((double)ilCurBuf/(double)iInLen)*100.0);
mvprintw(2, 0, "Time Elapsed: %02u:%02u", (tlSecond.tv_sec-tlBeg.tv_sec)/60, ((tlSecond.tv_sec-tlBeg.tv_sec)-((tlSecond.tv_sec-tlBeg.tv_sec)/60)*60));
refresh();
*/
}
dlFinal = (double)(tlSecond.tv_sec-tlBeg.tv_sec)+(double)(tlSecond.tv_usec-tlBeg.tv_usec)/1000000;
dlFinal = (iInLen/1024.0)/dlFinal;
erase();
mvprintw(0, 0, "Speed: %06.2f KB/s", dlFinal);
mvprintw(1, 0, "Progress: %02.1f%%", ((double)ilCurBuf/(double)iInLen)*100.0);
mvprintw(2, 0, "Time Elapsed: %02u:%02u", (tlSecond.tv_sec-tlBeg.tv_sec)/60, ((tlSecond.tv_sec-tlBeg.tv_sec)-((tlSecond.tv_sec-tlBeg.tv_sec)/60)*60));
refresh();
vlDat.resize(0);
return 0;
}
int main(int argc, char *argv[])
{
TestSend ts;
string ex;
WINDOW *plWin;
plWin = initscr();
if (argc < 3) return 0;
ex = argv[1];
Socket::Init();
ts.Connect(argv[2]);
ts.Send(ex.c_str());
ts.sSock.Close();
Socket::Fini();
refresh();
getch();
endwin();
return 0;
}
|
[
"[email protected]"
] |
[
[
[
1,
225
]
]
] |
88bb515c6d5b33e2ffe3c981c4bdd7179a7ec68d
|
3857c09b3f7eeaa8dfc7fe89af389309290ba036
|
/colormapradiobutton.cpp
|
d89e047482ba7a6f8f146f6127ca1981b015b78d
|
[] |
no_license
|
aloschilov/Test-Project
|
b4644ed6f5ef2c7f315579eef8727351be439443
|
feb48a72065b30c0788f59d506f3ae00ba7fbc30
|
refs/heads/master
| 2020-04-29T21:19:22.569644 | 2011-09-02T23:09:35 | 2011-09-02T23:09:35 | 2,173,568 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 660 |
cpp
|
#include "scale.h"
#include "colormapradiobutton.h"
using namespace std;
ColormapRadioButton::ColormapRadioButton(const QString &text,const QString &filename,QWidget *parent)
: QRadioButton(text,parent)
{
scale=0;
QImage imageToPrepareScalePoints;
imageToPrepareScalePoints.load(filename);
int width = imageToPrepareScalePoints.width();
vector<QRgb> vectorToInitScale;
for(int i=0;i<width;++i)
{
vectorToInitScale.push_back(imageToPrepareScalePoints.pixel(i,0));
}
scale = new Scale(vectorToInitScale);
connect(this,SIGNAL(toggled(bool)),this,SLOT(reemitClickedWithScale(bool)));
}
|
[
"[email protected]"
] |
[
[
[
1,
22
]
]
] |
61d7ac9de1036ab1265ae015840885aaae7d6770
|
ea12fed4c32e9c7992956419eb3e2bace91f063a
|
/zombie/code/nebula2/src/entity/nclassentityobject.cc
|
7502618e880c34082d11b3c260e942b18af92d16
|
[] |
no_license
|
ugozapad/TheZombieEngine
|
832492930df28c28cd349673f79f3609b1fe7190
|
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
|
refs/heads/master
| 2020-04-30T11:35:36.258363 | 2011-02-24T14:18:43 | 2011-02-24T14:18:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,978 |
cc
|
//------------------------------------------------------------------------------
// nclassentityobject.cc
// (c) 2006 Conjurer Services, S.A.
//------------------------------------------------------------------------------
#include "precompiled/pchnentity.h"
#include "entity/nclassentityobject.h"
#include "entity/ncomponentobjectserver.h"
//------------------------------------------------------------------------------
/**
constructor
*/
nClassEntityObject::nClassEntityObject()
{
/// empty
}
//------------------------------------------------------------------------------
/**
@brief Constructor with parameters
@param name name of the component object class
@param ks kernel server instance
@param newFunc pointer to n_create function in class package
@param native Native or runtime created component object nClass
*/
nClassEntityObject::nClassEntityObject(
const char* name,
nKernelServer * ks,
void* (*newFunc)(void),
bool native ) :
nClass(name, ks, newFunc, native)
{
/// empty
}
//------------------------------------------------------------------------------
/**
destructor
*/
nClassEntityObject::~nClassEntityObject()
{
/// empty
}
//------------------------------------------------------------------------------
/**
@brief Begin the definition of the commands for the entity object.
First of all the cmds from the components get copied, meaning BeginCmds must
be called after having set up the component id list of the entity object.
*/
void
nClassEntityObject::BeginCmds()
{
nClass::BeginCmds();
// add all the cmds from the components
if (this->IsNative())
{
int i(0);
while(i < this->compList.GetNumComponents())
{
const nComponentId & id = this->compList.GetComponentIdByIndex(i++);
nClass * cl = nComponentObjectServer::Instance()->FindClass(id);
n_assert(cl);
// add all the cmds from the component and all their parent components
while(cl)
{
this->AddCmds(cl);
this->AddScriptCmds(cl);
cl = cl->GetSuperClass();
}
}
}
}
//------------------------------------------------------------------------------
/**
@brief Begin the definition of signals for the entity object.
First of all the cmds from the components get copied, meaning BeginSignals
must be called after having set up the component id list of the entity object.
*/
void
nClassEntityObject::BeginSignals(int numSignals)
{
int ns(numSignals);
// get the number of total signals for the components and their parents
if (this->IsNative())
{
int i(0);
while(i < this->compList.GetNumComponents())
{
const nComponentId & id = this->compList.GetComponentIdByIndex(i++);
nClass * cl = nComponentObjectServer::Instance()->FindClass(id);
n_assert(cl);
while(cl)
{
ns += cl->GetNumSignals();
cl = cl->GetSuperClass();
}
}
}
nClass::BeginSignals(ns);
// add all the signals from the components
if (this->IsNative())
{
int i(0);
while(i < this->compList.GetNumComponents())
{
const nComponentId & id = this->compList.GetComponentIdByIndex(i++);
nClass * cl = nComponentObjectServer::Instance()->FindClass(id);
n_assert(cl);
// add all the cmds from the component and their parent components
while(cl)
{
this->AddSignals(cl);
cl = cl->GetSuperClass();
}
}
}
}
//------------------------------------------------------------------------------
/**
@brief Create a new component object
*/
void *
nClassEntityObject::NewObject()
{
nEntityObject * obj = (nEntityObject *) this->n_new_ptr();
n_assert(obj);
obj->AddRef();
obj->SetClass(this);
obj->SetComponentIdList(this->GetComponentIdList());
// create all the components and add them to the entity object
int i(0);
while(i < this->compList.GetNumComponents())
{
const nComponentId & id = this->compList.GetComponentIdByIndex(i++);
nComponentObject * comp = nComponentObjectServer::Instance()->New(id);
n_assert(comp);
obj->AddComponentUnsafe(comp);
}
return static_cast<nObject *> (obj);
}
//------------------------------------------------------------------------------
/**
@brief Return the list of component ids of the entity object represented
by this nClass.
*/
nComponentIdList *
nClassEntityObject::GetComponentIdList()
{
return &this->compList;
}
//------------------------------------------------------------------------------
void
nClassEntityObject::SetupComponents(const nComponentId * list)
{
n_assert(list);
this->compList.BeginComponents();
int i(0);
while(list[i] != compIdInvalid)
{
const nComponentId & compId = list[i++];
nClassComponentObject * cco = nComponentObjectServer::Instance()->FindClass(compId);
if (cco)
{
this->compList.AddComponent(compId);
// add all parents
cco = static_cast<nClassComponentObject *> (cco->GetSuperClass());
while(cco)
{
this->compList.AddParentComponent(nComponentId(cco->GetProperName()));
cco = static_cast<nClassComponentObject *> (cco->GetSuperClass());
}
}
}
this->compList.EndComponents();
}
//------------------------------------------------------------------------------
|
[
"magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91"
] |
[
[
[
1,
190
]
]
] |
389e4de3d228718402c0a026dc9294d26dfa7f9e
|
06ff805f168597297a87642c951867b453e401f7
|
/Algorithm/boost/boost/mpl/aux_/config/dtp.hpp
|
bc1ab71c775a81b9823f0dc427c38faf309cda44
|
[] |
no_license
|
fredska/algorithms
|
58459720295f8cf36edc88f68e4b37962235e533
|
10538d9677894b450f359db9301108b459b604ca
|
refs/heads/master
| 2021-01-02T09:38:34.466733 | 2011-11-09T17:32:57 | 2011-11-09T17:32:57 | 2,652,603 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,691 |
hpp
|
#ifndef BOOST_MPL_AUX_CONFIG_DTP_HPP_INCLUDED
#define BOOST_MPL_AUX_CONFIG_DTP_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id: dtp.hpp,v 1.1 2010-07-13 06:44:24 egraf Exp $
// $Date: 2010-07-13 06:44:24 $
// $Revision: 1.1 $
#include <boost/mpl/aux_/config/workaround.hpp>
// MWCW 7.x-8.0 "losts" default template parameters of nested class
// templates when their owner classes are passed as arguments to other
// templates; Borland 5.5.1 "forgets" them from the very beginning (if
// the owner class is a class template), and Borland 5.6 isn't even
// able to compile a definition of nested class template with DTP
#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& BOOST_WORKAROUND(__BORLANDC__, >= 0x560) \
&& BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610))
# define BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES
#endif
#if !defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& ( BOOST_WORKAROUND(__MWERKS__, <= 0x3001) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|| defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \
)
# define BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES
#endif
#endif // BOOST_MPL_AUX_CONFIG_DTP_HPP_INCLUDED
|
[
"[email protected]"
] |
[
[
[
1,
46
]
]
] |
973870c958e7592a871ba878081e3d2e3909f0b1
|
563e71cceb33a518f53326838a595c0f23d9b8f3
|
/v1/POC/Framework.cpp
|
ed1e8caba90434fcf2baf5e7c7eb82901c3d1462
|
[] |
no_license
|
fabio-miranda/procedural
|
3d937037d63dd16cd6d9e68fe17efde0688b5a0a
|
e2f4b9d34baa1315e258613fb0ea66d1235a63f0
|
refs/heads/master
| 2021-05-28T18:13:57.833985 | 2009-10-07T21:09:13 | 2009-10-07T21:09:13 | 39,636,279 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,845 |
cpp
|
#include "stdafx.h"
#include "Framework.h"
#include "FileHeightmap.h"
#include "Vector3.h"
#include "GL/glew.h"
#include "GL/glfw.h"
//#include "AntTweakBar.h"
#include <IL/il.h>
#include "Constants.h"
Framework::Framework(int p_width, int p_height)
{
m_width = p_width;
m_height = p_height;
//Camera
m_camera = new Camera(Vector3<float>(10, 250, 10), Vector3<float>(0,0,0));
}
void Framework::Init(){
int ok;
glfwInit();
ok = glfwOpenWindow(
m_width, m_height, // Width and height of window
8, 8, 8, // Number of red, green, and blue bits for color buffer
8, // Number of bits for alpha buffer
24, // Number of bits for depth buffer (Z-buffer)
0, // Number of bits for stencil buffer
GLFW_WINDOW // We want a desktop window (could be GLFW_FULLSCREEN)
);
// If we could not open a window, exit now
if( !ok )
{
glfwTerminate();
}
int err=glewInit();
if(err!=GLEW_OK)
{
glfwTerminate();
}
// Initialize AntTweakBar
if( !TwInit(TW_OPENGL, NULL) )
{
// A fatal error occured
glfwTerminate();
}
TwWindowSize(m_width, m_height);
//Initialize DevIL
ilInit();
// Set window title
glfwSetWindowTitle( "POC I - Fabio Miranda" );
// Enable sticky keys
glfwEnable( GLFW_STICKY_KEYS );
//glfwEnable( GLFW_KEY_REPEAT );
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_TEXTURE_2D);
m_isRunning = true;
m_colorToRender = 0;
//Menu
//m_menu = new Menu();
//Skybox
m_skybox = new Skybox();
}
int Framework::Start(){
Init();
while(m_isRunning){
DoUpdate();
DoRender();
glfwSwapBuffers();
m_isRunning = (!glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED ));
}
glfwTerminate();
TwTerminate();
return 0;
}
void Framework::GLConfig(){
double t; // Time (in seconds)
// Get current time
t = glfwGetTime();
glfwGetWindowSize( &m_width, &m_height );
glViewport( 0, 0, m_width, m_height );
// Clear color and depht buffers
glClearColor( 1.0f, 1.0f, 1.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// Set up projection matrix
glMatrixMode( GL_PROJECTION ); // Select projection matrix
glLoadIdentity(); // Start with an identity matrix
gluPerspective( // Set perspective view
90.0, // Field of view = 65 degrees
(double)m_width/(double)m_height, // Window aspect (assumes square pixels)
1.0, // Near Z clipping plane
10000.0 // Far Z clippling plane
);
// Set up modelview matrix
/*
glMatrixMode( GL_MODELVIEW ); // Select modelview matrix
glLoadIdentity(); // Start with an identity matrix
gluLookAt( // Set camera position and orientation
0.0, 0.0, 10.0, // Camera position (x,y,z)
0.0, 0.0, 0.0, // View point (x,y,z)
0.0, 1.0, 0.0 // Up-vector (x,y,z)
);
*/
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glRotatef(m_camera->m_rotation.GetX(),1.0,0.0,0.0); //rotate our camera on teh x-axis (left and right)
glRotatef(m_camera->m_rotation.GetY(),0.0,1.0,0.0); //rotate our camera on the y-axis (up and down)
glTranslated(-m_camera->m_pos.GetX(),-m_camera->m_pos.GetY(),-m_camera->m_pos.GetZ()); //translate the screen to the position of our camera
}
void Framework::DoUpdate(){
m_camera->Update();
//Keyboard
if(glfwGetKey( '1' )){
m_wireFrame = true;
}
if(glfwGetKey( '2' )){
m_wireFrame = false;
}
if(glfwGetKey( 'Z' ))
m_colorToRender = COLOR_GRAYSCALE;
else if(glfwGetKey( 'X' ))
m_colorToRender = COLOR_MIX;
else if(glfwGetKey( 'C' ))
m_colorToRender = COLOR_GREEN;
}
void Framework::DoRender(){
GLConfig();
//Light
//Framework::InitLight();
//Skybox
m_skybox->RenderSkybox(m_camera->m_pos);
m_currentNode->Render(m_wireFrame, m_colorToRender);
//See if the camera is on another node. If so, we have to generate its neighbours
if(m_currentNode->IsWithin(m_camera->m_pos) == false){
m_currentNode = m_currentNode->FindCurrentStandingNode(m_camera->m_pos);
}
// Draw tweak bars
TwDraw();
/*
for (m_iterator = m_sceneGraph.begin(); m_iterator != m_sceneGraph.end(); m_iterator++ )
{
Node& node = **m_iterator;
//cout << &node;
//cout << "\n";
node.Render();
//See if the camera is on the node
if(node.IsWithin(camera->m_pos)){
//See if the node is different from the last one (so we have to generate more patchs)
if(m_currentNode->m_position.equals(node.m_position) == false){
//cout << "caiu";
node.GenerateNeighbours(m_currentNode);
m_currentNode = &node;
}
//node.GenerateNeighbours();
}
}
*/
}
void Framework::InitLight(){
//Light
glEnable(GL_LIGHT0);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
GLfloat light_ambient[] =
{0.0, 0.0, 0.0, 1.0};
GLfloat light_diffuse[] =
{1.0, 1.0, 1.0, 1.0};
GLfloat light_specular[] =
{1.0, 1.0, 1.0, 1.0};
GLfloat light_position[] =
{0.0, -1.0, 25.0, 0.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
}
|
[
"fabiom@01b71de8-32d4-11de-96ab-f16d9912eac9"
] |
[
[
[
1,
280
]
]
] |
51a16f0388955ace97e573b58c463781d6bea4e4
|
d37a1d5e50105d82427e8bf3642ba6f3e56e06b8
|
/DVR/DemoPlayer/SetKeyDlg.cpp
|
e9320f4baa121d8328346ebbded65f117f2b9f0d
|
[] |
no_license
|
080278/dvrmd-filter
|
176f4406dbb437fb5e67159b6cdce8c0f48fe0ca
|
b9461f3bf4a07b4c16e337e9c1d5683193498227
|
refs/heads/master
| 2016-09-10T21:14:44.669128 | 2011-10-17T09:18:09 | 2011-10-17T09:18:09 | 32,274,136 | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 3,690 |
cpp
|
/////////////////////////////////////////////////////////////////////////////
// SetKeyDlg.cpp
#include "stdafx.h"
#include "player.h"
#include "SetKeyDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CSetKeyDlg::CSetKeyDlg(LONG lPort, CWnd* pParent /* = NULL */)
: CDialog(CSetKeyDlg::IDD, pParent)
, m_lPort(lPort)
{
}
CSetKeyDlg::CSetKeyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetKeyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetKeyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CSetKeyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetKeyDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetKeyDlg, CDialog)
//{{AFX_MSG_MAP(CSetKeyDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetKeyDlg message handlers
BOOL CSetKeyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CComboBox *pCombo = (CComboBox*)GetDlgItem(IDC_CB_FORMAT);
pCombo->AddString(_T("AES"));
pCombo->SetCurSel(0);
pCombo = (CComboBox*)GetDlgItem(IDC_CB_LENGTH);
pCombo->AddString(_T("128"));
pCombo->SetCurSel(0);
CButton *pRad = (CButton*)GetDlgItem(IDC_RAD_ASCII);
pRad->SetCheck(BST_CHECKED);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetKeyDlg::OnOK()
{
// TODO: Add extra validation here
char cKey[256] = {0};
GetDlgItem(IDC_EDT_KEY)->GetWindowText(cKey, 256);
int iRet = CheckKey(cKey);
if (0 == iRet)
{
MessageBox("The length of key is not correct!", "Error", MB_ICONWARNING);
return;
}
else if (-1 == iRet)
{
MessageBox("The word input is in wrong format!", "Error", MB_ICONWARNING);
return;
}
if (NAME(PlayM4_SetSecretKey(m_lPort, 1, cKey, 128)))
{
MessageBox("Secret key set succeed!", "Success", MB_ICONINFORMATION);
}
else
{
MessageBox("Secret key set failed!", "Failed", MB_ICONINFORMATION);
return;
}
CDialog::OnOK();
}
int CSetKeyDlg::CheckKey(PSTR szKey)
{
int iLength = strlen(szKey);
BOOL bASCII = TRUE;
CButton *pRad = (CButton*)GetDlgItem(IDC_RAD_ASCII);
if (BST_CHECKED != pRad->GetCheck()) //16进制模式
{
bASCII = FALSE;
}
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_CB_LENGTH);
int iCurSel = pCombo->GetCurSel();
if (0 == iCurSel) //检查密钥长度,目前只支持128位模式
{
if (bASCII && iLength != 16 || !bASCII && iLength != 32)
{
return 0;
}
}
else
{
return 0;
}
//如果由16进制输入则需要判断输入是否合法
if (!bASCII)
{
CopyMemory(szKey, strupr(szKey), iLength);
int i = 0;
for (; i < iLength; i++)
{
if (szKey[i] >= 'A' && szKey[i] <= 'F' || szKey[i] >= '0' && szKey[i] <= '9')
{
continue;
}
break;
}
if (i != iLength) //输入非法
{
return -1;
}
HexToASCII(szKey);
}
return 1;
}
void CSetKeyDlg::HexToASCII(PSTR szKey)
{
for (int i = 0; i < 32; i += 2)
{
if (szKey[i] >= 65) //将字母转化为对应的16进制数值
{
szKey[i] -= 55;
}
else //将数字转化为对应的16进制数值
{
szKey[i] -= 48;
}
if (szKey[i + 1] >= 65)
{
szKey[i + 1] -= 55;
}
else
{
szKey[i + 1] -= 48;
}
szKey[i / 2] = szKey[i] << 4 | szKey[i + 1]; //Hex下两个字符表示ASCII下一个字符
}
}
|
[
"[email protected]@27769579-7047-b306-4d6f-d36f87483bb3"
] |
[
[
[
1,
172
]
]
] |
91ed4ec23248ad9db4399442007c1fdc24a818a8
|
5f48a255bae33b09fdc35c56a09c175534f79ac0
|
/CommandPlugin/ICommand.cpp
|
d04918b18067ff5123e95c1724912b23752d58b9
|
[] |
no_license
|
reyoung/SimpleCppPluginSystem
|
5f8e0a12f223ca29088585b8817259aa96d66944
|
357ffbb7a9d3efc98b09b42a47d687451a2d3bb6
|
refs/heads/master
| 2016-09-06T01:26:20.412191 | 2011-07-02T14:20:33 | 2011-07-02T14:20:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 274 |
cpp
|
#include "ICommand.h"
using namespace std;
ICommand::ICommand(void)
{
}
ICommand::~ICommand(void)
{
}
bool ICommand::perform() const
{
map<string,Variant> param = getParam();
PluginManager::Invoke("ActionPlugin",¶m);
return param["ok"].toBool();
}
|
[
"[email protected]"
] |
[
[
[
1,
16
]
]
] |
0af735224634d69148924109bc1ca02bcd2c0698
|
bf278d024957a59c6f1efb36aa8b76069eff22a5
|
/keyboard.h
|
8bfc42c563c99db4c40a053a68923768f2b6aa28
|
[
"BSD-3-Clause",
"BSL-1.0"
] |
permissive
|
byplayer/yamy
|
b84741fe738f5abac33edb934951ea91454fb4ca
|
031e57e81caeb881a0a219e2a11429795a59d845
|
refs/heads/master
| 2020-05-22T12:46:55.516053 | 2010-05-19T15:57:38 | 2010-05-19T15:57:38 | 3,842,546 | 6 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 10,478 |
h
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// keyboard.h
#ifndef _KEYBOARD_H
# define _KEYBOARD_H
# include "misc.h"
# include "driver.h"
# include "stringtool.h"
# include <vector>
# include <list>
# include <map>
/// a scan code with flags
class ScanCode
{
public:
///
enum {
BREAK = KEYBOARD_INPUT_DATA::BREAK, /// key release flag
E0 = KEYBOARD_INPUT_DATA::E0, /// extended key flag
E1 = KEYBOARD_INPUT_DATA::E1, /// extended key flag
E0E1 = KEYBOARD_INPUT_DATA::E0E1, /// extended key flag
};
public:
USHORT m_scan; ///
USHORT m_flags; ///
public:
///
ScanCode() : m_scan(0), m_flags(0) { }
///
ScanCode(USHORT i_scan, USHORT i_flags)
: m_scan(i_scan), m_flags(i_flags) { }
///
bool operator==(const ScanCode &i_sc) const {
return (m_scan == i_sc.m_scan &&
(E0E1 & m_flags) == (E0E1 & i_sc.m_flags));
}
///
bool operator!=(const ScanCode &i_sc) const {
return !(*this == i_sc);
}
};
/// a key
class Key
{
public:
enum {
///
MAX_SCAN_CODES_SIZE = 4,
};
private:
///
typedef std::vector<tstringi> Names;
public:
/// if this key pressed physically
bool m_isPressed;
/// if this key pressed on Win32
bool m_isPressedOnWin32;
/// if this key pressed by assign
bool m_isPressedByAssign;
private:
/// key name
Names m_names;
/// key scan code length
size_t m_scanCodesSize;
/// key scan code
ScanCode m_scanCodes[MAX_SCAN_CODES_SIZE];
public:
///
Key()
: m_isPressed(false),
m_isPressedOnWin32(false),
m_isPressedByAssign(false),
m_scanCodesSize(0) { }
/// for Event::* only
Key(const tstringi &i_name)
: m_isPressed(false),
m_isPressedOnWin32(false),
m_isPressedByAssign(false),
m_scanCodesSize(0) {
addName(i_name);
addScanCode(ScanCode());
}
/// get key name (first name)
const tstringi &getName() const {
return m_names.front();
}
/// get scan codes
const ScanCode *getScanCodes() const {
return m_scanCodes;
}
///
size_t getScanCodesSize() const {
return m_scanCodesSize;
}
/// add a name of key
void addName(const tstringi &i_name);
/// add a scan code
void addScanCode(const ScanCode &i_sc);
/// initializer
Key &initialize();
/// equation by name
bool operator==(const tstringi &i_name) const;
///
bool operator!=(const tstringi &i_name) const {
return !(*this == i_name);
}
/// is the scan code of this key ?
bool isSameScanCode(const Key &i_key) const;
/// is the i_key's scan code the prefix of this key's scan code ?
bool isPrefixScanCode(const Key &i_key) const;
/// stream output
friend tostream &operator<<(tostream &i_ost, const Key &i_key);
/// <
bool operator<(const Key &i_key) const {
return getName() < i_key.getName();
}
};
///
class Modifier
{
///
typedef u_int64 MODIFIERS;
///
MODIFIERS m_modifiers;
///
MODIFIERS m_dontcares;
public:
///
enum Type {
Type_begin = 0, ///
Type_Shift = Type_begin, /// <BASIC_MODIFIER>
Type_Alt, /// <BASIC_MODIFIER>
Type_Control, /// <BASIC_MODIFIER>
Type_Windows, /// <BASIC_MODIFIER>
Type_BASIC, ///
Type_Up = Type_BASIC, /// <KEYSEQ_MODIFIER>
Type_Down, /// <KEYSEQ_MODIFIER>
Type_KEYSEQ, ///
Type_Repeat = Type_KEYSEQ, /// <ASSIGN_MODIFIER>
Type_ImeLock, /// <ASSIGN_MODIFIER>
Type_ImeComp, /// <ASSIGN_MODIFIER>
Type_NumLock, /// <ASSIGN_MODIFIER>
Type_CapsLock, /// <ASSIGN_MODIFIER>
Type_ScrollLock, /// <ASSIGN_MODIFIER>
Type_KanaLock, /// <ASSIGN_MODIFIER>
Type_Maximized, /// <ASSIGN_MODIFIER>
Type_Minimized, /// <ASSIGN_MODIFIER>
Type_MdiMaximized, /// <ASSIGN_MODIFIER>
Type_MdiMinimized, /// <ASSIGN_MODIFIER>
Type_Touchpad, /// <ASSIGN_MODIFIER>
Type_TouchpadSticky, /// <ASSIGN_MODIFIER>
Type_Mod0, /// <ASSIGN_MODIFIER>
Type_Mod1, /// <ASSIGN_MODIFIER>
Type_Mod2, /// <ASSIGN_MODIFIER>
Type_Mod3, /// <ASSIGN_MODIFIER>
Type_Mod4, /// <ASSIGN_MODIFIER>
Type_Mod5, /// <ASSIGN_MODIFIER>
Type_Mod6, /// <ASSIGN_MODIFIER>
Type_Mod7, /// <ASSIGN_MODIFIER>
Type_Mod8, /// <ASSIGN_MODIFIER>
Type_Mod9, /// <ASSIGN_MODIFIER>
Type_Lock0, /// <ASSIGN_MODIFIER>
Type_Lock1, /// <ASSIGN_MODIFIER>
Type_Lock2, /// <ASSIGN_MODIFIER>
Type_Lock3, /// <ASSIGN_MODIFIER>
Type_Lock4, /// <ASSIGN_MODIFIER>
Type_Lock5, /// <ASSIGN_MODIFIER>
Type_Lock6, /// <ASSIGN_MODIFIER>
Type_Lock7, /// <ASSIGN_MODIFIER>
Type_Lock8, /// <ASSIGN_MODIFIER>
Type_Lock9, /// <ASSIGN_MODIFIER>
Type_ASSIGN, ///
Type_end = Type_ASSIGN ///
};
public:
///
Modifier();
///
Modifier &on(Type i_type) {
return press(i_type);
}
///
Modifier &off(Type i_type) {
return release(i_type);
}
///
Modifier &press(Type i_type) {
m_modifiers |= ((MODIFIERS(1)) << i_type);
return care(i_type);
}
///
Modifier &release(Type i_type) {
m_modifiers &= ~((MODIFIERS(1)) << i_type);
return care(i_type);
}
///
Modifier &care(Type i_type) {
m_dontcares &= ~((MODIFIERS(1)) << i_type);
return *this;
}
///
Modifier &dontcare(Type i_type) {
m_dontcares |= ((MODIFIERS(1)) << i_type);
return *this;
}
/// set all modifiers to dontcare
Modifier &dontcare() {
m_dontcares = ~MODIFIERS(0);
return *this;
}
///
Modifier &on(Type i_type, bool i_isOn) {
return press(i_type, i_isOn);
}
///
Modifier &press(Type i_type, bool i_isPressed) {
return i_isPressed ? press(i_type) : release(i_type);
}
///
Modifier &care(Type i_type, bool i_doCare) {
return i_doCare ? care(i_type) : dontcare(i_type);
}
///
bool operator==(const Modifier &i_m) const {
return m_modifiers == i_m.m_modifiers && m_dontcares == i_m.m_dontcares;
}
/// add m's modifiers where this dontcare
void add(const Modifier &i_m);
//Modifier &operator+=(const Modifier &i_m);
/** does match. (except dontcare modifiers) (is the m included in the *this
set ?) */
bool doesMatch(const Modifier &i_m) const {
return ((m_modifiers | m_dontcares) == (i_m.m_modifiers | m_dontcares));
}
///
bool isOn(Type i_type) const {
return isPressed(i_type);
}
///
bool isPressed(Type i_type) const {
return !!(m_modifiers & ((MODIFIERS(1)) << i_type));
}
///
bool isDontcare(Type i_type) const {
return !!(m_dontcares & ((MODIFIERS(1)) << i_type));
}
/// stream output
friend tostream &operator<<(tostream &i_ost, const Modifier &i_m);
/// <
bool operator<(const Modifier &i_m) const {
return m_modifiers < i_m.m_modifiers ||
(m_modifiers == i_m.m_modifiers && m_dontcares < i_m.m_dontcares);
}
};
/// stream output
tostream &operator<<(tostream &i_ost, Modifier::Type i_type);
///
class ModifiedKey
{
public:
Modifier m_modifier; ///
Key *m_key; ///
public:
///
ModifiedKey() : m_key(NULL) { }
///
ModifiedKey(Key *i_key) : m_key(i_key) { }
///
ModifiedKey(const Modifier &i_modifier, Key *i_key)
: m_modifier(i_modifier), m_key(i_key) { }
///
bool operator==(const ModifiedKey &i_mk) const {
return m_modifier == i_mk.m_modifier && m_key == i_mk.m_key;
}
///
bool operator!=(const ModifiedKey &i_mk) const {
return !operator==(i_mk);
}
/// stream output
friend tostream &operator<<(tostream &i_ost, const ModifiedKey &i_mk);
/// <
bool operator<(const ModifiedKey &i_mk) const {
return *m_key < *i_mk.m_key ||
(!(*i_mk.m_key < *m_key) && m_modifier < i_mk.m_modifier);
}
};
///
class Keyboard
{
public:
/// keyboard modifiers (pointer into Keys)
typedef std::list<Key *> Mods;
private:
/** keyboard keys (hashed by first scan code).
Keys must be *list* of Key.
Because *pointers* into Keys exist anywhere in this program, the address
of Key's elements must be fixed. */
enum {
HASHED_KEYS_SIZE = 128, ///
};
typedef std::list<Key> Keys; ///
typedef std::map<tstringi, Key *> Aliases; /// key name aliases
///
class Substitute
{
public:
ModifiedKey m_mkeyFrom;
ModifiedKey m_mkeyTo;
public:
Substitute(const ModifiedKey &i_mkeyFrom,
const ModifiedKey &i_mkeyTo)
: m_mkeyFrom(i_mkeyFrom), m_mkeyTo(i_mkeyTo) {
}
};
typedef std::list<Substitute> Substitutes; /// substitutes
private:
Keys m_hashedKeys[HASHED_KEYS_SIZE]; ///
Aliases m_aliases; ///
Substitutes m_substitutes; ///
Key m_syncKey; /// key used to synchronize
private:
///
Mods m_mods[Modifier::Type_BASIC];
public:
///
class KeyIterator
{
///
Keys *m_hashedKeys;
///
size_t m_hashedKeysSize;
///
Keys::iterator m_i;
///
void next();
public:
///
KeyIterator(Keys *i_hashedKeys, size_t i_hashedKeysSize);
///
Key *operator *();
///
void operator++() {
next();
}
};
private:
///
Keys &getKeys(const Key &i_key);
public:
/// add a key
void addKey(const Key &i_key);
/// add a key name alias
void addAlias(const tstringi &i_aliasName, Key *i_key);
/// add substitute
void addSubstitute(const ModifiedKey &i_mkeyFrom,
const ModifiedKey &i_mkeyTo);
/// get a sync key
Key *getSyncKey() {
return &m_syncKey;
}
/// add a modifier key
void addModifier(Modifier::Type i_mt, Key * i_key);
/// search a key
Key *searchKey(const Key &i_key);
/// search a key (of which the key's scan code is the prefix)
Key *searchPrefixKey(const Key &i_key);
/// search a key by name
Key *searchKey(const tstringi &i_name);
/// search a key by non-alias name
Key *searchKeyByNonAliasName(const tstringi &i_name);
/// search a substitute
ModifiedKey searchSubstitute(const ModifiedKey &i_mkey);
/// get modifiers
Mods &getModifiers(Modifier::Type i_mt) {
return m_mods[i_mt];
}
/// get key iterator
KeyIterator getKeyIterator() {
return KeyIterator(&m_hashedKeys[0], HASHED_KEYS_SIZE);
}
};
#endif // !_KEYBOARD_H
|
[
"[email protected]"
] |
[
[
[
1,
450
]
]
] |
5b3103bf9c8a26feccba11a73ceebaa8038ef452
|
de98f880e307627d5ce93dcad1397bd4813751dd
|
/3libs/ut/include/OXCRCChk.h
|
6f51f5524e5a2918e009986329c101a2c01582fa
|
[] |
no_license
|
weimingtom/sls
|
7d44391bc0c6ae66f83ddcb6381db9ae97ee0dd8
|
d0d1de9c05ecf8bb6e4eda8a260c7a2f711615dd
|
refs/heads/master
| 2021-01-10T22:20:55.638757 | 2011-03-19T06:23:49 | 2011-03-19T06:23:49 | 44,464,621 | 2 | 0 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 11,341 |
h
|
// ==========================================================================
// Class Specification : COXCheckBase, COXCheckSum8,
// COXCheckSum16, COXCheckSum32, COXCRC16, COXCRC32
// ==========================================================================
// Header file : OXCRCChk.h
// Version: 9.3
// This software along with its related components, documentation and files ("The Libraries")
// is © 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is
// governed by a software license agreement ("Agreement"). Copies of the Agreement are
// available at The Code Project (www.codeproject.com), as part of the package you downloaded
// to obtain this file, or directly from our office. For a copy of the license governing
// this software, you may contact us at [email protected], or by calling 416-849-8900.
// //////////////////////////////////////////////////////////////////////////
// Properties:
// YES Abstract class (does not have any objects) --> COXCheckBase
// NO Abstract class --> The other
// YES Derived from CObject
// NO Is a Cwnd.
// NO Two stage creation (constructor & Create())
// NO Has a message map
// NO Needs a resource (template)
// NO Persistent objects (saveable on disk)
// NO Uses exceptions
// //////////////////////////////////////////////////////////////////////////
// Desciption: COXCheckBase
//
// Class COXCheckBase is the abstract base class used for deriving
// the classes which carry out integrity checking on data
// buffers.
// The pure virtual function 'CalculateBlock' needs to be implemented
// by the derived classes.
// Desciption: COXCheckSum8, 16 and 32
//
// Class COXChecksum8, 16 and 32 implements the simplest method of
// integrity check. It involves a simple summation of each byte of data,
// wrapping when the capacity of the checksum variable is exceeded.
// Desciption: COXCRC16 and 32
//
// The additive checksum calculation provides a simple test of integrity for
// transmitted data blocks. It is possible for a block of data to be corrupted
// so that the checksum is not altered. For example, two complementary errors
// in a block would be undetected. Cyclic redundancy check or CRC calculation
// provides a more secure form of error checking.
// A CRC is similar to a normal checksum in that operations are performed on
// successive bytes of data. The CRC value is derived using division and shifting.
// Remark:
// All the from COXCheckBase derived implementation classes have an identical
// interface with this base class.
// There are two main functions: CalculateBlock() and CalculateFile()
// CalculateBlock() is used for the checksum (or CRC) calculation of a memory
// block.
// CalculateFile() has two version. The first one receives a CFile object as
// parameter and the second receives a string with the file name of the file.
// Prerequisites (necessary conditions):
// ***
/////////////////////////////////////////////////////////////////////////////
#ifndef __OXCRCCHK_H__
#define __OXCRCCHK_H__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "OXDllExt.h"
#define OX_CRC16_POLYNOMIAL 0x1021 // default 16 bit polynomial
#define OX_CRC32_POLYNOMIAL 0xEDB88320L // default 32 bit polynomial
////////////////////////////////////////////////////////////////////////////
// The base class for all the derived integrity check implementation classes
//
class OX_CLASS_DECL COXCheckBase : public CObject
{
// Data members -------------------------------------------------------------
public:
union
{
BYTE m_nCheck8; // the 8 bit check result of the calculation
WORD m_nCheck16; // the 16 bit check result
DWORD m_nCheck32; // the 32 bit check result
};
enum ESize
{
szNone,
sz8bit,
sz16bit,
sz32bit
};
const ESize m_eSize; // the size of the check result (8, 16 or 32 bit)
protected:
private:
// Member functions ---------------------------------------------------------
public:
COXCheckBase(ESize eSize = szNone);
// --- In : eSize: the size of the check key that will be used
// --- Out :
// --- Returns :
// --- Effect : Contructor of object
// It will initialize the internal state
virtual ~COXCheckBase();
// --- In :
// --- Out :
// --- Returns :
// --- Effect : Destructor of object
virtual DWORD CalculateBlock( const LPVOID pData,
DWORD nCount);
// --- In : pData: The buffer to do the checksum calculation on.
// nCount: The number of bytes in the buffer.
// --- Out :
// --- Returns : the check result
// --- Effect : Calls the overloaded seed version of this function.
// The last check result is passed as seed parameter.
// In this way you can combine different data blocks
// in one Check Result.
virtual DWORD CalculateBlock( const LPVOID pData,
DWORD nCount,
DWORD nSeed) = 0;
// --- In : pData : The buffer to do the checksum calculation on.
// nCount : The number of bytes in the buffer.
// seed : A seed value is used as a begin value for the Check
// calculation
// The overloaded version uses the previous check result
// as begin value.
// --- Out : none
// --- Returns : the check result
// --- Effect : used to calculate a Check Result for a supplied buffer. This
// function is pure virtual so it has to be redefined in derived classes.
virtual DWORD CalculateFile(CFile* pFile, DWORD nCount = 0xFFFFFFFF, DWORD nBufferLength = 2048);
// --- In : pFile : The CFile pointer of the file which check is to be calculated
// nCount : the number of bytes
// nBufferLength: The size of the read buffer:
// a large read buffer increases the performance
// --- Out : none
// --- Returns : the check result
// --- Effect : The CFile must already be opened. The CalculateBlock function is called.
// The previous check result is used as seed for the new calculation.
// Use the Reset() function to use calculate with the initial seed value.
// --- EXCEPTIONS: Can throw CFileExceptions
virtual DWORD CalculateFile(CString sFileName);
// --- In : sFileName : The Name of the file which crc is to be calculated
// --- Out :
// --- Returns : the check result
// --- Effect : This function calls the calculateBlock function with the data of the file
// --- EXCEPTIONS: Can throw CFileExceptions
void Reset() {m_nCheck32 = 0xFFFFFFFF;}
// --- In : none
// --- Out : none
// --- Returns : none
// --- Effect : Sets the check result back to the initial value
protected:
private:
};
////////////////////////////////////////////////////////////////////////////
// The Checksum classes: COXCheckSum8, COXCheckSum16 and COXCheckSum32
//
class OX_CLASS_DECL COXCheckSum8 : public COXCheckBase
{
// Data members -------------------------------------------------------------
public:
protected:
private:
// Member functions ---------------------------------------------------------
public:
COXCheckSum8();
// --- In: none
// --- Out: none
// --- Returns: none
// --- Effect: constructs the object and initialize the internal state
virtual DWORD CalculateBlock( const LPVOID pData, DWORD nCount, DWORD nSeed);
// --- In : pData : The buffer to do the checksum calculation on.
// nCount : The number of bytes in the buffer.
// seed : A seed value is used as a begin value for the CRC
// calculation
// --- Out : none
// --- Returns : the 8 bit checksum result of the data block
// --- Effect : This Checksum implemation is the simplest integrity check method.
// It involves a simple summation of each byte of data.
protected:
private:
};
///////////////////////////////////////////////////////////////////////////
// an 16 bit version of the previous class
class OX_CLASS_DECL COXCheckSum16 : public COXCheckBase
{
public:
COXCheckSum16();
virtual DWORD CalculateBlock( const LPVOID pData, DWORD nCount, DWORD nSeed);
};
///////////////////////////////////////////////////////////////////////////
// an 32 bit version of the previous class
class OX_CLASS_DECL COXCheckSum32 : public COXCheckBase
{
public:
COXCheckSum32();
virtual DWORD CalculateBlock( const LPVOID pData, DWORD nCount, DWORD nSeed);
};
////////////////////////////////////////////////////////////////////////////
// The CRC classes: COXCRC16 and COXCRC32
//
// Helper classes for the CRC classes
// These helper classes are implemented to keep track of the CRC tables.
// A CRC table is calculated just one time for each used polynomial
template<class VALUE>
struct COXCRCTable
{
VALUE values[256];
VALUE m_nPolynomial;
COXCRCTable* m_pNextTable;
COXCRCTable(VALUE nPolynomial);
};
template<class VALUE>
class COXCRCTableList
{
public:
COXCRCTable<VALUE>* m_pTableList;
public:
COXCRCTableList();
virtual ~COXCRCTableList();
virtual COXCRCTable<VALUE>* CreateTable(VALUE nPolynomial) = 0;
COXCRCTable<VALUE>* GetTable(VALUE nPolynomial);
};
class OX_CLASS_DECL COXCRC16 : public COXCheckBase
{
// Data members -------------------------------------------------------------
public:
class OX_CLASS_DECL CTableList : public COXCRCTableList<WORD>
{
public:
CTableList();
virtual COXCRCTable<WORD>* CreateTable(WORD nPolynomial);
};
static CTableList m_tableList;
COXCRCTable<WORD>* m_pTable;
protected:
private:
// Member functions ---------------------------------------------------------
public:
COXCRC16(WORD nPolynomial = OX_CRC16_POLYNOMIAL);
// --- In: none
// --- Out: none
// --- Returns: none
// --- Effect: constructs the object and initialize the internal state
virtual DWORD CalculateBlock( const LPVOID pData, DWORD nCount, DWORD nSeed);
// --- In : pData : The buffer to do the checksum calculation on.
// nCount : The number of bytes in the buffer.
// seed : A seed value is used as a begin value for the CRC
// calculation
// --- Out : none
// --- Returns : the 16 bit CRC result of the data block
// --- Effect : This CRC implementation uses Cyclic redun
protected:
private:
};
// an 32 bit version of the previous class
class OX_CLASS_DECL COXCRC32 : public COXCheckBase
{
// Data members -------------------------------------------------------------
public:
protected:
class OX_CLASS_DECL CTableList : public COXCRCTableList<DWORD>
{
public:
CTableList();
virtual COXCRCTable<DWORD>* CreateTable(DWORD nPolynomial);
};
static CTableList m_tableList;
COXCRCTable<DWORD>* m_pTable;
private:
// Member functions ---------------------------------------------------------
public:
COXCRC32(DWORD nPolynomial = OX_CRC32_POLYNOMIAL);
virtual DWORD CalculateBlock( const LPVOID pData, DWORD nCount, DWORD nSeed);
protected:
private:
};
#include "OXCRCChk.inl"
#endif //__OXCRCCHK_H__
// ==========================================================================
|
[
"[email protected]"
] |
[
[
[
1,
340
]
]
] |
01e2c007582182fe3dee717cee277f6d5b793539
|
7bfc60c56b4c12957c53657d0549a136b6e6cdb2
|
/utility.hpp
|
fdd68fd6e1bceebe69e2b84b6db94f8a73fd4766
|
[
"BSL-1.0"
] |
permissive
|
bolero-MURAKAMI/CEL---ConstExpr-Library
|
867ef5656ff531ececaf5747594f8b948d872f34
|
1ad865dd8845c63e473a132870347e913ff91c1c
|
refs/heads/master
| 2021-01-17T22:03:25.021662 | 2011-11-26T12:59:00 | 2011-11-26T12:59:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 851 |
hpp
|
// Copyright (C) 2011 RiSK (sscrisk)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(SSCRISK_CEL_UTILITY_HPP)
#define SSCRISK_CEL_UTILITY_HPP
#if defined(_MSC_VER) && _MSC_VER >= 1020
#pragma once
#endif
// utility.hpp
namespace sscrisk{ namespace cel{
template <class T1, class T2>
struct pair
{
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
constexpr pair(const pair&) = default;
constexpr pair()
: first(), second()
{}
constexpr pair(const T1& x, const T2& y)
: first(x), second(y)
{}
template<class U, class V>
constexpr pair(const pair<U, V>& p)
: first(p.first), second(p.second)
{}
};
}}
#endif
|
[
"[email protected]"
] |
[
[
[
1,
40
]
]
] |
f7be7cbdb9a31b00433198891ad68f244465de8a
|
4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61
|
/CleanProject/ParticleUniverse/include/ParticleUniverseSystemManager.h
|
65ccc5b18a986608db13a95b6cb0ec2256a991ad
|
[] |
no_license
|
bahao247/apeengine2
|
56560dbf6d262364fbc0f9f96ba4231e5e4ed301
|
f2617b2a42bdf2907c6d56e334c0d027fb62062d
|
refs/heads/master
| 2021-01-10T14:04:02.319337 | 2009-08-26T08:23:33 | 2009-08-26T08:23:33 | 45,979,392 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 17,890 |
h
|
/*
-----------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2006-2008 Henry van Merode
Usage of this program is free for non-commercial use and licensed under the
the terms of the GNU Lesser General Public License.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
-----------------------------------------------------------------------------
*/
#ifndef __PU_PARTICLE_SYSTEM_MANAGER_H__
#define __PU_PARTICLE_SYSTEM_MANAGER_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseScriptTokeniser.h"
#include "ParticleUniverseRendererFactory.h"
#include "ParticleRenderers/ParticleUniverseBoxSet.h"
#include "ParticleRenderers/ParticleUniverseBox.h"
#include "ParticleRenderers/ParticleUniverseSphereSet.h"
#include "ParticleRenderers/ParticleUniverseSphere.h"
#include "ParticleUniverseEmitterFactory.h"
#include "ParticleUniverseAffectorFactory.h"
#include "ParticleUniverseObserverFactory.h"
#include "ParticleUniverseEventHandlerFactory.h"
#include "ParticleUniverseExternFactory.h"
#include "ParticleUniverseBehaviourFactory.h"
#include "ParticleUniverseITokenInitialiser.h"
#include "ParticleUniverseIAlias.h"
#include "ParticleUniverseCameraDependency.h"
#include "ParticleUniverseSystemTokens.h"
#include "ParticleUniverseTechniqueTokens.h"
#include "ParticleUniverseRendererTokens.h"
#include "ParticleUniverseEmitterTokens.h"
#include "ParticleUniverseAffectorTokens.h"
#include "ParticleUniverseObserverTokens.h"
#include "ParticleUniverseAttachableTokens.h"
#include "ParticleUniverseDynamicAttributeTokens.h"
#include "ParticleUniverseSystemManagerTokens.h"
#include "ParticleUniverseCameraDependencyTokens.h"
#include "ParticleUniverseAttachable.h"
namespace ParticleUniverse
{
/** The ParticleSystemManager manages particle systems, particle system scripts (templates), etc. It is also
responsible for actually creating techniques, emitters, observers, etc.
*/
class ParticleSystemFactory;
class _ParticleUniverseExport ParticleSystemManager:
public Ogre::Singleton<ParticleSystemManager>, public Ogre::ScriptLoader, ITokenInitialiser
{
friend class ParticleSystemFactory;
public:
// Constructor
ParticleSystemManager (void);
// Destructor
~ParticleSystemManager (void);
/** Remove all registered templates
*/
void removeAllParticleSystemTemplates();
/** Create a BoxSet. This is similar to a BillboardSet, instead it uses boxes.
*/
BoxSet* createBoxSet(const Ogre::String& name, Ogre::SceneManager* sceneManager, const Ogre::uint poolSize = 20);
/** Destroy the BoxSet.
*/
void destroyBoxSet(BoxSet* boxSet, Ogre::SceneManager* sceneManager);
/** Create a SphereSet. This is similar to a BillboardSet, instead it uses spheres.
*/
SphereSet* createSphereSet(const Ogre::String& name, Ogre::SceneManager* sceneManager, const Ogre::uint poolSize = 20);
/** Destroy the SphereSet.
*/
void destroySphereSet(SphereSet* sphereSet, Ogre::SceneManager* sceneManager);
/** Registers a previously created Attachable. This is needed, because the scenemanager has to
know.
*/
void registerAttachable(Attachable* attachable, Ogre::SceneManager* sceneManager);
/** Unregisters a created Attachable.
*/
void unregisterAttachable(Attachable* attachable, Ogre::SceneManager* sceneManager);
/** Adds a new 'factory' object for emitters to the list of available emitter types.
@remarks
This method allows plugins etc to add new particle emitter types. Particle emitters
are sources of particles, and generate new particles with their start positions, colours and
momentums appropriately.
@par
All particle emitter factories have an assigned name which is used to identify the emitter
type. This must be unique.
@param
factory Pointer to a ParticleEmitterFactory subclass created by the plugin or application code.
*/
void addEmitterFactory(ParticleEmitterFactory* factory);
/** Delete an ParticleEmitterFactory. Search the factory by its type.
*/
void destroyEmitterFactory(const Ogre::String& emitterType);
/** Method for creating a new emitter from a factory.
@param
emitterType String name of the emitter type to be created. A factory of this type must have been registered.
*/
ParticleEmitter* createEmitter(const Ogre::String& emitterType);
/** Clone a ParticleEmitter.
*/
ParticleEmitter* cloneEmitter(ParticleEmitter* emitter);
/** Delete a ParticleEmitter.
*/
void destroyEmitter(ParticleEmitter* emitter);
/** Add a ParticleAffectorFactory to this ParticleSystemManager.
@remarks
ParticleAffectorFactories, ParticleEmitterFactories, ... can be registered by the
ParticleSystemManager. This is done by means of their type. If a certain ParticleAffector,
ParticleEmitter, ... must be created, the appropriate factory is searched (by means of
its type), which created the object needed.
@param
factory Pointer to a ParticleAffectorFactory subclass created by the plugin or application code.
*/
void addAffectorFactory(ParticleAffectorFactory* factory);
/** Delete a ParticleAffectorFactory. Search by its type.
*/
void destroyAffectorFactory(const Ogre::String& affectorType);
/** Create a ParticleAffector given a type.
*/
ParticleAffector* createAffector(const Ogre::String& affectorType);
/** Clone a ParticleAffector.
*/
ParticleAffector* cloneAffector(ParticleAffector* affector);
/** Delete a ParticleAffector.
*/
void destroyAffector(ParticleAffector* affector);
/** Create a ParticleTechnique.
*/
ParticleTechnique* createTechnique(void);
/** Clone a ParticleTechnique.
*/
ParticleTechnique* cloneTechnique(ParticleTechnique* technique);
/** Delete a ParticleTechnique.
*/
void destroyTechnique(ParticleTechnique* technique);
/** Add a ParticleObserverFactory to this ParticleSystemManager.
@param
factory Pointer to a ParticleObserverFactory subclass created by the plugin or application code.
*/
void addObserverFactory(ParticleObserverFactory* factory);
/** Delete a ParticleObserverFactory given its type.
*/
void destroyObserverFactory(const Ogre::String& observerType) {/* No implementation */};
/** Create a ParticleObserver given a certain type.
*/
ParticleObserver* createObserver(const Ogre::String& observerType);
/** Clone a ParticleObserver.
*/
ParticleObserver* cloneObserver(ParticleObserver* observer);
/** Destroye a ParticleObserver.
*/
void destroyObserver(ParticleObserver* observer);
/** Add a ParticleEventHandlerFactory to this ParticleSystemManager.
@param
factory Pointer to a ParticleEventHandlerFactory subclass created by the plugin or application code.
*/
void addEventHandlerFactory(ParticleEventHandlerFactory* factory);
/** Delete a ParticleEventHandlerFactory given a certain type.
*/
void destroyEventHandlerFactory(const Ogre::String& eventHandlerType) {/* No implementation */};
/** Create a ParticleEventHandler given a certain type.
*/
ParticleEventHandler* createEventHandler(const Ogre::String& eventHandlerType);
/** Clone a ParticleEventHandler.
*/
ParticleEventHandler* cloneEventHandler(ParticleEventHandler* eventHandler);
/** Delete a ParticleEventHandler.
*/
void destroyEventHandler(ParticleEventHandler* eventHandler);
/** Add a ParticleRendererFactory to this ParticleSystemManager.
*/
void addRendererFactory(ParticleRendererFactory* factory);
/** Delete a ParticleRendererFactory given a certain type.
*/
void destroyRendererFactory(const Ogre::String& rendererType);
/** Create a ParticleRenderer.
*/
ParticleRenderer* createRenderer(const Ogre::String& rendererType);
/** Clone a ParticleRenderer.
*/
ParticleRenderer* cloneRenderer(ParticleRenderer* renderer);
/** Delete a ParticleRenderer.
*/
void destroyRenderer(ParticleRenderer* renderer);
/** Add a ExternFactory to this ParticleSystemManager.
*/
void addExternFactory(ExternFactory* factory);
/** Delete a ExternFactory given a certain type.
*/
void destroyExternFactory(const Ogre::String& externType);
/** Create an Extern object.
*/
Extern* createExtern(const Ogre::String& externType);
/** Clone an Extern object.
*/
Extern* cloneExtern(Extern* externObject);
/** Delete an Extern object.
*/
void destroyExtern(Extern* externObject);
/** Add a BehaviourFactory to this ParticleSystemManager.
*/
void addBehaviourFactory(ParticleBehaviourFactory* factory);
/** Delete a BehaviourFactory given a certain type.
*/
void destroyBehaviourFactory(const Ogre::String& behaviourType);
/** Create a Behaviour object.
*/
ParticleBehaviour* createBehaviour(const Ogre::String& behaviourType);
/** Clone a Behaviour object.
*/
ParticleBehaviour* cloneBehaviour(ParticleBehaviour* behaviour);
/** Delete a Behaviour object.
*/
void destroyBehaviour(ParticleBehaviour* behaviour);
/** Create a ParticleSystemTemplate.
@remarks
ParticleSystemTemplates contain a ParticleSystem and form a blueprint for other ParticleSystems.
Given the name of the template, a copy is made of the ParticleSystem. This copy can be used
in your application. The ParticleSystem templates however are restricted to the
ParticleSystemManager.
*/
ParticleSystem* createParticleSystemTemplate(const Ogre::String& name, const Ogre::String& resourceGroupName);
/** Add a ParticleSystem template to this ParticleSystemManager.
*/
void addParticleSystemTemplate(const Ogre::String& name, ParticleSystem* systemTemplate);
/** Retrieves a particle system template.
*/
ParticleSystem* getParticleSystemTemplate(const Ogre::String& templateName);
/** Fill a list of template names in the vector.
*/
void particleSystemTemplateNames(std::vector<Ogre::String>& v);
/** Creates a ParticleSystem, using a template as a blueprint.
@remarks
This is the function that must be used by the client application that wants to create a
ParticleSystem.
*/
ParticleSystem* createParticleSystem(const Ogre::String& name,
const Ogre::String& templateName,
Ogre::SceneManager* sceneManager);
/** Creates a default ParticleSystem.
@remarks
This is the function that must be used by the client application that wants to create a
ParticleSystem.
*/
ParticleSystem* createParticleSystem(const Ogre::String& name,
Ogre::SceneManager* sceneManager);
/** Delete a ParticleSystem.
@remarks
This is the function that must be used by the client application that wants to delete a
ParticleSystem.
*/
void destroyParticleSystem(ParticleSystem* particleSystem, Ogre::SceneManager* sceneManager);
/** Delete a ParticleSystem.
@remarks
This implementation deletes a ParticleSystem identified by its name. The function always
validates whether the name still exists.
*/
void destroyParticleSystem(const Ogre::String& particleSystemName, Ogre::SceneManager* sceneManager);
/** Add an alias to this ParticleSystemManager.
@remarks
An alias is a ParticleTechnique, ParticleEmitter, ParticleAffector, etc. and forms the
blueprint to create copies. These copies can be used again in ParticleSystems (templates).
An alias is similar to a template, but where templates are restricted to ParticleSystems,
aliasses can be any type of object that inherits from IAlias.
*/
void addAlias (IAlias* alias);
/** Returns an alias.
*/
IAlias* getAlias (const Ogre::String& aliasName);
/** Delete an alias from the ParticleSystemManager.
*/
void destroyAlias(IAlias* alias);
/** Delete all aliasses.
*/
void destroyAllAliasses(void);
/** Override standard Singleton retrieval.
*/
static ParticleSystemManager& getSingleton (void);
/** Override standard Singleton retrieval.
*/
static ParticleSystemManager* getSingletonPtr (void);
// @copydoc ScriptLoader::getScriptPatterns
const Ogre::StringVector& getScriptPatterns (void) const;
// @copydoc ScriptLoader::parseScript
void parseScript (Ogre::DataStreamPtr& stream, const Ogre::String& groupName);
// @copydoc ScriptLoader::getLoadingOrder
Ogre::Real getLoadingOrder (void) const;
/** Returns the ParticleScriptTokeniser.
@remarks
The ParticleScriptTokeniser is the main class responsible for parsing scripts.
*/
ParticleScriptTokeniser* getParticleScriptTokeniser(void) const;
/** @see
ITokenInitialiser::setupTokenDefinitions
*/
virtual void setupTokenDefinitions(ITokenRegister* tokenRegister);
/** Returns Camera Dependency.
@remarks
CameraDependency is used as a container that stores data parsed from a particle script.
*/
CameraDependency* createCameraDependency(void);
protected:
/** Implementation of creating a particle system used by the MovableObject factory.
@remarks
This function must not be used directly.
*/
ParticleSystem* _createSystemImpl(const Ogre::String& name);
/** Implementation of creating a particle system used by the MovableObject factory.
@remarks
This function must not be used directly.
*/
ParticleSystem* _createSystemImpl(const Ogre::String& name, const Ogre::String& templateName);
/** Delete a particle system.
@remarks
This is a protected function used by the ParticleSystemManager itself.
*/
void _destroySystemImpl(ParticleSystem* particleSystem);
ParticleScriptTokeniser* mParticleScriptTokeniser;
Ogre::StringVector _scriptPatterns;
ParticleSystemTokens mParticleSystemTokens;
ParticleTechniqueTokens mParticleTechniqueTokens;
ParticleRendererTokens mParticleRendererTokens;
ParticleEmitterTokens mParticleEmitterTokens;
ParticleAffectorTokens mParticleAffectorTokens;
ParticleObserverTokens mParticleObserverTokens;
AttachableTokens mAttachableTokens;
DynamicAttributeTokens mDynamicAttributeTokens;
CameraDependencyTokens mCameraDependencyTokens;
// Emitter Factories
typedef std::map<Ogre::String, ParticleEmitterFactory*> EmitterFactoryMap;
EmitterFactoryMap mEmitterFactories;
// Affector Factories
typedef std::map<Ogre::String, ParticleAffectorFactory*> AffectorFactoryMap;
AffectorFactoryMap mAffectorFactories;
// Observer Factories
typedef std::map<Ogre::String, ParticleObserverFactory*> ObserverFactoryMap;
ObserverFactoryMap mObserverFactories;
// EventHandler Factories
typedef std::map<Ogre::String, ParticleEventHandlerFactory*> EventHandlerFactoryMap;
EventHandlerFactoryMap mEventHandlerFactories;
// Renderer Factories
typedef std::map<Ogre::String, ParticleRendererFactory*> RendererFactoryMap;
RendererFactoryMap mRendererFactories;
// Extern Factories
typedef std::map<Ogre::String, ExternFactory*> ExternFactoryMap;
ExternFactoryMap mExternFactories;
// Behaviour Factories
typedef std::map<Ogre::String, ParticleBehaviourFactory*> BehaviourFactoryMap;
BehaviourFactoryMap mBehaviourFactories;
/* The alias map contains a list with all alias objects that are created during parsing of the
scripts. The alias map contains objects that are used in the templated particle systems.
*/
typedef std::map<Ogre::String, IAlias*> AliasMap;
AliasMap mAliasMap;
/* The template map contains a list with all particle systems that act as a template.
These templates cannot be used themselves, but form the blueprint for creation of other
particle systems.
*/
typedef std::map<Ogre::String, ParticleSystem*> ParticleSystemTemplateMap;
ParticleSystemTemplateMap mParticleSystemTemplates;
// Factory used to create ParticleSystems
ParticleSystemFactory* mParticleSystemFactory;
// Factory used to create BoxSets
BoxSetFactory* mBoxSetFactory;
// Factory used to create SphereSets
SphereSetFactory* mSphereSetFactory;
// Parse functions on ParticleSystemManager level
ParticleSystemManagerTokens mParticleSystemManagerTokens;
// CameraDependency object is used as a container to store data from a particle script.
CameraDependency mCameraDependency;
};
/** Factory object for creating ParticleSystem instances */
class _ParticleUniverseExport ParticleSystemFactory : public Ogre::MovableObjectFactory
{
protected:
Ogre::MovableObject* createInstanceImpl(const Ogre::String& name, const Ogre::NameValuePairList* params);
public:
ParticleSystemFactory() {}
~ParticleSystemFactory() {}
static Ogre::String PU_FACTORY_TYPE_NAME;
const Ogre::String& getType(void) const;
void destroyInstance(Ogre::MovableObject* obj);
};
}
#endif
|
[
"pablosn@06488772-1f9a-11de-8b5c-13accb87f508"
] |
[
[
[
1,
484
]
]
] |
b73fbb4a604dd69fb626d245688eb29af34d06cb
|
daef491056b6a9e227eef3e3b820e7ee7b0af6b6
|
/Tags/0.2.6/code/toolkit/graphics/gl/gl_vertexformat.cpp
|
496dfee381aca4328c6c3928f8726f60344f5463
|
[
"BSD-3-Clause"
] |
permissive
|
BackupTheBerlios/gut-svn
|
de9952b8b3e62cedbcfeb7ccba0b4d267771dd95
|
0981d3b37ccfc1ff36cd79000f6c6be481ea4546
|
refs/heads/master
| 2021-03-12T22:40:32.685049 | 2006-07-07T02:18:38 | 2006-07-07T02:18:38 | 40,725,529 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,046 |
cpp
|
/**********************************************************************
* GameGut - graphics/gl/gl_vertexformat.cpp
* Copyright (c) 1999-2005 Jason Perkins.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the BSD-style license that is
* included with this library in the file LICENSE.txt.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* files LICENSE.txt for more details.
**********************************************************************/
#include "core/core.h"
#include "gl_graphics.h"
/* Keep track of all open formats so I can close them at exit */
static utxArray<utVertexFormat> my_formats;
utVertexFormat utCreateVertexFormat(const utVertexAttribute* attributes, int count)
{
utVertexFormat format = utNEW utxVertexFormat();
format->attributes = (utVertexAttribute*)utALLOC(sizeof(utVertexAttribute) * count);
format->count = count;
format->stride = 0;
for (int i = 0; i < count; ++i)
{
format->attributes[i] = attributes[i];
switch (attributes[i])
{
case UT_VERTEX_POSITION:
format->stride += 3 * sizeof(float);
break;
case UT_VERTEX_NORMAL:
format->stride += 3 * sizeof(float);
break;
case UT_VERTEX_TEXTURE2:
format->stride += 2 * sizeof(float);
break;
default:
utDELETE format;
utLog("utCreateVertexFormat: invalid attribute\n");
return NULL;
}
}
/* Add the buffer to the master list */
format->reference();
my_formats.push_back(format);
return format;
}
utxVertexFormat::~utxVertexFormat()
{
utFREE(attributes);
}
int utReleaseVertexFormat(utVertexFormat format)
{
if (my_formats.remove(format))
format->release();
return true;
}
void utxReleaseAllVertexFormats()
{
for (int i = 0; i < my_formats.size(); ++i)
my_formats[i]->release();
my_formats.clear();
}
|
[
"starkos@5eb1f239-c603-0410-9f17-9cbfe04d0a06"
] |
[
[
[
1,
79
]
]
] |
20412b464ff3332efd113fa89328b1bf7efd493d
|
46e34957617ae9aa499d42e2112a5a7048af0bcc
|
/mar/QOpenCVWidget.h
|
be2cc73fc06a6dca950a83a39ccf674bfb122cf6
|
[] |
no_license
|
abelsoares/portfolio
|
718e390ebc725d57fc77067e3fd168398e31dbab
|
8155c7f6cb32bf0d0cc90554c436cd6135f9c8ba
|
refs/heads/master
| 2021-01-19T08:03:16.655776 | 2011-08-26T14:03:05 | 2011-08-26T14:03:05 | 2,274,224 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 459 |
h
|
#ifndef QOPENCVWIDGET_H
#define QOPENCVWIDGET_H
#include <opencv/cv.h>
#include <QPixmap>
#include <QLabel>
#include <QWidget>
#include <QVBoxLayout>
#include <QImage>
class QOpenCVWidget : public QWidget {
private:
QLabel *imagelabel;
QVBoxLayout *layout;
QImage image;
public:
QOpenCVWidget(QWidget *parent = 0);
~QOpenCVWidget(void);
void putImage(IplImage *);
};
#endif
|
[
"[email protected]"
] |
[
[
[
1,
24
]
]
] |
a69ad1ce7e0865aec6a53b0ae227a150f7a2e2d3
|
709cd826da3ae55945fd7036ecf872ee7cdbd82a
|
/Term/Bowling/trunk/Source/RaytraceMgr/SceneDescription.h
|
f8325a05bac2c43eefae8f821f23096d628e18bc
|
[] |
no_license
|
argapratama/kucgbowling
|
20dbaefe1596358156691e81ccceb9151b15efb0
|
65e40b6f33c5511bddf0fa350c1eefc647ace48a
|
refs/heads/master
| 2018-01-08T15:27:44.784437 | 2011-06-19T15:23:39 | 2011-06-19T15:23:39 | 36,738,655 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 13,926 |
h
|
/*
*
* RayTrace Software Package, release 3.0. May 3, 2006
*
* Author: Samuel R. Buss
*
* Software accompanying the book
* 3D Computer Graphics: A Mathematical Introduction with OpenGL,
* by S. Buss, Cambridge University Press, 2003.
*
* Software is "as-is" and carries no warranty. It may be used without
* restriction, but if you modify it, please change the filenames to
* prevent confusion between different versions. Please acknowledge
* all use of the software in any publications or products based on it.
*
* Bug reports: Sam Buss, [email protected].
* Web page: http://math.ucsd.edu/~sbuss/MathCG
*
*/
#ifndef SCENE_DESCRIPTION_H
#define SCENE_DESCRIPTION_H
#include "../DataStructs/Array.h"
#include "../VrMath/LinearR3.h"
#include "../Graphics/CameraView.h"
#include "../Graphics/Light.h"
#include "../Graphics/MaterialBase.h"
#include "../Graphics/Material.h"
#include "../Graphics/MaterialCookTorrance.h"
#include "../Graphics/TextureMapBase.h"
#include "../Graphics/TextureAffineXform.h"
#include "../Graphics/TextureBilinearXform.h"
#include "../Graphics/TextureCheckered.h"
#include "../Graphics/TextureMultiFaces.h"
#include "../Graphics/TextureRgbImage.h"
#include "../Graphics/TextureSequence.h"
#include "../Graphics/BumpMapFunction.h"
#include "../Graphics/ViewableBase.h"
class SceneDescription
{
public:
SceneDescription();
void SetBackGroundColor( float* color ) { TheBackgroundColor.Load( color ); }
void SetBackGroundColor( double* color ) { TheBackgroundColor.Load( color ); }
void SetBackGroundColor( const VectorR3& color ) { TheBackgroundColor = color; }
void SetBackGroundColor( double r, double g, double b ) { TheBackgroundColor.Set(r, g, b); }
VectorR3& BackgroundColor() { return TheBackgroundColor; }
const VectorR3& BackgroundColor() const { return TheBackgroundColor; }
void SetGlobalAmbientLight( float* color ) { TheGlobalAmbientLight.Load( color ); }
void SetGlobalAmbientLight( double* color ) { TheGlobalAmbientLight.Load( color ); }
void SetGlobalAmbientLight( const VectorR3& color ) { TheGlobalAmbientLight = color; }
void SetGlobalAmbientLight( double r, double g, double b ) { TheGlobalAmbientLight.Set(r, g, b); }
VectorR3& GlobalAmbientLight() { return TheGlobalAmbientLight; }
const VectorR3& GlobalAmbientLight() const { return TheGlobalAmbientLight; }
CameraView& GetCameraView() { return CameraAndViewer; }
const CameraView& GetCameraView() const { return CameraAndViewer; }
// Once you have set up an initial CameraView, you can call RegisterCameraView.
// After that, you may call CalcNewSceenDims( aspectRatio ) to get
// a suggested width and height for the camera screen.
void RegisterCameraView();
void CalcNewScreenDims( float aspectRatio );
int NumLights() const { return LightArray.SizeUsed(); }
Light* NewLight() { return *(LightArray.Push()) ; }
int AddLight( Light* newLight );
Light& GetLight( int i ) { return *LightArray[i]; }
const Light& GetLight( int i ) const { return *LightArray[i]; }
Array<Light*>& GetLightArray() { return LightArray; }
const Array<Light*>& GetLightArray() const { return LightArray; }
int NumMaterials() const { return MaterialArray.SizeUsed(); }
Material* NewMaterial();
MaterialCookTorrance* NewMaterialCookTorrance();
int AddMaterial( MaterialBase* newMaterial );
MaterialBase& GetMaterial( int i ) { return *MaterialArray[i]; }
const MaterialBase& GetMaterial( int i ) const { return *MaterialArray[i]; }
Array<MaterialBase*>& GetMaterialArray() { return MaterialArray; }
const Array<MaterialBase*>& GetMaterialArray() const { return MaterialArray; }
int NumTextures() const { return TextureArray.SizeUsed(); }
int AddTexture( TextureMapBase* newTexture );
TextureAffineXform* NewTextureAffineXform();
TextureBilinearXform* NewTextureBilinearXform();
TextureCheckered* NewTextureCheckered();
TextureMultiFaces* NewTextureMultiFaces( int numTexMaps );
TextureMultiFaces* NewTextureMultiFaces( int numTexturesMaps, TextureMapBase* textureMaps[] );
TextureMultiFaces* NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1 );
TextureMultiFaces* NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2 );
TextureMultiFaces* NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3 );
TextureMultiFaces* NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3,
TextureMapBase* textureMap4, TextureMapBase* textureMap5 );
TextureRgbImage* NewTextureRgbImage();
TextureRgbImage* NewTextureRgbImage( const RgbImage& rgbImage );
TextureRgbImage* NewTextureRgbImage( const char* filename );
TextureSequence* NewTextureSequence( int numTexMaps );
TextureSequence* NewTextureSequence( int numTexturesMaps, TextureMapBase* textureMaps[] );
TextureSequence* NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1 );
TextureSequence* NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2 );
TextureSequence* NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3 );
BumpMapFunction* NewBumpMapFunction();
TextureMapBase& GetTexture( int i ) { return *TextureArray[i]; }
const TextureMapBase& GetTexture( int i ) const { return *TextureArray[i]; }
Array<TextureMapBase*>& GetTextureArray() { return TextureArray; }
const Array<TextureMapBase*>& GetTextureArray() const { return TextureArray; }
int NumViewables() const { return ViewableArray.SizeUsed(); }
int AddViewable( ViewableBase* newViewable );
ViewableBase& GetViewable( int i ) { return *ViewableArray[i]; }
const ViewableBase& GetViewable( int i ) const { return *ViewableArray[i]; }
Array<ViewableBase*>& GetViewableArray() { return ViewableArray; }
const Array<ViewableBase*>& GetViewableArray() const { return ViewableArray; }
void DeleteAllLights();
void DeleteAllTextures();
void DeleteAllMaterials();
void DeleteAllViewables();
void DeleteAll();
private:
VectorR3 TheGlobalAmbientLight;
VectorR3 TheBackgroundColor;
CameraView CameraAndViewer;
double RegisteredScreenWidth;
double RegisteredScreenHeight;
bool ScreenRegistered;
Array<Light*> LightArray;
Array<MaterialBase*> MaterialArray;
Array<TextureMapBase*> TextureArray;
Array<ViewableBase*> ViewableArray;
};
inline SceneDescription::SceneDescription()
{
TheBackgroundColor.Set( 1.0, 1.0, 1.0 );
TheGlobalAmbientLight.SetZero();
ScreenRegistered = false;
}
inline int SceneDescription::AddLight( Light* newLight )
{
int index = (int)LightArray.SizeUsed();
LightArray.Push( newLight );
return index;
}
inline Material* SceneDescription::NewMaterial()
{
Material* newMat = new Material();
MaterialBase* newMatBase = (MaterialBase*)newMat;
MaterialArray.Push( newMatBase );
return newMat;
}
inline MaterialCookTorrance* SceneDescription::NewMaterialCookTorrance()
{
MaterialCookTorrance* newMatCT = new MaterialCookTorrance();
MaterialBase* newMatBase = (MaterialBase*)newMatCT;
MaterialArray.Push( newMatBase );
return newMatCT;
}
inline int SceneDescription::AddMaterial( MaterialBase* newMaterial )
{
int index = (int)MaterialArray.SizeUsed();
MaterialArray.Push( newMaterial );
return index;
}
inline int SceneDescription::AddTexture( TextureMapBase* newTexture )
{
int index = (int)TextureArray.SizeUsed();
TextureArray.Push( newTexture );
return index;
}
inline int SceneDescription::AddViewable( ViewableBase* newViewable )
{
int index = (int)ViewableArray.SizeUsed();
ViewableArray.Push( newViewable );
return index;
}
inline TextureAffineXform* SceneDescription::NewTextureAffineXform()
{
TextureAffineXform* newTex = new TextureAffineXform();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureBilinearXform* SceneDescription::NewTextureBilinearXform()
{
TextureBilinearXform* newTex = new TextureBilinearXform();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureCheckered* SceneDescription::NewTextureCheckered()
{
TextureCheckered* newTex = new TextureCheckered();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureRgbImage* SceneDescription::NewTextureRgbImage()
{
TextureRgbImage* newTex = new TextureRgbImage();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureRgbImage* SceneDescription::NewTextureRgbImage( const RgbImage& rgbImage)
{
TextureRgbImage* newTex = new TextureRgbImage( rgbImage );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureRgbImage* SceneDescription::NewTextureRgbImage( const char* filename )
{
TextureRgbImage* newTex = new TextureRgbImage();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces( int numTexMaps )
{
TextureMultiFaces* newTex = new TextureMultiFaces( numTexMaps );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces( int numTexturesMaps, TextureMapBase* textureMaps[] )
{
TextureMultiFaces* newTex = new TextureMultiFaces( numTexturesMaps, textureMaps );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1 )
{
TextureMultiFaces* newTex = new TextureMultiFaces( textureMap0, textureMap1 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2 )
{
TextureMultiFaces* newTex = new TextureMultiFaces( textureMap0, textureMap1, textureMap2 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces(TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3 )
{
TextureMultiFaces* newTex = new TextureMultiFaces( textureMap0, textureMap1, textureMap2, textureMap3 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureMultiFaces* SceneDescription::NewTextureMultiFaces( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3,
TextureMapBase* textureMap4, TextureMapBase* textureMap5 )
{
TextureMultiFaces* newTex = new TextureMultiFaces( textureMap0, textureMap1, textureMap2, textureMap3,
textureMap4, textureMap5 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureSequence* SceneDescription::NewTextureSequence( int numTexMaps )
{
TextureSequence* newTex = new TextureSequence( numTexMaps );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureSequence* SceneDescription::NewTextureSequence( int numTexturesMaps, TextureMapBase* textureMaps[] )
{
TextureSequence* newTex = new TextureSequence( numTexturesMaps, textureMaps );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureSequence* SceneDescription::NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1 )
{
TextureSequence* newTex = new TextureSequence( textureMap0, textureMap1 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureSequence* SceneDescription::NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2 )
{
TextureSequence* newTex = new TextureSequence( textureMap0, textureMap1, textureMap2 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline TextureSequence* SceneDescription::NewTextureSequence( TextureMapBase* textureMap0, TextureMapBase* textureMap1,
TextureMapBase* textureMap2, TextureMapBase* textureMap3 )
{
TextureSequence* newTex = new TextureSequence( textureMap0, textureMap1, textureMap2, textureMap3 );
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline BumpMapFunction* SceneDescription::NewBumpMapFunction()
{
BumpMapFunction* newTex = new BumpMapFunction();
TextureMapBase* newTexBase = (TextureMapBase*)newTex;
TextureArray.Push( newTexBase );
return newTex;
}
inline void SceneDescription::DeleteAll()
{
DeleteAllLights();
DeleteAllTextures();
DeleteAllMaterials();
DeleteAllViewables();
}
#endif // SCENE_DESCRIPTION_H
|
[
"[email protected]"
] |
[
[
[
1,
366
]
]
] |
5af26a43290de758b8c8704c8225a0163eabe45a
|
45229380094a0c2b603616e7505cbdc4d89dfaee
|
/wavelets/facedetector_src/src/cvLib/ImageResize.cpp
|
6c3b9d3ea40ce21e90f34abaa1611d232e5accd9
|
[] |
no_license
|
xcud/msrds
|
a71000cc096723272e5ada7229426dee5100406c
|
04764859c88f5c36a757dbffc105309a27cd9c4d
|
refs/heads/master
| 2021-01-10T01:19:35.834296 | 2011-11-04T09:26:01 | 2011-11-04T09:26:01 | 45,697,313 | 1 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,554 |
cpp
|
#include "stdafx.h"
#include "ImageResize.h"
#include "vec2D.h"
#include "basefwt.h"
#include "haar.h"
/////////////////////////constructors/destructors////////////////////////////////////////////////////
ImageResize::ImageResize() : m_status(0), m_width(0), m_height(0), m_rdata(0), m_gdata(0), m_bdata(0),
m_zoom(1.0f), m_y(0)
{
m_r = new Haar();
m_g = new Haar();
m_b = new Haar();
}
ImageResize::~ImageResize()
{
delete m_r;
delete m_g;
delete m_b;
if (m_y != 0) delete m_y;
if (m_rdata != 0) delete[] m_rdata;
if (m_gdata != 0) delete[] m_gdata;
if (m_bdata != 0) delete[] m_bdata;
}
/////////////////////////constructors/destructors////////////////////////////////////////////////////
void ImageResize::init(unsigned int w, unsigned int h, float zoom)
{
m_width = w;
m_height = h;
m_zoom = zoom;
if (m_y != 0) delete m_y;
m_y = new vec2D((unsigned int)((float)h*zoom), (unsigned int)((float)w*zoom));
if (m_rdata != 0) delete[] m_rdata;
m_rdata = new unsigned char[w*h];
if (m_gdata != 0) delete[] m_gdata;
m_gdata = new unsigned char[w*h];
if (m_bdata != 0) delete[] m_bdata;
m_bdata = new unsigned char[w*h];
m_r->init(w, h);
m_g->init(w, h);
m_b->init(w, h);
m_status = 1;
}
int ImageResize::resize(const unsigned char *pBGR) //pBGR [bgr] triplets
{
if (m_status == 0) return -1;
//uchar to char
for (unsigned int i = 0; i < m_width*m_height; i++) {
m_bdata[i] = *pBGR++;
m_gdata[i] = *pBGR++;
m_rdata[i] = *pBGR++;
}
//transform///////////////////////////////////////////
unsigned int scales = (unsigned int)log2(1.0f / m_zoom);
m_r->trans(m_rdata, scales);
m_g->trans(m_gdata, scales);
m_b->trans(m_bdata, scales);
rgb2y();
//debug
//m_y->print(L"pic.txt");
return 0;
}
int ImageResize::resize(const unsigned char* pR,
const unsigned char* pG,
const unsigned char* pB) const
{
if (m_status == 0) return -1;
//transform///////////////////////////////////////////
int scales = (int)log2(1.0f / m_zoom);
m_r->trans(pR, scales);
m_g->trans(pG, scales);
m_b->trans(pB, scales);
rgb2y();
//debug
//m_y->print(L"pic.txt");
return 0;
}
void ImageResize::rgb2y() const
{
char** r2 = m_r->getspec2d();
char** g2 = m_g->getspec2d();
char** b2 = m_b->getspec2d();
//gray scale convert
for (unsigned int y = 0; y < m_y->height(); y++)
for (unsigned int x = 0; x < m_y->width(); x++) {
int r = int(r2[y][x]) + 128;
int g = int(g2[y][x]) + 128;
int b = int(b2[y][x]) + 128;
(*m_y)(y, x) = 0.2989f * float(r) + 0.5870f * float(g) + 0.1140f * float(b); //SSE on
}
}
char** ImageResize::getr() const
{
return m_r->getspec2d();
}
char** ImageResize::getg() const
{
return m_g->getspec2d();
}
char** ImageResize::getb() const
{
return m_b->getspec2d();
}
|
[
"perpet99@cc61708c-8d4c-0410-8fce-b5b73d66a671"
] |
[
[
[
1,
129
]
]
] |
e4a281c4b778c25a78af02d2a12ed42508ed9acc
|
3c4f5bd6d7ac3878c181fb05ab41c1d755ddf343
|
/CmdLine.cpp
|
81dd55afd62e160a9333735ff94c4b853383551f
|
[] |
no_license
|
imcooder/public
|
1078df18c1459e67afd1200346dd971ea3b71933
|
be947923c6e2fbd9c993a41115ace3e32dad74bf
|
refs/heads/master
| 2021-05-28T08:43:00.027020 | 2010-07-24T07:39:51 | 2010-07-24T07:39:51 | 32,301,120 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,633 |
cpp
|
#include "stdafx.h"
#include "CmdLine.h"
CParseCmdLine::CParseCmdLine( LPCTSTR pszCmd)
{
Parse(pszCmd);
}
CParseCmdLine::~CParseCmdLine()
{
}
void CParseCmdLine::Reset()
{
ZeroMemory(m_szCmdLine, sizeof(m_szCmdLine));
ZeroMemory(m_pszArg, sizeof(m_pszArg));
m_wArgCount = 0;;
}
void CParseCmdLine::Parse(LPCTSTR pszCmd)
{
Reset();
if (!pszCmd)
{
return;
}
TCHAR szCmdLine[MAX_SIZE_LL] = {0};
_tcsncpy_s(szCmdLine, _countof(szCmdLine), pszCmd, _TRUNCATE);
TCHAR szSeprateCmd[4][MAX_SIZE_SSS] = {0};
LPTSTR pszToken = NULL, pszNextToken = NULL;
m_wArgCount = 0;
pszToken = _tcstok_s(szCmdLine, TEXT("-\\/"), &pszNextToken);
TCHAR szArg[MAX_SIZE_M] = {0};
while (pszToken)
{
_tcsncpy_s(szArg, _countof(szArg), pszToken, _TRUNCATE);
StrTrim(szArg, TEXT(" \t"));
if (m_wArgCount >= _countof(m_pszArg) - 2)
{
break;
}
if (szArg[0])
{
LPTSTR pszLocal = NULL;
if (!m_wArgCount)
{
pszLocal = m_szCmdLine;
}
else
{
pszLocal = m_pszArg[m_wArgCount - 1];
pszLocal += _tcslen(pszLocal) + 1;
}
if (pszLocal + _tcslen(szArg) < m_szCmdLine + _countof(m_szCmdLine) - 3)
{
*pszLocal = 0;// Important for _tcsncpy_s
_tcscpy(pszLocal, szArg);
m_pszArg[m_wArgCount] = pszLocal;
m_wArgCount ++;
}
}
pszToken = _tcstok_s(NULL, TEXT("-\\/"), &pszNextToken);
}
}
DWORD CParseCmdLine::GetCount() const
{
return m_wArgCount;
}
LPCTSTR CParseCmdLine::GetArgument( DWORD dwIdx) const
{
if (dwIdx >= m_wArgCount)
{
return NULL;
}
return m_pszArg[dwIdx];
}
|
[
"[email protected]@716a2f10-c84c-11dd-bf7c-81814f527a11"
] |
[
[
[
1,
83
]
]
] |
ca7433ceb1328a3bb7bc209a3d4f1aee5731e5ff
|
ef23e388061a637f82b815d32f7af8cb60c5bb1f
|
/src/emu/machine/at28c16.h
|
82413829e76b015f57d1e4fe5d2046587f3f8578
|
[] |
no_license
|
marcellodash/psmame
|
76fd877a210d50d34f23e50d338e65a17deff066
|
09f52313bd3b06311b910ed67a0e7c70c2dd2535
|
refs/heads/master
| 2021-05-29T23:57:23.333706 | 2011-06-23T20:11:22 | 2011-06-23T20:11:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,344 |
h
|
/***************************************************************************
ATMEL AT28C16
16K ( 2K x 8 ) Parallel EEPROM
***************************************************************************/
#pragma once
#ifndef __AT28C16_H__
#define __AT28C16_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_AT28C16_ADD( _tag, _interface ) \
MCFG_DEVICE_ADD( _tag, AT28C16, 0 )
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> at28c16_interface
struct at28c16_interface
{
};
// ======================> at28c16_device_config
class at28c16_device_config :
public device_config,
public device_config_memory_interface,
public device_config_nvram_interface,
public at28c16_interface
{
friend class at28c16_device;
// construction/destruction
at28c16_device_config( const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock );
public:
// allocators
static device_config *static_alloc_device_config( const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock );
virtual device_t *alloc_device( running_machine &machine ) const;
// inline configuration indexes
enum
{
INLINE_INTERFACE
};
protected:
// device_config overrides
virtual void device_config_complete();
virtual bool device_validity_check( emu_options &options, const game_driver &driver ) const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config( address_spacenum spacenum = AS_0 ) const;
// device-specific configuration
address_space_config m_space_config;
};
// ======================> at28c16_device
class at28c16_device :
public device_t,
public device_memory_interface,
public device_nvram_interface
{
friend class at28c16_device_config;
// construction/destruction
at28c16_device( running_machine &_machine, const at28c16_device_config &config );
public:
// I/O operations
void write( offs_t offset, UINT8 data );
UINT8 read( offs_t offset );
void set_a9_12v( int state );
void set_oe_12v( int state );
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
// device_nvram_interface overrides
virtual void nvram_default();
virtual void nvram_read( emu_file &file );
virtual void nvram_write( emu_file &file );
// internal helpers
static TIMER_CALLBACK( write_finished );
// internal state
const at28c16_device_config &m_config;
emu_timer *m_write_timer;
int m_a9_12v;
int m_oe_12v;
int m_last_write;
};
// device type definition
extern const device_type AT28C16;
//**************************************************************************
// READ/WRITE HANDLERS
//**************************************************************************
WRITE8_DEVICE_HANDLER( at28c16_w );
READ8_DEVICE_HANDLER( at28c16_r );
WRITE_LINE_DEVICE_HANDLER( at28c16_a9_12v );
WRITE_LINE_DEVICE_HANDLER( at28c16_oe_12v );
#endif
|
[
"Mike@localhost"
] |
[
[
[
1,
125
]
]
] |
68c8369f72e24b99f1461f3486ca2ca45bcada42
|
d752d83f8bd72d9b280a8c70e28e56e502ef096f
|
/FugueDLL/String Data/StringConstants.h
|
fd74858eba8de6393a847a359328605f8909c69c
|
[] |
no_license
|
apoch/epoch-language.old
|
f87b4512ec6bb5591bc1610e21210e0ed6a82104
|
b09701714d556442202fccb92405e6886064f4af
|
refs/heads/master
| 2021-01-10T20:17:56.774468 | 2010-03-07T09:19:02 | 2010-03-07T09:19:02 | 34,307,116 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 218 |
h
|
//
// The Epoch Language Project
// FUGUE Virtual Machine
//
// Constant declarations for strings used by the Epoch system
//
#pragma once
namespace Strings
{
extern const char* WindowTitle;
}
|
[
"[email protected]"
] |
[
[
[
1,
17
]
]
] |
40a935aafff55f6d7918cd7c08fb53bdd6d9ac55
|
971b000b9e6c4bf91d28f3723923a678520f5bcf
|
/_odbc_wizard/c_gui/invoice.cpp
|
cf25f22a64939ba6f8176cc7f91c2b8c66d4be6d
|
[] |
no_license
|
google-code-export/fop-miniscribus
|
14ce53d21893ce1821386a94d42485ee0465121f
|
966a9ca7097268c18e690aa0ea4b24b308475af9
|
refs/heads/master
| 2020-12-24T17:08:51.551987 | 2011-09-02T07:55:05 | 2011-09-02T07:55:05 | 32,133,292 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,171 |
cpp
|
#include "invoice.h"
//
/* Save file as invoice.cpp */
/* Class Invoice Created on Fri Sep 29 18:55:33 CEST 2006 */
//
#include <QCloseEvent>
//
//
Invoice::Invoice()
{
setupUi( this );
largominimocentro = 760;
summlinerfak = 1;
FirstSetup();
flow = new FlowLayout(piano_centrale,2,8);
piano_centrale->setMinimumSize(QSize(largominimocentro, 15 ));
setMinimumSize(QSize(largominimocentro + 110, 600));
connect( aggiungilineax, SIGNAL( clicked() ),this, SLOT( AppendLine()));
/* aggiungilineax */
AppendLine();
}
void Invoice::FirstSetup()
{
QDateTime timer( QDateTime::currentDateTime() );
const uint rifermineto = timer.toTime_t();
riferimNR = QString("RT-%1").arg(QString::number(rifermineto));
riferimento_generato->setText(riferimNR);
/* verifica se il numero esiste */
}
void Invoice::AppendLine()
{
sumflow = flow->count();
if ( sumflow <= 9) {
aggiungilineax->setDisabled (false); /* disable button */
summlinerfak++;
fiocco = new ItemLine(piano_centrale);
fiocco->setNumerate(summlinerfak);
fiocco->setTitle(tr("Testo di descrizione %1").arg(summlinerfak));
fiocco->setQuant(1);
fiocco->setUnitprice(0);
connect(fiocco, SIGNAL(RemoveItems(int)), this, SLOT(RemoveItemFromList(int)));
connect(fiocco, SIGNAL(RecalCalc()), this, SLOT(WakeUpsAll()));
connect(fiocco, SIGNAL(MoveUp(int)), this, SLOT(RegisterUpLine(int)));
flow->addWidget(fiocco);
flow->setGeometry(QRect(QPoint(10,10),QSize(800,800)));
WakeUpsAll();
/*qDebug() << "### sendaltos " << sendaltos;*/
lines.append( fiocco ); /* QList<ItemLine *> lines; */
} else {
WakeUpsAll();
aggiungilineax->setDisabled (true); /* disable button */
}
}
void Invoice::RegisterUpLine( int nummerfak )
{
if ( flow->count() >= 1 and lines.size() >= 2) {
int effettivo = Linefindstatus(nummerfak);
int movetonew = effettivo - 1;
if (movetonew >= 0) {
/* replace items start */
lines[effettivo]->CalcSumLine();
QString asx = lines[effettivo]->Get_Title_Pos();
double bsx = lines[effettivo]->Get_Menge_Pos();
double csx = lines[effettivo]->Get_Unitprice_Pos();
lines[movetonew]->CalcSumLine();
QString fsx = lines[movetonew]->Get_Title_Pos();
double gsx = lines[movetonew]->Get_Menge_Pos();
double hsx = lines[movetonew]->Get_Unitprice_Pos();
/* swap line up & down */
lines[movetonew]->setTitle(asx);
lines[movetonew]->setQuant(bsx);
lines[movetonew]->setUnitprice(csx);
/* swap line up & down */
lines[effettivo]->setTitle(fsx);
lines[effettivo]->setQuant(gsx);
lines[effettivo]->setUnitprice(hsx);
/* recalc to new value */
lines[effettivo]->CalcSumLine();
lines[movetonew]->CalcSumLine();
/* replace items stop */
}
}
WakeUpsAll();
}
void Invoice::WakeUpsAll()
{
sumflow = flow->count();
qlistersizert = lines.size();
qDebug() << "### WakeUpsAll sumflow ->" << sumflow << " qlist ->" << qlistersizert;
if ( sumflow <= 9) {
aggiungilineax->setDisabled (false);
} else {
aggiungilineax->setDisabled (true);
}
SummarizeTotal();
int altor = 35;
int sendaltos, totalwidg;
sendaltos = altor * (sumflow + 1);
totalwidg = 340 + sendaltos;
if (sumflow > 0) {
piano_centrale->setMinimumSize(QSize(largominimocentro, sendaltos));
setMinimumSize(QSize(largominimocentro, totalwidg));
} else {
piano_centrale->setMinimumSize(QSize(largominimocentro, altor));
}
}
void Invoice::RemoveItemFromList( int nummerfak )
{
int removesx = Linefindstatus(nummerfak);
if (removesx >= 0) {
lines.removeAt(removesx);
}
WakeUpsAll();
sumflow = flow->count();
qlistersizert = lines.size();
if (qlistersizert < 1) {
AppendLine();
}
}
int Invoice::Linefindstatus( int nummerfak )
{
int finder = -1;
for ( int x = 0; x < lines.size() ; ++x ) {
int grab = lines[x]->Get_Nummer_Pos();
if ( grab == nummerfak ) {
finder = x;
}
}
return finder;
}
void Invoice::SummarizeTotal()
{
double summsval = 0;
for ( int x = 0; x < lines.size() ; ++x ) {
summsval +=lines[x]->Get_Line_Tot();
}
bool ok;
double d;
QString istx = QString("%1").arg(summsval);
QLocale c(QLocale::C);
d = c.toDouble( istx , &ok );
fatt_totale_fr->setText(QString("Valuta %1 ").arg(d) );
}
void Invoice::closeEvent( QCloseEvent* e )
{
e->accept();
}
/* -------------------------ItemLine::ItemLine----------------------------------------------*/
ItemLine::ItemLine(QWidget *parent)
: QWidget( parent )
{
gridLayout = new QGridLayout(this);
gridLayout->setSpacing(1);
gridLayout->setMargin(1);
hboxLayout = new QHBoxLayout();
hboxLayout->setSpacing(0);
hboxLayout->setMargin(0);
capitolo = new QLabel(this);
capitolo->setText(tr(" a1."));
fine = new QLabel(this);
fine->setText(tr(" "));
fatextline = new QLineEdit(this);
fatextline->setMinimumSize(QSize(380, 18));
fatextline->setMaximumSize(QSize(380, 18));
fquant = new QDoubleSpinBox(this);
fquant->setMaximum(9999.99);
unitafr = new QDoubleSpinBox(this);
unitafr->setMaximum(1e+06);
sommalineafr = new QDoubleSpinBox(this);
sommalineafr->setMaximum(1e+06);
eliminalinea = new QToolButton(this);
eliminalinea->setText(tr("Del"));
moveup = new QToolButton(this);
moveup->setText(tr("Up"));
hboxLayout->addWidget(capitolo);
hboxLayout->addWidget(fatextline);
hboxLayout->addWidget(fine);
hboxLayout->addWidget(fquant);
hboxLayout->addWidget(fine);
hboxLayout->addWidget(unitafr);
hboxLayout->addWidget(fine);
hboxLayout->addWidget(sommalineafr);
hboxLayout->addWidget(fine);
hboxLayout->addWidget(moveup);
hboxLayout->addWidget(fine);
hboxLayout->addWidget(eliminalinea);
hboxLayout->addWidget(fine);
gridLayout->addLayout(hboxLayout, 1, 0, 1, 1);
connect( moveup, SIGNAL( clicked() ),this, SLOT( MoveUpActuals()));
connect( eliminalinea, SIGNAL( clicked() ),this, SLOT( RemoveActuals()));
connect(fquant, SIGNAL(valueChanged(double)), this, SLOT(CalcSumLine()));
connect(unitafr, SIGNAL(valueChanged(double)), this, SLOT(CalcSumLine()));
connect(fatextline, SIGNAL(textChanged(QString)), this, SLOT(CalcSumLine()));
connect(fatextline, SIGNAL(editingFinished()), this, SLOT(CalcSumLine()));
}
void ItemLine::MoveUpActuals()
{
emit MoveUp(chain);
}
void ItemLine::RemoveActuals()
{
emit RemoveItems(chain);
delete this;
}
void ItemLine::setNumerate( int pos )
{
chain = pos;
if (chain > 9) {
capitolo->setText(QString(" ID %1 ").arg(QString::number(pos)));
} else {
capitolo->setText(QString(" ID 0%1 ").arg(QString::number(pos)));
}
}
void ItemLine::setTitle( QString title )
{
fatextline->setText(title);
}
void ItemLine::setQuant( double menge )
{
fquant->setValue(menge);
/*
int value () const
void setValue ( int val )
*/
}
void ItemLine::setUnitprice( double unitario )
{
unitafr->setValue(unitario);
}
void ItemLine::CalcSumLine()
{
dicituratitolo = fatextline->text();
menge = fquant->value();
afranchi = unitafr->value();
sommaline = menge * afranchi;
sommalineafr->setValue(sommaline);
emit RecalCalc();
}
|
[
"[email protected]@9af58faf-7e3e-0410-b956-55d145112073"
] |
[
[
[
1,
284
]
]
] |
515d7697166f925d3fe37f274058e538cbaf3523
|
8d2f7e73154de7c9b5ba8e9530bbc0655f3d1f80
|
/java/jniwrapper-3.6.1-win32/samples/native/JNIWrapperSampleDLL.cpp
|
7f8006ad7f64f03fa37ea2adca72fe73510c42cb
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
bspkrs/la2-screenbot
|
6dd5608d868e3462e9e2e73d3b7bbcb2c00f0dd4
|
097870e30aac8717fb087b7f910e1bdfda659a49
|
refs/heads/master
| 2021-01-10T12:53:39.644240 | 2008-08-04T13:51:49 | 2008-08-04T13:51:49 | 55,447,465 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,397 |
cpp
|
#include "stdafx.h"
#define EOF (-1)
#ifdef __cplusplus // If used by C++ code,
extern "C" { // we need to export the C interface
#endif
using namespace std;
// Global variable.
extern "C" __declspec (dllexport) int* _data = new int(123);
// The Sample Structure with fields of most usable types.
struct SampleStructure
{
bool b;
short s;
int i;
long l;
char c;
wchar_t w;
float f;
double d;
long double ld;
};
// The structure with the pointer field.
struct KeyValueStructure
{
int* key;
char* value;
};
// The structure with union.
struct UnionStructure
{
bool isChar;
union
{
wchar_t symbol;
int code;
};};
// The structure with the pointer field, which refers to the next structure.
struct LinkedStructure
{
int content;
LinkedStructure* next;
};
//--------------------------------------functions--------------------------------------
// Puts a string to the standard output stream. CDECL calling convention.
__declspec(dllexport) void printStringCdeclCall(LPTSTR lpszMsg)
{
cout<<lpszMsg;
}
// Returns a sum of two numbers. Std calling convention.
__declspec(dllexport) int _stdcall sumStdCall(int a,int b)
{
return a + b;
}
// Copies SampleStructures:inStructure to the outStructure.
__declspec(dllexport) void _stdcall copySampleStructure( SampleStructure* inStructure,
SampleStructure* outStructure)
{
outStructure->b = inStructure->b;
outStructure->s = inStructure->s;
outStructure->i = inStructure->i;
outStructure->l = inStructure->l;
outStructure->c = inStructure->c;
outStructure->w = inStructure->w;
outStructure->d = inStructure->d;
outStructure->f = inStructure->f;
outStructure->ld = inStructure->ld;
}
// Assigns 0 to the Key and empty string to the Value fields of KeyValueStructure.
__declspec(dllexport) void _stdcall fillKeyValueStructure(KeyValueStructure* inStructure)
{
*(inStructure->key) = 365;
inStructure->value = " days of the year.";
}
// Copies UnionStructure to another UnionStructure according to the isSymbol flag value.
__declspec(dllexport) void _stdcall copyUnionStructure(UnionStructure* inStructure,
UnionStructure* outStructure)
{
outStructure->isChar = inStructure->isChar;
if (inStructure->isChar == 0)
outStructure->code = inStructure->code;
else
outStructure->symbol = inStructure->symbol;
}
// Fills the content of 10 linkedStructure with numbers from 1 to 10
// and refers each to the next LinkedStructure.
__declspec(dllexport) void _stdcall fillLinkedStructures( LinkedStructure* firstLinkedStructure)
{
LinkedStructure* current = new LinkedStructure();
current->next = NULL;
LinkedStructure* previous;
int n = 10;
for(int i = 0; i < n; i++)
{
current->content = i;
previous = new LinkedStructure();
previous->next = current;
current = previous;
}
*firstLinkedStructure = *(previous->next);
}
// Returns the minimum value in the array of doubles.
__declspec(dllexport) double _stdcall findMinimum(double* array,int size)
{
double result = array[0];
for(int i=1 ; i< size; i++)
{
if(array[i] < result)
result = array[i];
}
return result;
}
// Returns the Value field according to the incoming Key value,
// finding the appropriate one among the specified KeyValueStructure array.
_declspec(dllexport) char* _stdcall findValueByKey(KeyValueStructure * structures,
int size, int key)
{
char* result;
for(int i=0; i < size; i++)
if (*structures[i].key == key)
result = structures[i].value;
return result;
}
// Removes duplicated values in the incoming array of doubles, changing the incoming array.
_declspec(dllexport) void _stdcall removeDuplicates(double* inArray,
int* length)
{
int currentSize = *length;
double current;
for(int i = 0;i < currentSize; i++)
{
current = inArray[i];
for(int j=(i+1); j < *length ; j++)
if(inArray[j] == current)
{
for(int k = j ; k < currentSize; k++)
inArray[k] = inArray[k+1];
currentSize--;
j--;
}
}
*length = currentSize;
}
// Removes duplicated values in the incoming array of characters without changing the incoming value.
_declspec(dllexport) void _stdcall removeDuplicatesFromString
(char* inString, char** returnValue)
{
int len = (int)strlen(inString);
char* outString =new char[len];
char current;
int pos=0;
int outPos=0;
bool oneMore = false;
while (current != '\0')
{
oneMore = false;
current = inString[pos];
for(int i=(pos+1) ; i < len; i++)
if(inString[i] == current)
oneMore = true;
if (!oneMore)
{
outString[outPos] = current;
outPos++;
}
pos++;
}
*returnValue = outString;
}
// Finds the longest string in the specified zero-terminated string array.
_declspec(dllexport) wchar_t* _stdcall findLongest(wchar_t* inArray)
{
int pos = 0;
int len = (int) wcslen(inArray);
wchar_t* longest = new wchar_t[len + 1];
wchar_t* word;
wcsncpy(longest, inArray + pos, len + 1);
while (*(inArray+pos) != '\0')
{
len = (int) wcslen(inArray + pos);
word = new wchar_t[len + 1];
wcsncpy(word, inArray + pos, len + 1);
if (wcslen(word) > wcslen(longest))
longest = word;
pos += len + 1;
}
return longest;
}
// Converts Unicode string to the ANSI one.
_declspec(dllexport) void _stdcall convert(wchar_t* inArray, char* outArray)
{
int len=0,pos=0;
while (*(inArray+pos) != '\0')
{
len = (int) wcslen(inArray + pos);
wchar_t* word = new wchar_t[len + 1];
char* charWord = new char[len + 1];
wcsncpy(word, inArray + pos, len + 1);
wcstombs(charWord, word, len+1);
strncpy(outArray + pos, charWord, len+1);
pos += len + 1;
}
}
typedef int _stdcall SumCallback(int number);
// Calculates a sum of all the natural numbers from 0 to number using java-side callback.
_declspec(dllexport) int _stdcall calculateSum(SumCallback* func,int number)
{
int sum = 0;
sum = func(number);
return sum;
}
#ifdef __cplusplus
}
#endif
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
|
[
"snslabs@ec34e671-4053-0410-a674-5d74bf75b951"
] |
[
[
[
1,
258
]
]
] |
507398933b50f59b8e812102cb03673d6a355f65
|
85ee7e4ebdc4323939a5381ef0ec1d296412533b
|
/source/Filesystem/FileSystem.cpp
|
4af0db308f2028a498dc2ba3dd845ff7c85f22aa
|
[
"MIT"
] |
permissive
|
hyperiris/praetoriansmapeditor
|
af71ab5d9174dfed1f4d8a4c751d92275eb541f2
|
e6f7c7bc913fb911632a738a557b5f2eb4d4fc57
|
refs/heads/master
| 2016-08-10T22:40:11.230823 | 2008-10-24T05:09:54 | 2008-10-24T05:09:54 | 43,621,569 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,988 |
cpp
|
#include "FileSystem.h"
#include "DirectoryScanner.h"
#include "Archive.h"
#include "../Managers/ArchivedItemManager.h"
#include "../Managers/MediaPathManager.h"
#include "../Kernel/Gateway.h"
Array <OCString> FileSystem::registeredNames;
ArrayPtr <Archive> FileSystem::archives;
GenericPool <ArchivedFile, 20, 10> FileSystem::openedFiles;
bool FileSystem::initialize()
{
DirectoryScanner dir;
DirectoryItem item;
const char* path;
OCString ext;
OCString::size_type idx;
HKEY hkey;
DWORD buffersize;
char* regval;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Pyro Studios\\Praetorians Game\\Paths", 0, KEY_READ, &hkey))
{
RegQueryValueEx(hkey, "Raiz", 0, 0, 0, &buffersize);
regval = new char[buffersize];
RegQueryValueEx(hkey, "Raiz", 0, 0, (LPBYTE)regval, &buffersize);
String strkey = String(regval) + "DATA\\";
strkey.convertChars('\\', '/');
MediaPathManager::registerPath(strkey);
deleteArray(regval);
}
for (int i = 0; i < MediaPathManager::getPathCount(); i++)
{
path = MediaPathManager::getPath(i);
dir.set(path);
while (dir.next())
{
item = dir.currentItem();
if (DIR_FILE == item.type)
{
idx = item.name.rfind(".");
if (idx == OCString::npos)
continue;
ext = item.name.substr(idx + 1);
if (ext == "PAK" || ext == "pak" || ext == "ZIP" || ext == "zip" || ext == "PAT" || ext == "pat")
if (!FileSystem::registerArchive(OCString(path + item.name).c_str()))
Logger::writeWarningLog(String("Could not register archive -> ") + item.name.c_str());
}
}
}
return true;
}
bool FileSystem::registerArchive(const char* path)
{
if (!strlen(path))
return false;
OCString tpath(path);
tpath = tpath.substr(tpath.rfind('/') + 1);
if (FileSystem::checkForRepeat(tpath.c_str()))
return true;
Archive* archive = new Archive(tpath.substr(0, tpath.rfind('.')).c_str());
if (!archive->open(path))
{
deleteObject(archive);
return false;
}
registeredNames.append(tpath);
archives.append(archive);
return true;
}
ArchivedFile* FileSystem::checkOut(const char* name)
{
ArchivedFile* p = openedFiles.allocate();
if (!checkOut(name, p))
{
openedFiles.recycle(p);
return 0;
}
return p;
}
bool FileSystem::checkOut(const char* name, ArchivedFile* file)
{
ZipEntry entry;
unsigned char* buf = 0;
ArchiveInfo* info;
file->reset();
if (!strlen(name) || !file || archives.length() == 0)
return Logger::writeWarningLog(String("FileSystem::checkOut - > ") + name);
for (unsigned int i = 0; i < archives.length(); i++)
if (archives(i)->findEntry(name, &entry))
{
info = ArchivedItemManager::getItemInfo(entry.zipname.c_str());
if (info)
{
info->increaseUserCount();
buf = info->getMedia();
}
else
{
//buf = new unsigned char[entry.zipuncmp];
buf = (unsigned char*) Gateway::aquireFilebufferMemory(entry.zipuncmp);
if (!archives(i)->unpackEntry(&entry, buf))
{
//deleteArray(buf);
Gateway::releaseFilebufferMemory(buf);
return Logger::writeErrorLog(String("Could not unpack file -> ") + name);
}
ArchivedItemManager::addItemInfo(new ArchiveInfo(entry.zipname.c_str(), buf));
}
file->size = entry.zipuncmp;/// <-- ?
file->setName(entry.zipname.c_str());
file->data = buf;
return true;
}
return false;
}
bool FileSystem::fileExist(const char* name)
{
if (!strlen(name) || archives.length() == 0)
return false;
for (unsigned int i = 0; i < archives.length(); i++)
if (archives(i)->containsEntry(name))
return true;
return false;
}
void FileSystem::checkIn(ArchivedFile* file)
{
if (!file || !file->data)
return;
ArchiveInfo* info = ArchivedItemManager::getItemInfo(file->getName());
if (info)
{
info->decreaseUserCount();
if (info->getUserCount() == 0)
Gateway::releaseFilebufferMemory(info->getMedia());
ArchivedItemManager::flushUnusedItems();
file->reset();
}
openedFiles.recycle(file);
}
bool FileSystem::checkForRepeat(const char* path)
{
return registeredNames.contains(path);
}
void FileSystem::printAllRegisteredNames()
{
for (unsigned int i = 0; i < registeredNames.length(); i++)
Logger::writeInfoLog(String("Registered archive -> ") + registeredNames(i).c_str());
}
void FileSystem::printAllPaths()
{
for (unsigned int i = 0; i < archives.length(); i++)
archives(i)->printAllPaths();
}
void FileSystem::printAllEntries()
{
for (unsigned int i = 0; i < archives.length(); i++)
archives(i)->printAllEntries();
}
void FileSystem::reset()
{
//ArchivedItemManager::flushAllItems();
ArchiveInfo* info;
for (unsigned int i = 0; i < ArchivedItemManager::getInfoCount(); i++)
{
info = ArchivedItemManager::getItemInfo(i);
if (info->getUserCount() == 0)
Gateway::releaseFilebufferMemory(info->getMedia());
}
ArchivedItemManager::flushUnusedItems();
}
void FileSystem::destroy()
{
//for (size_t i = 0; i < archives.length(); i++)
// archives(i)->close();
ArchiveInfo* info;
for (unsigned int i = 0; i < ArchivedItemManager::getInfoCount(); i++)
{
info = ArchivedItemManager::getItemInfo(i);
if (info->getUserCount() == 0)
Gateway::releaseFilebufferMemory(info->getMedia());
}
ArchivedItemManager::flushAllItems();
archives.clearAndDestroy();
registeredNames.clear();
}
|
[
"kwantum26@d2fd1b2e-92ce-11dd-9977-cddf1a87921b"
] |
[
[
[
1,
230
]
]
] |
291f37705cd75c3b0f3933a46628f288f8fa0cee
|
565d432f8223100873944cfa22b9d9b2f14575f1
|
/图片验证码/ClassTupian/ClassTupianDlg.cpp
|
b1d0157e416db0d0bdd99cd49e51de0c5d95a01a
|
[] |
no_license
|
glencui2015/tlautologin
|
ce029c688e0414497e91115a2ee19e7abcac56d2
|
6e825807e2523bf4e020d91f92d86ce194747d0d
|
refs/heads/master
| 2021-01-10T10:50:34.139524 | 2010-12-17T17:43:33 | 2010-12-17T17:43:33 | 50,753,256 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 18,395 |
cpp
|
// ClassTupianDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ClassTupian.h"
#include "ClassTupianDlg.h"
#include "DealPic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CClassTupianDlg dialog
CClassTupianDlg::CClassTupianDlg(CWnd* pParent /*=NULL*/)
: CDialog(CClassTupianDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CClassTupianDlg)
m_edit = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CClassTupianDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CClassTupianDlg)
DDX_Control(pDX, IDC_EDIT2, m_Pointlist);
DDX_Text(pDX, IDC_EDIT1, m_edit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CClassTupianDlg, CDialog)
//{{AFX_MSG_MAP(CClassTupianDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CClassTupianDlg message handlers
BOOL CClassTupianDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CClassTupianDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CClassTupianDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CClassTupianDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
// char *pDate = "\x00\x3F\xFF\xFF\xFF\x44\xE3\xB0\x00\x40\x00\x00\x3F\xD8\x00\xE0"
// "\x00\x3F\xFF\xFF\xFF\xFF\xF4\xFA\x00\x20\x00\x18\xC7\xFC\x01\xF0"
// "\x02\xBA\xFF\xFF\xFF\xFF\xFD\xFF\x00\x08\x06\x0B\xE7\xFF\xF7\xF0"
// "\x07\xF0\x1F\xFF\xFF\xFF\xFF\xFF\x80\x00\x02\x07\xFF\xFF\xFF\xF0"
// "\x07\xE1\x63\xFF\xEF\xFF\xFF\xFF\xC1\x00\x02\x3F\xFF\xFD\xFF\xF0"
// "\x07\xE3\xF3\xFF\xFF\xFF\xFF\xFF\xE9\xB0\x4F\x3F\xFF\xFF\xFD\xF0"
// "\x07\xE6\xF9\xFF\xFF\xC3\xED\xFF\xDF\xF1\xBC\x7F\xFF\xFF\xFC\xFC"
// "\x07\xC7\x78\xFF\xFF\xC0\xEF\xFF\xDF\xFF\xBC\x7F\xFF\xFF\xFF\xF0"
// "\x07\xC7\xF8\xFF\xFF\x98\x1F\xFF\xFF\xFF\xF8\x7F\xFF\xFF\xFF\xF0"
// "\x07\xE3\xB9\xFF\xFF\x9F\x0F\xFF\x3F\xDF\xE0\x72\xFF\x3B\xFF\xF8"
// "\x07\xC1\x79\xFF\xEF\x3F\xC6\x7F\x7F\xFF\xC0\xF0\xBF\x7D\xC1\xFC"
// "\x05\xE6\xE1\xFD\xD7\x3F\xF7\xFF\xFF\xFF\xC8\xFF\xBF\xFF\xC0\x73"
// "\x00\xDE\xA3\xF8\xDE\x7F\xBF\xBF\xFF\xFF\x08\xFF\xFF\xFF\x8C\x00"
// "\x00\xFC\x07\xFC\x7E\x4F\xBF\xBF\xFF\xFE\x71\xFD\xFF\xFF\x9D\x8C"
// "\x01\xF0\x3F\xFC\x2A\x0F\xFF\xFF\xFF\xFC\x71\xFD\xFF\xFF\x9F\xF8"
// "\x03\xC4\x3F\xFE\x03\x53\xFB\x7F\xFF\xF8\xF1\xFF\xED\x7E\x3F\xF0"
// "\x03\x87\x1F\xFE\x05\x79\xFA\x1F\xFF\xF1\xF1\xFF\xC0\x27\x3F\xB0"
// "\x03\x07\x1F\xFE\x00\x98\x1C\x0F\xF7\xE5\xE3\xFF\x80\x03\x3F\x10"
// "\x07\x07\x9B\xFE\x00\x43\x08\x05\xFF\xC7\xE3\xFE\x00\x03\x26\x00"
// "\x07\x47\x8F\xFE\x10\x03\x00\x00\xFF\x03\xE3\xFC\x00\x01\xFF\x00"
// "\x03\x07\x1F\xFE\x38\x07\x80\x00\x7F\xC0\x03\xE8\x00\x03\x83\x00"
// "\x03\x03\x9F\xFC\x30\x07\x00\x10\x3E\xFC\x03\x40\x00\x81\x81\x80"
// "\x01\xC2\x9F\xFC\x70\x03\x00\x10\x14\x4F\x81\x80\x00\x01\x05\x80"
// "\x01\xC8\x3F\xF8\x66\x06\x00\x00\x00\x07\xC7\x00\x00\x00\x05\xC0"
// "\x20\x3F\x7F\xF0\x24\x06\x00\x00\x00\x00\x71\x00\x00\x0C\x01\xC0"
// "\x20\x0C\x7F\x60\x10\x1C\x80\x40\x00\x00\x71\x00\x00\x0C\x01\x80"
// "\x00\x00\x5F\x00\x18\x1C\x00\x40\x00\x00\x74\x00\x00\x18\x01\x80"
// "\x10\x00\x00\x00\x67\xF8\x00\x00\x00\x0F\xF6\x00\x00\x18\x01\x80"
// "\x08\x00\x00\x00\x01\xFC\x00\x30\x00\x07\xFA\x01\x00\x58\x07\x00"
// "\x00\x90\x00\x00\x00\x10\x00\x20\x00\x00\x7C\x74\x00\x18\x07\x80"
// "\xC0\x40\x00\x00\x00\x06\x00\x80\x18\x00\xC4\x10\x18\x04\x0F\x00"
// "\xC0\x00\x80\x00\x40\x06\x00\x80\x08\x00\x00\x00\x08\x07\x7E\x00"
// "\x02\x00\x00\x00\x00\x02\x60\x00\x00\x00\x08\x00\x00\x01\x98\x40"
// "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x18\x20"
// "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00"
// "\x00\x13\x00\x00\x00\x00\x00\x00\x80\x00\x04\x00\x00\x06\x00\x00";
//0659
// char *pDate = "\x44\x02\xB0\x00\x00\x12\xCE\x22\x1E\x40\x18\x83\xC0\x25\x7C\x30"
// "\x0C\x0F\x3A\x03\x40\x34\x3F\xCF\xBF\xFA\x81\xEF\xE0\x39\xFC\xF0"
// "\x08\x19\xFF\x04\xA0\x3D\xBF\xFB\xFF\xFF\xBF\xE9\xE0\x00\x7F\xF0"
// "\x10\x7F\xFE\x2D\x98\x3F\xFF\xFB\xFD\xF3\xFF\xE7\xF9\x1E\x3F\xF0"
// "\x10\x7F\xFF\xBF\xE0\xFF\xFF\x7F\xFF\xFB\xFF\xE7\xFE\x3F\x07\xF0"
// "\x03\x7F\xEF\x9F\xE2\xF8\xFF\xFF\xFF\xFF\xFF\xFE\x7C\x3F\x8B\xC0"
// "\x03\xEF\xE7\xFF\xFA\xE0\xFD\xFF\xFF\x9F\xFF\xFF\x7C\x7F\x8B\xC0"
// "\xC3\xFF\xE0\xFF\xFF\x9E\x7F\xFF\xFE\xCF\xFF\xFC\xFC\x7F\xCF\xF0"
// "\x87\xBF\x00\x3F\xFF\x1E\x7F\xFF\xFF\x7F\xE1\xFF\xFC\x7F\x87\xF0"
// "\x5F\xDF\x1C\x1F\xF7\x3F\xFF\xFF\xFF\xF7\xE0\x7F\xFC\x7F\xC7\xF0"
// "\x7F\xFE\x1F\x9E\xF2\x7F\xFF\xFF\xFF\xFF\xCC\x1F\xFE\x7F\xC7\xF0"
// "\xFF\xBC\x7F\x9F\xFF\x37\xFF\xFF\xFF\xFF\xC7\x87\xFE\x7F\x87\xF0"
// "\xFF\x9C\x7F\x4F\xFF\x7B\xBF\xFF\xFF\xE6\x9B\xE3\xFE\x3F\xC3\xF0"
// "\xFF\xBC\x7F\x1F\xFE\x3E\x0F\xFF\xFF\xEF\x9F\xFB\xFD\x0E\x23\xF0"
// "\xFF\xD9\xFF\x8F\xFD\x39\x07\xFF\xFF\xFF\x3F\xFD\xFF\x82\x23\xF0"
// "\xFF\xF9\xFF\x0F\xFE\x1B\x81\xFF\xFF\xFF\x3F\xFD\xFF\x81\xF1\xF0"
// "\xFF\xF0\x6F\x1F\x7F\x1B\xA4\xFF\xFF\xFE\x07\xFF\xFF\xFF\xCA\x60"
// "\xFF\xF3\x07\x9F\xBF\x59\x1F\x7F\xFF\xFE\xA9\xF9\xFF\xDA\x9F\x00"
// "\xFF\xF2\x07\x1F\xFD\x70\x47\x3F\xFF\xE6\xBC\xFF\xDD\x00\x1D\x00"
// "\xFF\xE0\x07\x3F\x7C\x70\x27\x3F\xFF\xD0\x3E\x7F\xCC\x00\x1C\x00"
// "\xFF\xE2\x07\x3F\x7E\x30\x07\x9F\xFF\x80\x1E\x7F\x84\x08\x18\x00"
// "\xFF\xE0\x02\x7D\xFC\x34\x07\x0F\xFF\x08\x0E\x7F\x80\x18\x30\x80"
// "\xFF\xE4\x00\x7C\xFC\x1C\x03\x0B\xFD\x1C\x04\x3E\x40\x18\xF0\x80"
// "\xF3\xE4\x02\x7F\xF8\x1C\x03\x01\xF8\x18\x82\x78\x00\x3C\xF0\x00"
// "\xFF\xFC\x07\xFF\xF0\x0E\x07\x00\x20\x38\x41\x80\x40\x27\x00\x04"
// "\x7F\xEC\x07\x7F\xE1\x8F\x06\x00\x10\x30\x03\x00\x40\x00\x00\x00"
// "\x1F\x8E\x1E\x1F\x86\x0B\xAC\x00\x00\x10\x03\x20\x00\x00\x00\x00"
// "\x00\x06\x7C\x00\x00\x03\xF0\x00\x00\x08\x0E\x10\x10\x00\x10\x00"
// "\x00\x01\xF8\x00\x00\x00\x60\x00\x00\x0C\x0E\x00\x08\x20\x00\x01"
// "\x00\x00\x40\x00\x00\x00\x40\x00\x00\x03\xFE\x00\x00\x10\x00\x00"
// "\x00\x10\x00\x00\x04\x00\x00\x00\x00\x00\xFE\x00\x00\x00\x40\x18"
// "\x00\x18\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x0C\x40\x08"
// "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00"
// "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x10\x00"
// "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x18\x00"
// "\x00\x00\x20\x00\x04\x00\x10\x00\x00\x40\x00\x00\x00\x00\x00\x0C";
//1202
// char *pDate = "\x00\x00\x00\x00\x00\x00\x01\x80\x00\x00\x30\x00\x30\x00\x00\x00"
// "\x10\x00\x00\x00\x00\x00\x80\x08\x00\x00\x26\x40\x20\x00\x00\x01"
// "\x10\x00\x00\x00\x00\x00\x80\xC0\x00\x00\x00\x40\x00\x00\x00\x10"
// "\x00\x03\x00\x10\x00\x01\x00\x80\x18\x13\x20\x00\x18\x00\x02\x07"
// "\x00\x02\x00\x08\x00\x00\x70\x80\x10\x3F\x90\x80\x40\x00\x73\x00"
// "\x00\x01\x00\x00\x00\x01\xF8\x00\x00\x39\xE0\xE0\x40\x01\xF8\x00"
// "\x00\x00\x00\x00\x00\x07\xFF\x00\x01\x9D\xF0\xC0\x01\xFF\xFC\x0C"
// "\x00\x00\xC0\x80\x00\x18\x1D\x00\x07\x1E\x39\x90\x07\xE6\x1C\x00"
// "\x00\x00\x9F\x80\x00\x18\x06\x00\x0F\x1C\x39\x10\x0F\xE6\x06\x00"
// "\x00\x1F\x9F\x00\x80\x1F\x87\x00\x1F\x1C\xB8\x00\x1F\xFF\x86\x00"
// "\x00\x7F\xE3\x00\x40\x6F\xE7\x00\x3E\x3F\xDC\x00\x3F\xEF\xC7\x00"
// "\x00\xFF\xF3\x00\x00\xCF\xF6\x00\x36\x1F\xCC\x80\x3F\x4F\xC6\x00"
// "\x01\xCF\xFE\x00\x01\xD5\xFF\x00\x7F\x1F\xEC\xC0\x7F\xD7\x67\x00"
// "\x03\xDF\x7A\x00\x03\xE7\xFB\x00\x7F\x1F\xEC\x00\x7F\xE7\xE7\x00"
// "\x03\xFF\xFA\x01\x83\xE3\xFA\x00\x7F\x3F\xE6\x14\x7F\xE3\xE6\x00"
// "\x07\xFF\xF2\x01\x99\xFF\xF8\x06\x7F\x9F\xE6\x06\x7F\xFF\xE6\x00"
// "\x07\xFE\x72\x00\x04\xFF\xF2\x14\x7F\x9F\xEF\x00\x7D\xFF\xEC\x00"
// "\x06\xFF\xE2\x08\x1F\xFF\xF2\x00\x7F\x9F\xEF\x80\x7C\xFF\xEC\x00"
// "\x07\xFF\xA6\x5D\xBF\xFF\xF1\x01\xBF\x9E\xC7\x00\x3F\xFF\xEC\x10"
// "\x01\xFF\x47\xFF\xF7\xFF\x65\xAF\xF9\xC7\xC7\x00\x3F\xFF\xE4\xA0"
// "\x01\xDF\xCF\xFF\xD0\x7F\xA7\xEF\xFF\xC7\xA6\x00\x1B\xFF\xE7\xA0"
// "\x03\xD9\xCF\xFF\xDD\xFF\xC7\xE7\xFF\xC7\x7B\x21\x3D\xFF\xC7\xC8"
// "\x03\xFC\xCF\xEF\x9F\xFF\xC7\xC7\xF7\xC1\xF0\x0F\xFF\xFF\xC7\xC8"
// "\x03\xFE\x9F\xEF\xFF\xFF\xCF\xC3\xFB\xF1\xF1\x5F\xFD\xFF\xCF\xCC"
// "\x07\xFF\x9F\xFF\xFF\xFF\x9F\x07\xFF\xF0\xE6\xFF\xFE\xFF\x9F\x08"
// "\x07\xFF\x9F\xFF\xFF\xFF\xCC\x2D\xDF\xFC\x07\xFF\xFF\xFF\xCC\x30"
// "\x07\xF4\x19\xFF\xF9\xFF\x80\xFD\xFF\xFF\x7F\xFF\xEF\xFF\x00\xF0"
// "\x07\xF8\x0F\xFF\xFF\xE7\x83\xFF\xFF\xF7\xFF\xFF\x8F\xFF\x83\xF0"
// "\x07\xE7\x0F\xFF\xFF\xF7\xCF\xFF\xFF\xF7\xFD\xFF\xBF\xFF\x8F\xF0"
// "\x0F\xE5\xC7\xFF\xFF\xFF\x9F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x9F\xF0"
// "\x03\xF9\xFF\xFF\xDB\xFF\xDF\xFF\xFF\xFF\xFF\xFE\xFF\xFF\xFF\xF0"
// "\x06\x7B\xFF\xFF\xEB\xFF\xFF\xEF\xBF\xFF\xFD\xFE\x7F\xFF\xFF\xF0"
// "\x04\x7F\xFF\xFF\xF9\xFF\xFF\xEF\xDE\x5F\xFC\xFF\xFF\xFF\xFF\xFC"
// "\x00\x37\xFF\xFE\xD0\xFF\xFF\xFF\xF8\x3F\xFF\xFF\xFB\xFF\xFF\xF2"
// "\x00\x03\xF3\xB6\xE0\xEA\x7B\xEF\x38\x3F\xFF\xFF\xFF\xFF\xDF\x70"
// "\x00\x01\xFE\x60\x40\x00\x18\xE2\x00\x1F\xDC\xFF\xFF\x9F\xDE\x70";
//3193
// char *pDate = "\x01\x00\x00\x06\x00\x00\x00\x00\x00\x01\x80\x00\x30\x00\x00\x00"
// "\x00\x81\x00\x02\x00\x00\x00\x00\x00\x61\x80\x00\x00\x00\xC0\x03"
// "\x00\x01\x06\x00\x00\x00\x00\x00\x02\x20\x00\x00\x00\x00\x08\x01"
// "\x20\x00\x02\x00\x00\x00\x60\x02\x01\x00\x00\x21\x80\x6C\x00\x01"
// "\x20\x00\x00\x00\x00\x07\xE0\xC0\x00\x00\x00\x30\x80\x68\x00\x00"
// "\x00\x00\x00\x00\x00\x01\xC0\x40\x20\x00\x00\x00\x00\x00\x00\x00"
// "\x00\x00\x00\x00\x00\x00\xC0\x00\x00\x03\x8C\x00\x81\xF9\xF8\x00"
// "\x00\x00\x00\x00\x00\x00\xD8\x18\x00\x77\xE0\x00\x07\xFF\x7E\x00"
// "\x01\x00\x80\x00\x00\x01\x90\x10\x00\x1E\xD8\x00\x0F\xFF\x7F\x00"
// "\x00\x03\xC0\x00\x00\x1E\x1F\x80\x04\x1C\x1C\x00\x1F\xFF\xDF\x80"
// "\x00\x0F\xF0\x60\x00\x7E\x5F\xE0\x04\xF8\x06\x00\x3F\xFF\x0F\xC0"
// "\x02\x10\xF0\x00\x00\xFC\xDF\xF0\x30\x70\x06\x00\x3F\xA4\x03\xC0"
// "\x07\x44\x18\x00\x01\xFC\xFF\xF8\x20\x60\x06\x00\x7F\xF3\xC3\xEC"
// "\x07\xBE\x18\x00\x03\xF8\xFF\xFC\x00\x60\x06\x00\x7F\xE3\xF9\xE4"
// "\x06\x1F\x1C\x80\x03\xF9\xFF\xFC\x00\xE0\x0F\x00\x7F\xEF\xF9\xE0"
// "\x07\x9F\x98\x18\x07\xF9\xFF\xFE\x00\x70\x06\x00\x7F\xC7\xF8\xD0"
// "\x07\x8F\xF4\x10\xC7\xF3\x7F\xFE\x00\xF0\x4E\x20\x7F\xE7\xF9\xC0"
// "\x07\xCF\xC6\xBF\xE7\xF3\x7F\xFE\x00\x30\x0C\x10\x7F\xE3\xFB\xE0"
// "\x1F\xDF\x82\xFF\xFF\x93\xFF\xFE\x00\x38\x7C\x34\x3F\xF3\xF1\xD0"
// "\x15\xFF\x00\x7F\xFF\xA7\xFF\xFF\x00\x0F\x79\x7F\x7F\x17\xE0\xB0"
// "\x05\xDB\xFC\x3F\xFF\xE7\xFF\xFF\x80\x03\xFF\xFF\xEF\x5F\x40\x10"
// "\x01\x1B\xFE\x3B\xFF\x87\xF7\xFF\xFA\x1A\xDF\xFF\xFF\xFF\xFF\x00"
// "\x00\x1F\xFF\x1D\xFD\x0F\xFB\xFF\xFF\x7F\x8F\xFF\x7F\xFF\xFF\x80"
// "\x00\x17\xFF\x9F\xFE\x07\xFF\xFF\xF8\xFF\x0F\xBF\x6F\xFB\xFF\xC8"
// "\x00\x03\xFF\x1F\xFF\xC3\xFF\xFF\xF9\xFF\x1F\xBF\xF7\xFF\xFF\xC8"
// "\x00\x93\xFF\x9F\xFF\xF1\xFF\xFF\xF9\xFC\x7F\xFF\xFF\xFF\xFF\xC8"
// "\x40\x82\xFF\x9F\xFF\xFC\xFF\x9F\xF8\xA0\x7F\xFF\xFF\xFF\xBF\x88"
// "\x00\x01\x7F\x1F\xFF\xFE\xFF\xDF\xFF\x03\xFF\xF9\xFF\xFF\xBF\xE8"
// "\x20\x01\xFE\x3F\xFF\xFF\xFF\xFF\xFF\x47\xFF\xF9\xFF\xFF\x9F\xC8"
// "\x20\x21\xFE\x7D\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x9F\x80"
// "\x00\x00\xE9\xFD\xFF\xFF\xFF\xFD\xFF\xFF\xFF\xFF\xFF\xFF\x8F\x90"
// "\x00\x00\x71\xF7\xFF\xFF\xFB\xFF\xFF\xFF\xFF\xFB\xFF\xFF\x48\x70"
// "\x00\x00\x01\xE7\xDF\x3F\xBD\xFF\xFF\xFF\xFF\xFB\xFF\xEF\x7D\xF0"
// "\x00\x00\x01\xE7\x1E\x3F\x8E\x0F\xFF\xFF\xFF\xE7\xFE\xC3\xFF\xF0"
// "\xC0\x00\x01\x41\x08\x0E\x06\x03\xFF\xFF\xFF\xFF\xFF\x81\x7C\xF0"
// "\xC0\x00\x01\x00\x00\x04\x00\x00\xFF\xFF\xFF\x81\xF0\xC0\x49\x20";
//4234
char *pDate = "\x00\x00\x00\x00\x00\x00\x01\x80\x00\x00\x00\x00\x23\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x01\x00\x00\x01\xF0\x00\x31\x00\x00\x00"
"\x00\x00\x00\x02\x00\x00\x00\x00\x00\x03\xCF\x00\x00\x00\x31\x00"
"\x00\x00\x1C\x00\x00\x00\x00\x00\x00\x03\x0F\x00\x00\x00\x0E\x80"
"\x00\x00\x1C\x00\x00\x00\x70\x30\x02\x06\x03\x80\x00\x00\x3E\x00"
"\x00\x00\x3C\x00\x00\x07\xFC\x00\x01\x06\x03\xC8\x18\x00\x7C\x00"
"\x00\x00\xFC\x00\x00\x08\xFD\xF8\x00\x06\x01\x80\x00\x00\x04\x00"
"\x40\x01\xF8\x00\x00\x18\x19\xFE\x00\x06\x01\x80\x00\x06\x06\x0C"
"\x40\x01\xB8\x00\x00\x20\x01\xFF\x00\x00\x01\x80\x00\x00\x86\x0C"
"\x80\x07\xB8\x00\x00\x30\x19\xFF\x80\x00\x07\x00\x00\x03\x8F\x80"
"\xE0\x0C\x70\x00\x00\x20\x39\xFF\xC0\x00\x27\x00\x00\x4F\x8F\xC1"
"\xF4\x0C\x70\x00\x00\x30\xF8\xFF\xC0\x00\x7E\x00\x01\xDF\x1F\xC0"
"\xFE\x00\x70\x00\x00\x39\xF9\xFF\xE0\x00\x3C\x00\x01\xFF\x1F\xE0"
"\xCF\x1C\x70\x00\x00\x1B\xF1\xFF\xE0\x00\x3C\x00\x07\xFE\x3F\xE0"
"\xEF\x3E\xE0\x00\x00\x03\xF3\xFF\xE0\x00\x0C\x00\x07\xFE\x3F\xE0"
"\xFE\x3F\xE0\x00\x00\x07\xF3\xF7\xC0\x00\x06\x00\xE1\x9C\x3F\xE0"
"\xFC\x1F\x60\x00\x80\x0F\xE3\xFF\x20\x30\x07\x01\xF0\x00\x7F\xE0"
"\xFE\x00\x00\x81\xD0\x3B\xE7\xFF\x60\x30\x06\x07\xFA\x60\x7F\xF0"
"\xFE\x00\x11\xC7\xFB\x7F\xCF\xFF\xC0\x38\x66\xAF\xBF\xF8\x3F\xF0"
"\xFE\xFE\x07\xFF\xFF\xFF\xCF\xFF\xD1\xDD\xFF\xFF\xFF\xF0\x0F\xF0"
"\xFF\xFE\x07\xFF\xBF\xFF\x9F\xBF\xF7\xDF\xE1\xFF\xFF\xF1\xBF\xF0"
"\xBF\xFC\x7F\xFF\xB9\xFF\x1F\xBE\x7F\xC7\xE3\xFF\xFE\xE1\xFF\xF0"
"\x1F\xFC\x7F\xFF\xFF\xFF\x3F\x9F\xFF\xE7\x43\xFF\xFE\x23\xFF\xF0"
"\x7F\xFC\x7F\xFF\xFF\xFE\x3F\x1C\xFF\xF8\x0F\xFF\xFE\x03\xFF\xF0"
"\xF7\x80\x7F\xFF\xFF\xFE\x7F\x1C\xFF\xFF\xBF\xFF\xFF\x83\xFF\xF0"
"\xE7\xC0\x3F\xFF\xFF\xFE\x70\x1F\xFF\xFF\xFF\xFF\xFF\xF0\xFF\xF0"
"\x80\x5C\x1F\xFF\xFF\xFC\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFC\xFF\xF0"
"\x00\x07\xDF\xFF\xFF\xFC\x0F\xFF\xF9\xFF\xFF\xFF\xFF\xFF\xFF\xF8"
"\x00\x01\xFF\xFF\xF7\xBE\xFF\xFF\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xF0"
"\x00\x04\xFF\xFF\xF7\xDF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xE0"
"\x00\x02\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xDF\xFF\xDE\xFF\xFF\xFE\x70"
"\x00\x00\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xCF\xFF\xC2\xFF\xFF\xFF\xE0"
"\x00\x00\x7F\xFF\xFB\xFB\xFF\xFF\xFF\xFF\x86\x03\x1F\xFF\xFF\xE0"
"\x00\x00\x7F\x7F\x7B\xC3\xFF\xFF\xDF\xE7\x86\x00\x0F\xFF\xFF\xC0"
"\x00\x00\x1E\x3C\x2F\xC1\xDF\xEF\xBD\xFF\x00\x00\x65\xBF\xDF\x80"
"\x10\x00\x00\x38\x04\x80\x87\xE5\xFF\xF6\x00\x02\x60\x0D\xCC\x80";
DealPic Dp;
void CClassTupianDlg::OnButton1()
{
// TODO: Add your control notification handler code here
Dp.LoadBin(pDate);
}
void CClassTupianDlg::OnButton2()
{
// TODO: Add your control notification handler code here
UpdateData();
Dp.ShowNum(atoi(m_edit), this->m_hWnd);
}
void CClassTupianDlg::OnButton3()
{
// TODO: Add your control notification handler code here
Dp.DealNum();
}
|
[
"woaini4t@84d92313-99f8-b76f-20ef-0d116c1dc3bd"
] |
[
[
[
1,
381
]
]
] |
0e52e207b9348eb6b747bdf0cee87bde194ae7a8
|
b49cf93c06ea6b4b13fee18cf64cd2f6f8528cc8
|
/src/Native/write_batch.h
|
aa68d306efe3df990733a5178a732b7cd3b2940b
|
[] |
no_license
|
Yitzchok/LevelDBWrapper
|
ba43c3f259c91f52683865fedbe8385920b0fbd0
|
d8e9f950af57e0511a39605b50c736754b2709e7
|
refs/heads/master
| 2021-01-13T01:43:58.764843 | 2011-11-21T09:01:20 | 2011-11-21T09:01:20 | 2,818,192 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,904 |
h
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
//
// WriteBatch holds a collection of updates to apply atomically to a DB.
//
// The updates are applied in the order in which they are added
// to the WriteBatch. For example, the value of "key" will be "v3"
// after the following batch is written:
//
// batch.Put("key", "v1");
// batch.Delete("key");
// batch.Put("key", "v2");
// batch.Put("key", "v3");
//
// Multiple threads can invoke const methods on a WriteBatch without
// external synchronization, but if any of the threads may call a
// non-const method, all threads accessing the same WriteBatch must use
// external synchronization.
#ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_
#define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_
#include <string>
#include "status.h"
namespace leveldb {
class Slice;
class WriteBatch {
public:
WriteBatch();
~WriteBatch();
// Store the mapping "key->value" in the database.
void Put(const Slice& key, const Slice& value);
// If the database contains a mapping for "key", erase it. Else do nothing.
void Delete(const Slice& key);
// Clear all updates buffered in this batch.
void Clear();
// Support for iterating over the contents of a batch.
class Handler {
public:
virtual ~Handler();
virtual void Put(const Slice& key, const Slice& value) = 0;
virtual void Delete(const Slice& key) = 0;
};
Status Iterate(Handler* handler) const;
private:
friend class WriteBatchInternal;
std::string rep_; // See comment in write_batch.cc for the format of rep_
// Intentionally copyable
};
} // namespace leveldb
#endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_
|
[
"[email protected]"
] |
[
[
[
1,
64
]
]
] |
11c29ded475c4cd2705ef5d356682995ae7d48c2
|
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
|
/terralib/src/terralib/drivers/shapelib/TeSHPDriverFactory.h
|
191e1b6180986d39f4128b44d0282d9c41f695a5
|
[] |
no_license
|
radtek/terra-printer
|
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
|
959241e52562128d196ccb806b51fda17d7342ae
|
refs/heads/master
| 2020-06-11T01:49:15.043478 | 2011-12-12T13:31:19 | 2011-12-12T13:31:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 652 |
h
|
#ifndef _TESHPDRIVERFACTORY_H
#define _TESHPDRIVERFACTORY_H
#include "../../kernel/TeGDriverFactory.h"
#include "TeSHPDefines.h"
class TeGeoDataDriver;
struct TeGDriverParams;
class TeShapefileDriver;
class SHP_DLL TeSHPDriverFactory : public TeGDriverFactory
{
public:
TeSHPDriverFactory();
~TeSHPDriverFactory();
protected:
//! Builds a new product from a set of parameters (should be implemented by descendants)
TeGeoDataDriver * build(TeGDriverParams * params);
//! Builds a new product without parameters (should be implemented by descendants)
TeGeoDataDriver * build();
};
#endif
|
[
"[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec"
] |
[
[
[
1,
27
]
]
] |
6a7269da939d491f3852d61bc15760cfe379643e
|
f8b364974573f652d7916c3a830e1d8773751277
|
/emulator/allegrex/disassembler/BNE.h
|
b742ee3b0a49f42793dc5acccf3e64ad1dc20918
|
[] |
no_license
|
lemmore22/pspe4all
|
7a234aece25340c99f49eac280780e08e4f8ef49
|
77ad0acf0fcb7eda137fdfcb1e93a36428badfd0
|
refs/heads/master
| 2021-01-10T08:39:45.222505 | 2009-08-02T11:58:07 | 2009-08-02T11:58:07 | 55,047,469 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 393 |
h
|
/* BNE */
void AllegrexInstructionTemplate< 0x14000000, 0xfc000000 >::disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment)
{
using namespace Allegrex;
s32 imm = simm16(opcode);
::strcpy(opcode_name, "bne");
::sprintf(operands, "%s, %s, 0x%08X", gpr_name[rs(opcode)], gpr_name[rt(opcode)], imm * 4 + address + 4);
::strcpy(comment, "");
}
|
[
"[email protected]"
] |
[
[
[
1,
10
]
]
] |
37d3ca844dcf71eb8e516985ca05b0b76af5c80a
|
0ce35229d1698224907e00f1fdfb34cfac5db1a2
|
/Config.h
|
83a345b675cc21ec6fae7478a5c7fc767b6a0533
|
[] |
no_license
|
manudss/efreiloca
|
f7b1089b6ba74ff26e6320044f66f9401ebca21b
|
54e8c4af1aace11f35846e63880a893e412b3309
|
refs/heads/master
| 2020-06-05T17:34:02.234617 | 2007-06-04T19:12:15 | 2007-06-04T19:12:15 | 32,325,713 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 151 |
h
|
#pragma once
class Config
{
private:
Config(void);
~Config(void);
static Config* instance;
private:
static Config* getinstance();
};
|
[
"manu.dss@65b228c9-682f-0410-abd1-c3b8cf015911"
] |
[
[
[
1,
12
]
]
] |
d74404d1494d0bb06be976e026e73e11e5d89c5c
|
ad00c3a132f75a71bf763ce0aa70742fcede5ce8
|
/DotnetServer/Packet.h
|
673831c52902f62f41960073e03fc9578e19c079
|
[] |
no_license
|
Dracar/samp-dotnet-script-api
|
6975208c1beab28bed2480602c232f737f0bd86b
|
d88ddfcb9c52a807d3eb8e74607c0857f184d006
|
refs/heads/master
| 2021-01-22T03:57:49.952418 | 2011-12-22T15:40:12 | 2011-12-22T15:40:12 | 42,196,278 | 0 | 0 | null | null | null | null |
WINDOWS-1258
|
C++
| false | false | 2,916 |
h
|
/*
* Iain Gilbert
* 2011
*
*/
/*
The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.opensource.org/licenses/cpal_1.0
The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer.
In addition, Exhibit A has been modified to be consistent with Exhibit B.
Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and limitations under the License.
The Original Code is SampDotnetScriptAPI.
The Initial Developer of the Original Code is Iain Gilbert. All portions of the code written by Iain Gilbert are Copyright (c) 2011. All Rights Reserved.
Contributors: ______________________.
The text of this license may differ slightly from the text of the notices in Exhibits A and B of the license at http://code.google.com/p/samp-dotnet-script-api/.
You should use the latest text at http://code.google.com/p/samp-dotnet-script-api/ for your modifications.
You may not remove this license text from the source files.
Attribution Information
Attribution Copyright Notice:
Attribution Phrase (not exceeding 10 words): Samp Dotnet Script API
Attribution URL: http://code.google.com/p/samp-dotnet-script-api/
Display of Attribution Information to the end user is not required on server login, or at any time the end user is connected to your server.
You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2.
Display of Attribution Information is not required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
*/
#pragma once
#include "DataStream.h"
#include "main.h"
#include <stdarg.h>
class Packet : public DataStream// a data packet
{
public:
Packet()
{
Opcode = 0;
}
char Opcode;
static const char Headerlength = 3;
void SetLength()
{
Length = pos+Headerlength;
}
enum Opcodes
{
Null = 0x00,
CryptKey = 0x01, // todo: encryption
Auth = 0x02,
Ping = 0x03,
Callback = 0x04,
CallbackFrequency = 0x05, // client sends to server. 0 = no callbacks are sent, 1 = all but player/vehicle updates, 2 = all. default is 1
FunctionRequest = 0x06,
FunctionReply = 0x07,
Test = 0x0A
};
private:
};
|
[
"[email protected]"
] |
[
[
[
1,
76
]
]
] |
21ffc43db21dc9c3ee271328891be495502b7d38
|
ce262ae496ab3eeebfcbb337da86d34eb689c07b
|
/SEFoundation/SEComputationalGeometry/SEQuery2TRational.cpp
|
d1f2341544d28c83fe2278e6f211fa91af9e4d83
|
[] |
no_license
|
pizibing/swingengine
|
d8d9208c00ec2944817e1aab51287a3c38103bea
|
e7109d7b3e28c4421c173712eaf872771550669e
|
refs/heads/master
| 2021-01-16T18:29:10.689858 | 2011-06-23T04:27:46 | 2011-06-23T04:27:46 | 33,969,301 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,408 |
cpp
|
// Swing Engine Version 1 Source Code
// Most of techniques in the engine are mainly based on David Eberly's
// Wild Magic 4 open-source code.The author of Swing Engine learned a lot
// from Eberly's experience of architecture and algorithm.
// Several sub-systems are totally new,and others are re-implimented or
// re-organized based on Wild Magic 4's sub-systems.
// Copyright (c) 2007-2010. All Rights Reserved
//
// Eberly's permission:
// Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version. The license is available for reading at
// the location:
// http://www.gnu.org/copyleft/lgpl.html
#include "SEFoundationPCH.h"
#include "SEQuery2TRational.h"
using namespace Swing;
//----------------------------------------------------------------------------
SEQuery2TRationalf::SEQuery2TRationalf(int iVCount, const SEVector2f* aVertex)
:
SEQuery2f(iVCount, aVertex)
{
m_aRVertex = SE_NEW RVector[m_iVCount];
m_abEvaluated = SE_NEW bool[m_iVCount];
memset(m_abEvaluated, 0, m_iVCount*sizeof(bool));
}
//----------------------------------------------------------------------------
SEQuery2TRationalf::~SEQuery2TRationalf()
{
SE_DELETE[] m_aRVertex;
SE_DELETE[] m_abEvaluated;
}
//----------------------------------------------------------------------------
SEQuery::Type SEQuery2TRationalf::GetType() const
{
return SEQuery::QT_RATIONAL;
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToLine(int i, int iV0, int iV1) const
{
int aiIndex[3] = { i, iV0, iV1 };
Convert(3, aiIndex);
return ToLine(m_aRVertex[i], iV0, iV1);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToLine(const SEVector2f& rP, int iV0, int iV1) const
{
RVector tempRP;
tempRP[0] = Rational(rP[0]);
tempRP[1] = Rational(rP[1]);
int aiIndex[2] = { iV0, iV1 };
Convert(2, aiIndex);
return ToLine(tempRP, iV0, iV1);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToTriangle(int i, int iV0, int iV1, int iV2) const
{
int aiIndex[4] = { i, iV0, iV1, iV2 };
Convert(4, aiIndex);
return ToTriangle(m_aRVertex[i], iV0, iV1, iV2);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToTriangle(const SEVector2f& rP, int iV0, int iV1,
int iV2) const
{
RVector tempRP;
tempRP[0] = Rational(rP[0]);
tempRP[1] = Rational(rP[1]);
int aiIndex[3] = { iV0, iV1, iV2 };
Convert(3, aiIndex);
return ToTriangle(tempRP, iV0, iV1, iV2);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToCircumcircle(int i, int iV0, int iV1, int iV2) const
{
int aiIndex[4] = { i, iV0, iV1, iV2 };
Convert(4, aiIndex);
return ToCircumcircle(m_aRVertex[i], iV0, iV1, iV2);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToCircumcircle(const SEVector2f& rP, int iV0, int iV1,
int iV2) const
{
RVector tempRP;
tempRP[0] = Rational(rP[0]);
tempRP[1] = Rational(rP[1]);
int aiIndex[3] = { iV0, iV1, iV2 };
Convert(3, aiIndex);
return ToCircumcircle(tempRP, iV0, iV1, iV2);
}
//----------------------------------------------------------------------------
void SEQuery2TRationalf::Convert(int iCount, int* aiIndex) const
{
for( int i = 0; i < iCount; i++ )
{
int j = aiIndex[i];
if( !m_abEvaluated[j] )
{
m_abEvaluated[j] = true;
m_aRVertex[j][0] = Rational(m_aVertex[j][0]);
m_aRVertex[j][1] = Rational(m_aVertex[j][1]);
}
}
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToLine(const RVector& rRP, int iV0, int iV1) const
{
Rational tempX0 = rRP[0] - m_aRVertex[iV0][0];
Rational tempY0 = rRP[1] - m_aRVertex[iV0][1];
Rational tempX1 = m_aRVertex[iV1][0] - m_aRVertex[iV0][0];
Rational tempY1 = m_aRVertex[iV1][1] - m_aRVertex[iV0][1];
Rational tempDet2 = Det2(tempX0, tempY0, tempX1, tempY1);
return (tempDet2 > 0 ? +1 : (tempDet2 < 0 ? -1 : 0));
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToTriangle(const RVector& rRP, int iV0, int iV1,
int iV2) const
{
int iSign0 = ToLine(rRP, iV1, iV2);
if( iSign0 > 0 )
{
return +1;
}
int iSign1 = ToLine(rRP, iV0, iV2);
if( iSign1 < 0 )
{
return +1;
}
int iSign2 = ToLine(rRP, iV0, iV1);
if( iSign2 > 0 )
{
return +1;
}
return ((iSign0 && iSign1 && iSign2) ? -1 : 0);
}
//----------------------------------------------------------------------------
int SEQuery2TRationalf::ToCircumcircle(const RVector& rRP, int iV0,
int iV1, int iV2) const
{
RVector& rRV0 = m_aRVertex[iV0];
RVector& rRV1 = m_aRVertex[iV1];
RVector& rRV2 = m_aRVertex[iV2];
Rational tempS0x = rRV0[0] + rRP[0];
Rational tempD0x = rRV0[0] - rRP[0];
Rational tempS0y = rRV0[1] + rRP[1];
Rational tempD0y = rRV0[1] - rRP[1];
Rational tempS1x = rRV1[0] + rRP[0];
Rational tempD1x = rRV1[0] - rRP[0];
Rational tempS1y = rRV1[1] + rRP[1];
Rational tempD1y = rRV1[1] - rRP[1];
Rational tempS2x = rRV2[0] + rRP[0];
Rational tempD2x = rRV2[0] - rRP[0];
Rational tempS2y = rRV2[1] + rRP[1];
Rational tempD2y = rRV2[1] - rRP[1];
Rational tempZ0 = tempS0x*tempD0x + tempS0y*tempD0y;
Rational tempZ1 = tempS1x*tempD1x + tempS1y*tempD1y;
Rational tempZ2 = tempS2x*tempD2x + tempS2y*tempD2y;
Rational tempDet3 = Det3(tempD0x, tempD0y, tempZ0, tempD1x,
tempD1y, tempZ1, tempD2x, tempD2y, tempZ2);
return (tempDet3 < 0 ? 1 : (tempDet3 > 0 ? -1 : 0));
}
//----------------------------------------------------------------------------
SEQuery2TRationalf::Rational SEQuery2TRationalf::Dot(
Rational& rX0, Rational& rY0, Rational& rX1, Rational& rY1)
{
return rX0*rX1 + rY0*rY1;
}
//----------------------------------------------------------------------------
SEQuery2TRationalf::Rational SEQuery2TRationalf::Det2(
Rational& rX0, Rational& rY0, Rational& rX1, Rational& rY1)
{
return rX0*rY1 - rX1*rY0;
}
//----------------------------------------------------------------------------
SEQuery2TRationalf::Rational SEQuery2TRationalf::Det3(
Rational& rX0, Rational& rY0, Rational& rZ0, Rational& rX1,
Rational& rY1, Rational& rZ1, Rational& rX2, Rational& rY2,
Rational& rZ2)
{
Rational tempC00 = rY1*rZ2 - rY2*rZ1;
Rational tempC01 = rY2*rZ0 - rY0*rZ2;
Rational tempC02 = rY0*rZ1 - rY1*rZ0;
return rX0*tempC00 + rX1*tempC01 + rX2*tempC02;
}
//----------------------------------------------------------------------------
|
[
"[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac"
] |
[
[
[
1,
207
]
]
] |
51b07d2c4e0ad768ce924a7e33660006ebe9b1eb
|
b5ad65ebe6a1148716115e1faab31b5f0de1b493
|
/src/Aran/ArnSceneGraph.h
|
bddccb07223dd0777861549dbf8653d42ac69e05
|
[] |
no_license
|
gasbank/aran
|
4360e3536185dcc0b364d8de84b34ae3a5f0855c
|
01908cd36612379ade220cc09783bc7366c80961
|
refs/heads/master
| 2021-05-01T01:16:19.815088 | 2011-03-01T05:21:38 | 2011-03-01T05:21:38 | 1,051,010 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,025 |
h
|
/*!
* @file ArnSceneGraph.h
* @author Geoyeob Kim
* @date 2009
*
* Scene Graph
*/
#pragma once
#include "ArnNode.h"
struct ArnFileData;
class ArnHierarchy;
class ArnBone;
class ArnBinaryChunk;
class ArnLight;
class ArnCamera;
TYPEDEF_SHARED_PTR(ArnSceneGraph)
/*!
* @brief 장면 그래프(scene graph)
*/
class ARAN_API ArnSceneGraph : public ArnNode
{
public:
~ArnSceneGraph(void);
/*!
* @brief 빈 장면 그래프를 생성 후 반환
*/
static ArnSceneGraph* createFromEmptySceneGraph();
/*!
* @brief Aran XML 장면 그래프 파일로부터 장면 그래프 생성 후 반환
*/
static ArnSceneGraph* createFrom(const char* fileName);
void attachToRoot(ArnNode* node);
void render();
void initRendererObjects();
void registerToCameraList(ArnCamera* cam);
/*!
* @brief 장면 그래프에 등록된 \a cam 다음 카메라를 반환
*
* 장면 그래프에 카메라가 추가될 때 \a m_cameraList 에도 등록이 됩니다.
* 이 함수는 \a cam 을 \a m_cameraList 에서 찾아 그 다음 카메라 포인터를
* 반환합니다. \a m_cameraList 에 \a cam 이 없을 경우에는 \a m_cameraList 의
* 첫 번째 원소를 반환하게 되며, \a m_cameraList 가 비어있을 경우에는 \c NULL 을
* 반환합니다. 같은 원리로 \a cam 에 \c NULL 을 주고, \c m_cameraList 가 비어있지
* 않다면 첫 번째 카메라를 반환받을 수 있습니다.
*/
ArnCamera* getNextCamera(const ArnCamera* cam) const;
/*!
* @brief 장면 그래프에 등록된 첫 번째 카메라를 반환
*/
ArnCamera* getFirstCamera() const;
/*!
* @internalonly
*/
//@{
virtual void interconnect(ArnNode* sceneRoot);
//@}
protected: // TODO: protected or private?
ArnSceneGraph();
EXPORT_VERSION m_exportVersion;
ArnBinaryChunk* m_binaryChunk;
std::list<ArnCamera*> m_cameraList;
};
#include "ArnSceneGraph.inl"
|
[
"[email protected]"
] |
[
[
[
1,
67
]
]
] |
4f32d6222602cf009f4f7e6a52844c50af7af7d2
|
138a353006eb1376668037fcdfbafc05450aa413
|
/source/ogre/OgreNewt/boost/mpl/multiplies.hpp
|
fe8cae094e860d3216d35dbc90a250745cbba42b
|
[] |
no_license
|
sonicma7/choreopower
|
107ed0a5f2eb5fa9e47378702469b77554e44746
|
1480a8f9512531665695b46dcfdde3f689888053
|
refs/heads/master
| 2020-05-16T20:53:11.590126 | 2009-11-18T03:10:12 | 2009-11-18T03:10:12 | 32,246,184 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,507 |
hpp
|
#ifndef BOOST_MPL_MULTIPLIES_HPP_INCLUDED
#define BOOST_MPL_MULTIPLIES_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/multiplies.hpp,v $
// $Date: 2006/04/17 23:49:40 $
// $Revision: 1.1 $
#include <boost/mpl/times.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/mpl/aux_/preprocessor/default_params.hpp>
#include <boost/mpl/aux_/preprocessor/params.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
// backward compatibility header, deprecated
namespace boost { namespace mpl {
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# define AUX778076_OP_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
#else
# define AUX778076_OP_ARITY 2
#endif
template<
BOOST_MPL_PP_DEFAULT_PARAMS(AUX778076_OP_ARITY, typename N, na)
>
struct multiplies
: times< BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
AUX778076_OP_ARITY
, multiplies
, ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
)
};
BOOST_MPL_AUX_NA_SPEC(AUX778076_OP_ARITY, multiplies)
#undef AUX778076_OP_ARITY
}}
#endif // BOOST_MPL_MULTIPLIES_HPP_INCLUDED
|
[
"Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e"
] |
[
[
[
1,
53
]
]
] |
fd39b1b99de7d332675cfcb8f3759924a3821a5d
|
0b039565382fe5cf8a9abe90a2999396d79ca37f
|
/GrpPciRegisters/grpPciRegisters.h
|
f8c4fd7680a527c932ff69f213686e1a59c73779
|
[
"Apache-2.0"
] |
permissive
|
cornsea/tnvme
|
989cf26233e05f816b7d64d4bb402124efd7d4e6
|
9e6100b771cd3d0ee7c497e27db391fca626d245
|
refs/heads/master
| 2021-01-16T18:14:35.269183 | 2011-12-23T20:56:25 | 2011-12-23T20:56:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,054 |
h
|
/*
* Copyright (c) 2011, Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _GRPPCIREGISTERS_H_
#define _GRPPCIREGISTERS_H_
#include "../group.h"
/**
* This class implements a logical grouping of test cases for all NVME
* specification document releases. It is logically grouping the PCI space
* register syntactical compliance.
*/
class GrpPciRegisters : public Group
{
public:
GrpPciRegisters(size_t grpNum, SpecRev specRev, int fd);
virtual ~GrpPciRegisters();
};
#endif
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
16
]
],
[
[
17,
35
]
]
] |
8fbb673e993e5eb40193c0e2630a7e159dd8c2a0
|
ef25bd96604141839b178a2db2c008c7da20c535
|
/src/src/Engine/Physics/BoundingBox.h
|
49a8d8a929e116f8809e6086e43e1503c0d80055
|
[] |
no_license
|
OtterOrder/crock-rising
|
fddd471971477c397e783dc6dd1a81efb5dc852c
|
543dc542bb313e1f5e34866bd58985775acf375a
|
refs/heads/master
| 2020-12-24T14:57:06.743092 | 2009-07-15T17:15:24 | 2009-07-15T17:15:24 | 32,115,272 | 0 | 0 | null | null | null | null |
ISO-8859-1
|
C++
| false | false | 4,598 |
h
|
#ifndef _BOUNDINGBOX_H
#define _BOUNDINGBOX_H
#include <list>
#include "NxPhysics.h"
#include "NxBoxController.h"
#include "NxCapsuleController.h"
#include "NxControllerManager.h"
#include "Resources/Mesh.h"
#include "Trigger/UserData.h"
class Hero;
class SceneObject;
enum GroupCollision;
//Type de la shape d'une bounding box
enum ShapeType
{
BOX,
SPHERE,
CAPSULE,
LOAD_ERROR
};
//Type de l'objet
/*enum PhysicalObjectType
{
PHYS_DYNAMIQUE,
PHYS_STATIC,
PHYS_TRIGGER,
PHYS_WEAPON,
PHYS_HERO,
PHYS_ENEMY,
PHYS_NOPHYSICAL
};*/
//Structure pour récupérer les infos sur le body pendant le loader
struct PhysicBody
{
ShapeType shapeType;
bool IsDynamic;
D3DXVECTOR3 bodySize; //BOX = largeur hauteur longueur
//SPHERE = Rayon 0 0
//CAPSULE = rayon, hauteur 0
D3DXVECTOR3 globalPos; //Position locale de la bounding box
D3DXVECTOR3 localPos; //Position locale de la bounding box
NxQuat rotate; //Rotation locale de la bounding box
D3DXVECTOR3 angularVelocity; //Vitesse de rotation à la création
D3DXVECTOR3 linearVelocity; //Vitesse de déplacement à la création
float fMass; //Masse
float fLinearDamping;
float fAngularDamping;
float frestitution;
float fstaticFriction;
float fdynamiqueFriction;
//Fonctions liées aux triggers, à remplir a la création du sceneobj
void (*OnEnterFunc)(void* param);
void (*OnLeaveFunc)(void* param);
void (*OnStayFunc)(void* param);
};
//Liste des bounding box d'un sceneobj
class ListOfBoundingBox
{
private:
std::vector<PhysicBody*> m_PbList;
std::vector<NxShapeDesc*> m_ShapeRefList; //Ne sert qu'à la destruction.
Vector3f m_InitialWorldPos;
public:
void ReleaseList(); //Permet la libération des descripteur qui st créés dynamiquement
inline std::vector<PhysicBody*> getPbList(){ return m_PbList; }
inline Vector3f getInitialWorldPos(){ return m_InitialWorldPos; }
inline void setPbList(std::vector<PhysicBody*> L){ m_PbList = L; }
inline void setInitialWorldPos(Vector3f P){ m_InitialWorldPos = P; }
inline void pushShapeRef(NxShapeDesc *const&Desc){ m_ShapeRefList.push_back(Desc); }
};
inline NxVec3 VecToNxVec(Vector3f V){ return NxVec3(V.x, V.y, V.z); }
namespace physX
{
void CreateBoundingBox(ListOfBoundingBox &BBList, NxActor* &pActor);
void CreateTrigger(ListOfBoundingBox &BBList,
void (*OnEnterFunc)(void* param),
void (*OnLeaveFunc)(void* param),
void (*OnStayFunc)(void* param), void* paramEnter, void* paramLeave, void* paramStay,
NxActor* &pActor);
void CreateControlledCapsule( Vector3f pos, float radius, float height, void* Ref,
NxActor* &pActor, NxController* &pController );
void CreateControlledBox( Vector3f const pos, float width, float height, float depth,
void* Ref, NxActor* &pActor, NxController* &pController );
/************************************************************************************
* Détruit un acteur ainsi que son userdata
************************************************************************************/
void releaseActor(NxActor* &pAct);
/************************************************************************************
* Détruit un controller ainsi que son userdata
************************************************************************************/
void releaseController(NxController* &pCont);
/************************************************************************************
* Fonction de récupération de la scène physique
* @return NxScene* : scène physique
************************************************************************************/
NxScene* getPhysicScene();
/************************************************************************************
* Fonction de récupération du manager des controlleur
* @return NxControllerManager* : manager des controlleur
************************************************************************************/
NxControllerManager* getControllerManager();
/************************************************************************************
* Fonction qui permet de lier deux objets de sorte à pouvoir récupérer leurs collisions
* @param[in] obj1 : Pointeur sur le premier objet
* @param[in] obj2 : Pointeur sur le deuxieme objet
************************************************************************************/
void Link( SceneObject* const obj1, SceneObject* const obj2 );
}
#endif
|
[
"mathieu.chabanon@7c6770cc-a6a4-11dd-91bf-632da8b6e10b",
"berenger.mantoue@7c6770cc-a6a4-11dd-91bf-632da8b6e10b"
] |
[
[
[
1,
8
],
[
10,
13
],
[
20,
20
],
[
38,
38
],
[
42,
42
],
[
66,
67
],
[
70,
70
],
[
75,
75
],
[
78,
78
],
[
86,
88
],
[
133,
134
]
],
[
[
9,
9
],
[
14,
19
],
[
21,
37
],
[
39,
41
],
[
43,
65
],
[
68,
69
],
[
71,
74
],
[
76,
77
],
[
79,
85
],
[
89,
132
]
]
] |
dd15938e25e334a0b75db495444ee81f2026c5bc
|
6581dacb25182f7f5d7afb39975dc622914defc7
|
/easyMule/easyMule/src/UILayer/SearchResultsWnd.h
|
2f51664e141e76a650d0b91dd83dae845fc454fe
|
[] |
no_license
|
dice2019/alexlabonline
|
caeccad28bf803afb9f30b9e3cc663bb2909cc4f
|
4c433839965ed0cff99dad82f0ba1757366be671
|
refs/heads/master
| 2021-01-16T19:37:24.002905 | 2011-09-21T15:20:16 | 2011-09-21T15:20:16 | null | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 6,576 |
h
|
/*
* $Id: SearchResultsWnd.h 18514 2010-03-24 09:51:09Z huby $
*
* this file is part of eMule
* Copyright (C)2002-2006 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net )
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#pragma once
#include "ResizableLib\ResizableFormView.h"
#include "SearchListCtrl.h"
#include "ClosableTabCtrl.h"
#include "IconStatic.h"
#include "EditX.h"
#include "EditDelayed.h"
#include "ComboBoxEx2.h"
#include "ListCtrlEditable.h"
#include "TabItemAffector.h"
#include "afxwin.h"
class CCustomAutoComplete;
class Packet;
class CSafeMemFile;
class CSearchParamsWnd;
struct SSearchParams;
class CDropDownButton;
class CFileSearch;
///////////////////////////////////////////////////////////////////////////////
// CSearchResultsSelector
class CSearchResultsSelector : public CClosableTabCtrl
{
public:
CSearchResultsSelector(){}
protected:
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
};
///////////////////////////////////////////////////////////////////////////////
// CSearchResultsWnd dialog
class CSearchResultsWnd : public CResizableFormView/*, public CTabItemAffector*/
{
DECLARE_DYNCREATE(CSearchResultsWnd)
public:
CSearchResultsWnd(CWnd* pParent = NULL); // standard constructor
virtual ~CSearchResultsWnd();
enum { IDD = IDD_SEARCH };
CSearchListCtrl searchlistctrl;
CSearchResultsSelector searchselect;
CStringArray m_astrFilter;
void Localize();
//MODIFIED by VC-fengwen on 2007/09/11 <begin> : 返回值标识pParams是否被删除了。
//void StartSearch(SSearchParams* pParams);
bool StartSearch(SSearchParams* pParams);
//MODIFIED by VC-fengwen on 2007/09/11 <end> : 返回值标识pParams是否被删除了。
bool SearchMore();
void CancelSearch(UINT uSearchID = 0);
bool DoNewEd2kSearch(SSearchParams* pParams,UINT uSearchID=0);
void CancelEd2kSearch();
bool IsLocalEd2kSearchRunning() const { return (m_uTimerLocalServer != 0); }
bool IsGlobalEd2kSearchRunning() const { return (global_search_timer != 0); }
void LocalEd2kSearchEnd(UINT count, bool bMoreResultsAvailable);
void AddGlobalEd2kSearchResults(UINT count);
bool DoNewKadSearch(SSearchParams* pParams,UINT uSearchID=0);
void CancelKadSearch(UINT uSearchID);
bool CanSearchRelatedFiles() const;
void SearchRelatedFiles(const CAbstractFile* file);
void DownloadSelected();
void DownloadSelected(bool bPaused);
bool CanDeleteSearch(uint32 nSearchID) const;
bool CanDeleteAllSearches() const;
void DeleteSearch(uint32 nSearchID);
void DeleteAllSearches();
bool CreateNewTab(SSearchParams* pParams);
void ShowSearchSelector(bool visible);
int GetSelectedCat() { return m_cattabs.GetCurSel(); }
void UpdateCatTabs();
uint32 GetFilterColumn() const { return m_nFilterColumn; }
void UpdateParamDisplay(SSearchParams* pParams);
protected:
Packet* searchpacket;
bool m_b64BitSearchPacket;
UINT_PTR global_search_timer;
UINT m_uTimerLocalServer;
CProgressCtrl searchprogress;
CEditDelayed m_ctlFilter;
bool canceld;
uint16 servercount;
bool globsearch;
uint32 m_nEd2kSearchID;
CImageList m_imlSearchResults;
CTabCtrl m_cattabs;
CDropDownButton* m_btnSearchListMenu;
HICON icon_search;
int m_iSentMoreReq;
uint32 m_nFilterColumn;
bool StartNewSearch(SSearchParams* pParams);
bool StartNeweasyMuleFileSearch(SSearchParams* pParams);
//bool StartVCAutomaticSearch(SSearchParams* pParams);
void SearchStarted();
void SearchCanceled(UINT uSearchID);
CString CreateWebQuery(SSearchParams* pParams);
void ShowResults(const SSearchParams* pParams);
void SetAllIcons();
void SetSearchResultsIcon(UINT uSearchID, int iImage);
void SetActiveSearchResultsIcon(UINT uSearchID);
void SetInactiveSearchResultsIcon(UINT uSearchID);
SSearchParams* GetSearchResultsParams(UINT uSearchID) const;
virtual void OnInitialUpdate();
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
afx_msg void OnDblClkSearchList(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnSelChangeTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg LRESULT OnCloseTab(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnDblClickTab(WPARAM wParam, LPARAM lParam);
afx_msg void OnDestroy();
afx_msg void OnSysColorChange();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnBnClickedDownloadSelected();
afx_msg void OnBnClickedClearAll();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnClose();
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam);
afx_msg void OnBnClickedOpenParamsWnd();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg LRESULT OnChangeFilter(WPARAM wParam, LPARAM lParam);
afx_msg void OnSearchListMenuBtnDropDown(NMHDR* pNMHDR, LRESULT* pResult);
public:
CEdit m_SearchCtrl;
CButton m_BtnSearch;
afx_msg void OnBnClickedButtonSearch();
void ShoweasyMuleFileSearch( DWORD dwSearchID );
protected:
SSearchParams* GetParameters(CString expression);
public:
enum ESearchArea
{
//NOTE: The numbers are *equal* to the entries in the comboxbox -> TODO: use item data
//SearchAreaVCAutomatic = 0,
SearchAreaEasyMuleFile = 0,
SearchAreaEd2kGlobal,
SearchAreaKademlia,
};
ESearchType SearchAreaToType(ESearchArea eArea);
ESearchArea SearchTypeToArea(ESearchType eType);
CComboBoxEx2 m_ctlMethod;
CImageList m_imlSearchMethods;
int m_iCurSearchIndexInRes;
virtual BOOL PreTranslateMessage(MSG* pMsg);
void SetPos(int pos);
CMap<uint32,uint32,CFileSearch*,CFileSearch*> m_FileSearchMap;
};
|
[
"damoguyan8844@3a4e9f68-f5c2-36dc-e45a-441593085838"
] |
[
[
[
1,
193
]
]
] |
ef6fdc2209f54723f4c937e40e8f8c8323309667
|
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
|
/PlayerBarWnd.h
|
3187182f3f38b192c31974bcc3522786e1ceeb28
|
[] |
no_license
|
outcast1000/Jaangle
|
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
|
18feb537068f1f3be6ecaa8a4b663b917c429e3d
|
refs/heads/master
| 2020-04-08T20:04:56.875651 | 2010-12-25T10:44:38 | 2010-12-25T10:44:38 | 19,334,292 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,751 |
h
|
// /*
// *
// * Copyright (C) 2003-2010 Alexandros Economou
// *
// * This file is part of Jaangle (http://www.jaangle.com)
// *
// * This Program is free software; you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation; either version 2, or (at your option)
// * any later version.
// *
// * This Program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with GNU Make; see the file COPYING. If not, write to
// * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
// * http://www.gnu.org/copyleft/gpl.html
// *
// */
#pragma once
#include "afxcmn.h"
#include "FlexButton.h"
#include "ICtrlColors.h"
#include "Label.h"
#include "LabelEx.h"
#include "TSTranslatable.h"
#include "TSSkinnable.h"
#include "CollectionUpdateJob.h"
#include "LevelMeter.h"
#include "MediaSlider.h"
#include "CtrlColorsMediaSliderAdapter.h"
#include "HTMLLite/PPTooltip.h"
#include "GuiControls/BCMenu.h"
#include "StateManager.h"
class MediaPlayer;
// CStatusBarChDlg dialog
//class IVisualizationContainer;
class CPlayerBarWnd : public CWnd,
public TSSkinnable, public TSTranslatable, public TSStateChangeListener,
public MediaSliderListener
{
public:
CPlayerBarWnd(CWnd* pParent = NULL); // standard constructor
virtual ~CPlayerBarWnd();
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
void Update();
void SetMediaPlayer(MediaPlayer* pPlayer);
virtual void ApplySkin(ISkin& skin); //TSSkinnable
virtual void ApplyTranslation(ITranslation& skin); //TSTranslatable
virtual BOOL OnStateChanged(UINT stateMessage);
virtual LPCTSTR GetStateListenerName() {return _T("CPlayerBarWnd");}
virtual void OnMediaSliderClick(CMediaSlider* pMediaSlider);
//---------------------------------------------------
//ICtrlColors ---------------------------------------
//#include "ICtrlColors.h" // ,public ICtrlColors
//---------------------------------------------------
public:
enum COLORS
{
COL_Bk,
COL_Text,
COL_Slider1,
COL_Slider2,
COL_Last
};
virtual void SetColor(UINT idx, COLORREF value);
virtual COLORREF GetColor(UINT idx);
private:
COLORREF m_colors[COL_Last];
//---------------------------------------------------
//---------------------------------------------------
//---------------------------------------------------
protected:
afx_msg void OnPaint();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg LRESULT OnSliderMessage( WPARAM wParam, LPARAM lParam );
//afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//virtual BOOL OnInitDialog();
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
DECLARE_MESSAGE_MAP()
private:
//void Resize(int cx = 0, int cy = 0);
void ConfigureButton(FlexButton& btn, HICON hIcon);
void ResizePlayerControls();
void SetTimeInfo(DOUBLE pos, DOUBLE total);
void ResizeWindow(int cx, int cy);
void UpdateWindowText(CWnd& wnd, LPCTSTR text);
enum ControlsEnum
{
CTRL_Previous = 667,
CTRL_Play,
CTRL_Pause,
CTRL_Stop,
CTRL_Next,
CTRL_CrossFade,
CTRL_Equalizer,
CTRL_Slider,
CTRL_SldVolume,
CTRL_VolMeterL,
CTRL_VolMeterR,
CTRL_TimeInfo,
CTRL_FullTimeInfo,
CTRL_PlayerInfo,
CTRL_Mute,
CTRL_Last
};
private:
CFont m_MainFont;
//From Player
//[Subclassed Controls]
//FlexButton m_start;
FlexButton m_previous;
FlexButton m_play;
FlexButton m_pause;
FlexButton m_stop;
FlexButton m_next;
FlexButton m_mute;
FlexButton m_crossfade;
FlexButton m_equalizer;
static const INT cSldEqCount = 3;
CMediaSlider m_sldEq[cSldEqCount];
CLevelMeter m_volMeterL;
CLevelMeter m_volMeterR;
CMediaSlider m_volumeSlider;
CMediaSlider m_positionSlider;
//CtrlColorsMediaSliderAdapter m_volumeSliderColorsAdapter;
//CtrlColorsMediaSliderAdapter m_positionSliderColorsAdapter;
CLabel m_timeInfo;
CLabel m_fullTimeInfo;
CLabelEx m_playerInfo;
MediaPlayer* m_pPlayer;
//CRect m_rcPlayer;//, m_rcInfo;
//INT m_netPendingJobs;
//CollectionUpdateJob::Progress m_oldColProgress;
CToolTipCtrl m_tooltip;
};
|
[
"outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678"
] |
[
[
[
1,
169
]
]
] |
85747b6923ebdc33e5d9807b24f6aebe5b0761aa
|
38664d844d9fad34e88160f6ebf86c043db9f1c5
|
/branches/initialize/skin/Samples/Skinmagic Toolkit 2.4/MFC/Player/Player.cpp
|
41bb8375282abe30e47daecbf8fa1cc2eae1fcfd
|
[] |
no_license
|
cnsuhao/jezzitest
|
84074b938b3e06ae820842dac62dae116d5fdaba
|
9b5f6cf40750511350e5456349ead8346cabb56e
|
refs/heads/master
| 2021-05-28T23:08:59.663581 | 2010-11-25T13:44:57 | 2010-11-25T13:44:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,101 |
cpp
|
// Player.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Player.h"
#include "PlayerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPlayerApp
BEGIN_MESSAGE_MAP(CPlayerApp, CWinApp)
//{{AFX_MSG_MAP(CPlayerApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPlayerApp construction
CPlayerApp::CPlayerApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPlayerApp object
CPlayerApp theApp;
CPlayerDlg* glpMainWnd = NULL;
/////////////////////////////////////////////////////////////////////////////
// CPlayerApp initialization
BOOL CPlayerApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
VERIFY( 1 == InitSkinMagicLib( AfxGetInstanceHandle(), "Demo" ,
NULL,
NULL ) );
if( 1 != LoadSkinFile("..\\Samples\\MFC\\Player\\Player.smf") )
{
VERIFY( 1 != LoadSkinFile("Player.smf") );
}
m_pMainWnd = new CPlayerDlg;
m_pMainWnd->ShowWindow( SW_SHOW );
glpMainWnd = (CPlayerDlg*)m_pMainWnd;
return TRUE;
}
int CPlayerApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
delete glpMainWnd;
return CWinApp::ExitInstance();
}
|
[
"zhongzeng@ba8f1dc9-3c1c-0410-9eed-0f8a660c14bd"
] |
[
[
[
1,
77
]
]
] |
1e318ea137674ab3af724295ca449bdaac01cd17
|
335783c9e5837a1b626073d1288b492f9f6b057f
|
/source/fbxcmd/daolib/Model/MESH/MESHFile.h
|
5f34ca48fc2491bdb795337563b9c4d150c4ebfa
|
[
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] |
permissive
|
code-google-com/fbx4eclipse
|
110766ee9760029d5017536847e9f3dc09e6ebd2
|
cc494db4261d7d636f8c4d0313db3953b781e295
|
refs/heads/master
| 2016-09-08T01:55:57.195874 | 2009-12-03T20:35:48 | 2009-12-03T20:35:48 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 536 |
h
|
/**********************************************************************
*<
FILE: MESHFile.h
DESCRIPTION: MESH File Format
HISTORY:
*> Copyright (c) 2009, All Rights Reserved.
**********************************************************************/
#pragma once
#include "MESHCommon.h"
#include "GFF/GFFFile.h"
#include "MESH/MESH.h"
namespace DAO {
namespace MESH {
class MESHFile
: public DAO::GFF::GFFFile
{
typedef DAO::GFF::GFFFile base;
public:
MESHFile();
virtual MESHPtr get_Root();
};
}
}
|
[
"tazpn314@ccf8930c-dfc1-11de-9043-17b7bd24f792"
] |
[
[
[
1,
30
]
]
] |
14815c19a486c731745732c1f60fb1bf8f9ab060
|
13f30850677b4b805aeddbad39cd9369d7234929
|
/ astrocytes --username [email protected]/CT_tutorial/main.cpp
|
78df20c12a8fb3e676e651345437272871eba522
|
[] |
no_license
|
hksonngan/astrocytes
|
2548c73bbe45ea4db133e465fa8a90d29dc60f64
|
e14544d21a077cdbc05356b05148cc408c255e04
|
refs/heads/master
| 2021-01-10T10:04:14.265392 | 2011-11-09T07:42:06 | 2011-11-09T07:42:06 | 46,898,541 | 0 | 0 | null | null | null | null |
WINDOWS-1251
|
C++
| false | false | 16,662 |
cpp
|
#include "AllInc.h"
#include "wxIncludes.h"
#include <GL/glfw.h>
#include <stdio.h>
#include <stdlib.h>
#include "AllDef.h"
#include "Mouse.h"
#include "Camera.h"
#include "Draw.h"
#include "output.h"
#include <Math.h>
#include <ivec3.h>
#include <vec4.h>
#include "Draw2D.h"
#include "vrml_loader.h"
#include "Edist.h"
#include "MeshSection.h"
#include "globals.h"
#include "table.h"
#include "painting.h"
#include "PN_Triangle.h"
#include "CaDepo.h"
vec Approx(vec& x_vals,vec& y_vals,v2vec& p_b);
Mouse mouse;
Camera cam;
extern bool transparency[10];
ivec2 old_mouse_pos;
int keyboard[255];
int width = 1000, height = 700;
extern vec4 light;
int stereo_on=0, anag=0;
void Calc();
void Calc(int psd_id);
void view_sect();
void view_sect2(flat sc_f,vec3 fd,bool fill);
void FullDraw();
std::vector<std::vector<Geometry>> neuron;//0-astr,1-psd,2-for testing, 3-dendrits
//std::vector<Edist> edist;
std::vector<PSD> psd;
std::vector<Line> section;
std::vector<Line2> section2d;
std::vector<FlatSection> flat_section;
int cur_psd=0;
void seg_BuildBox();
void seg_Cut(ivec2 a,ivec2 b);
// направление в точку на экране с координатами x,y
vec3 GetNav(int x,int y)
{
vec3 ll=cam.GetLeft()*((x-width/2)/float(height));
vec3 uu=cam.GetTop()*((y-height/2)/float(height));
return cam.GetNav()-(uu-ll)*(2*TAN_22_5);
}
// результат перемещения точки dot в точку с экранными координатами x,y
vec3 MoveDot(int x,int y,vec3 dot)
{
vec3 n = cam.GetNav();
float mx = max(abs(n.x),max(abs(n.y),abs(n.z)));
flat f(dot-cam.GetPosition(),vec3(mx==abs(n.x),mx==abs(n.y),mx==abs(n.z)));
return flat_cross_line(f,GetNav(x,y))+cam.GetPosition();
}
//обработчик движения мыши
void MouseMove ( int x, int y )
{
mouse.Move(x,y);
light.set(-cam.GetNav().x,-cam.GetNav().y,-cam.GetNav().z,0);
{
if(keyboard['R'])
{
//psd[cur_psd].mediator_radius += (mouse.dx+mouse.dy)*0.01f;
sect_radius += (mouse.dx+mouse.dy)*0.01;
if(sect_radius<0.01)sect_radius=0.01;
printf("%g\n",sect_radius);
}
if(keyboard['W'])
{
if(flat_section.size())
{
vec2 bc = flat_section[0].bc;
bc += vec2(-mouse.dy-mouse.dx,-mouse.dy+mouse.dx)*0.01;
for(int i=0;i<flat_section.size();i++)
flat_section[i].bc = bc;
}
}
}
if(mouse.btn&2 || mouse.btn&1)
{
vec3 old_pos = cam.GetPosition();
vec3 a_dx = cam.GetTop(); float an_x = -PI*mouse.oldy/float(height)+HALF_PI; mat34 mrx(cos(an_x),sin(an_x),cam.GetLeft()); a_dx = mrx.MultRot(a_dx); cam.Rotate(mouse.dx*0.004,a_dx);
vec3 a_dy = cam.GetLeft(); float an_y = -PI*mouse.oldx/float(width)+HALF_PI; mat34 mry(cos(an_y),sin(an_y),cam.GetTop()); a_dy = mry.MultRot(a_dy); cam.Rotate(mouse.dy*0.004,a_dy);
//light.set(-cam.GetNav().x,-cam.GetNav().y,-cam.GetNav().z,0);
}
if( mouse.btn&4)
{cam.SetCenter(cam.GetCenter() + (cam.GetLeft() *(float)(-mouse.dx) + cam.GetTop() * (float)(mouse.dy))*(2*cam.GetDistance()*cam.CameraZoom2D/height));}
}
//обработчик события, связанного с кнопками мыши
void MouseButton ( int button, int state )
{
mouse.Button(button,state);
if(button==0)
{
if(state)
{
old_mouse_pos = ivec2(mouse.oldx,mouse.oldy);
}else
{
//boolean//seg_Cut(ivec2(min(mouse.oldx,old_mouse_pos.x),min(mouse.oldy,old_mouse_pos.y)),ivec2(max(mouse.oldx,old_mouse_pos.x),max(mouse.oldy,old_mouse_pos.y)));
}
}
}
void Calc2(int psd_id);
void Calc3();
void CalcAreas(vec3 d,vec3 x,vec3 y,float rad,float*res,ivec2 res_size);
void CalcHist1();
void CalcSVRHist();
void CalcHist2(int psd_id);
void CalcHist3();
//обработчик клавиатуры
void KeyButton ( int key, int state )
{
keyboard[key]=state;
srand(glfwGetTime ( ));
if(state)
{
//boolean//if(key=='B')seg_BuildBox();
if(key=='L')light.set(-cam.GetNav().x,-cam.GetNav().y,-cam.GetNav().z,0);
if(key=='.')
{
cur_psd = (cur_psd+1)%psd.size();
//cam.ToCoordSystem2(CS3(psd[cur_psd].fl.d,psd[cur_psd].front,psd[cur_psd].left,psd[cur_psd].fl.n*(-1)));
//cam.SetDistance(2);
cam.SetCenter(psd[cur_psd].fl.d);
printf("\n[%d] ",cur_psd);
}
if(key==',')
{
cur_psd = (cur_psd-1+psd.size())%psd.size();
//cam.ToCoordSystem2(CS3(psd[cur_psd].fl.d,psd[cur_psd].front,psd[cur_psd].left,psd[cur_psd].fl.n*(-1)));
//cam.SetDistance(2);
cam.SetCenter(psd[cur_psd].fl.d);
printf("\n[%d] ",cur_psd);
}
static float rad=0.5;
if(key=='T')
{
for(int i=0;i<neuron.size();i++)
//if(i!=1 && i!=2)
for(int j=0;j<neuron[i].size();j++)
if(neuron[i][j].vert.size())
{
printf("%d %d, ",i,j);
Geometry g1;
MakeSmoothed(&neuron[i][j],&g1,8);
neuron[i][j].vbo_mesh.Build(g1.vert,g1.norm,g1.vert_col,g1.face);
}
}
if(key=='Q')PaintTrue(sect_radius);
if(key=='H')
{
//for(int r=3;r<=7;r++)
{
//SetPaintingRadius(r*100);
SetPaintingRadius(600);
//CalcSVRHist();
CalcHist1();
}
if(0)
for(int as=0;as<5;as++)
CalcERtoSVR(as,0.6);
}
if(key=='Z')PaintAs(cam.GetPosition(),0.6);
if(key=='Y')
{
/*
Geometry*g0=&neuron[2][0];
g0->renull();
g0->color.set(1,1,1,1);
for(int as=0;as<neuron[0].size();as++)
{
GetInSphere(&neuron[0][as],cam.GetCenter(),sect_radius,g0);
}
*/
float a,b;
CalcMonteEPR_as(cam.GetCenter(),sect_radius,a,b);
}
if(key=='X')
{
double start = glfwGetTime ( );
/*
int psd_id=cur_psd;
vec3 cen = psd[psd_id].fl.d;
float max_vl=0,rd=psd[psd_id].mediator_radius;
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g = &neuron[0][as];
g->vert_col.resize(g->vert.size());
for(int i=0;i<g->vert_col.size();i++)
if(g->vert[i].lengthSQR(cen)<rd*rd)
{
float ar = CalcSV(g->vert[i],rad);
//float ar = CalcArea(g->vert[i],rad);
if(ar>max_vl)max_vl=ar;
g->vert_col[i].x = ar;
}else
g->vert_col[i].x = 0;
}
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g = &neuron[0][as];
for(int i=0;i<g->vert_col.size();i++)
{
float vl = g->vert_col[i].x/max_vl;
if(vl)
g->vert_col[i].set(vl,0,1-vl,1);
else
g->vert_col[i]=g->color;
}
}
*/
Geometry*g0;
//int psd_id=cur_psd;
vec3 c = cam.GetCenter();
float rad = sect_radius;
Geometry*g=&neuron[2][0];
Geometry*g1=&neuron[2][2];
g0=new Geometry();
g->renull();
g->color.set(1,1,1,1);
g1->renull();
g1->color.set(1,0,0,1);
AddSphere(g0,rad,20,20);
g0->Move(c+vec3(RND11,RND11,RND11)*0.00001f);
g0->UpdateBox();
g0->RebuildTrBB();
//g0->RebuildTrBB2();
for(int as=0;as<neuron[0].size();as++)
{
GetSection(&neuron[0][as],g0,g,1,0);
GetSection(g0,&neuron[0][as],g1,1,0);
}
float s1=g->CalcArea();
float v1 = g1->CalcVolume()+g->CalcVolume();
delete g0;
printf("\n%g sec\n white surface square = %g mcm2\n section volume = %g mcm3\n S/V = %g mcm-1\n\n",glfwGetTime ( )-start,s1,v1,s1/v1);
g->BuildRep2();
g1->BuildRep2();
/*
start = glfwGetTime ( );
g0=new Geometry();
for(int as=0;as<neuron[0].size();as++)
{
GetInSphere(&neuron[0][as],c,rad,g0);
}
s1 = mc_CalcArea(g0,c,rad);
v1 = mc_CalcVolume(g0,c,rad,c,0);
float s2 = mc_CalcArea(g0,c,rad);
float v2 = mc_CalcVolume(g0,c,rad,c,0);
delete g0;
printf("\n%g sec S(%g) V(%g|%g) %g| %g",glfwGetTime ( )-start,s1,v1,v1-v2,s1/v1,s1/v1-s2/v2);
*/
//
}
if(key=='I')
{
// FullDraw();
static int id=0, dd=int(glfwGetTime ( )*1000)%10000;
id++;
MakeScreenShot("screenshots//"+str::ToString(dd)+"_"+str::ToString(id)+".png");
}
if(key=='P')
{
cam.SetCenter(psd[cur_psd].fl.d);
}
if(key=='O')
{
cam.SetCenter(vec3(0));
}
if(key=='S')smoothing=!smoothing;
if(key=='D')transparency[0]=!transparency[0];
if(key==']'){SaveApp("saving");}
if(key=='['){LoadApp("saving");}
if(key=='B')draw_boxes=!draw_boxes;
if(key=='D')
{
}
if(key=='C' || key=='V')
{
/*
if(!flat_section.size()){flat_section.push_back(FlatSection());}
int psd_id=cur_psd;
double start = glfwGetTime ( );
int sz=(key=='V')?8:128;
float sizef=2;
float *dt=new float[sz*sz];
vec3 offset = (psd[psd_id].front+psd[psd_id].left)*(-0.5f*sizef);
CalcAreas(psd[psd_id].fl.d+offset,psd[psd_id].front*sizef,psd[psd_id].left*sizef,psd[psd_id].mediator_radius,dt,ivec2(sz));
// for(int i=0;i<sz;i++) for(int j=0;j<sz;j++) dt[i+j*sz]=RND01;
flat_section[0].SetValues(dt,ivec2(sz));
flat_section[0].d = psd[psd_id].fl.d+offset;
flat_section[0].x = psd[psd_id].front*sizef;
flat_section[0].y = psd[psd_id].left*sizef;
//
delete[]dt;
printf("\n%g sec ",glfwGetTime ( )-start);
*/
//Calc(cur_psd);
CalcER();
}
if(key=='J')
//if(0)
{
double start = glfwGetTime ( );
for(int r=3;r<=7;r++)
{
SetPaintingRadius(r*100);
//for(int rd=5;rd<25;rd++)
{
for(int i=0;i<psd.size();i++)
//for(int i=0;i<1;i++)
{
// printf("\n------------ %d PSD Rad=%d\n",i,rd);
PaintAs(psd[i].fl.d,1000*0.1f);
}
CalcHist1();
}
}
printf("\n%g min ",(glfwGetTime ( )-start)/60);
}
if(key>='0' && key<='9')
{
int id = key-'0';
if(id<neuron.size())
{
for(int i=0;i<neuron[id].size();i++)
neuron[id][i].visible=!neuron[id][i].visible;
}
}
}
}
//обработчик вращения колёсика мыши
void MouseWheel( int val )
{
static int oval = val;
mouse.Wheel(val-oval);
/// cam.MouseWheel(val-oval);
cam.SetDistance(cam.GetDistance()*((val-oval)<0?1.1f:0.9f));
oval = val;
}
void SetupGL()
{
#ifdef USE_GLEW
glewInit();
#endif
glClearColor(0.6,0.7,1,1);
//glClearColor(0,0,0,1);
//glClearColor(1,1,1,1);
//glShadeModel(GL_FLAT);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_LINE_SMOOTH);
glCullFace(GL_FRONT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void initIVP()
{
SetupGL();
wxImage::AddHandler(new wxPNGHandler);
cam.SetupProjection(45,0.3f,60.0f,0,0,width,height);
printf("-----\n%s\n-----\n",output::out_string.c_str()); //вывод результата компилляции шейдера на консоль
output::out_string.clear();
LoadNeuron();
//boolean//seg_BuildBox();
cam.SetCenter(psd[cur_psd].fl.d);
cam.SetDistance(5.5f);
/*
Geometry gg;
AddSphere(&gg,1,30,30);
gg.RebuildTrBB();
float ss = mc_CalcVolume(&gg,vec3(0.0),1.5);
*/
PaintTrue(1.0f/30);
//printf("\n");
if(0)
for(int i=0;i<5;i++)
{
float v = neuron[0][i].CalcVolume();
printf("%g\n",v);
}
/* //approximation with 2 gausses
Table tbl(4,410);
tbl.OpenFromFile("results\\hist_svr_600.txt");
vec x_vals,y_vals;
v2vec p_b;
for(int i=0;i<400;i++)
{
printf(" %g\n",tbl.GetFloatValue(0,i+1));
x_vals.push_back(tbl.GetFloatValue(1,i+1));
y_vals.push_back(tbl.GetFloatValue(0,i+1));
}
p_b.resize(5);
for(int i=0;i<2;i++)
{
p_b[0+i*2].set(3,30);
p_b[1+i*2].set(0,10);
}
p_b[4].set(0,1);
vec prm = Approx(x_vals,y_vals,p_b);
Table tbl1(1,6);
for(int i=0;i<prm.size();i++)
{
tbl1.SetValue(prm[i],0,i);
}
tbl1.StoreToFile("results\\_gauss2.txt");
*/
/*
// shift
Table tbl(249,160);
tbl.OpenFromFile("results\\ER_central.txt");
int offset[53],max_offset=0;
int med_max=0;
for(int i=0;i<53;i++)
{
float vl0=0;
for(int j=1;j<tbl.GetWidth();j++)
{
float vl = tbl.GetFloatValue(j,1+53*2+i);
if(vl<vl0)
{
offset[i] = j-2;
if(vl0>0.02)
{
if(max_offset<j-2)max_offset=j-2;
//printf("\n%d) %d, %dnm",i,j-2,(j-2)*10);
printf("\n%g",(j-1)*0.01f);
med_max+=(j-2);
break;
}
}
vl0=vl;
}
}
printf("\n________\n max=%d mid=%g",max_offset,med_max/53.0f);
Table tbl1(tbl.GetWidth()+max_offset,tbl.GetHeight());
for(int i=0;i<53;i++)
{
for(int j=1;j<tbl.GetWidth();j++)
{
for(int p=0;p<3;p++)
{
std::string vl = tbl.GetStringValue(j,1+53*p+i);
tbl1.SetValue(vl,j+max_offset-offset[i],1+53*p+i);
}
}
}
tbl1.StoreToFile("results\\_ER_central.txt");
int dv=4;
Table tbl2(tbl1.GetWidth()/dv+1,tbl1.GetHeight());
for(int i=0;i<53;i++)
{
for(int j=0;j<tbl2.GetWidth();j++)
{
for(int p=0;p<3;p++)
{
float vl = 0;
int smm=0;
for(int k=0;k<dv;k++)
{
if(tbl1.GetStringValue(j*dv+k+1,1+53*p+i)!="")
{
vl+=tbl1.GetFloatValue(j*dv+k+1,1+53*p+i);
smm++;
}
}
vl/=smm;
if(smm)tbl2.SetValue(vl,j+1,1+53*p+i);
}
}
}
tbl2.StoreToFile("results\\smaller_ER_central.txt");
Table tbl3(tbl.GetWidth()/dv+1,tbl.GetHeight());
for(int i=0;i<53;i++)
{
for(int j=0;j<tbl3.GetWidth();j++)
{
for(int p=0;p<3;p++)
{
float vl = 0;
for(int k=0;k<dv;k++)
vl+=tbl.GetFloatValue(j*dv+k+1,1+53*p+i);
vl/=dv;
tbl3.SetValue(vl,j+1,1+53*p+i);
}
tbl3.SetValue(tbl.GetStringValue(j*dv+1,0),j+1,0);
}
}
tbl3.StoreToFile("results\\smallerER_central.txt");
*/
int ii;
float l1=0;
for(int i=0;i<psd.size();i++)
{
float minl;
for(int j=0;j<psd.size();j++)
if(i!=j)
{
float ll = psd[j].fl.d.lengthSQR(psd[i].fl.d);
if(ll<minl || !j){minl=ll;}
}
minl=sqrt(minl);
printf("\n< %g",minl);
l1 += minl/53.0f;
}
printf("< %g >",l1);
}
int main ( void )
{
glfwInit ( );
// printf("Do you want to run program in fullscreen mode? [Y/N]\n");
printf("[S] - toggle smoothing\n");
printf("[>] - to next PSD\n");
printf("[<] - to previous PSD\n");
printf("[X] - perform the astrocytes section by the sphere\n\n");
printf("[0] - show/hide astrocytes\n");
printf("[1] - show/hide PSD\n");
printf("[2] - show/hide the section\n");
printf("[3] - show/hide dendrite spinuliferous\n\n");
printf("[R]+mouse movement - change the sphere radius\n");
int choice = 0;//getchar ( );
int _width, _height, mode = GLFW_WINDOW;
//---------------------------------------------------------------------------------------------
if ( choice == 'Y' || choice == 'y' )
{
GLFWvidmode vidmode;
glfwGetDesktopMode ( &vidmode );
width = vidmode.Width;
height = vidmode.Height;
mode = GLFW_FULLSCREEN;
}
//---------------------------------------------------------------------------------------------
if( !glfwOpenWindow ( width, height, 8, 8, 8, 8, 8, 8, mode ) )
{
glfwTerminate ( ); exit ( 0 );
}
//---------------------------------------------------------------------------------------------
glfwSwapInterval ( 0 );
glfwSetMousePosCallback ( MouseMove );
glfwSetMouseButtonCallback ( MouseButton );
glfwSetKeyCallback ( KeyButton );
glfwSetMouseWheelCallback ( MouseWheel );
//---------------------------------------------------------------------------------------------
bool running = GL_TRUE;
int frames = 0;
char caption [100];
initIVP();
double start = glfwGetTime ( );
double frame_time = glfwGetTime ( );
while ( running )
{
double time = glfwGetTime ( );
// glfwSetWindowTitle ( caption );
//-----------------------------------------------------------------------------------------
glfwGetWindowSize ( &_width, &_height );
_height = max ( _height, 1 );
if(_height!=height || _width!=width)
{
width=_width;
height=_height;
cam.SetupProjection(45,0.3f,60.0f,0,0,width,height);
}
if(time-frame_time>1/30.0)
{frame_time=time;
FullDraw();
glfwSwapBuffers ( );
}
//-----------------------------------------------------------------------------------------
running = !glfwGetKey ( GLFW_KEY_ESC ) && glfwGetWindowParam ( GLFW_OPENED );
}
glfwTerminate ( );
exit ( 0 );
}
|
[
"[email protected]"
] |
[
[
[
1,
719
]
]
] |
a7f6841bb6855e5271ddd590189762a94c309e27
|
e8a62d1954bd0a93cf2ab329dbceca9a78200794
|
/win7taskbar/win7taskbar.cpp
|
fd55acb86cbe673aca80966ca607f96425ba7014
|
[
"BSD-3-Clause"
] |
permissive
|
gageas/FittleWin7Taskbar
|
21059202e911a90f4ef8d258aaedf4226c293d07
|
0f69141f5ab6df37aaec2cccd7cc5f6fc549a472
|
refs/heads/master
| 2016-09-06T05:27:22.613728 | 2010-04-03T03:19:19 | 2010-04-03T03:19:19 | null | 0 | 0 | null | null | null | null |
SHIFT_JIS
|
C++
| false | false | 6,351 |
cpp
|
/*
* win7taskbar by gageas/nig_luce<[email protected]>
*
* xdelfileをスケルトンとして利用させていただきました
*/
/*
* xdelfile
*
* Copyright(C) 2004-2008 Mallow <mallow at livedoor.com>
* All Rights Reserved
*/
#include <Windows.h>
#include <ShObjIdl.h>
#include "resource.h"
#include "..\..\..\..\..\..\..\fittlesrc\source\fittle\src\plugin.h"
#if defined(_MSC_VER)
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#endif
#if defined(_MSC_VER) && !defined(_DEBUG)
//#pragma comment(linker,"/ENTRY:DllMain")
#pragma comment(linker,"/MERGE:.rdata=.text")
#pragma comment(linker,"/OPT:NOWIN98")
#endif
#define MAX_FITTLE_PATH 260*2
#define ID_SEEKTIMER 200
#define IDM_PREV 40044
#define IDM_PLAYPAUSE 40164
#define IDM_STOP 40047
#define IDM_NEXT 40048
static HMODULE hDLL = 0;
static HICON hIconPlay = NULL;
static HICON hIconPause = NULL;
static ITaskbarList3* m_pTaskbarList = NULL; // タスクバーリスト
static THUMBBUTTON m_ThumbButtons[4];
static DWORD m_wmTBC = (DWORD)-1; // タスクバーボタン生成メッセージ
static BOOL OnInit();
static void OnQuit();
static void OnTrackChange();
static void OnStatusChange();
static void OnConfig();
static FITTLE_PLUGIN_INFO fpi = {
PDK_VER,
OnInit,
OnQuit,
OnTrackChange,
OnStatusChange,
OnConfig,
NULL,
NULL
};
static LRESULT SendFittleMessage(UINT uMsg, WPARAM wp, LPARAM lp){
return SendMessage(fpi.hParent, uMsg, wp, lp);
}
static LRESULT SendFittleCommand(int nCmd){
return SendFittleMessage(WM_COMMAND, MAKEWPARAM(nCmd, 0), 0);
}
static void SetTaskBarButton(THUMBBUTTON* button, THUMBBUTTONMASK dwMask, UINT iId, HICON hIcon, LPCWSTR szTip, THUMBBUTTONFLAGS dwFlag){
button->dwMask = dwMask;
button->iId = iId;
button->hIcon = hIcon;
wcscpy_s(button->szTip, sizeof(button->szTip)/sizeof(button->szTip[0]), szTip);
button->dwFlags = dwFlag;
}
static void ResetTaskbarProgress(){
if(m_pTaskbarList == NULL)return;
switch((int)SendMessage(fpi.hParent, WM_FITTLE, GET_STATUS, 0)){
case 1: // Play
SetTaskBarButton(&m_ThumbButtons[1], THB_ICON|THB_TOOLTIP|THB_FLAGS, 1, hIconPause, L"Pause", THBF_ENABLED);
m_pTaskbarList->SetProgressState(fpi.hParent, TBPF_NORMAL);
m_ThumbButtons[1].hIcon = hIconPause;
break;
case 3: // Pause
SetTaskBarButton(&m_ThumbButtons[1], THB_ICON|THB_TOOLTIP|THB_FLAGS, 1, hIconPlay, L"Play", THBF_ENABLED);
m_pTaskbarList->SetProgressState(fpi.hParent, TBPF_PAUSED);
m_ThumbButtons[1].hIcon = hIconPlay;
break;
default:
SetTaskBarButton(&m_ThumbButtons[1], THB_ICON|THB_TOOLTIP|THB_FLAGS, 1, hIconPlay, L"Play", THBF_ENABLED);
m_pTaskbarList->SetOverlayIcon(fpi.hParent, NULL ,L"");
m_pTaskbarList->SetProgressState(fpi.hParent, TBPF_NOPROGRESS);
m_ThumbButtons[1].hIcon = hIconPlay;
break;
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){
(void)lpvReserved;
if (fdwReason == DLL_PROCESS_ATTACH){
hDLL = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
}else if (fdwReason == DLL_PROCESS_DETACH){
}
return TRUE;
}
static BOOL bOldProc;
static WNDPROC hOldProc;
// サブクラス化したウィンドウプロシージャ
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp){
switch(msg){
case WM_COMMAND:
if (HIWORD(wp) == THBN_CLICKED) {
switch(LOWORD(wp)){
case 0:
SendFittleCommand(IDM_PREV);
break;
case 1:
SendFittleCommand(IDM_PLAYPAUSE);
break;
case 2:
SendFittleCommand(IDM_STOP);
break;
case 3:
SendFittleCommand(IDM_NEXT);
break;
}
}
break;
case WM_TIMER:
if(wp == ID_SEEKTIMER){
if(m_pTaskbarList != NULL)m_pTaskbarList->SetProgressValue(fpi.hParent, SendMessage(hWnd, WM_FITTLE, GET_POSITION, 0), SendMessage(hWnd, WM_FITTLE, GET_DURATION, 0));
}
break;
default:
if(msg == m_wmTBC){ // case m_wmTBCとすると怒られるのでdefaultの下にいれます・・・
ResetTaskbarProgress();
m_pTaskbarList->ThumbBarAddButtons(hWnd, sizeof(m_ThumbButtons)/sizeof(m_ThumbButtons[0]), m_ThumbButtons);
break;
}
}
return (bOldProc ? CallWindowProcW : CallWindowProcA)(hOldProc, hWnd, msg, wp, lp);
}
/* 起動時に一度だけ呼ばれます */
static BOOL OnInit(){
bOldProc = IsWindowUnicode(fpi.hParent);
hOldProc = (WNDPROC)(bOldProc ? SetWindowLongW : SetWindowLongA)(fpi.hParent, GWL_WNDPROC, (LONG)WndProc);
CoCreateInstance(
CLSID_TaskbarList, NULL, CLSCTX_ALL,
IID_ITaskbarList3, (void**)&m_pTaskbarList);
m_wmTBC = RegisterWindowMessage(L"TaskbarButtonCreated");
hIconPlay = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(IDI_PLAY),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE | LR_SHARED );
hIconPause = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(IDI_PAUSE),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE | LR_SHARED );
SetTaskBarButton(&m_ThumbButtons[0], THB_ICON|THB_TOOLTIP|THB_FLAGS, 0,
(HICON)LoadImage(hDLL, MAKEINTRESOURCE(IDI_PREV),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE | LR_SHARED ),
L"Prev", THBF_ENABLED);
SetTaskBarButton(&m_ThumbButtons[1], THB_ICON|THB_TOOLTIP|THB_FLAGS, 1, hIconPlay, L"Play", THBF_ENABLED);
SetTaskBarButton(&m_ThumbButtons[2], THB_ICON|THB_TOOLTIP|THB_FLAGS, 2,
(HICON)LoadImage(hDLL, MAKEINTRESOURCE(IDI_STOP),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE | LR_SHARED ),
L"Stop", THBF_ENABLED);
SetTaskBarButton(&m_ThumbButtons[3], THB_ICON|THB_TOOLTIP|THB_FLAGS, 3,
(HICON)LoadImage(hDLL, MAKEINTRESOURCE(IDI_NEXT),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE | LR_SHARED ),
L"Next", THBF_ENABLED);
return TRUE;
}
/* 終了時に一度だけ呼ばれます */
static void OnQuit(){
return;
}
/* 曲が変わる時に呼ばれます */
static void OnTrackChange(){
}
/* 再生状態が変わる時に呼ばれます */
static void OnStatusChange(){
ResetTaskbarProgress();
m_pTaskbarList->ThumbBarUpdateButtons(fpi.hParent, sizeof(m_ThumbButtons)/sizeof(m_ThumbButtons[0]), m_ThumbButtons);
}
/* 設定画面を呼び出します(未実装)*/
static void OnConfig(){
}
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) FITTLE_PLUGIN_INFO *GetPluginInfo(){
return &fpi;
}
#ifdef __cplusplus
}
#endif
|
[
"[email protected]"
] |
[
[
[
1,
206
]
]
] |
28e3f36971f1ee254322ed4772888d71634d0b73
|
ad8046a7c792e31fab898fa13a7693ff34ef2b83
|
/eFilm/CustomeMessageExample/CustomeMessageExamplePropPage.cpp
|
f5ab7482be497c92ec1a24e423571a098b573acc
|
[] |
no_license
|
alibinjamil/datamedris
|
df5f205775e78b76f15155c27e316f81beba1660
|
3f4711ef3c43e21870261bfbcab7fbafd369e114
|
refs/heads/master
| 2016-08-12T06:06:00.915112 | 2010-12-22T08:47:14 | 2010-12-22T08:47:14 | 44,970,197 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,641 |
cpp
|
// CustomeMessageExamplePropPage.cpp : Implementation of the CCustomeMessageExamplePropPage property page class.
#include "stdafx.h"
#include "CustomeMessageExample.h"
#include "CustomeMessageExamplePropPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE(CCustomeMessageExamplePropPage, COlePropertyPage)
// Message map
BEGIN_MESSAGE_MAP(CCustomeMessageExamplePropPage, COlePropertyPage)
END_MESSAGE_MAP()
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CCustomeMessageExamplePropPage, "CUSTOMEMESSAGE.CustomeMessagePropPage.1",
0x5fb87d32, 0x17e4, 0x45b9, 0x84, 0x92, 0x9c, 0x4a, 0x2a, 0xdd, 0xdf, 0x55)
// CCustomeMessageExamplePropPage::CCustomeMessageExamplePropPageFactory::UpdateRegistry -
// Adds or removes system registry entries for CCustomeMessageExamplePropPage
BOOL CCustomeMessageExamplePropPage::CCustomeMessageExamplePropPageFactory::UpdateRegistry(BOOL bRegister)
{
if (bRegister)
return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
m_clsid, IDS_CUSTOMEMESSAGEEXAMPLE_PPG);
else
return AfxOleUnregisterClass(m_clsid, NULL);
}
// CCustomeMessageExamplePropPage::CCustomeMessageExamplePropPage - Constructor
CCustomeMessageExamplePropPage::CCustomeMessageExamplePropPage() :
COlePropertyPage(IDD, IDS_CUSTOMEMESSAGEEXAMPLE_PPG_CAPTION)
{
}
// CCustomeMessageExamplePropPage::DoDataExchange - Moves data between page and properties
void CCustomeMessageExamplePropPage::DoDataExchange(CDataExchange* pDX)
{
DDP_PostProcessing(pDX);
}
// CCustomeMessageExamplePropPage message handlers
|
[
"[email protected]"
] |
[
[
[
1,
62
]
]
] |
af76cdb5455df74b308ebdb981f6dbfd491a464d
|
bef7d0477a5cac485b4b3921a718394d5c2cf700
|
/dingus/dingus/audio/SoundWaveFmt.h
|
72b435065585aa149b36b0190f0de469eb0459ec
|
[
"MIT"
] |
permissive
|
TomLeeLive/aras-p-dingus
|
ed91127790a604e0813cd4704acba742d3485400
|
22ef90c2bf01afd53c0b5b045f4dd0b59fe83009
|
refs/heads/master
| 2023-04-19T20:45:14.410448 | 2011-10-04T10:51:13 | 2011-10-04T10:51:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,120 |
h
|
#ifndef __SOUND_WAVE_FORMAT_H
#define __SOUND_WAVE_FORMAT_H
#include <mmsystem.h>
#include <mmreg.h>
namespace dingus {
class CSoundWaveFmt : public boost::noncopyable {
public:
CSoundWaveFmt();
~CSoundWaveFmt();
bool open( const std::string& fileName, WAVEFORMATEX* pwfx, bool reading );
bool openFromMemory( BYTE* data, ULONG dataSize, WAVEFORMATEX* pwfx );
bool close();
bool read( BYTE* buffer, DWORD sizeToRead, DWORD* sizeRead );
bool write( DWORD sizeToWrite, BYTE* data, DWORD* sizeWritten );
DWORD getSize() const { return mSize; }
bool resetFile();
const WAVEFORMATEX* getFormat() const { return mFormat; };
protected:
bool readMmio();
bool writeMmio( WAVEFORMATEX *destFmt );
public:
WAVEFORMATEX* mFormat;
HMMIO mMmio; // MM I/O handle for the WAVE
MMCKINFO mChunk; // Multimedia RIFF chunk
MMCKINFO mChunkRiff; // Use in opening a WAVE file
DWORD mSize; // The size of the wave file
MMIOINFO mMmioOut;
bool mFromMemory;
bool mReading;
BYTE* mData;
BYTE* mDataCurr;
ULONG mDataSize;
};
}; // namespace
#endif
|
[
"[email protected]"
] |
[
[
[
1,
49
]
]
] |
5769c19773eb2a2f69b4fcf51a4c7a461e9dcf59
|
cdaf7ae09b73fc003cad3a0d206e9d75fd11ae46
|
/ImageProcDlg.h
|
a34144d471005e635de940bc2bdcddd3e4ddb810
|
[] |
no_license
|
DanGodfrey/ImageProc_Object_Detection
|
70bddb9b4c98ee3f93326b68f3a22d03d8798b64
|
37189786eadaf16c5b2828e988fc4509a784eacb
|
refs/heads/master
| 2021-01-19T15:33:53.652003 | 2011-02-04T02:00:05 | 2011-02-04T02:00:05 | 1,326,603 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 919 |
h
|
// ImageProcDlg.h : header file
//
#pragma once
#include "CSI4133.h"
// CImageProcDlg dialog
class CImageProcDlg : public CDialogEx
{
//CSI4133
CSI4133 ocv;
// Construction
public:
CImageProcDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_IMAGEPROC_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedButtonprocess();
afx_msg void OnBnClickedButtonsave();
CString strPath;
afx_msg void OnBnClickedButtonload();
afx_msg void OnBnClickedButtonshow();
afx_msg void OnBnClickedButtontest();
};
|
[
"[email protected]"
] |
[
[
[
1,
43
]
]
] |
4e0d204a339958dadb5b3a66d5cf12a998472e5a
|
2b80036db6f86012afcc7bc55431355fc3234058
|
/src/win32cpp/Image.hpp
|
93d55d7a8c690117528668a559273d96f271b87d
|
[
"BSD-3-Clause"
] |
permissive
|
leezhongshan/musikcube
|
d1e09cf263854bb16acbde707cb6c18b09a0189f
|
e7ca6a5515a5f5e8e499bbdd158e5cb406fda948
|
refs/heads/master
| 2021-01-15T11:45:29.512171 | 2011-02-25T14:09:21 | 2011-02-25T14:09:21 | null | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 3,426 |
hpp
|
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2007, Casey Langen
//
// Sources and Binaries of: win32cpp
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
//////////////////////////////////////////////////////////////////////////////
#include <win32cpp/Win32Config.hpp>
#include <win32cpp/Types.hpp>
#include <win32cpp/Exception.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
#include <boost/gil/gil_all.hpp>
//////////////////////////////////////////////////////////////////////////////
namespace win32cpp {
class Image;
///
///\brief A shared pointer to a Font object
///
typedef boost::shared_ptr<Image> ImageRef;
///\brief
///Image provides a light-weight wrapper around an image. It is backed
///by boost::gil.
///
///\see
///ImageRef
class Image
{
public: // types
class InvalidFontWeightException: public Exception { };
private: // types
typedef boost::mpl::vector<
boost::gil::gray8_image_t,
boost::gil::gray16_image_t,
boost::gil::rgb8_image_t,
boost::gil::rgb16_image_t> SupportedFormats;
typedef boost::gil::any_image<
SupportedFormats> ImageType;
private: // constructors
/*ctor*/ Image();
public: // creation methods
static ImageRef Create(const uistring& filename);
public: // destructor
/*dtor*/ ~Image();
public: // methods
void DrawToHDC(HDC hdc, const Point& point);
private: // instance data
ImageType image;
};
//////////////////////////////////////////////////////////////////////////////
} // win32cpp
|
[
"onnerby@6a861d04-ae47-0410-a6da-2d49beace72e",
"[email protected]@6a861d04-ae47-0410-a6da-2d49beace72e"
] |
[
[
[
1,
43
],
[
46,
46
],
[
51,
53
],
[
62,
62
],
[
70,
70
],
[
73,
73
],
[
86,
86
],
[
89,
89
],
[
95,
96
],
[
98,
99
],
[
101,
101
]
],
[
[
44,
45
],
[
47,
50
],
[
54,
61
],
[
63,
69
],
[
71,
72
],
[
74,
85
],
[
87,
88
],
[
90,
94
],
[
97,
97
],
[
100,
100
],
[
102,
102
]
]
] |
0b51c80e4e1d2c49a73d7a3776f8b7928f88354c
|
d54d8b1bbc9575f3c96853e0c67f17c1ad7ab546
|
/hlsdk-2.3-p3/multiplayer/ricochet/dlls/wpn_shared/disc_weapon_disc.cpp
|
c69eb1306d41a7ef5ee82c41c5025a16df15ead0
|
[] |
no_license
|
joropito/amxxgroup
|
637ee71e250ffd6a7e628f77893caef4c4b1af0a
|
f948042ee63ebac6ad0332f8a77393322157fa8f
|
refs/heads/master
| 2021-01-10T09:21:31.449489 | 2010-04-11T21:34:27 | 2010-04-11T21:34:27 | 47,087,485 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 20,910 |
cpp
|
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: Weapon functionality for Discwar
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "effects.h"
#include "discwar.h"
#include "disc_objects.h"
#include "disc_arena.h"
// Disc trail colors
float g_iaDiscColors[33][3] =
{
{ 255, 255, 255, },
{ 250, 0, 0 },
{ 0, 0, 250 },
{ 0, 250, 0 },
{ 128, 128, 0 },
{ 128, 0, 128 },
{ 0, 128, 128 },
{ 128, 128, 128 },
{ 64, 128, 0 },
{ 128, 64, 0 },
{ 128, 0, 64 },
{ 64, 0, 128 },
{ 0, 64, 128 },
{ 64, 64, 128 },
{ 128, 64, 64 },
{ 64, 128, 64 },
{ 128, 128, 64 },
{ 128, 64, 128 },
{ 64, 128, 128 },
{ 250, 128, 0 },
{ 128, 250, 0 },
{ 128, 0, 250 },
{ 250, 0, 128 },
{ 0, 250, 128 },
{ 250, 250, 128 },
{ 250, 128, 250 },
{ 128, 250, 250 },
{ 250, 128, 64 },
{ 250, 64, 128 },
{ 128, 250, 64 },
{ 64, 128, 250 },
{ 128, 64, 250 },
};
enum disc_e
{
DISC_IDLE = 0,
DISC_FIDGET,
DISC_PINPULL,
DISC_THROW1, // toss
DISC_THROW2, // medium
DISC_THROW3, // hard
DISC_HOLSTER,
DISC_DRAW
};
#include "disc_weapon.h"
LINK_ENTITY_TO_CLASS( weapon_disc, CDiscWeapon );
#if !defined( CLIENT_DLL )
LINK_ENTITY_TO_CLASS( disc, CDisc );
//========================================================================================
// DISC
//========================================================================================
void CDisc::Spawn( void )
{
Precache( );
pev->classname = MAKE_STRING("disc");
pev->movetype = MOVETYPE_BOUNCEMISSILE;
pev->solid = SOLID_TRIGGER;
// Setup model
if ( m_iPowerupFlags & POW_HARD )
SET_MODEL(ENT(pev), "models/disc_hard.mdl");
else
SET_MODEL(ENT(pev), "models/disc.mdl");
UTIL_SetSize(pev, Vector( -4,-4,-4 ), Vector(4, 4, 4));
UTIL_SetOrigin( pev, pev->origin );
SetTouch( DiscTouch );
SetThink( DiscThink );
m_iBounces = 0;
m_fDontTouchOwner = gpGlobals->time + 0.2;
m_fDontTouchEnemies = 0;
m_bRemoveSelf = false;
m_bTeleported = false;
m_pLockTarget = NULL;
UTIL_MakeVectors( pev->angles );
// Fast powerup makes discs go faster
if ( m_iPowerupFlags & POW_FAST )
pev->velocity = gpGlobals->v_forward * DISC_VELOCITY * 1.5;
else
pev->velocity = gpGlobals->v_forward * DISC_VELOCITY;
// Pull our owner out so we will still touch it
if ( pev->owner )
m_hOwner = Instance(pev->owner);
pev->owner = NULL;
// Trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT(entindex()); // entity
WRITE_SHORT(m_iTrail ); // model
if (m_bDecapitate)
WRITE_BYTE( 5 ); // life
else
WRITE_BYTE( 3 ); // life
WRITE_BYTE( 5 ); // width
WRITE_BYTE( g_iaDiscColors[pev->team][0] ); // r, g, b
WRITE_BYTE( g_iaDiscColors[pev->team][1] ); // r, g, b
WRITE_BYTE( g_iaDiscColors[pev->team][2] ); // r, g, b
WRITE_BYTE( 250 ); // brightness
MESSAGE_END();
// Decapitator's make sound
if (m_bDecapitate)
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/rocket1.wav", 0.5, 0.5 );
// Highlighter
pev->renderfx = kRenderFxGlowShell;
for (int i = 0; i <= 2;i ++)
pev->rendercolor[i] = g_iaDiscColors[pev->team][i];
pev->renderamt = 100;
pev->nextthink = gpGlobals->time + 0.1;
}
void CDisc::Precache( void )
{
PRECACHE_MODEL("models/disc.mdl");
PRECACHE_MODEL("models/disc_hard.mdl");
PRECACHE_SOUND("weapons/cbar_hitbod1.wav");
PRECACHE_SOUND("weapons/cbar_hitbod2.wav");
PRECACHE_SOUND("weapons/cbar_hitbod3.wav");
PRECACHE_SOUND("weapons/altfire.wav");
PRECACHE_SOUND("items/gunpickup2.wav");
PRECACHE_SOUND("weapons/electro5.wav");
PRECACHE_SOUND("weapons/xbow_hit1.wav");
PRECACHE_SOUND("weapons/xbow_hit2.wav");
PRECACHE_SOUND("weapons/rocket1.wav");
PRECACHE_SOUND("dischit.wav");
m_iTrail = PRECACHE_MODEL("sprites/smoke.spr");
m_iSpriteTexture = PRECACHE_MODEL( "sprites/lgtning.spr" );
}
/*
void CDisc::SetObjectCollisionBox( void )
{
pev->absmin = pev->origin + Vector( -8, -8, 8 );
pev->absmax = pev->origin + Vector( 8, 8, 8 );
}
*/
// Give the disc back to it's owner
void CDisc::ReturnToThrower( void )
{
if (m_bDecapitate)
{
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
if ( !m_bRemoveSelf )
((CBasePlayer*)(CBaseEntity*)m_hOwner)->GiveAmmo( MAX_DISCS, "disc", MAX_DISCS );
}
else
{
if ( !m_bRemoveSelf )
((CBasePlayer*)(CBaseEntity*)m_hOwner)->GiveAmmo( 1, "disc", MAX_DISCS );
}
UTIL_Remove( this );
}
void CDisc::DiscTouch ( CBaseEntity *pOther )
{
// Push players backwards
if ( pOther->IsPlayer() )
{
if ( ((CBaseEntity*)m_hOwner) == pOther )
{
if (m_fDontTouchOwner < gpGlobals->time)
{
// Play catch sound
EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
ReturnToThrower();
}
return;
}
else if ( m_fDontTouchEnemies < gpGlobals->time)
{
if ( pev->team != pOther->pev->team )
{
((CBasePlayer*)pOther)->m_LastHitGroup = HITGROUP_GENERIC;
// Do freeze seperately so you can freeze and shatter a person with a single shot
if ( m_iPowerupFlags & POW_FREEZE && ((CBasePlayer*)pOther)->m_iFrozen == FALSE )
{
// Freeze the player and make them glow blue
EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
((CBasePlayer*)pOther)->Freeze();
// If it's not a decap, return now. If it's a decap, continue to shatter
if ( !m_bDecapitate )
{
m_fDontTouchEnemies = gpGlobals->time + 2.0;
return;
}
}
// Decap or push
if (m_bDecapitate)
{
// Decapitate!
if ( m_bTeleported )
((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
((CBasePlayer*)pOther)->Decapitate( ((CBaseEntity*)m_hOwner)->pev );
m_fDontTouchEnemies = gpGlobals->time + 0.5;
}
else
{
// Play thwack sound
switch( RANDOM_LONG(0,2) )
{
case 0:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 1:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 2:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
}
// Push the player
Vector vecDir = pev->velocity.Normalize();
pOther->pev->flags &= ~FL_ONGROUND;
((CBasePlayer*)pOther)->m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;
// Shield flash only if the player isnt frozen
if ( ((CBasePlayer*)pOther)->m_iFrozen == false )
{
pOther->pev->renderfx = kRenderFxGlowShell;
pOther->pev->rendercolor.x = 255;
pOther->pev->renderamt = 150;
}
((CBasePlayer*)pOther)->m_hLastPlayerToHitMe = m_hOwner;
((CBasePlayer*)pOther)->m_flLastDiscHit = gpGlobals->time;
((CBasePlayer*)pOther)->m_flLastDiscBounces = m_iBounces;
if ( m_bTeleported )
((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
m_fDontTouchEnemies = gpGlobals->time + 2.0;
}
}
}
}
// Hit a disc?
else if ( pOther->pev->iuser4 )
{
// Enemy Discs destroy each other
if ( pOther->pev->iuser4 != pev->iuser4 )
{
// Play a warp sound and sprite
CSprite *pSprite = CSprite::SpriteCreate( "sprites/discreturn.spr", pev->origin, TRUE );
pSprite->AnimateAndDie( 60 );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
pSprite->SetScale( 1 );
EMIT_SOUND_DYN( edict(), CHAN_ITEM, "dischit.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
// Return both discs to their owners
((CDisc*)pOther)->ReturnToThrower();
ReturnToThrower();
}
else
{
// Friendly discs just pass through each other
}
}
else
{
m_iBounces++;
switch ( RANDOM_LONG( 0, 1 ) )
{
case 0: EMIT_SOUND_DYN( edict(), CHAN_ITEM, "weapons/xbow_hit1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); break;
case 1: EMIT_SOUND_DYN( edict(), CHAN_ITEM, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); break;
}
UTIL_Sparks( pev->origin, edict() );
}
}
void CDisc::DiscThink()
{
// Make Freeze discs home towards any player ahead of them
if ( (m_iPowerupFlags & POW_FREEZE) && (m_iBounces == 0) )
{
// Use an existing target if he's still in the view cone
if ( m_pLockTarget != NULL )
{
Vector vecDir = (m_pLockTarget->pev->origin - pev->origin).Normalize();
UTIL_MakeVectors( pev->angles );
float flDot = DotProduct( gpGlobals->v_forward, vecDir );
if ( flDot < 0.6 )
m_pLockTarget = NULL;
}
// Get a new target if we don't have one
if ( m_pLockTarget == NULL )
{
CBaseEntity *pOther = NULL;
// Examine all entities within a reasonable radius
while ((pOther = UTIL_FindEntityByClassname( pOther, "player" )) != NULL)
{
// Skip the guy who threw this
if ( ((CBaseEntity*)m_hOwner) == pOther )
continue;
// Skip observers
if ( ((CBasePlayer*)pOther)->IsObserver() )
continue;
// Make sure the enemy's in a cone ahead of us
Vector vecDir = (pOther->pev->origin - pev->origin).Normalize();
UTIL_MakeVectors( pev->angles );
float flDot = DotProduct( gpGlobals->v_forward, vecDir );
if ( flDot > 0.6 )
{
m_pLockTarget = pOther;
break;
}
}
}
// Track towards our target
if ( m_pLockTarget != NULL )
{
// Calculate new velocity
Vector vecDir = (m_pLockTarget->pev->origin - pev->origin).Normalize();
pev->velocity = ( pev->velocity.Normalize() + (vecDir.Normalize() * 0.25)).Normalize();
pev->velocity = pev->velocity * DISC_VELOCITY;
pev->angles = UTIL_VecToAngles( pev->velocity );
}
}
// Track the player if we've bounced 3 or more times ( Fast discs remove immediately )
if ( m_iBounces >= 3 || (m_iPowerupFlags & POW_FAST && m_iBounces >= 1) )
{
// Remove myself if my owner's died
if (m_bRemoveSelf)
{
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
UTIL_Remove( this );
return;
}
// 7 Bounces, just remove myself
if ( m_iBounces > 7 )
{
ReturnToThrower();
return;
}
// Start heading for the player
if ( m_hOwner )
{
Vector vecDir = ( m_hOwner->pev->origin - pev->origin );
vecDir = vecDir.Normalize();
pev->velocity = vecDir * DISC_VELOCITY;
pev->nextthink = gpGlobals->time + 0.1;
}
else
{
UTIL_Remove( this );
}
}
// Sanity check
if ( pev->velocity == g_vecZero )
ReturnToThrower();
pev->nextthink = gpGlobals->time + 0.1;
}
CDisc *CDisc::CreateDisc( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CDiscWeapon *pLauncher, bool bDecapitator, int iPowerupFlags )
{
CDisc *pDisc = GetClassPtr( (CDisc *)NULL );
UTIL_SetOrigin( pDisc->pev, vecOrigin );
pDisc->m_iPowerupFlags = iPowerupFlags;
// Hard shots always decapitate
if ( pDisc->m_iPowerupFlags & POW_HARD )
pDisc->m_bDecapitate = TRUE;
else
pDisc->m_bDecapitate = bDecapitator;
pDisc->pev->angles = vecAngles;
pDisc->pev->owner = pOwner->edict();
pDisc->pev->team = pOwner->pev->team;
pDisc->pev->iuser4 = pOwner->pev->iuser4;
// Set the Group Info
pDisc->pev->groupinfo = pOwner->pev->groupinfo;
pDisc->m_pLauncher = pLauncher;
pDisc->Spawn();
return pDisc;
}
#endif // !CLIENT_DLL
//========================================================================================
// DISC WEAPON
//========================================================================================
void CDiscWeapon::Spawn( )
{
Precache( );
m_iId = WEAPON_DISC;
SET_MODEL(ENT(pev), "models/disc.mdl");
#if !defined( CLIENT_DLL )
pev->dmg = gSkillData.plrDmgHandGrenade;
#endif
m_iDefaultAmmo = STARTING_DISCS;
m_iFastShotDiscs = NUM_FASTSHOT_DISCS;
FallInit();// get ready to fall down.
}
void CDiscWeapon::Precache( void )
{
PRECACHE_MODEL("models/disc.mdl");
PRECACHE_MODEL("models/disc_hard.mdl");
PRECACHE_MODEL("models/v_disc.mdl");
PRECACHE_MODEL("models/p_disc.mdl");
PRECACHE_SOUND("weapons/cbar_miss1.wav");
m_iSpriteTexture = PRECACHE_MODEL( "sprites/lgtning.spr" );
m_usFireDisc = PRECACHE_EVENT( 1, "events/firedisc.sc" );
}
int CDiscWeapon::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "disc";
p->iMaxAmmo1 = MAX_DISCS;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 4;
p->iPosition = 0;
p->iId = WEAPON_DISC;
p->iWeight = 100;
p->iFlags = ITEM_FLAG_NOAUTORELOAD | ITEM_FLAG_NOAUTOSWITCHEMPTY;
return 1;
}
BOOL CDiscWeapon::Deploy( )
{
return DefaultDeploy( "models/v_disc.mdl", "models/p_disc.mdl", DISC_DRAW, "crowbar" );
}
BOOL CDiscWeapon::CanHolster( void )
{
return TRUE;
}
void CDiscWeapon::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
SendWeaponAnim( DISC_HOLSTER, 1 );
}
else
{
// no more grenades!
m_pPlayer->pev->weapons &= ~(1<<WEAPON_DISC);
SetThink( DestroyItem );
pev->nextthink = gpGlobals->time + 0.1;
}
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM);
}
CDisc *CDiscWeapon::FireDisc( bool bDecapitator )
{
CDisc *pReturnDisc = NULL;
SendWeaponAnim( DISC_THROW1, 1 );
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
#if !defined( CLIENT_DLL )
Vector vecFireDir = g_vecZero;
vecFireDir[1] = m_pPlayer->pev->v_angle[1];
UTIL_MakeVectors( vecFireDir );
Vector vecSrc = m_pPlayer->pev->origin + (m_pPlayer->pev->view_ofs * 0.25) + gpGlobals->v_forward * 16;
CDisc *pDisc = CDisc::CreateDisc( vecSrc, vecFireDir, m_pPlayer, this, bDecapitator, m_pPlayer->m_iPowerups );
pReturnDisc = pDisc;
// Triple shot fires 2 more disks
if ( m_pPlayer->HasPowerup( POW_TRIPLE ) )
{
// The 2 extra discs from triple shot are removed after their 3rd bounce
vecFireDir[1] = m_pPlayer->pev->v_angle[1] - 7;
UTIL_MakeVectors( vecFireDir );
vecSrc = m_pPlayer->pev->origin + (m_pPlayer->pev->view_ofs * 0.25) + gpGlobals->v_forward * 16;
pDisc = CDisc::CreateDisc( vecSrc, vecFireDir, m_pPlayer, this, bDecapitator, POW_TRIPLE );
pDisc->m_bRemoveSelf = true;
vecFireDir[1] = m_pPlayer->pev->v_angle[1] + 7;
UTIL_MakeVectors( vecFireDir );
vecSrc = m_pPlayer->pev->origin + (m_pPlayer->pev->view_ofs * 0.25) + gpGlobals->v_forward * 16;
pDisc = CDisc::CreateDisc( vecSrc, vecFireDir, m_pPlayer, this, bDecapitator, POW_TRIPLE );
pDisc->m_bRemoveSelf = true;
}
#endif
// Fast shot allows faster throwing
float flTimeToNextShot = 0.5;
if ( m_pPlayer->HasPowerup( POW_FAST ) )
flTimeToNextShot = 0.2;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + flTimeToNextShot;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + flTimeToNextShot;
return pReturnDisc;
}
void CDiscWeapon::PrimaryAttack()
{
#if !defined( CLIENT_DLL )
if ( m_pPlayer->m_pCurrentArena )
{
if ( m_pPlayer->m_pCurrentArena->AllowedToFire() == false )
return;
}
#endif
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFireDisc, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 );
CDisc *pDisc = FireDisc( false );
// Fast powerup has a number of discs per 1 normal disc
if ( m_pPlayer->HasPowerup( POW_FAST ) )
{
m_iFastShotDiscs--;
if ( m_iFastShotDiscs )
{
// Make this disc remove itself
pDisc->m_bRemoveSelf = true;
return;
}
m_iFastShotDiscs = NUM_FASTSHOT_DISCS;
}
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
// If we have powered discs, remove one
if ( m_pPlayer->m_iPowerupDiscs )
{
m_pPlayer->m_iPowerupDiscs--;
if ( !m_pPlayer->m_iPowerupDiscs )
m_pPlayer->RemoveAllPowerups();
}
}
}
void CDiscWeapon::SecondaryAttack()
{
#if !defined( CLIENT_DLL )
if ( m_pPlayer->m_pCurrentArena )
{
if ( m_pPlayer->m_pCurrentArena->AllowedToFire() == false )
return;
}
#endif
// Fast powerup has a number of discs per 1 normal disc (so it can throw a decap when it has at least 1 real disc)
if ( (m_pPlayer->HasPowerup( POW_FAST ) && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0 ) ||
( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == MAX_DISCS ) )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFireDisc, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 1, 0 );
FireDisc( true );
// Deduct MAX_DISCS from fast shot, or deduct all discs if we don't have fast shot
if ( m_pPlayer->HasPowerup( POW_FAST ) )
{
for ( int i = 1; i <= MAX_DISCS; i++ )
{
m_iFastShotDiscs--;
if ( m_iFastShotDiscs == 0 )
{
m_iFastShotDiscs = NUM_FASTSHOT_DISCS;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
// Remove a powered disc
m_pPlayer->m_iPowerupDiscs--;
if ( !m_pPlayer->m_iPowerupDiscs )
m_pPlayer->RemoveAllPowerups();
}
}
}
else
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] = 0;
// If we have powered discs, remove one
if ( m_pPlayer->m_iPowerupDiscs )
{
m_pPlayer->m_iPowerupDiscs--;
if ( !m_pPlayer->m_iPowerupDiscs )
m_pPlayer->RemoveAllPowerups();
}
}
}
}
void CDiscWeapon::WeaponIdle( void )
{
#if !defined( CLIENT_DLL )
if ( m_pPlayer->HasPowerup(POW_VISUALIZE_REBOUNDS) )
{
Vector vecFireDir = g_vecZero;
Vector vecSrc = m_pPlayer->pev->origin + (m_pPlayer->pev->view_ofs * 0.25);
vecFireDir[1] = m_pPlayer->pev->v_angle[1];
// Draw beams to show where rebounds will go
for (int i = 0; i < 3; i++)
{
TraceResult tr;
UTIL_MakeVectors( vecFireDir );
UTIL_TraceLine( vecSrc, (vecSrc + gpGlobals->v_forward * 2048), ignore_monsters, ENT(pev), &tr );
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMPOINTS );
WRITE_COORD( vecSrc.x);
WRITE_COORD( vecSrc.y);
WRITE_COORD( vecSrc.z);
WRITE_COORD( tr.vecEndPos.x);
WRITE_COORD( tr.vecEndPos.y);
WRITE_COORD( tr.vecEndPos.z);
WRITE_SHORT( m_iSpriteTexture );
WRITE_BYTE( 0 ); // framerate
WRITE_BYTE( 0 ); // framerate
WRITE_BYTE( 1 ); // life
WRITE_BYTE( 40 ); // width
WRITE_BYTE( 0 ); // noise
WRITE_BYTE( i * 50 ); // r, g, b
WRITE_BYTE( i * 50 ); // r, g, b
WRITE_BYTE( 200 - (i * 50)); // r, g, b
WRITE_BYTE( 128 - (i * 30) ); // r, g, b
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
// Calculate rebound angle
Vector vecOut;
Vector vecIn = tr.vecEndPos - (tr.vecEndPos - (gpGlobals->v_forward * 5));
float backoff = DotProduct( vecIn, tr.vecPlaneNormal ) * 2.0;
for (int i=0 ; i<3 ; i++)
{
float change = tr.vecPlaneNormal[i] * backoff;
vecOut[i] = vecIn[i] - change;
if (vecOut[i] > -0.1 && vecOut[i] < 0.1)
vecOut[i] = 0;
}
vecOut = vecOut.Normalize();
vecSrc = tr.vecEndPos;
vecFireDir = UTIL_VecToAngles(vecOut);
}
}
#endif
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if (flRand <= 0.75)
{
iAnim = DISC_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
}
else
{
iAnim = DISC_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim( iAnim, 1 );
}
}
// Prevent disc weapons lying around on the ground
int CDiscWeapon::AddDuplicate( CBasePlayerItem *pOriginal )
{
pev->flags |= FL_KILLME;
return FALSE;
}
|
[
"joropito@23c7d628-c96c-11de-a380-73d83ba7c083"
] |
[
[
[
1,
753
]
]
] |
2fee1fc4e99fdabee84fb0affa09fb29d8370fe6
|
5ff30d64df43c7438bbbcfda528b09bb8fec9e6b
|
/kgraphics/math/GaussianElim.h
|
b897cee6b8d46a3e0ff81593fe402dc9f974520d
|
[] |
no_license
|
lvtx/gamekernel
|
c80cdb4655f6d4930a7d035a5448b469ac9ae924
|
a84d9c268590a294a298a4c825d2dfe35e6eca21
|
refs/heads/master
| 2016-09-06T18:11:42.702216 | 2011-09-27T07:22:08 | 2011-09-27T07:22:08 | 38,255,025 | 3 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 525 |
h
|
#pragma once
namespace gfx {
// NOTE: matrix mustbe be stored in column major order
// solve for system Ax = b for n by n matrix and n-vector
// will destroy contents of A and return result in b
bool Solve( float* b, float* A, unsigned int n );
// invert matrix n by n matrix A
// will store results in A
bool InvertMatrix( float* A, unsigned int n );
// Get determinant of matrix using Gaussian elimination
// Will not destroy A
float Determinant( float* A, unsigned int n );
} // namespace gfx
|
[
"keedongpark@keedongpark"
] |
[
[
[
1,
20
]
]
] |
b163dc5e5b2a46b0eb15aa3146eedc92525cdb6a
|
c95a83e1a741b8c0eb810dd018d91060e5872dd8
|
/Engine/sdk/inc/ltvector.h
|
30bd015bc2fb30007d38015a46746650fcf0a984
|
[] |
no_license
|
rickyharis39/nolf2
|
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
|
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
|
refs/heads/master
| 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 9,117 |
h
|
#ifndef __LTVECTOR_H__
#define __LTVECTOR_H__
#ifndef __ILTSTREAM_H__
#include "iltstream.h"
#endif
#ifndef _VECTOR_H_
#include "physics/vector.h"//vectors for math and physics
#endif
#ifndef __LTSYSOPTIM_H__
#include "ltsysoptim.h"
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/*!
Used for: Obsolete.
*/
//---------------------------------------------------------------------------//
template<class T>
struct TVector3 {
T x, y, z;
TVector3()
{}
TVector3( const T x, const T y, const T z )
: x(x), y(y), z(z)
{}
TVector3( const LTVector3f& v )
: x(v.x), y(v.y), z(v.z)
{}
operator LTVector3f() const
{
return LTVector3f(x,y,z);
}
void Init( T a=0, T b=0, T c=0)
{
x = a;
y = b;
z = c;
}
T Dot( const TVector3& b ) const
{
return x*b.x + y*b.y + z*b.z;
}
T MagSqr() const
{
return x*x + y*y + z*z;
}
T Mag() const
{
return (T)ltsqrtf( x*x + y*y + z*z );
}
T LengthSquared() const
{
return x*x + y*y + z*z;
}
T Length() const
{
return (T)ltsqrtf( x*x + y*y + z*z );
}
const TVector3 Unit() const
{
return (*this) / this->Length();
}
const TVector3& Normalize()
{
(*this) /= this->Length();
return *this;
}
bool NearlyEquals(const TVector3& b, const T r = 0) const
{
//within a tolerance
const TVector3 t = *this - b;//difference
return t.Dot(t) <= r*r;//radius
}
const TVector3 Cross( const TVector3& b ) const
{
return TVector3( b.y*z - b.z*y, b.z*x - b.x*z, b.x*y - b.y*x );
}
const T& operator [] ( const int32 i ) const
{
return *((&x) + i);
}
T& operator [] ( const int32 i )
{
return *((&x) + i);
}
bool operator == ( const TVector3& b ) const
{
return (b.x==x && b.y==y && b.z==z);
}
bool operator != ( const TVector3& b ) const
{
return !(b == *this);
}
const TVector3 operator - () const
{
return TVector3( -x, -y, -z );
}
const TVector3& operator = ( const TVector3& b )
{
x = b.x;
y = b.y;
z = b.z;
return *this;
}
const TVector3& operator += (const TVector3& b)
{
x += b.x;
y += b.y;
z += b.z;
return *this;
}
const TVector3& operator -= (const TVector3& b)
{
x -= b.x;
y -= b.y;
z -= b.z;
return *this;
}
const TVector3& operator *= (const T s)
{
x *= s;
y *= s;
z *= s;
return *this;
}
const TVector3& operator /= (const T s)
{
const T r = 1 / s;//reciprocal
x *= r;
y *= r;
z *= r;
return *this;
}
const TVector3 operator + (const TVector3& b) const
{
return TVector3(x + b.x, y + b.y, z + b.z);
}
const TVector3 operator - (const TVector3& b) const
{
return TVector3(x - b.x, y - b.y, z - b.z);
}
const TVector3 operator * (const T s) const
{
return TVector3(x*s, y*s, z*s);
}
friend inline const TVector3 operator * (const T s, const TVector3& v)
{
return v * s;
}
const TVector3 operator / (const T s) const
{
const T r = 1 / s;//reciprocal
return TVector3(x*r, y*r, z*r);
}
bool operator > (const TVector3 &other) const { return ((x>other.x) && (y>other.y) && (z>other.z)); }
bool operator < (const TVector3 &other) const { return ((x<other.x) && (y<other.y) && (z<other.z)); }
bool operator >= (const TVector3 &other) const { return ((x>=other.x) && (y>=other.y) && (z>=other.z)); }
bool operator <= (const TVector3 &other) const { return ((x<=other.x) && (y<=other.y) && (z<=other.z)); }
TVector3 operator * (const TVector3& v) const { return TVector3(x * v.x, y * v.y, z * v.z); }
TVector3 operator / (const TVector3& v) const { return TVector3(x / v.x, y / v.y, z / v.z); }
void operator += (T s)
{
x += s;
y += s;
z += s;
}
void operator -= (T s)
{
x -= s;
y -= s;
z -= s;
}
T Dist(const TVector3& b) const
{
return (*this - b).Mag();
}
T DistSqr(const TVector3& b) const
{
return (*this - b).MagSqr();
}
T MagApprox() const;
void Norm(T nVal = 1);
void NormApprox(T nVal = 1);
};
//Don't worry about all the template stuff, just always use this.
typedef TVector3<float> LTVector;
template<class T>
inline void LTStream_Read(ILTStream *pStream, TVector3<T> &vec)
{
STREAM_READ(vec.x);
STREAM_READ(vec.y);
STREAM_READ(vec.z);
}
template<class T>
inline void LTStream_Write(ILTStream *pStream, const TVector3<T> &vec)
{
STREAM_WRITE(vec.x);
STREAM_WRITE(vec.y);
STREAM_WRITE(vec.z);
}
template<class T>
inline T TVector3<T>::MagApprox () const
{
T min, med, max;
T temp;
max = fabsf(x);
med = fabsf(y);
min = fabsf(z);
if (max < med)
{
temp = max;
max = med;
med = temp;
}
if (max < min)
{
temp = max;
max = min;
min = temp;
}
return max + ((med + min) * 0.25f);
}
template<class T>
inline void TVector3<T>::Norm(T nVal)
{
T inv;
T mag = Mag();
if (mag == 0)
return;
inv = nVal / mag;
x = x * inv;
y = y * inv;
z = z * inv;
}
template<class T>
inline void TVector3<T>::NormApprox(T nVal)
{
T inv;
T mag = MagApprox();
if (mag == 0)
return;
inv = nVal / mag;
x = x * inv;
y = y * inv;
z = z * inv;
}
#define VEC_CROSS(dest, v1, v2) \
{\
(dest).x = ((v2).y*(v1).z - (v2).z*(v1).y);\
(dest).y = ((v2).z*(v1).x - (v2).x*(v1).z);\
(dest).z = ((v2).x*(v1).y - (v2).y*(v1).x);\
}
#define VEC_ADD(d, v1, v2) \
{\
(d).x = (v1).x + (v2).x;\
(d).y = (v1).y + (v2).y;\
(d).z = (v1).z + (v2).z;\
}
#define VEC_ADDSCALED(d, v1, v2, s) \
{\
(d).x = (v1).x + ((v2).x * (s));\
(d).y = (v1).y + ((v2).y * (s));\
(d).z = (v1).z + ((v2).z * (s));\
}
#define VEC_SUB(d, v1, v2) \
{\
(d).x = (v1).x - (v2).x;\
(d).y = (v1).y - (v2).y;\
(d).z = (v1).z - (v2).z;\
}
#define VEC_MUL(d, v1, v2) \
{\
(d).x = (v1).x * (v2).x;\
(d).y = (v1).y * (v2).y;\
(d).z = (v1).z * (v2).z;\
}
#define VEC_DIV(d, v1, v2) \
{\
(d).x = (v1).x / (v2).x;\
(d).y = (v1).y / (v2).y;\
(d).z = (v1).z / (v2).z;\
}
#define VEC_MULSCALAR(d, v1, s) \
{\
(d).x = (v1).x * (s); \
(d).y = (v1).y * (s); \
(d).z = (v1).z * (s); \
}
#define VEC_DIVSCALAR(d, v1, s) \
{\
(d).x = (v1).x / (s); \
(d).y = (v1).y / (s); \
(d).z = (v1).z / (s);\
}
#define VEC_LERP(d, v1, v2, t) \
{\
(d).x = (v1).x + ((v2).x - (v1).x) * t;\
(d).y = (v1).y + ((v2).y - (v1).y) * t;\
(d).z = (v1).z + ((v2).z - (v1).z) * t;\
}
#define VEC_CLAMP(v, a, b) \
{\
(v).x = LTCLAMP((v).x, a, b);\
(v).y = LTCLAMP((v).y, a, b);\
(v).z = LTCLAMP((v).z, a, b);\
}
#define VEC_MIN(v, a, b) \
{\
(v).x = LTMIN((a).x, (b).x);\
(v).y = LTMIN((a).y, (b).y);\
(v).z = LTMIN((a).z, (b).z);\
}
#define VEC_MAX(v, a, b) \
{\
(v).x = LTMAX((a).x, (b).x);\
(v).y = LTMAX((a).y, (b).y);\
(v).z = LTMAX((a).z, (b).z);\
}
#define VEC_NEGATE(d, s) \
{\
(d).x = -(s).x; \
(d).y = -(s).y; \
(d).z = -(s).z; \
}
#define VEC_DOT(v1, v2) ((v1).x*(v2).x + (v1).y*(v2).y + (v1).z*(v2).z)
#define EXPANDVEC(vec) (vec).x, (vec).y, (vec).z
//---------------------------------------------------------------------------//
#define VEC_DISTSQR(v1, v2) ( \
((v1).x-(v2).x) * ((v1).x-(v2).x) + \
((v1).y-(v2).y) * ((v1).y-(v2).y) + \
((v1).z-(v2).z) * ((v1).z-(v2).z) )
//---------------------------------------------------------------------------//
#define VEC_DIST(v1, v2) ((float)sqrt(VEC_DISTSQR(v1, v2)))
#define VEC_MAGSQR(v) ((v).x*(v).x + (v).y*(v).y + (v).z*(v).z)
//---------------------------------------------------------------------------//
#define VEC_MAG(v) ((float)sqrt(VEC_MAGSQR(v)))
#define VEC_INVMAG(v) (1.0f / VEC_MAG(v))
#define VEC_NORM(v) \
{\
float __temp_normalizer_____;\
__temp_normalizer_____ = 1.0f / VEC_MAG(v);\
(v).x *= __temp_normalizer_____;\
(v).y *= __temp_normalizer_____;\
(v).z *= __temp_normalizer_____;\
}
#define VEC_COPY(dest, src) \
{\
(dest).x = (src).x; (dest).y = (src).y; (dest).z = (src).z;\
}
#define VEC_SET(v, vx, vy, vz) \
{\
(v).x = (float)(vx); (v).y = (float)(vy); (v).z = (float)(vz);\
}
#define VEC_EXPAND(v) (v).x, (v).y, (v).z
#define VEC_INIT(v) (v).x = (v).y = (v).z = 0;
#define VEC_INDEX(v, i) (((float*)&(v))[i])
#endif//doxygen
#endif
|
[
"[email protected]"
] |
[
[
[
1,
419
]
]
] |
969e7cb3722b7b8de04453541578c424eba6dc32
|
3bf3c2da2fd334599a80aa09420dbe4c187e71a0
|
/constants.cpp
|
14df5e8877f3a738c61848fe506439fc0537954f
|
[] |
no_license
|
xiongchiamiov/virus-td
|
31b88f6a5d156a7b7ee076df55ddce4e1c65ca4f
|
a7b24ce50d07388018f82d00469cb331275f429b
|
refs/heads/master
| 2020-12-24T16:50:11.991795 | 2010-06-10T05:05:48 | 2010-06-10T05:05:48 | 668,821 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,834 |
cpp
|
#include "constants.h"
const int GRID_WIDTH = 16;
const int GRID_HEIGHT = 32;
const float GOAL_X = 3.5;
const float GOAL_Z = 17.5;
const float START_X = 3.5;
const float START_Z = -2.0;
const float GRID_SIZE = 0.25;
const int CYCLE_TIME = 15000;
const int UNIT_COOLDOWN = 1000;
const int UNIT_MAX = 50;
const int SLOW_TIME = 3000;
bool RAND_SEEDED = false;
const float P1_POSX = -GRID_SIZE*float(GRID_WIDTH) + GRID_SIZE;
const float P1_POSY = 0.0;
const float P1_POSZ = -GRID_SIZE*float(GRID_HEIGHT) + GRID_SIZE;
const float OPP_POSX = -GRID_SIZE*float(GRID_WIDTH) + GRID_SIZE;
const float OPP_POSY = 0.0;
const float OPP_POSZ = -GRID_SIZE*float(GRID_HEIGHT) + GRID_SIZE + GRID_SIZE*(GRID_HEIGHT + 8)*2.0;
const float OPP_POSX2 = -GRID_SIZE*float(GRID_WIDTH) + GRID_SIZE + GRID_SIZE*(GRID_WIDTH + 8)*2.0;
const float OPP_POSY2 = 0.0;
const float OPP_POSZ2 = -GRID_SIZE*float(GRID_HEIGHT) + GRID_SIZE;
namespace unit_cost {
const int BASIC = 5;
const int FAST = 10;
const int FAST2 = 20;
const int STRONG = 20;
const int STRONG2 = 50;
const int STRONG3 = 30;
const int BOSS = 300;
}
namespace unit_bonus {
const int BASIC = 1;
const int FAST = 2;
const int FAST2 = 3;
const int STRONG = 5;
const int STRONG2 = 12;
const int STRONG3 = 7;
const int BOSS = 20;
}
namespace unit_health {
const int BASIC = 10;
const int FAST = 8;
const int FAST2 = 16;
const int STRONG = 50;
const int STRONG2 = 100;
const int STRONG3 = 60;
const int BOSS = 1000;
}
namespace unit_speed {
const double BASIC = 0.0015;
const double FAST = 0.003;
const double FAST2 = 0.0032;
const double STRONG = 0.001;
const double STRONG2 = 0.001;
const double STRONG3 = 0.0015;
const double BOSS = 0.0017;
}
namespace unit_name {
const char* BASIC = "Worm";
const char* FAST = "Virus";
const char* FAST2 = "Phish";
const char* STRONG = "Fork Bomb";
const char* STRONG2 = "Trojan Horse";
const char* STRONG3 = "Lock";
const char* BOSS = "Ultimate";
}
namespace unit_description {
const char* BASIC = "This is a basic unit.";
const char* FAST = "This unit is very fast, but dosen't\n have a lot of HP.";
const char* STRONG = "This unit moves very \nslowly, but has a \nlot of HP.";
const char* STRONG2 = "This unit moves very slowly, but has\n a lot of HP.";
const char* FAST2 = "This unit is similar to the virus\n but it is stronger.";/*
const char* STRONG = "This unit is strong, but slow.";
const char* STRONG2 = "This unit is strong, but slow. This is stronger than a fork bomb.";*/
const char* STRONG3 = "This unit is a stronger, faster worm unit.";
const char* BOSS = "This is a boss unit. It is faster than normal\n units and extremely strong.";
}
namespace tower_cost{
const int BASIC = 5;
const int FAST = 5;
const int FREEZE = 10;
const int SLOW = 25;
const int TRAP = 15;
const int WALL = 2;
}
namespace tower_damage{
const int BASIC = 10;
const int FAST = 5;
const int FREEZE = 10;
const int SLOW = 25;
const int TRAP = 15;
const int WALL = 0;
}
namespace tower_speed{
const int BASIC = 10;
const int FAST = 25;
const int FREEZE = 10;
const int SLOW = 5;
const int TRAP = 0;
const int WALL = 0;
}
namespace tower_name{
const char* BASIC = "Memory Turret";
const char* FAST = "BackTrack";
const char* FREEZE = "8-Core CPU Fan";
const char* SLOW = "Tesla Coil";
const char* TRAP = "Black Hat Trap";
const char* WALL = "Firewall";
}
namespace tower_description{
const char* BASIC = "This tower has average speed\nand average damage";
const char* FAST = "This tower fires very rapidly,\nbut its damage is low";
const char* FREEZE = "This tower's damage is average,\nbut it causes enemies to slow\ndown after getting shot";
const char* SLOW = "This tower has a very slow rate of fire,\nbut does a great deal of damage";
const char* TRAP = "This tower can be placed along the path of\nviruses and it will do damage when\nthey cross the trap";
const char* WALL = "This tower does not attack enemy units but\nmerely blocks them from passing";
}
g_elem loc2grid(float x, float z) {
return g_elem((int)((x)/(2.0 * GRID_SIZE) + 0.5), (int)((z)/(2.0 * GRID_SIZE) + 0.5 + 4.0));
}
void grid2loc(g_elem g, float * x, float * z) {
*x = GRID_SIZE * 2.0 * g.x;
*z = GRID_SIZE * 2.0 * g.y - 2.0;
}
/*
Button Number Layout for checking the following
Index parameters for button numbers on GUI.
6 7 8 17 16 15
3 4 5 14 13 12
0 1 2 11 10 9
*/
int getObjectCost(int index) {
switch(index) {
case 17: return tower_cost::BASIC;
break;
case 16: return tower_cost::FREEZE;
break;
case 15: return tower_cost::FAST;
break;
case 14: return tower_cost::SLOW;
break;
case 13: return tower_cost::TRAP;
break;
case 12: return tower_cost::WALL;
break;
case 8: return unit_cost::FAST2;
break;
case 7: return unit_cost::BASIC;
break;
case 6: return unit_cost::FAST;
break;
case 5: return unit_cost::STRONG;
break;
case 4: return unit_cost::STRONG2;
break;
case 3: return unit_cost::STRONG3;
break;
case 0: return unit_cost::BOSS;
break;
default: return -1;
break;
}
}
int getObjectDamageHealth(int index) {
switch(index) {
case 17: return tower_damage::BASIC;
break;
case 16: return tower_damage::FREEZE;
break;
case 15: return tower_damage::FAST;
break;
case 14: return tower_damage::SLOW;
break;
case 13: return tower_damage::TRAP;
break;
case 12: return tower_damage::WALL;
break;
case 6: return unit_health::FAST;
break;
case 7: return unit_health::BASIC;
break;
case 8: return unit_health::FAST2;
break;
case 3: return unit_health::STRONG3;
break;
case 4: return unit_health::STRONG2;
break;
case 5: return unit_health::STRONG;
break;
case 0: return unit_health::BOSS;
break;
default: return -1;
break;
}
}
int getObjectSpeed(int index) {
switch(index) {
case 17: return tower_speed::BASIC;
break;
case 16: return tower_speed::FREEZE;
break;
case 15: return tower_speed::FAST;
break;
case 14: return tower_speed::SLOW;
break;
case 13: return tower_speed::TRAP;
break;
case 12: return tower_speed::WALL;
break;
case 6: return (int)(10000.0 * unit_speed::FAST);
break;
case 7: return (int)(10000.0 * unit_speed::BASIC);
break;
case 8: return (int)(10000.0 * unit_speed::FAST2);
break;
case 3: return (int)(10000.0 * unit_speed::STRONG3);
break;
case 4: return (int)(10000.0 * unit_speed::STRONG2);
break;
case 5: return (int)(10000.0 * unit_speed::STRONG);
break;
case 0: return (int)(10000.0 * unit_speed::BOSS);
break;
default: return -1;
break;
}
}
const char* getObjectName(int index) {
switch(index) {
case 17: return tower_name::BASIC;
break;
case 16: return tower_name::FREEZE;
break;
case 15: return tower_name::FAST;
break;
case 14: return tower_name::SLOW;
break;
case 13: return tower_name::TRAP;
break;
case 12: return tower_name::WALL;
break;
case 8: return unit_name::FAST2;
break;
case 7: return unit_name::BASIC;
break;
case 6: return unit_name::FAST;
break;
case 5: return unit_name::STRONG;
break;
case 4: return unit_name::STRONG2;
break;
case 3: return unit_name::STRONG3;
break;
case 0: return unit_name::BOSS;
break;
default: return "Unnamed";
break;
}
}
const char* getObjectDescription(int index) {
switch(index) {
case 17: return tower_description::BASIC;
break;
case 16: return tower_description::FREEZE;
break;
case 15: return tower_description::FAST;
break;
case 14: return tower_description::SLOW;
break;
case 13: return tower_description::TRAP;
break;
case 12: return tower_description::WALL;
break;
case 8: return unit_description::FAST2;
break;
case 7: return unit_description::BASIC;
break;
case 6: return unit_description::FAST;
break;
case 5: return unit_description::STRONG;
break;
case 4: return unit_description::STRONG2;
break;
case 3: return unit_description::STRONG3;
break;
case 0: return unit_description::BOSS;
break;
default: return "N/A";
break;
}
}
|
[
"jtrobins@05766cc9-4f33-4ba7-801d-bd015708efd9",
"agonza40@05766cc9-4f33-4ba7-801d-bd015708efd9",
"tcasella@05766cc9-4f33-4ba7-801d-bd015708efd9",
"kehung@05766cc9-4f33-4ba7-801d-bd015708efd9"
] |
[
[
[
1,
9
],
[
25,
25
],
[
133,
139
],
[
321,
321
]
],
[
[
10,
13
],
[
15,
24
],
[
27,
28
],
[
30,
30
],
[
34,
34
],
[
37,
38
],
[
40,
42
],
[
44,
44
],
[
67,
73
],
[
88,
96
],
[
116,
121
]
],
[
[
14,
14
],
[
46,
65
],
[
79,
81
],
[
83,
83
],
[
97,
115
],
[
122,
124
],
[
131,
132
],
[
140,
141
],
[
150,
150
],
[
152,
152
],
[
154,
154
],
[
156,
156
],
[
158,
158
],
[
160,
160
],
[
162,
162
],
[
180,
186
],
[
188,
188
],
[
190,
190
],
[
192,
192
],
[
194,
194
],
[
196,
196
],
[
198,
217
],
[
219,
219
],
[
221,
221
],
[
223,
223
],
[
225,
225
],
[
227,
227
],
[
229,
229
],
[
231,
250
],
[
252,
252
],
[
254,
254
],
[
256,
256
],
[
258,
258
],
[
260,
260
],
[
262,
262
],
[
264,
264
],
[
282,
286
],
[
288,
288
],
[
290,
290
],
[
292,
292
],
[
294,
294
],
[
296,
296
],
[
298,
298
],
[
300,
300
],
[
318,
320
]
],
[
[
26,
26
],
[
29,
29
],
[
31,
33
],
[
35,
36
],
[
39,
39
],
[
43,
43
],
[
45,
45
],
[
66,
66
],
[
74,
78
],
[
82,
82
],
[
84,
87
],
[
125,
130
],
[
142,
149
],
[
151,
151
],
[
153,
153
],
[
155,
155
],
[
157,
157
],
[
159,
159
],
[
161,
161
],
[
163,
179
],
[
187,
187
],
[
189,
189
],
[
191,
191
],
[
193,
193
],
[
195,
195
],
[
197,
197
],
[
218,
218
],
[
220,
220
],
[
222,
222
],
[
224,
224
],
[
226,
226
],
[
228,
228
],
[
230,
230
],
[
251,
251
],
[
253,
253
],
[
255,
255
],
[
257,
257
],
[
259,
259
],
[
261,
261
],
[
263,
263
],
[
265,
281
],
[
287,
287
],
[
289,
289
],
[
291,
291
],
[
293,
293
],
[
295,
295
],
[
297,
297
],
[
299,
299
],
[
301,
317
]
]
] |
af7509931e2736dfa3092c2745c7c19ebd72d3ad
|
0f8559dad8e89d112362f9770a4551149d4e738f
|
/Wall_Destruction/Havok/Source/Physics/Dynamics/Collide/ContactListener/Util/hkpAddModifierUtil.h
|
02733e0c1f9759f241097f44914fcaf3e7a3e351
|
[] |
no_license
|
TheProjecter/olafurabertaymsc
|
9360ad4c988d921e55b8cef9b8dcf1959e92d814
|
456d4d87699342c5459534a7992f04669e75d2e1
|
refs/heads/master
| 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,660 |
h
|
/*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#include <Common/Base/Container/Array/hkArray.h>
#include <Physics/Dynamics/Collide/ContactListener/hkpContactListener.h>
/// This utility contains static functions useful to contactListeners.
class hkpAddModifierUtil
{
public:
//
// Response modifiers functions which can be used from contact point callbacks.
//
// To use these, one or both of the involved hkpEntities must have the appropriate flag set in its m_responseModifierFlags member.
static void HK_CALL setInvMassScalingForContact( const hkpContactPointEvent& event, hkpRigidBody* bodyA, hkpRigidBody* bodyB, const hkVector4& factorA, const hkVector4& factorB );
static void HK_CALL setInvMassScalingForContact( const hkpContactPointEvent& event, hkpRigidBody* body, const hkVector4& factor );
static void HK_CALL setCenterOfMassDisplacementForContact( const hkpContactPointEvent& event, hkpRigidBody* bodyA, hkpRigidBody* bodyB, const hkVector4& displacementA, const hkVector4& displacementB );
static void HK_CALL setImpulseScalingForContact( const hkpContactPointEvent& event, hkpRigidBody* bodyA, hkpRigidBody* bodyB, hkReal usedImpulseFraction, hkReal maxAcceleration );
static void HK_CALL setSurfaceVelocity( const hkpContactPointEvent& event, hkpRigidBody* body, const hkVector4& velWorld );
static void HK_CALL clearSurfaceVelocity( const hkpContactPointEvent& event, hkpRigidBody* body );
static void HK_CALL setLowSurfaceViscosity( const hkpContactPointEvent& event );
};
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
|
[
"[email protected]"
] |
[
[
[
1,
43
]
]
] |
ef286b564b9e66a8226ec2a6a76bd3e994d96820
|
f0c08b3ddefc91f1fa342f637b0e947a9a892556
|
/branches/develop/cppreflect/src/TypeOf.cpp
|
27d3241b7b19f81b0e6f97a81ec0a3077cb0be66
|
[] |
no_license
|
BackupTheBerlios/coffeestore-svn
|
1db0f60ddb85ccbbdfeb9b3271a687b23e29fc8f
|
ddee83284fe9875bf0d04e6b7da7a2113e85a040
|
refs/heads/master
| 2021-01-01T05:30:22.345767 | 2009-10-11T08:55:35 | 2009-10-11T08:55:35 | 40,725,038 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 447 |
cpp
|
#include "TypeOf.hpp"
namespace reflect {
REFLECT_TYPEOF_BUILTIN_REG(bool)
REFLECT_TYPEOF_BUILTIN_REG(char)
REFLECT_TYPEOF_BUILTIN_REG(int)
REFLECT_TYPEOF_BUILTIN_REG(float)
REFLECT_TYPEOF_BUILTIN_REG(double)
StringType::StringType()
: Type("std::string")
{
TypeRegistry::getInstance().add(typeid(std::string), *this);
}
Type& TypeOf<std::string>::get()
{
return StringType::getInstance();
}
} // namespace reflect
|
[
"fabioppp@e591b805-c13a-0410-8b2d-a75de64125fb"
] |
[
[
[
1,
23
]
]
] |
e5be9d56a35d03256edcc53978e4b7345af25eff
|
670c614fea64d683cd517bf973559217a4b8d4b6
|
/ mindmap-search/mindmap-search_2nd/indexer/indexer.cpp
|
4158ba932033ee41ec0b4be3d5d22156c0af56b6
|
[] |
no_license
|
mcpanic/mindmap-search
|
5ce3e9a75d9a91224c38d7c0faa4089d9ea2487b
|
67fd93be5f60c61a33d84f18cbaa1c5dd7ae7166
|
refs/heads/master
| 2021-01-18T13:33:19.390091 | 2009-04-06T11:42:07 | 2009-04-06T11:42:07 | 32,127,402 | 0 | 0 | null | null | null | null |
UHC
|
C++
| false | false | 1,867 |
cpp
|
// mindmap-search.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
#include "stdafx.h"
#include "indexer.h"
using namespace std;
static IDBIndex *CreateDBIndexBuilder() // 인덱스 생성 interface
{
return new DBIndexBuilder;
}
void StoreInDB (vector<DBIndexEntity> &a_vNodes, string g_szDBFilename, IDBIndex *dbIndex)
{
dbIndex->SetDBName(g_szDBFilename);
dbIndex->OpenDB();
dbIndex->AddDictionaryTable(); // Dictionary Table생성
dbIndex->AddIndexDBTable(); // IndexDBTable 생성
}
int main (int argc, char* args[])
{
string g_szDBFilename = "mindmap.db";
char charChoice;
IDBIndex *dbIndex = CreateDBIndexBuilder();
IAnalysisFile *analyzer = new Analyzer; // 단어분석위해
// Create module objects
do {
string szFilename; // mm file
cout << "\nEnter the mind map XML file name: ";
cin >> szFilename;
// Parsing
vector<DBIndexEntity> vNodes;
analyzer->initFile(szFilename, vNodes);
vector<string>::iterator resultWord;
vector<DBIndexEntity>::iterator itNodes;
cout << szFilename << " file has these words ... " << endl;
// 각각의 단어를 불러온다
for (itNodes = vNodes.begin(); itNodes != vNodes.end(); itNodes++)
cout << (*itNodes).GetWord() << endl;
//dbIndex->OpenDB();
// Store in DB.
StoreInDB (vNodes, g_szDBFilename, dbIndex);
// Insert all Nodes in Dictionary and IndexDB.table
analyzer->getResult(vNodes, szFilename, dbIndex);
// Calculate weight and insert.
analyzer->calcWeight(vNodes, dbIndex);
cout << "Do you want to add more mindmap file? (y/n) ";
cin >> charChoice;
} while ((charChoice == 'y') || (charChoice == 'Y'));
cout << "\nDB저장이 완료되었습니다." << endl;
dbIndex->CloseDB();
dbIndex->Release();
dbIndex = NULL;
return 0;
}
|
[
"dolphhong@ba4b31b2-0743-0410-801d-7d2edeec4cc6"
] |
[
[
[
1,
67
]
]
] |
cfcd60f01f3795a29a36ec36b362d9909053cb96
|
28476e6f67b37670a87bfaed30fbeabaa5f773a2
|
/src/AutumnGen/src/ClassElmt.h
|
9a5b6f448cfdd6f2ebf88a10c9432e7d5df1b412
|
[] |
no_license
|
rdmenezes/autumnframework
|
d1aeb657cd470b67616dfcf0aacdb173ac1e96e1
|
d082d8dc12cc00edae5f132b7f5f6e0b6406fe1d
|
refs/heads/master
| 2021-01-20T13:48:52.187425 | 2008-07-17T18:25:19 | 2008-07-17T18:25:19 | 32,969,073 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,382 |
h
|
/*
* Copyright 2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef AUTUMNGEN_CLASSELMT_H
#define AUTUMNGEN_CLASSELMT_H
#include "IElement.h"
/**
* Class element
*/
class ClassElmt: public IElement{
vector<string> BaseClass;
/** Generate wrapper's tail, export functions */
string genWrapperTail();
/** Generate wrapper part of execCreateMethod() */
string genWrapper4ECM();
/** Generate wrapper part of execVoidMethod() */
string genWrapper4EVM();
/** Generate wrapper part of cast2Base() */
string genWrapper4Cast();
/** Generate wrapper part of getParamTypes() */
string genWrapper4GPT();
/** Generate wrapper .h file part for local bean */
string genWrapperH4Local();
/** Generate wrapper .cpp file part for local bean */
string genWrapperCPP4Local();
/** Add a default constructor for c if it has not */
void addDefaultCon(ClassElmt* c);
/** This class is abstract or not */
bool isAbstract();
public:
/**
* The string is a element of this type or not.
* @param s the whole content of head file.
* @param idx Position to start parsing.
*/
virtual bool isThisType(const string& s, int idx);
/**
* Clone a element of this type from string s.
* @param s the whole content of head file.
* @param idx In: position to start parsing,
* Out: the position after this element.
* !!Notice: if clone failed, idx should not be changed!
*/
virtual IElement* clone(const string& s, int& idx);
/** Generate wrapper .h file part of this element */
virtual string genWrapperH();
/** Generate wrapper .cpp file part of this element */
virtual string genWrapperCPP();
/** Return the type of this element. */
IElement::ElmtType getType() const {
return IElement::CLASS;
}
};
#endif
|
[
"sharplog@c16174ff-a625-0410-88e5-87db5789ed7d"
] |
[
[
[
1,
86
]
]
] |
984ed6c9ae077de2249a41d539be9d32250e6886
|
0b55a33f4df7593378f58b60faff6bac01ec27f3
|
/Konstruct/Client/Dimensions/SkillCombo.h
|
d46ba69e2fc50fc34924c16a1097093ddcbb2661
|
[] |
no_license
|
RonOHara-GG/dimgame
|
8d149ffac1b1176432a3cae4643ba2d07011dd8e
|
bbde89435683244133dca9743d652dabb9edf1a4
|
refs/heads/master
| 2021-01-10T21:05:40.480392 | 2010-09-01T20:46:40 | 2010-09-01T20:46:40 | 32,113,739 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 701 |
h
|
#pragma once
#include "Common/Utility/kpuArrayList.h"
class Skill;
//template<typename T> class kpuArrayList;
class PlayerCharacter;
class SkillCombo
{
public:
SkillCombo(void);
~SkillCombo(void);
void Swap(int iOldIndex, int iNewIndex); //Swap 2 skills in the combo
void AddEnd(Skill* pSkill); //Add skill to end of combo
void RemoveSkillAt(int iIndex); //Remove skill by index
void Use(float fGameTime, PlayerCharacter* pPlayer); //Goes and uses each skill in the list
bool IsRunning() { return m_bRunning; } //return true if there are still skills to go off
private:
kpuArrayList<Skill*>* m_pSkillList;
int m_iNextSkill;
bool m_bRunning;
};
|
[
"bflassing@0c57dbdb-4d19-7b8c-568b-3fe73d88484e"
] |
[
[
[
1,
26
]
]
] |
66613187f523a0942cd55ba0e39192c6314f2dfa
|
7997cad2b3711678b6d642ed275ecdee7f58bba3
|
/dstetris/source/Tetris/TetrisShape.cpp
|
54701c50c2026acbdeaa7e5f0391ccda9bc0e069
|
[] |
no_license
|
Arkasha83/dstetris
|
08fcf4c20b53770b474dee32e89017fa6ecd3c7b
|
4add60a2abb2e093410a4c010119981e8726762f
|
refs/heads/master
| 2016-09-01T10:39:16.286833 | 2009-12-09T15:49:16 | 2009-12-09T15:49:16 | 55,130,745 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,588 |
cpp
|
#pragma once
#include <stdlib.h>
#include "TetrisShape.h"
#include <nds/arm9/sound.h> // sound functions
bool Shape_isGameOver = false;
bool Shape_isInited = false;
int Shape_Orient;
int Shape_Type;
int Shape_NextType;
int Shape_State;
int Shape_Elems[MAX_ELEMS];
int Shape_TempElems[MAX_ELEMS];
void Shape_init(void)
{
Shape_NextType = rand() % TYPE_MAX_TYPES;
int i;
for (i = 0; i < MAX_ELEMS; i++)
{
Shape_Elems[i] = DONT_CHECK_CELL;
Shape_TempElems[i] = DONT_CHECK_CELL;
}
}
bool Shape_tryToMove(int newElemPos[])
{
bool hasMoved = Grid_tryToMoveCells(Shape_Elems, newElemPos);
if (hasMoved)
Array_cloneInt(newElemPos,Shape_Elems,MAX_ELEMS);
return hasMoved;
}
bool Shape_alignFromOrientation(int orientation)
{
Array_cloneInt(Shape_Elems,Shape_TempElems,MAX_ELEMS);
int typeOffset = (Shape_Type * SHAPE_TABLE_TYPE_OFFSET);
orientation *= SHAPE_TABLE_ELEMS_PER_ROW;
Shape_TempElems[ELEM_1] = Shape_TempElems[ELEM_BASE] + SHAPE_TABLE[typeOffset + orientation + SHAPE_TABLE_ELEMS_1];
Shape_TempElems[ELEM_2] = Shape_TempElems[ELEM_BASE] + SHAPE_TABLE[typeOffset + orientation + SHAPE_TABLE_ELEMS_2];
Shape_TempElems[ELEM_3] = Shape_TempElems[ELEM_BASE] + SHAPE_TABLE[typeOffset + orientation + SHAPE_TABLE_ELEMS_3];
return Shape_tryToMove(Shape_TempElems);
}
bool Shape_spawn()
{
int i;
Shape_isGameOver = false;
for (i = 0; i < MAX_ELEMS; i++)
{
Shape_Elems[i] = DONT_CHECK_CELL;
}
Shape_Type = Shape_NextType;
Shape_NextType = rand() % TYPE_MAX_TYPES;
Shape_Elems[ELEM_BASE] = START_CELL;
Shape_Orient = START_ORIENTATION;
Shape_State = STATE_USER;
return Shape_alignFromOrientation(Shape_Orient);
}
bool Shape_rotateShape(int rotation)
{
int orient = Shape_Orient;
orient += rotation;
if (orient < OR_NORTH)
orient = OR_WEST;
else if (orient > OR_WEST)
orient = OR_NORTH;
bool hasRotated = Shape_alignFromOrientation(orient);
if (hasRotated)
Shape_Orient = orient;
return hasRotated;
}
bool Shape_shiftCells(int cellscrool)
{
int i;
Array_cloneInt(Shape_Elems, Shape_TempElems, MAX_ELEMS);
for (i = 0; i < MAX_ELEMS; i++)
{
if (Shape_Elems[i] != DONT_CHECK_CELL)
Shape_TempElems[i] += cellscrool;
}
if (cellscrool == C_LEFT || cellscrool == C_RIGHT)
if (Grid_getRow(Shape_Elems[ELEM_BASE]) != Grid_getRow(Shape_TempElems[ELEM_BASE]))
return false;
return Shape_tryToMove(Shape_TempElems);
}
void Shape_update(int currentAction)
{
if (Shape_State == STATE_USER)
{
switch (currentAction)
{
case ACTION_STRAFE_LEFT:
{
Shape_shiftCells(C_LEFT);
break;
}
case ACTION_STRAFE_RIGHT:
{
Shape_shiftCells(C_RIGHT);
break;
}
case ACTION_ROTATE_L:
{
if (Shape_rotateShape(ROT_LEFT))
;
Audio_PlaySound( eSFX_SWISH );
//playGenericSound(swish_raw_bin, swish_raw_bin_size);
break;
}
case ACTION_ROTATE_R:
{
if (Shape_rotateShape(ROT_RIGHT))
;
Audio_PlaySound( eSFX_SWISH );
//playGenericSound(swish_raw_bin, swish_raw_bin_size);
break;
}
case ACTION_MAKE_FALL:
{
Shape_State = STATE_FALLING;
Audio_PlaySound( eSFX_CLUNK );
//playGenericSound(clunk_raw_bin, clunk_raw_bin_size);
break;
}
}
}
}
bool Shape_IsFalling()
{
return Shape_State == STATE_FALLING;
}
//true when need to recheck playfield
bool Shape_addGravity()
{
if (Shape_isInited)
{
//gravity
bool falling = Shape_shiftCells(C_DOWN);
if (!falling)
{
Shape_State = STATE_LOCKED;
Shape_isInited = false;
return true;
}
}
else
{
Shape_isInited = Shape_spawn();
if (!Shape_isInited)//this means no room to init = game over
{
Shape_isGameOver = true;
}
}
return false;
}
|
[
"[email protected]"
] |
[
[
[
1,
175
]
]
] |
681b19ba4289e5df991dd0da6ae82f56d1075eb9
|
bb64905d66c8409dce481e371304675ad713a4e6
|
/spod_parser.cxx
|
fe962d151e1aeccd116b47056b2955850fa21244
|
[] |
no_license
|
gitpan/spodcxx
|
20e7c6bcacaa9f494f4e0325fe277395c15d4600
|
feb7d75ceab420c22bcddc1023874ccf0c7e8beb
|
refs/heads/master
| 2021-01-17T11:59:06.120764 | 2005-08-10T09:56:01 | 2014-10-26T18:36:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 33,351 |
cxx
|
#include <spod_parser.h>
#include <md5.h>
#include <ctype.h>
#ifdef _MSC_VER
#ifndef WIN32
#define WIN32
#endif
#endif
#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
#endif
#include <stdarg.h>
#include <harray.h>
#define MAX_LINE 20480
#define BUF_SIZE 10240
#define DEBUG(a,b) SPODDBG(a,b)
spod_parser::spod_parser(int fh,const std::string & _comment)
{
std::string comment=_comment;
{
char buf[BUF_SIZE+1];
int bytes;
while ((bytes=read(fh,buf,BUF_SIZE))!=0) {
buf[bytes]='\0';
_in+=buf;
}
// To prevent this thing from sigsegv'ing, add =cut\n\n (the last \n is for read_block()).
while(_in.substr(_in.size()-2)!="\n\n") {
_in+="\n";
}
_in+="=cut\n\n";
// Convert from DOS to UNIX if necessary
{int i,j,N;
char *S;
N=(int) _in.size();
S=new char[N+1];
for(i=0,j=0;i<N;i++) {
if (_in[i]!='\r') { S[j]=_in[i];j++; }
}
S[j]='\0';
_in=S;
delete S;
}
}
_length=_in.size();
{
trim(comment);
while (comment!="") {
int i=comment.find("|");
if (i==-1) {
trim(comment);
if (comment!="") {
_comments.insert(_comments.end(),comment);
}
comment="";
}
else {
std::string cmnt=ltrim(comment.substr(0,i));
comment=comment.substr(i+1);
if (cmnt!="") {
_comments.insert(_comments.end(),cmnt);
}
}
}
}
_reread=false;
_line_number=0;
_syntax="txt";
_tabsize=8;
debug();
}
spod_parser::~spod_parser()
{
}
void spod_parser::parse(void)
{
// Initialize
DEBUG(1,fprintf(stderr,"init\n"));
rewind();
_body="";
_ispod=false;
_cursor=0;
DEBUG(1,fprintf(stderr,"initialization: parse_init\n"));
parse_init();
DEBUG(1,fprintf(stderr,"init ready\n"));
// Stage WikiWiki
DEBUG(1,fprintf(stderr,"stage 0: convert wikiwikiwiki mode to spod\n"));
rewind();
_body="";
parse_wikiwikiwiki(_body);
// Stage 1
DEBUG(1,fprintf(stderr,"stage 1: parse_escapes\n"));
_in=_body;
rewind();
_body="";
_next_block_is_title=false;
parse_escapes(_body);
DEBUG(1,fprintf(stderr,"stage 1 _body size: %d\n",_body.size()));
DEBUG(2,fprintf(stderr,"body contents:\n********************\n%s\n********************\n",_body.c_str()));
// Stage 2
DEBUG(1,fprintf(stderr,"stage 2 preparation\n"));
_in=_body;
rewind();
_body="";
_ispod=false;
_next_block_is_title=false;
DEBUG(1,fprintf(stderr,"stage 2: parse_body\n"));
parse_body(_body);
DEBUG(1,fprintf(stderr,"stage 2 _body size: %d\n",_body.size()));
// Enclose pod?
DEBUG(1,fprintf(stderr,"finishing: parse_finish\n"));
parse_finish(_body);
}
std::string spod_parser::get_item_type(const std::string & line)
{
std::string ln;
std::string R;
ln=ltrim(line);
if (ln=="" || ln=="*" || ln=="-") { R="dot"; }
else {
int i;
for(i=0;i<(int) ln.size() && ln[i]>='0' && ln[i]<='9';i++);
if (i==(int) ln.size()) { R="number"; }
else if ((ln[i]=='.' || ln[i]==')') && i==(int) ln.size()-1) { R="number"; }
else { R="text"; }
}
return R;
}
bool spod_parser::parse_image(std::string block,
std::string & img_descr,
std::string & img_name,
std::string & img_url,
std::string & img_type,
std::string & img_align)
{
std::vector<std::string> image_parts;
split(ltrim(block),",",image_parts);
{
int i;
for(i=0;i<(int) image_parts.size();i++) {
trim(image_parts[i]);
}
}
if (image_parts.size()<5) {
warning("=image : syntax error, use: =image <description>,<name>,<url>,<type>,<alignment>; provided: =image %s",block.c_str());
return false;
}
else {
img_descr=image_parts[0];
img_name=image_parts[1];
img_url=image_parts[2];
img_type=image_parts[3];
img_align=image_parts[4];
img_align=tolower(img_align);
return true;
}
}
bool spod_parser::parse_table(std::string block,
std::vector<int> & widths,
std::string & caption,
int & border,
int & frame)
{
int j,i,N,k;
std::string _colspec=block;
harray<std::string> _colspecs;
std::string _border;
std::string _frame;
std::string _caption;
trim(_colspec);
DEBUG(7,fprintf(stderr,"=table: starting, colspec=%s\n",_colspec.c_str()));
for(i=0,N=_colspec.length();i<N && _colspec[i]!=',';i++);
if (i<N) {
_caption=_colspec.substr(i+1);
_colspec=_colspec.substr(0,i);
}
for(i=0,N=_caption.length();i<N && _caption[i]!=',';i++);
if (i<N) {
_border=_caption.substr(i+1);
_caption=_caption.substr(0,i);
}
for(i=0,N=_border.length();i<N && _border[i]!=',';i++);
if (i<N) {
_frame=_border.substr(i+1);
_border=_border.substr(0,i);
}
trim(_colspec);
if (_colspec!="") {
_colspec+=" ";
for(j=0,k=0,i=0,N=_colspec.length();i<N;i++) {
if (isspace(_colspec[i])) {
_colspecs[j++]=_colspec.substr(k,i-k);
for(;i<N && isspace(_colspec[i]);i++);
k=i;
}
}
}
trim(_frame);
trim(_border);
trim(_caption);
// output
widths.clear();
for(i=0,N=_colspecs.length();i<N;i++) {
widths.insert(widths.end(),atoi(_colspecs[i].c_str()));
}
if (_frame!="") {
frame=atoi(_frame.c_str());
}
else {
frame=-1;
}
if (_border!="") {
border=atoi(_border.c_str());
}
else {
border=-1;
}
caption=_caption;
if (N==0) {
warning("=table: syntax error, syntax: =table <widths(%%) of columns>[,caption[,border[,frame]]], provided: =table %s",
block.c_str()
);
widths.insert(widths.end(),100);
return false;
}
else {
return true;
}
}
bool spod_parser::parse_link(const std::string & _part,std::vector<std::string> & link_parts)
// returns in vector: link, link_description, link_type, document_internal_link.
{
std::string link,description,link_type,document_link;
std::string part(_part);
int i;
bool link_is_desc;
trim(part);
i=part.find("|");
if (i!=-1) {
description=part.substr(0,i);
link=part.substr(i+1);
link_is_desc=false;
}
else {
link=part;
link_is_desc=true;
}
link_type="external";
// Link type adjustment
trim(link);
{
int i;
for(i=0;i<(int) link.size() && ::tolower(link[i])>='a' && ::tolower(link[i])<='z' && link[i]!=':';i++);
if (i!=(int) link.size() && link[i]==':' && i>0) {
link_type="fullurl";
}
}
if (link_type!="fullurl") {
i=link.find("/");
if (i!=-1) {
int j,N;
document_link=link.substr(i+1);
link=link.substr(0,i);
for(j=0,N=document_link.size();j<N && document_link[j]=='"';j++);
document_link=document_link.substr(j);
for(N=document_link.size(),j=N-1;j>=0 && document_link[j]=='"';j--);
document_link=document_link.substr(0,j+1);
if (i==0) {
link_type=="internal";
}
}
}
if (link_is_desc) {
description=link+"/"+document_link;
if (description[0]=='/') { description=description.substr(1); }
}
// Trimming
trim(link);
trim(description);
trim(link_type);
trim(document_link);
// Post parsing and returning
if (document_link!="") { document_link=link_id(document_link); }
link_parts.insert(link_parts.end(),link);
link_parts.insert(link_parts.end(),description);
link_parts.insert(link_parts.end(),link_type);
link_parts.insert(link_parts.end(),document_link);
return true;
}
std::string spod_parser::parse_escapes_for_part(const std::string & part,int level)
{
int from,to,N;
int escapes;
DEBUG(4,fprintf(stderr,"recursion level:%d\n",++level));
DEBUG(4,fprintf(stderr,"part.size=%d\n",part.size()));
DEBUG(5,fprintf(stderr,"part=%s\n",part.c_str()));
for(from=0,N=part.size();from<N && part[from]!='<';from++);
if (from==N) {
DEBUG(4,fprintf(stderr,"returns part itself\n"));
return std::string(part);
}
else {
// find closer
for(to=from+1,escapes=1;to<N && escapes>0;) {
if (part[to]=='<') { escapes+=1; }
if (part[to]=='>') { escapes-=1; }
if (escapes!=0) { to+=1; }
}
if (escapes>0) {
warning("Unclosed escape sequence");
escapes=0;
}
std::string head,middle,tail,escape;
if (from>0) { escape=part.substr(from-1,1); } // keep in mind: C<<< ... >>>can also happen!
if (from>0) { head=part.substr(0,from-1); }
DEBUG(4,fprintf(stderr,"parse_escapes_for_part(middle)\n"));
middle=parse_escapes_for_part(part.substr(from+1,to-from-1),level);
DEBUG(5,fprintf(stderr,"middle=%s\n",middle.c_str()));
DEBUG(4,fprintf(stderr,"parse_escape(%s,%s)\n",escape.c_str(),middle.c_str() ));
if (escape!="") {
middle=parse_escape(escape,middle);
}
DEBUG(5,fprintf(stderr,"middle=%s\n",middle.c_str()));
if (to<N-1) {
DEBUG(4,fprintf(stderr,"parse_escapes_for_part(tail)\n"));
tail=part.substr(to+1);
DEBUG(5,fprintf(stderr,"tail.size=%d, tail=%s\n",tail.size(),tail.c_str()));
tail=parse_escapes_for_part(tail,level);
}
DEBUG(5,fprintf(stderr,"%s - %s - %s\n",head.c_str(),middle.c_str(),tail.c_str()));
return head+middle+tail;
}
}
void spod_parser::parse_escapes(std::string & body) {
std::string directive,block;
bool tmp;
std::string pdir,part,original_block;
bool ispod=false;
while(read_block(directive,block,tmp,original_block)) {
if (directive!="=p" && directive!="=pre" && directive!="=cut") {
ispod=true;
}
else if (directive=="=cut") { ispod=false; }
DEBUG(6,fprintf(stderr,"%d - %s\n",ispod,block.c_str()));
if (directive=="=verbatim") {
body+=original_block;
}
else if (ispod &&
directive!="=pre" && directive!="=for" && directive!="=begin" && directive!="=end"
) {
body+=parse_escapes_for_part(original_block,0);
}
else {
body+=original_block;
}
}
}
static
int eof_line(std::string & block,int pos)
{
if (block[pos]=='\r') {
if (block[pos+1]=='\n') { return 2; }
else { return 0; }
}
else if (block[pos]=='\n') {
return 1;
}
else {
return 0;
}
}
static
bool is_url(std::string word)
{
int i,N=word.length();
for(i=0;i<N &&
(word[i]>='a' && word[i]<='z') ||
(word[i]>='A' && word[i]<='Z');i++);
if (i==N) {
return false;
}
else {
return word[i]==':' && i!=N-1 && !isspace(word[i+1]);
}
}
static
std::string wikiwiki_escape(std::string word)
{
int i,N=word.length();
std::string nword;
for(i=0;i<N;i++) {
if (word[i]=='<') {
nword+="E<lt>";
}
else if (word[i]=='>') {
nword+="E<gt>";
}
else {
nword+=word[i];
}
}
return nword;
}
static
int is_wikiwikiword(std::string word,std::string & w,std::string & r)
{
int i,N=word.length();
bool wikiword=false;
int caseChanges=0;
int theCase,oldCase;
theCase=(word[0]>='a' && word[0]<='z') ? 0 : (word[0]>='A' && word[0]<='Z') ? 1 : 0;
oldCase=theCase;
for(i=1;i<N && !wikiword;i++) {
theCase=(word[i]>='a' && word[i]<='z') ? 0 : (word[i]>='A' && word[i]<='Z') ? 1 : theCase;
if (oldCase!=theCase) { caseChanges+=1; }
oldCase=theCase;
if (caseChanges>2) { wikiword=true; }
}
if (wikiword) {
int i;
for(i=0;i<N && (isalnum(word[i]) || word[i]=='-' || word[i]=='_');i++);
w=word.substr(0,i);
r=word.substr(i);
}
return wikiword;
}
bool spod_parser::is_image_word(std::string & word,std::string & type)
{
trim(word);
{
int N=word.length();
if (N<5) { return false; }
else {
std::string ext=word.substr(N-4);
type=ext.substr(1);
DEBUG(7,fprintf(stderr,"is_image_word: %s, %s, %s\n",word.c_str(),ext.c_str(),type.c_str()));
if (ext==".png") { return true; }
else if (ext==".jpg") { return true; }
else if (ext==".gif") { return true; }
else { return false; }
}
}
}
static
bool is_space(const char c)
{
return isspace(c) || c=='.' || c==',' || c==':' || c==';';
}
static
bool is_sep(const char c)
{
return c=='*' || c=='/' || c=='*' || c=='[' || c==']' || c=='#' || c=='_';
}
static
bool is_same(const char a,const char b)
{
return a==b;
}
int spod_parser::is_wikiwiki_start_markup(int i,std::string line,const char *sep)
{
if (i>0) {
int k;
for(k=i-1;k>0 && is_sep(line[k]) && !is_space(line[k]) && !is_same(line[k],sep[0]);k--);
if (is_space(line[k]) || k==0) {
if (line[i]==sep[0]) {
int k;
int N=line.length();
for(k=i+1;k<N && is_sep(line[k]) && !is_same(line[i],line[k]);k++);
if (k==N || is_same(line[i],line[k])) {
return 0;
}
else {
return 1;
}
}
else {
return 0;
}
}
else {
return 0;
}
}
else {
if (line[i]==sep[0]) {
int k;
int N=line.length();
for(k=i+1;k<N && is_sep(line[k]) && !is_same(line[i],line[k]);k++);
if (k==N || is_same(line[i],line[k])) {
return 0;
}
else {
return 1;
}
}
else {
return 0;
}
}
}
static
std::string remove_wikiwiki_escaped_markup(std::string line)
{
int i;
int N=line.length();
for(i=0;i<N-1;i++) {
if (line[i]=='!' && (is_sep(line[i+1]) || isalpha(line[i+1]) || isdigit(line[i+1]))) {
line[i]=' ';
}
}
return line;
}
int spod_parser::is_wikiwiki_end_markup(int i,std::string line,const char *sep)
{
int N=line.length();
if (i<N) {
if (line[i]==sep[0]) {
int k;
DEBUG(7,fprintf(stderr,"wikiwiki_end_markup: line='%s', sep='%s', i=%d, line[i]=%c\n",
line.c_str(),sep,i,line[i]
));
for(k=i+1;k<N && is_sep(line[k]) && !is_space(line[k]) && !is_same(line[k],sep[0]);k++);
if (k==N || is_space(line[k])) {
return 1;
}
else {
return 0;
}
}
else {
return 0;
}
}
else {
return 0;
}
}
std::string spod_parser::parse_wikiwikiwiki_recurse(std::string & line,std::string & end_sep,std::string link)
{
int i=0,N=line.length();
std::string subline;
std::string new_sep;
DEBUG(6,fprintf(stderr,"wikiwikiwiki_recurse: '%s' (%s,%s)\n",line.c_str(),end_sep.c_str(),link.c_str()));
for(i=0;i<N &&
!is_wikiwiki_start_markup(i,line,"*") &&
!is_wikiwiki_start_markup(i,line,"/") &&
!is_wikiwiki_start_markup(i,line,"_") &&
!is_wikiwiki_start_markup(i,line,"#") &&
!is_wikiwiki_start_markup(i,line,"[") &&
!is_wikiwiki_end_markup(i,line,end_sep.substr(0,1).c_str())
;i++);
if (i<N) {
subline=line.substr(0,i);
if (is_wikiwiki_end_markup(i,line,end_sep.substr(0,1).c_str())) {
std::string sep=end_sep.substr(0,1);
end_sep=end_sep.substr(1);
DEBUG(6,fprintf(stderr,"i=%d, line[i]=%c orig line='%s', link='%s', subline='%s'\n",i,line[i],line.c_str(),link.c_str(),subline.c_str()));
line=line.substr(i+is_wikiwiki_end_markup(i,line,sep.c_str()));
DEBUG(6,fprintf(stderr,"new line='%s'\n",line.c_str()))
if (sep=="]") {
if (link=="##@IMG@##") {
return parse_wikiwikiwiki_recurse(subline,new_sep,"")+
parse_wikiwikiwiki_recurse(line,end_sep,"");
}
else {
std::string s;
if (subline=="") { subline=link; }
s=parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"|"+link+"> "+
parse_wikiwikiwiki_recurse(line,end_sep,"");
DEBUG(6,fprintf(stderr,"s=%s\n",s.c_str()));
return s;
}
}
else if (sep=="#") {
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
">> "+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
else {
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"> "+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
}
else if (is_wikiwiki_start_markup(i,line,"#")) {
end_sep="#"+end_sep;
line=line.substr(i+is_wikiwiki_start_markup(i,line,"#"));
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"S<C<"+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
else if (is_wikiwiki_start_markup(i,line,"*")) {
end_sep="*"+end_sep;
line=line.substr(i+is_wikiwiki_start_markup(i,line,"*"));
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"B<"+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
else if (is_wikiwiki_start_markup(i,line,"/")) {
end_sep="/"+end_sep;
line=line.substr(i+is_wikiwiki_start_markup(i,line,"/"));
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"I<"+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
else if (is_wikiwiki_start_markup(i,line,"_")) {
end_sep="_"+end_sep;
line=line.substr(i+is_wikiwiki_start_markup(i,line,"_"));
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
" U<"+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
else if (is_wikiwiki_start_markup(i,line,"[")) {
std::string word,img_type,img_word;
int k;
int C=is_wikiwiki_start_markup(i,line,"[");
for(k=i+C;k<N && !isspace(line[k]) && line[k]!=']';k++);
word=line.substr(i+C,k-(i+C)); //+1);
line=line.substr(k);
img_word=word;
end_sep="]"+end_sep;
if (is_image_word(img_word,img_type)) { /* SIDE EFFECTS! */
std::string s;
s=parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"\n\n=image "+img_word+","+img_word+","+img_word+","+img_type+",center\n\n"+
parse_wikiwikiwiki_recurse(line,end_sep,"##@IMG@##");
DEBUG(7,fprintf(stderr,"image:'%s'\n",s.c_str()));
return s;
}
else {
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
"L<"+
parse_wikiwikiwiki_recurse(line,end_sep,word);
}
}
else {
return
parse_wikiwikiwiki_recurse(subline,new_sep,"")+
parse_wikiwikiwiki_recurse(line,end_sep,link);
}
}
else { /* No special things found, search for wikiwiki words */
std::string newsub;
int b=0,e=0;
for(i=0;i<N;i++) {
e=i;
if (isspace(line[i])) {
if (e>b) {
std::string word=line.substr(b,e-b);
std::string w,r;
if (is_wikiwikiword(word,w,r)) {
DEBUG(6,fprintf(stderr,"word=%s, w=%s, r=%s\n",word.c_str(),w.c_str(),r.c_str()));
newsub+="L<";
newsub+=w;
newsub+="|";
newsub+=w;
newsub+=">";
newsub+=r;
}
else if (is_url(word)) {
newsub+="L<";
newsub+=word;
newsub+="|";
newsub+=word;
newsub+=">";
}
else {
newsub+=wikiwiki_escape(word);
}
newsub+=line[i];
b=i+1;
}
else {
newsub+=line[i];
e=b=i+1;
}
}
}
if (b<e) {
newsub+=line.substr(b,e-b+1);
}
DEBUG(6,fprintf(stderr,"returns %d,%d %s\n",b,e,newsub.c_str()));
return newsub;
}
}
static
std::string create_table_code(bool in_table,bool is_table,std::string text)
{
if (in_table && !is_table) {
return "\n\n=table\n\n"+text;
}
else if (is_table) {
int i,N;
std::string nt;
for(i=0,N=text.length();i<N;i++) {
if (text[i]=='|') {
char *c="=cell";
if (i<N-2) {
if (isspace(text[i+2])) {
if (text[i+1]=='r') {
c="=rcell";
i+=1;
}
else if (text[i+1]=='c') {
c="=ccell";
i+=1;
}
}
}
nt+="\n\n";
nt+= c;
nt+=" ";
}
else {
nt+=text[i];
}
}
return nt;
}
else {
return text;
}
}
std::string spod_parser::parse_wikiwikiwiki_line(std::string & line,int & list_level)
{
int L=line.length();
std::string new_line;
bool items=false;
bool in_table=is_table;
DEBUG(5,fprintf(stderr,"wikiwikiwiki_line: '%s'\n",line.c_str()));
is_table=false;
if (L>=6 && line.substr(0,6)=="======") {
new_line="=head6 ";
line=line.substr(6);
}
else if (L>=5 && line.substr(0,5)=="=====") {
new_line="=head5 ";
line=line.substr(5);
}
else if (L>=4 && line.substr(0,4)=="====") {
new_line="=head4 ";
line=line.substr(4);
}
else if (L>=3 && line.substr(0,3)=="===") {
new_line="=head3 ";
line=line.substr(3);
}
else if (L>=2 && line.substr(0,2)=="==") {
new_line="=head2 ";
line=line.substr(2);
}
else if (L>=1 && line.substr(0,1)=="=") {
new_line="=head1 ";
line=line.substr(1);
}
else if (L>=4 && line.substr(0,4)=="----") {
new_line="=hline ";
line=line.substr(4);
}
else if (L>=1 && line.substr(0,1)=="|") {
if (!in_table) {
int i,pipes=0;
for(i=0;i<L;i++) {
if (line[i]=='|') { pipes+=1; }
}
{
new_line="=table ";
for(i=0;i<pipes;i++) {
new_line+=" 0";
}
new_line+=",,,1";
}
new_line+="\n\n";
}
else {
new_line="\n=row";
}
is_table=true;
}
else if (L>=1 && line.substr(0,1)=="*") {
int i;
char buf[100];
for(i=0;i<L && line.substr(i,1)=="*";i++);
if (line.substr(i,1)==" ") {
if (i>list_level) {
sprintf(buf,"\n=over %d\n\n=item *\n\n",i-list_level);
}
else if (i<list_level) {
sprintf(buf,"\n=back %d\n\n=item *\n\n",list_level-i);
}
else {
sprintf(buf,"\n=item *\n\n");
}
new_line=buf;
list_level=i;
for(;i<L && isspace(line[i]);i++);
line=line.substr(i);
items=true;
}
}
else if (L>=1 && line.substr(0,1)=="0") {
int i;
char buf[100];
for(i=0;i<L && line.substr(i,1)=="0";i++);
if (line.substr(i,1)==" ") {
if (i>list_level) {
sprintf(buf,"\n=over %d\n\n=item 0\n\n",i-list_level);
}
else if (i<list_level) {
sprintf(buf,"\n=back %d\n\n=item 0\n\n",list_level-i);
}
else {
sprintf(buf,"\n=item 0\n\n");
}
new_line=buf;
list_level=i;
for(;i<L && isspace(line[i]);i++);
line=line.substr(i);
items=true;
}
}
if (!items && list_level>0) {
char buf[100];
sprintf(buf,"\n=back %d\n\n",list_level);
list_level=0;
new_line=buf+new_line;
}
{
std::string R;
if (line.substr(0,1)==" " || line.substr(0,1)=="\t") {
if (!is_verbatim_text) {
is_verbatim_text=true;
new_line=new_line+"\n";
}
R=new_line+line;
}
else {
std::string end_sep;
if (is_verbatim_text) {
new_line=new_line+"\n";
is_verbatim_text=false;
}
R=remove_wikiwiki_escaped_markup(new_line+
create_table_code(in_table,is_table,parse_wikiwikiwiki_recurse(line,end_sep,""))
);
}
return R;
}
}
std::string spod_parser::parse_wikiwikiwiki_block(std::string & block)
{
std::string body;
int i,position=0,N=block.length(),L;
bool eof_block=(N==0);
std::string line;
int list_level=0;
is_verbatim_text=false;
is_table=false;
while(!eof_block) {
for(i=position,L=0;i!=N && !(L=eof_line(block,i));i++);
{
int E=i+L;
DEBUG(6,fprintf(stderr,"position=%d,E=%d,len=%d\n",position,E,E-position+1));
line=block.substr(position,E-position);
body+=parse_wikiwikiwiki_line(line,list_level);
position=E;
}
eof_block=position==N;
}
DEBUG(5,fprintf(stderr,"BODY!\n%s\n",body.c_str()));
return body;
}
void spod_parser::parse_wikiwikiwiki(std::string & body)
{
std::string directive,block;
bool tmp;
std::string original_block;
while(read_block(directive,block,tmp,original_block)) {
if (directive=="=wikiwikiwiki") {
body+=parse_wikiwikiwiki_block(block);
}
else {
body+=original_block;
}
}
DEBUG(3,fprintf(stderr,"parse_wikiwikiwiki::body:\n%s\n",body.c_str()));
}
void spod_parser::parse_body(std::string & body)
{
std::string directive,line,original_line;
bool goon=true;
bool has_reread=false;
DEBUG(5,fprintf(stderr,"starting body size=%d, _ispod=%d\n",body.size(),_ispod));
while(goon && read_block(directive,line,has_reread,original_line)) {
if (directive=="=cut") {
_ispod=false;
parse_directive(directive,line,body);
}
else if (directive!="=p" && directive!="=pre" && directive!="=pod" && directive!="=verbatim") {
_ispod=true;
}
else if (directive=="=pod") {
// do nothing now, from next line text is pod
}
DEBUG(5,fprintf(stderr,"parse_body:%d %s %s\n",_ispod,directive.c_str(),line.c_str()));
if (_ispod && directive!="=skip") {
if (_next_block_is_title) {
_title=ltrim(line);
_next_block_is_title=false;
}
parse_head(directive,line,has_reread);
// Get the verbatim part going.
if (directive=="=verbatim") {
std::string syn="txt,8";
int i;
i=line.find("\n");
if (i!=-1) {
syn=line.substr(0,i);
line=line.substr(i+1);
}
parse_directive("=syn",syn,body);
parse_directive("=pre",line,body);
goon=parse_directive("=p","",body);
}
else {
goon=parse_directive(directive,line,body);
}
}
else {
goon=true;
}
if (directive=="=pod") { _ispod=true; }
}
}
std::string spod_parser::link_id(const std::string & text)
{
std::string id=text;
trim(id);
{
int i;
int N=id.length();
for(i=0;i<N;i++) {
if (isspace(id[i])) {
id[i]='_';
}
else if (!(isalpha(id[i]) || isdigit(id[i]))) {
id[i]='_';
}
}
}
/*md5 hash(id);
return hash.hex();*/
return tolower(id);
}
void spod_parser::parse_head(const std::string & directive, const std::string & line,bool has_reread)
{
if (!has_reread) {
if (directive.substr(0,5)=="=head") {
int level=to_int(directive.substr(5));
std::string ln=ltrim(line);
_toc.insert(_toc.end(),ln);
_toc_level.insert(_toc_level.end(),level);
_toc_id.insert(_toc_id.end(),link_id(line));
if (tolower(ln)=="name") { _next_block_is_title=true; }
}
}
}
void spod_parser::rewind(void)
{
_cursor=0;
_length=_in.size();
_line_number=0;
}
bool spod_parser::read_block(std::string & directive,std::string & block,bool & has_reread,std::string & original_block)
{
bool result;
if (_reread) {
block=_last_block;
directive=_last_directive;
original_block=_last_original_block;
result=true;
_reread=false;
has_reread=true;
}
else {
std::string line,oline;
std::string dir;
if (read_line(dir,line,has_reread,oline)) {
bool ok;
block=line;
original_block=oline;
directive=dir;
if (directive=="=verbatim") {
while((ok=read_line(dir,line,has_reread,oline)) && dir!="=verbatim") {
DEBUG(6,fprintf(stderr,"read_line: directive=%s\n",dir.c_str()));
block+=oline;
original_block+=oline;
}
if (ok) {
original_block+=oline;
}
}
else if (directive=="=wikiwikiwiki") {
while((ok=read_line(dir,line,has_reread,oline)) && dir!="=wikiwikiwiki") {
DEBUG(6,fprintf(stderr,"read_line: directive=%s\n",dir.c_str()));
block+=oline;
original_block+=oline;
}
if (ok) {
original_block+=oline;
}
}
else {
if (ltrim(line)!="") {
while((ok=read_line(dir,line,has_reread,oline)) && ltrim(line)!="" && dir==directive) {
block+=line;
original_block+=oline;
}
if (ok) {
original_block+=oline;
}
}
}
result=true;
_last_block=block;
_last_directive=directive;
_last_original_block=original_block;
}
else {
result=false;
_last_block="";
_last_directive="";
_last_original_block="";
}
}
DEBUG(5,fprintf(stderr,"read_block:%s,%s\n",directive.c_str(),block.c_str()));
return result;
}
bool spod_parser::read_line(std::string & directive,std::string & line,bool & has_reread,std::string & original_line)
{
bool result;
// read line
if (_cursor==_length) {
result=false;
line="";
has_reread=false;
}
else {
int _from=_cursor;
while(_cursor<_length && _in[_cursor]!='\n') { _cursor+=1; }
DEBUG(8,fprintf(stderr,"%d,%d,%d\n",_from,_cursor,_length));
_cursor+=1;
line=_in.substr(_from,_cursor-_from);
has_reread=false;
result=true;
_line_number+=1;
}
original_line=line;
// Parse for a directive
{int i;
std::string prev_directive=directive,comment;
directive="";
// skip comments
if (_comments.size()>0) {int pos;
for(pos=0;pos<(int) line.size() && isspace(line[pos]);pos++);
if (pos!=(int) line.size()) {int c;
for(c=0;c<(int) _comments.size() && line.substr(pos,_comments[c].size())!=_comments[c];c++);
if (c!=(int) _comments.size()) {
DEBUG(7,fprintf(stderr,"line[%d]=%s\n",pos,line.substr(pos).c_str()));
int size=_comments[c].size();
for(pos+=size;pos<(int) line.size() && line.substr(pos,size)==_comments[c];pos+=size);
line=line.substr(pos);
}
}
}
// Get directive
DEBUG(7,fprintf(stderr,"line=%s\n",line.c_str()));
if (directive=="") {
if (isspace(line[0]) && !linefeed_only(line)) {
directive="=pre";
}
else {
if (line[0]=='=') {
for(i=0;i<(int) line.size() && !isspace(line[i]);i++);
directive=line.substr(0,i);
for(;i<(int) line.size() && isspace(line[i]);i++);
line=line.substr(i,line.size());
}
else {
directive="=p";
}
}
}
}
return result;
}
bool spod_parser::is_verbatim(const std::string & block)
{
DEBUG(3,fprintf(stderr,"=verbatim: %s!=%s?\n",tolower(ltrim(block)).c_str(),"end"));
return tolower(ltrim(block))!="end";
}
void spod_parser::get_parameters(const std::string & block,std::string & parameters,std::string & newblock)
{
int i;
i=block.find("\n");
if (i!=-1) {
parameters=ltrim(block.substr(0,i));
newblock=block.substr(i+1);
}
}
void spod_parser::push_back_block(void)
{
_reread=true;
}
std::string & spod_parser::body(void)
{
return _body;
}
std::string & spod_parser::title(void)
{
if (_title=="") {
if (_toc.size()>0) {
_title=_toc[0];
}
else {
_title="unknown";
}
}
return _title;
}
bool spod_parser::current_toc(int & level,std::string & head,std::string & id)
{
return toc(_toc.size()-1,level,head,id);
}
bool spod_parser::toc(int i,int & level,std::string & head,std::string & id)
{
if (i>=(int) _toc.size()) {
level=-1;
head="";
id="";
return false;
}
else {
level=_toc_level[i];
head=_toc[i];
id=_toc_id[i];
return true;
}
}
void spod_parser::trim(std::string & line)
{
int i,k;
for(i=0;i<(int) line.size() && isspace(line[i]);i++);
for(k=line.size()-1;k>=i && isspace(line[k]);k--);
line=line.substr(i,k+1);
}
std::string spod_parser::ltrim(const std::string & line)
{
std::string s(line);
trim(s);
return s;
}
std::string spod_parser::tolower(const std::string & s)
{
int i,N;
std::string S=s;
for(i=0,N=S.size();i<N;i++) {
if (S[i]>='A' && S[i]<='Z') { S[i]=::tolower(S[i]); }
}
return S;
}
bool spod_parser::is_empty(const std::string & line)
{
int i;
for(i=0;i<(int) line.size() && isspace(line[i]);i++);
return i==(int) line.size();
}
int spod_parser::to_int(std::string line)
{
trim(line);
return atoi(line.c_str());
}
bool spod_parser::linefeed_only(const std::string & line)
{
return line[0]=='\n';
}
void spod_parser::split(const std::string & s,
const std::string & substr,
std::vector<std::string> & parts)
{
int from,to,size;
parts.clear();
from=0;
to=-1;
size=substr.size();
while((to=s.find(substr,from))!=-1) {
if (to==-1) {
parts.insert(parts.end(),s.substr(from));
}
else {
parts.insert(parts.end(),s.substr(from,to-from));
}
from=to+size;
}
parts.insert(parts.end(),s.substr(from));
}
/***************************************************************************************/
bool spod_parser::is_uint(const std::string & s)
{
int i,p;
for(i=0,p=0;i<(int) s.size() && s[i]>='0' && s[i]<='9';i++);
if (i==(int) s.size()) {
return true;
}
else if (isspace(s[i])) {
return true;
}
else {
return false;
}
}
void spod_parser::warning(const char * format, ...) {
va_list ap;
va_start(ap,format);
fprintf(stderr,"block before line %d: ",_line_number);
vfprintf(stderr,format,ap);
fprintf(stderr,"\n");
va_end(ap);
}
|
[
"[email protected]"
] |
[
[
[
1,
1463
]
]
] |
474f19542835abb3e5fa96e7875a312e20932c8e
|
c1bcff0f1321de8a6425723cdfa0b5aa65b5c81f
|
/TransX/trunk/transx.h
|
bbe8dd6c53a3351d8f5668f8e058da77b15e8093
|
[
"MIT"
] |
permissive
|
net-lisias-orbiter/transx
|
560266e7a4ef73ed29d9004e406fd8db28da9a43
|
b9297027718a7499934a9614430aebb47422ce7f
|
refs/heads/master
| 2023-06-27T14:16:10.697238 | 2010-09-05T01:18:54 | 2010-09-05T01:18:54 | 390,398,358 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,977 |
h
|
/* Copyright (c) 2007 Duncan Sharpe, Steve Arch
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is
** furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
** THE SOFTWARE.*/
#ifndef __TRANSX_H
#define __TRANSX_H
#include "graph.h"
using namespace oapi;
class TransxMFD: public MFD2 {
public:
TransxMFD (DWORD w, DWORD h, VESSEL *Vessel, UINT mfd);
~TransxMFD();
char *ButtonLabel (int bt);
int ButtonMenu (const MFDBUTTONMENU **menu) const;
bool ConsumeKeyImmediate(char *kstate);
bool ConsumeButton(int bt, int event);
bool ConsumeKeyBuffered(DWORD key);
bool Update (Sketchpad *sketchpad);
void WriteStatus(FILEHANDLE scn) const;
void ReadStatus(FILEHANDLE scn);
static int MsgProc (UINT msg, UINT mfd, WPARAM wparam, LPARAM lparam);
int getwidth();
int getheight();
static int GetMfdCount(){return MfdCount;}
bool isvalid() { return valid;};
private:
class viewstate *viewstate;// Pointer to viewstate
static int MfdCount;
bool valid;
};
#endif
|
[
"steve@5a6c10e1-6920-0410-8c7b-9669c677a970",
"agentgonzo@5a6c10e1-6920-0410-8c7b-9669c677a970"
] |
[
[
[
1,
24
],
[
28,
35
],
[
37,
52
]
],
[
[
25,
27
],
[
36,
36
]
]
] |
80fb5e1dc9c14f246048f0a852d8ad81786fd412
|
57be15ccf8458cdc18ed9ddc425260a380c80ebf
|
/MatchingBackend/matching/SURFMatcher.cpp
|
01637c0fc03f7cd77799902f02d3c91f5d0ab123
|
[] |
no_license
|
lkn/MatchingBackend
|
9fe7687e0dcfb109c8ef16507ec5b88cafa1b612
|
7e4039c594dadc94843db605b36648681171d2d0
|
refs/heads/master
| 2021-01-01T18:27:29.084638 | 2011-06-06T20:36:03 | 2011-06-06T20:36:03 | 1,797,326 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 16,371 |
cpp
|
// TODO: use flann
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "../support/util.h"
#include "../support/cv_helper.h"
#include "../thirdparty/tinyxml/tinyxml.h"
#include "StatsTable.h"
#include "SURFMatcher.h"
SURFMatcher::SURFMatcher(Logger *logger, const SURFMatcherParams& params, bool write_stats) : logger_(logger) {
memcpy(¶ms_, ¶ms, sizeof(SURFMatcherParams));
storage_ = cvCreateMemStorage(0);
stats_table_ = NULL;
if (write_stats) {
stats_table_ = new StatsTable();
}
}
SURFMatcher::~SURFMatcher() {
std::vector<ImageData *>::iterator it;
for (it = referenceData_.begin(); it != referenceData_.end(); ++it) {
cvReleaseImage(&((*it)->image));
delete *it;
}
if (storage_ != NULL) {
cvReleaseMemStorage(&storage_);
}
if (stats_table_) {
delete stats_table_;
}
}
void SURFMatcher::Extract() {
// extract data for SURF
CvSURFParams params = cvSURFParams(params_.hessian_threshold, params_.extended_parameter);
vector<ImageData *>::const_iterator refIt;
CvSeq *keyPoint = 0, *descriptor = 0;
for (refIt = referenceData_.begin(); refIt != referenceData_.end(); ++refIt) {
cvExtractSURF((*refIt)->image, 0, &keyPoint, &descriptor, storage_, params);
refKD_.push_back(make_pair(keyPoint, descriptor));
logger_->Log(INFO, "\tExtracted %s with %d keypoints and %d descriptors",
(*refIt)->path.c_str(), keyPoint->total, descriptor->total);
}
if (refKD_.size() != referenceData_.size()) {
logger_->Log(WARNING, "Only extracted SURF features from %d / %d images!\n",
refKD_.size(), referenceData_.size());
}
}
// fileName contains list of images to build library with
int SURFMatcher::BuildFromXml(std::string fileName) {
logger_->Log(INFO, "Building SURF reference library with %s...\n", fileName);
double tt = (double) -cvGetTickCount();
// parse library file
TiXmlDocument *doc = new TiXmlDocument(fileName.c_str());
const char dlmtr = '/';
size_t pos = fileName.rfind(dlmtr);
string dirName = pos == string::npos ? "" : fileName.substr(0, pos) + dlmtr;
doc->LoadFile();
TiXmlNode *root = doc->FirstChild("images");
TiXmlNode *child = NULL;
while (child = root->IterateChildren(child)) {
if (child->Type() == TiXmlNode::TINYXML_COMMENT) continue;
TiXmlElement *element = child->ToElement();
ImageData *data = new ImageData();
// TODO: add error checking
// TODO: check for null descriptions
element->QueryIntAttribute("id", &(data->id));
data->name = string(element->Attribute("name"));
logger_->Log(INFO, "Reading %s...", data->name.c_str());
data->path = dirName + string(element->Attribute("path"));
TiXmlText *description = child->FirstChild()->ToText();
data->description = string(description->Value());
IplImage *tmp = cvLoadImage((data->path).c_str(), CV_LOAD_IMAGE_GRAYSCALE);
if (tmp == NULL) {
logger_->Log(ERR, "Unable to cvLoadImage for %s", data->name.c_str());
} else {
// resize the image
data->image = resizeImage(tmp, params_.image_width, params_.image_height, true);
referenceData_.push_back(data);
cvReleaseImage(&tmp);
}
}
logger_->Log(INFO, "Finished loading images, now extracting data");
Extract();
logger_->Log(INFO, "Build Time for %d Images = %gm\n",
refKD_.size(), ((tt + cvGetTickCount()) / cvGetTickFrequency()*1000.));
return referenceData_.size();
}
int SURFMatcher::BuildFromList(vector<pair<string, string> > pathTuples) {
logger_->Log(INFO, "Building SURF reference library from list");
double tt = (double) -cvGetTickCount();
vector<pair<string, string> >::const_iterator it;
for (it = pathTuples.begin(); it != pathTuples.end(); ++it) {
ImageData *data = new ImageData();
data->name = it->first;
data->path = it->second;
logger_->Log(INFO, "Loading image %s...", data->name.c_str());
IplImage *tmp = cvLoadImage((data->path).c_str(), CV_LOAD_IMAGE_GRAYSCALE);
if (tmp == NULL) {
logger_->Log(ERR, "Unable to cvLoadImage for %s", data->name.c_str());
} else {
// resize the image
data->image = resizeImage(tmp, params_.image_width, params_.image_height, true);
referenceData_.push_back(data);
cvReleaseImage(&tmp);
}
}
logger_->Log(INFO, "Finished loading images, now extracting data");
Extract();
logger_->Log(INFO, "Build Time for %d Images = %gm\n",
refKD_.size(), ((tt + cvGetTickCount()) / cvGetTickFrequency()*1000.));
return referenceData_.size();
}
// return null if no match, otherwise return image description to display
string SURFMatcher::MatchAgainstLibrary(const char *queryImageName,
const IplImage *queryImage, const CvSeq *queryKeyPoints, const CvSeq *queryDescriptors) const {
logger_->Log(INFO, "Using SURF to match %s to image library", queryImageName);
IplImage *referenceImage = NULL;
double matchPercentage = 0;
vector<int> ptPairs;
int indexBestMatch = -1;
double bestPercentage = 0;
double tt = (double) -cvGetTickCount();
for (int i = 0; i < referenceData_.size(); ++i) {
referenceImage = referenceData_[i]->image;
SURFFeatures_t features = refKD_[i];
ptPairs.clear();
matchPercentage = FlannFindPairs(queryKeyPoints,
queryDescriptors, features.first, features.second, ptPairs);
//logger_->Log(VERBOSE, "\t%s matched %2.2f%% with %s",
// queryImageName, matchPercentage, referenceData_[i]->name.c_str());
if (matchPercentage > bestPercentage) {
indexBestMatch = i;
bestPercentage = matchPercentage;
}
}
// time in secomds
double match_time = (tt + cvGetTickCount()) / (cvGetTickFrequency() * 1e6);
logger_->Log(INFO, "Match Time for %s = %g s", queryImageName, match_time);
if (indexBestMatch >= 0 && indexBestMatch < referenceData_.size() && bestPercentage >= params_.match_threshold) {
logger_->Log(INFO, "%s was best matched with %s\n",
queryImageName, referenceData_[indexBestMatch]->name.c_str());
if (stats_table_) {
stats_table_->WriteRow(queryImageName, bestPercentage, referenceData_[indexBestMatch]->name, match_time);
}
return referenceData_[indexBestMatch]->name;
}
logger_->Log(INFO, "Unable to find a match for %s\n", queryImageName);
if (stats_table_) {
stats_table_->WriteRow(queryImageName, bestPercentage, "NONE", match_time);
}
return "-1";
}
// object = query
// image = reference image
double SURFMatcher::FlannFindPairs(const CvSeq*, const CvSeq* objectDescriptors,
const CvSeq*, const CvSeq* imageDescriptors, vector<int>& ptpairs) const {
int length = (int) (objectDescriptors->elem_size / sizeof(float));
cv::Mat m_object(objectDescriptors->total, length, CV_32F);
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
// copy descriptors
CvSeqReader obj_reader;
float* obj_ptr = m_object.ptr<float>(0);
cvStartReadSeq(objectDescriptors, &obj_reader);
for (int i = 0; i < objectDescriptors->total; i++) {
const float* descriptor = (const float*) obj_reader.ptr;
CV_NEXT_SEQ_ELEM(obj_reader.seq->elem_size, obj_reader);
memcpy(obj_ptr, descriptor, length*sizeof(float));
obj_ptr += length;
}
CvSeqReader img_reader;
float* img_ptr = m_image.ptr<float>(0);
cvStartReadSeq(imageDescriptors, &img_reader);
for (int i = 0; i < imageDescriptors->total; i++) {
const float* descriptor = (const float*) img_reader.ptr;
CV_NEXT_SEQ_ELEM(img_reader.seq->elem_size, img_reader);
memcpy(img_ptr, descriptor, length*sizeof(float));
img_ptr += length;
}
// find nearest neighbors using FLANN
cv::Mat m_indices(objectDescriptors->total, 2, CV_32S);
cv::Mat m_dists(objectDescriptors->total, 2, CV_32F);
cv::flann::Index flann_index(m_image, cv::flann::KDTreeIndexParams(4)); // using 4 randomized kdtrees
flann_index.knnSearch(m_object, m_indices, m_dists, 2, cv::flann::SearchParams(64)); // maximum number of leafs checked
double numMatched = 0.f;
int* indices_ptr = m_indices.ptr<int>(0);
float* dists_ptr = m_dists.ptr<float>(0);
for (int i = 0; i < m_indices.rows; ++i) {
if (dists_ptr[2*i] < 0.6*dists_ptr[2*i+1]) {
ptpairs.push_back(i);
ptpairs.push_back(indices_ptr[2*i]);
++numMatched;
}
}
// TODO: SUPER NAIVE match :( We should care more about the concentration of the match I think rather than percentage matched
return (numMatched / objectDescriptors->total) * 100;
}
// object = the query image
// image = scene in which to find 'object'
double SURFMatcher::FindPairs(const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
const CvSeq* imageKeypoints, const CvSeq* imageDescriptors, vector<int>& ptpairs) const {
int i;
CvSeqReader reader, kreader;
cvStartReadSeq(objectKeypoints, &kreader);
cvStartReadSeq(objectDescriptors, &reader);
ptpairs.clear();
double numMatched = 0.;
for (i = 0; i < objectDescriptors->total; i++) {
const CvSURFPoint* kp = (const CvSURFPoint*) kreader.ptr;
const float* descriptor = (const float *) reader.ptr;
CV_NEXT_SEQ_ELEM(kreader.seq->elem_size, kreader);
CV_NEXT_SEQ_ELEM(reader.seq->elem_size, reader);
int nearest_neighbor = NaiveNearestNeighbor(descriptor, kp->laplacian, imageKeypoints, imageDescriptors);
if (nearest_neighbor >= 0) {
ptpairs.push_back(i);
ptpairs.push_back(nearest_neighbor);
++numMatched;
}
}
// TODO: SUPER NAIVE match :( We should care more about the concentration of the match I think rather than percentage matched
return (numMatched / objectDescriptors->total) * 100;
}
// Using brute force
// vec = the query descriptor
// model_* = the library descriptors to match against.
int SURFMatcher::NaiveNearestNeighbor(const float* vec, int laplacian,
const CvSeq* model_keypoints,
const CvSeq* model_descriptors) const {
int length = (int) (model_descriptors->elem_size / sizeof(float));
int i, neighbor = -1;
double d, dist1 = 1e6, dist2 = 1e6;
CvSeqReader reader, kreader;
cvStartReadSeq(model_keypoints, &kreader, 0);
cvStartReadSeq(model_descriptors, &reader, 0);
for (i = 0; i < model_descriptors->total; i++) {
const CvSURFPoint* kp = (const CvSURFPoint*) kreader.ptr;
const float* mvec = (const float*) reader.ptr;
CV_NEXT_SEQ_ELEM(kreader.seq->elem_size, kreader);
CV_NEXT_SEQ_ELEM(reader.seq->elem_size, reader);
if (laplacian != kp->laplacian)
continue;
d = CompareSURFDescriptors(vec, mvec, dist2, length);
if (d < dist1) {
dist2 = dist1;
dist1 = d;
neighbor = i;
} else if (d < dist2) {
dist2 = d;
}
}
return (dist1 < 0.6*dist2) ? neighbor : -1;
}
double SURFMatcher::CompareSURFDescriptors( const float* d1, const float* d2, double best, int length ) const {
double total_cost = 0;
assert( length % 4 == 0 );
for( int i = 0; i < length; i += 4 )
{
double t0 = d1[i] - d2[i];
double t1 = d1[i+1] - d2[i+1];
double t2 = d1[i+2] - d2[i+2];
double t3 = d1[i+3] - d2[i+3];
total_cost += t0*t0 + t1*t1 + t2*t2 + t3*t3;
if( total_cost > best )
break;
}
return total_cost;
}
// Save image to disk with query located in reference image as well as the query
// image on top of the reference image with lines drawn between them.
void SURFMatcher::Visualize(string dirName, string queryImageName,
IplImage *queryImage, CvSeq *queryKeyPoints, CvSeq *queryDescriptors) const {
logger_->Log(INFO, "Visualizing match for %s", queryImageName.c_str());
CvPoint src_corners[4] = {{0,0},
{queryImage->width, 0},
{queryImage->width, queryImage->height},
{0, queryImage->height}};
CvPoint dst_corners[4];
IplImage *correspond, *referenceImage;
// TODO: Also assumes we have as many reference images as we supplied in the text file
// Very presumptious and prone to error... UGHHH WHY DOESN'T IT STRIP THE EXTENSION
size_t end = queryImageName.rfind('.');
size_t begin = queryImageName.rfind('/');
string queryName = queryImageName.substr(begin+1, end);
string out_base = dirName + "/res_" + queryName + "_";
double tt = (double) -cvGetTickCount();
for (int i = 0; i < referenceData_.size(); ++i) {
referenceImage = referenceData_[i]->image;
correspond = cvCreateImage(cvSize(referenceImage->width, queryImage->height + referenceImage->height), 8, 1);
cvSetImageROI(correspond, cvRect(0, 0, queryImage->width, queryImage->height));
cvCopy(queryImage, correspond);
cvSetImageROI(correspond, cvRect(0, queryImage->height, correspond->width, correspond->height));
cvCopy(referenceImage, correspond);
cvResetImageROI(correspond);
SURFFeatures_t features = refKD_[i];
// Draw a square in the training image corresponding to the query
vector<int> ptpairs;
FindPairs(queryKeyPoints, queryDescriptors, features.first, features.second, ptpairs);
if (LocatePlanarObject(queryKeyPoints, queryDescriptors, features.first, features.second, ptpairs,
src_corners, dst_corners)) {
for (int c = 0; c < 4; ++c) {
CvPoint r1 = dst_corners[c%4];
CvPoint r2 = dst_corners[(c+1)%4];
cvLine(correspond, cvPoint(r1.x, r1.y + queryImage->height),
cvPoint(r2.x, r2.y + queryImage->height ), colors[8], 2);
}
}
ConnectMatchingFeatures(correspond, queryKeyPoints, features.first, ptpairs, queryImage->height);
string out_name = out_base + referenceData_[i]->name + ".jpg";
if (!cvSaveImage(out_name.c_str(), correspond)) {
logger_->Log(WARNING, "Could not save image: %s", out_name.c_str());
}
}
// TOADD
if (correspond != NULL) {
cvReleaseImage(&correspond);
}
logger_->Log(INFO, "Visualization Time for %s = %gm\n",
queryImageName.c_str(), ((tt + cvGetTickCount()) / cvGetTickFrequency()*1000.));
}
// Draw lines between matching features of object and image, where
// object is presumed to be in image. correspond is the combo of the object pic on top of
// the image pic. So the lines are drawn between those 2 pics.
void SURFMatcher::ConnectMatchingFeatures(IplImage *correspond, const CvSeq *objectKeypoints,
const CvSeq *imageKeypoints, const vector<int>& ptpairs, int objectHeight) const {
for (int i = 0; i < (int) ptpairs.size(); i += 2) {
CvSURFPoint* r1 = (CvSURFPoint*)cvGetSeqElem(objectKeypoints, ptpairs[i]);
CvSURFPoint* r2 = (CvSURFPoint*)cvGetSeqElem(imageKeypoints, ptpairs[i+1]);
cvLine(correspond, cvPointFrom32f(r1->pt),
cvPoint(cvRound(r2->pt.x), cvRound(r2->pt.y + objectHeight)), colors[8]);
}
}
int SURFMatcher::LocatePlanarObject(const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
const CvSeq* imageKeypoints, const CvSeq* imageDescriptors,
const vector<int>& ptpairs, const CvPoint src_corners[4], CvPoint dst_corners[4]) const {
double h[9];
CvMat _h = cvMat(3, 3, CV_64F, h);
vector<CvPoint2D32f> pt1, pt2;
CvMat _pt1, _pt2;
int i, n;
n = ptpairs.size()/2;
if( n < 4 )
return 0;
pt1.resize(n);
pt2.resize(n);
for( i = 0; i < n; i++ )
{
pt1[i] = ((CvSURFPoint*)cvGetSeqElem(objectKeypoints,ptpairs[i*2]))->pt;
pt2[i] = ((CvSURFPoint*)cvGetSeqElem(imageKeypoints,ptpairs[i*2+1]))->pt;
}
_pt1 = cvMat(1, n, CV_32FC2, &pt1[0] );
_pt2 = cvMat(1, n, CV_32FC2, &pt2[0] );
if( !cvFindHomography( &_pt1, &_pt2, &_h, CV_RANSAC, 5 ))
return 0;
for( i = 0; i < 4; i++ )
{
double x = src_corners[i].x, y = src_corners[i].y;
double Z = 1./(h[6]*x + h[7]*y + h[8]);
double X = (h[0]*x + h[1]*y + h[2])*Z;
double Y = (h[3]*x + h[4]*y + h[5])*Z;
dst_corners[i] = cvPoint(cvRound(X), cvRound(Y));
}
return 1;
}
|
[
"[email protected]"
] |
[
[
[
1,
434
]
]
] |
55355d648a0ddab9b7caacc657c5ff6133a68c16
|
38702f23d56e6d7f2261a0c2876b1a29e47e38fe
|
/File.cpp
|
3fc42dfa8b287e6e9bf0a72182859a27fab2e4e6
|
[] |
no_license
|
flyfire/listfile
|
0084af270ead090736b1b66ee4cf6a99ca65fe90
|
537dfe2a0b98de19574a888a1769968a134f0257
|
refs/heads/master
| 2016-09-10T09:09:36.670579 | 2010-10-31T11:25:41 | 2010-10-31T11:25:41 | 32,198,169 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,581 |
cpp
|
#include <sstream>
#include <cstring>
#include "File.h"
File::File() {
File(".");
}
File::File(const char* pname IN) {
if (pname == NULL) {
throw "Illegal Argument: the pathname must not be NULL";
}
int size = GetFullPathName(pname, 0, NULL, NULL);
char* fullpath = new char[size];
if (GetFullPathName(pname, size, fullpath, NULL)) {
if (fullpath[size - 2] == separator && fullpath[size - 3] != ':') {
fullpath[size - 2] = 0;
}
pathname = fullpath;
attribute = GetFileAttributes(fullpath);
if (attribute == INVALID_FILE_ATTRIBUTES) {
attribute = FILE_ATTRIBUTE_SYSTEM;
}
} else {
pathname = "";
attribute = 0x0;
}
delete fullpath;
}
File::File(const File& file IN) {
assign(file);
}
void File::assign(const File& file IN) {
pathname = file.pathname;
attribute = file.attribute;
}
File& File::operator=(const File& file IN) {
assign(file);
return *this;
}
File::~File() {
}
bool File::exists() {
return pathname != "";
}
bool File::isExecutable() {
const char* extension = getExtension().c_str();
char pathext[MAX_PATH] = {0};
GetEnvironmentVariable("PATHEXT", pathext, MAX_PATH);
stringstream ss(pathext);
char ext[MAX_PATH];
while (ss.getline(ext, sizeof(ext), ';')) {
if (!stricmp(extension, ext)) {
return true;
}
}
return false;
}
bool File::isLink() {
return getExtension() == ".lnk";
}
bool File::isDirectory() {
return (attribute & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
bool File::isHidden() {
return (attribute & FILE_ATTRIBUTE_HIDDEN) != 0;
}
bool File::isReadonly() {
return (attribute & FILE_ATTRIBUTE_READONLY) != 0;
}
bool File::isSystem() {
return (attribute & FILE_ATTRIBUTE_SYSTEM) != 0;
}
DWORD File::getAttribute() {
return attribute;
}
string File::getAbsolutePath() {
return pathname;
}
string File::getName() {
int pos = pathname.find_last_of(separator);
return pos != string::npos? pathname.substr(pos + 1): "";
}
string File::getExtension() {
string filename = getName();
int pos = filename.find_last_of(".");
return pos != string::npos? filename.substr(pos): "";
}
bool File::list(vector<string>& filenames OUT) {
int sizeCurrentDir = GetCurrentDirectory(0, NULL);
char* dirBackup = new char[sizeCurrentDir];
GetCurrentDirectory(sizeCurrentDir, dirBackup);
SetCurrentDirectory(pathname.c_str());
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile("*", &ffd);
if (hFind == INVALID_HANDLE_VALUE) {
return false;
}
do {
// ignore current directory & parent directory
if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName, "..")) {
continue;
}
char fullpath[MAX_PATH] = {0};
GetFullPathName(ffd.cFileName, MAX_PATH, fullpath, NULL);
filenames.push_back(fullpath);
} while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
SetCurrentDirectory(dirBackup);
delete[] dirBackup;
return true;
}
bool File::listFiles(vector<File>& files OUT) {
vector<string> filenames;
if (!list(filenames)) {
return false;
}
vector<string>::iterator fn = filenames.begin();
while (fn != filenames.end()) {
files.push_back(File(fn->c_str()));
fn++;
}
return true;
}
|
[
"redraiment@17e98cdd-3a08-1915-22bd-2711ff92a4fa"
] |
[
[
[
1,
150
]
]
] |
7da8bbbe51bba6e750dda8d4b669eec1de89849d
|
6114db1d18909e8d38365a81ab5f0b1221c6d479
|
/Sources/ExpressionParser/Stdafx.cpp
|
e3b53b23199956e7bfb4252507c9211ca516f1f2
|
[] |
no_license
|
bitmizone/asprofiled
|
c6bf81e89037b68d0a7c8a981be3cd9c8a4db7c7
|
b54cb47b1d3ee1ce6ad7077960394ddd5578c0ff
|
refs/heads/master
| 2021-01-10T14:14:42.048633 | 2011-06-21T11:38:26 | 2011-06-21T11:38:26 | 48,724,442 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 212 |
cpp
|
// stdafx.cpp : source file that includes just the standard includes
// ExpressionParser.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
|
[
"adamsonic@cf2cc628-70ab-11de-90d8-1fdda9445408"
] |
[
[
[
1,
5
]
]
] |
65251c2c111558d45213a2c923cfc7842ad3dee1
|
80716d408715377e88de1fc736c9204b87a12376
|
/OnSipCommon/StateMachine.h
|
663e23a5db8d374904b589f4de14c6aae06851b1
|
[] |
no_license
|
junction/jn-tapi
|
b5cf4b1bb010d696473cabcc3d5950b756ef37e9
|
a2ef6c91c9ffa60739ecee75d6d58928f4a5ffd4
|
refs/heads/master
| 2021-03-12T23:38:01.037779 | 2011-03-10T01:08:40 | 2011-03-10T01:08:40 | 199,317 | 2 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 19,337 |
h
|
#ifndef STATE_MACHINE_H
#define STATE_MACHINE_H
#include "onsip.h"
#include "logger.h"
// Class wrapper around OnStateChangeReason enum
class StateChangeReason
{
public:
// Reasons why OnStateChange virtual are called
enum eOnStateChangeReason { IsYourEventHandled, NewHandlerCreated, RemovedHandler, PollHandler, AddedHandler };
};
// An external interface that can be implemented
// in order to retrieve external notifications of state
// changes within a state machine
template <class Tstate,class TstateData>
class IStateNotify
{
public:
virtual void StateChange(Tstate state,TstateData stateData,StateChangeReason::eOnStateChangeReason reason) =0;
};
// A container of IStateNotify instances to be
// notified when a OnStatechange occurs within a state machine.
template <class Tstate,class TstateData>
class IStateNotifyContainer
{
private:
CheckThread _checkThread;
std::list< IStateNotify<Tstate,TstateData> * > m_stateNotifys;
public:
// Add a IStateNotify to be notified for a OnStateChange notify within
// a state machine.
// The iStateNotify instance passed is not owned by this object!
// It should be cleared if this object is being released
void AddIStateNotify( IStateNotify<Tstate,TstateData>* iStateNotify )
{
Logger::log_debug( _T("IStateNotifyContainer::AddIStateNotify %p sz=%d"), iStateNotify, m_stateNotifys.size() );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
m_stateNotifys.push_back(iStateNotify);
}
// Clear all IStateNotifys from our list to be notified
void Clear()
{
Logger::log_debug( _T("IStateNotifyContainer::Clear sz=%d"), m_stateNotifys.size() );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
m_stateNotifys.clear();
}
void NotifyStateChange(Tstate state,TstateData stateData,StateChangeReason::eOnStateChangeReason reason)
{
Logger::log_debug( _T("IStateNotifyContainer::NotifyStateChange state=%d"), state );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
std::list< IStateNotify<Tstate,TstateData> * >::iterator iter = m_stateNotifys.begin();
while ( iter != m_stateNotifys.end() )
{
(*iter)->StateChange(state,stateData,reason);
iter++;
}
}
};
// Template class for internal object held within the state machine.
// Keeps track of a state and the latest EventData
//
// TState = expected to be an enum that represents the state
// TeventData = class that is "new" and "deleted" that represents
// event data that is "signaled" to the state machine to transition
// it from state to state
// StateData = class or struct that represents additional state data
// that is maintained by class. class/struct is required to have
// operator= overload so that state data can be copied, as
// well as a default constructor that will init default state data instance;
template <class Tstate,class TeventData,class TstateData>
class StateItem
{
private:
Tstate m_state;
std::auto_ptr<TeventData> m_eventData;
TstateData m_stateData;
CheckThread _checkThread;
DWORD m_lastStateChange; // Last time the state has been updated
public:
StateItem(Tstate state,TeventData* eventData)
{
Logger::log_trace("StateItem::StateItem this=%x state=%d eventData=%x",this,state,eventData);
m_state = state;
m_eventData.reset(eventData);
m_lastStateChange = GetTickCount();
}
StateItem(Tstate state,TeventData* eventData,TstateData& stateData)
{
Logger::log_trace("StateItem::StateItem this=%x state=%d eventData=%x stateData",this,state,eventData);
m_state = state;
m_eventData.reset(eventData);
m_stateData = stateData;
m_lastStateChange = GetTickCount();
}
// Reset the CheckThread to current executing thread.
// This is to check proper thread operation,
// e.g. do not access single thread objects from multi-threads.
// StateHandler may be reset when added to StateMachine
// due to it may have been created initially in separate thread.
void ResetCheckThread()
{
Logger::log_debug(_T("StateItem::ResetCheckThread") );
_checkThread.Reset();
}
void assignNewState(Tstate state,TeventData* eventData)
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
Logger::log_debug("StateItem::assignNewState this=%x state=%d eventData=%x",this,state,eventData);
m_state = state;
m_eventData.reset(eventData);
m_lastStateChange = GetTickCount();
}
void assignNewState(Tstate state,TeventData* eventData,TstateData& stateData)
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
Logger::log_debug("StateItem::assignNewState this=%x state=%d eventData=%x stateData",this,state,eventData);
m_state = state;
m_eventData.reset(eventData);
m_stateData = stateData;
m_lastStateChange = GetTickCount();
}
// # of msecs since the last time there was a state change
long MsecsSinceLastStateChange()
{ return (long) (GetTickCount() - m_lastStateChange); }
Tstate getState()
{ return m_state; }
TeventData* getEventData()
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
return m_eventData.get();
}
TstateData& getStateData()
{ return m_stateData; }
};
//*******************************************************************
//*******************************************************************
// TODO:: Change StateItem to use this??
// Simple class that maintains the association of the TState and TstateData
template <class Tstate,class TstateData>
class StateAndStateData
{
public:
Tstate m_state; // considered to be an enum
TstateData m_stateData; // considered to be a struct item with operator= overload
StateAndStateData() { }
StateAndStateData(Tstate state,TstateData stateData)
{ m_state = state; m_stateData = stateData; };
const StateAndStateData& operator=(const StateAndStateData& stateAndStateData)
{
if ( &stateAndStateData == this )
return *this;
m_state = stateAndStateData.m_state;
m_stateData = stateAndStateData.m_stateData;
}
};
//*******************************************************************
//*******************************************************************
template <class Tstate,class TeventData,class TstateData> class StateMachine;
// Template class for a State Handler, an object that
// can accept events and handle the logic from one state
// to another. A StateHandler will keep track of the
// current state for its implementation.
//
// There are multiple StateHandlers within an instance of the StateMachine.
// The StateHandler needs to recognize the EventData that is specific
// for its state flow.
template <class Tstate,class TeventData,class TstateData>
class StateHandler
{
protected:
std::auto_ptr< StateItem<Tstate,TeventData,TstateData> > m_currentState;
CheckThread _checkThread;
public:
// Reset the CheckThread to current executing thread.
// This is to check proper thread operation,
// e.g. do not access single thread objects from multi-threads.
// StateHandler may be reset when added to StateMachine
// due to it may have been created initially in separate thread.
void ResetCheckThread()
{
Logger::log_debug(_T("StateHandler::ResetCheckThread") );
_checkThread.Reset();
if ( m_currentState.get() != NULL )
m_currentState->ResetCheckThread();
}
virtual bool IsYourEvent(StateMachine<Tstate,TeventData,TstateData> *pStateMachine, TeventData *) = 0;
virtual bool IsStillExist() = 0;
// Poll into the state machine. Allows update StateHandler to determine
// if there are any changes needed. Return true if a state
// change or state data change did occur.
virtual bool PollStateHandler()
{ return false; }
StateHandler(Tstate m_state,TeventData *eventData)
{
m_currentState.reset( new StateItem<Tstate,TeventData,TstateData>(m_state,eventData) );
}
StateHandler(Tstate m_state,TeventData *eventData,TstateData& stateData)
{
m_currentState.reset( new StateItem<Tstate,TeventData,TstateData>(m_state,eventData,stateData) );
}
virtual ~StateHandler() { }
Tstate getCurrentState()
{ return m_currentState->getState(); }
bool IsState(Tstate state)
{ return state == getCurrentState(); }
TeventData* getCurrentEvent()
{ return m_currentState->getEventData(); }
TstateData& getCurrentStateData()
{ return m_currentState->getStateData(); }
// # of msecs since the last time there was a state change
long MsecsSinceLastStateChange()
{ return m_currentState->MsecsSinceLastStateChange(); }
void assignNewState(Tstate state,TeventData *eventData)
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
m_currentState->assignNewState(state,eventData);
}
void assignNewState(Tstate state,TeventData *eventData,TstateData& stateData)
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
m_currentState->assignNewState(state,eventData,stateData);
}
};
//*******************************************************************
//*******************************************************************
// Main StateMachine implementation.
// Manages multiple StateHandlers. Accepts events via the SignalEvent(EventData *)
// method. It will ask each of the existing StateHandlers if the eventData
// is for its state. If not, then will call virtual UnknownEvent
// where the dervice class should return a new StateHandler for this event,
// or return NULL if not recognized.
template <class Tstate,class TeventData,class TstateData> class StateMachine
{
private:
// List of current StateHandlers that are active
std::list< StateHandler<Tstate,TeventData,TstateData> * > m_stateHandlers;
// List of interaces to notify
// Check with each StateHandler if they still are valid and exist.
// StateHandlers may be removed during this check
void _checkStateHandlersExist()
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
// Logger::log_trace( _T("StateMachine::_checkStateHandlersExist") );
// Ask each stateHandler if they are still valid
std::list< StateHandler<Tstate,TeventData,TstateData> *>::iterator iter = m_stateHandlers.begin();
while ( iter != m_stateHandlers.end() )
{
// Logger::log_trace("StateMachine::_checkStateHandlersExist this=%x stillValid=%x",this,iter);
// It no longer exists, then remove this handler
if ( !(*iter)->IsStillExist() )
{
Logger::log_debug("StateMachine::_checkStateHandlersExist this=%x notValid=%x being removed",this,iter);
// Assume state changed, so do virtual notify
OnStateChange( (*iter)->getCurrentState(), (*iter)->getCurrentStateData(), StateChangeReason::RemovedHandler );
// Remove the StateHandler and iterate to next in the list
StateHandler<Tstate,TeventData,TstateData>* evt = *iter;
iter = m_stateHandlers.erase( iter );
delete evt;
}
else
{
iter++;
}
}
}
protected:
CheckThread _checkThread;
IStateNotifyContainer<Tstate,TstateData> m_iStateNotifys;
// Virtual called if a TeventData does not belong to any of the current StateHandlers.
// Return new StateHandler if one should be created to handle the event,
// else return null
virtual StateHandler<Tstate,TeventData,TstateData> *UnknownEvent(TeventData *eventData) = 0;
// Virtual notify that either the state has changed or the state data has changed
virtual void OnStateChange(Tstate state,TstateData& stateData,StateChangeReason::eOnStateChangeReason reason)
{
Logger::log_debug(_T("StateMachine::OnStateChange state=%d reason=%d"),state,reason);
// Pass on event to any external notifies that were added
m_iStateNotifys.NotifyStateChange(state,stateData,reason);
}
public:
virtual ~StateMachine()
{
Logger::log_debug(_T("StateMachine::~StateMachine"));
RemoveStateHandlers();
}
// Add a IStateNotify to be notified for a OnStateChange notify within
// a state machine.
// The iStateNotify instance passed is not owned by this object!
// It should be cleared if this object is being released
void AddIStateNotify( IStateNotify<Tstate,TstateData>* iStateNotify )
{
Logger::log_debug( _T("StateMachine::AddIStateNotify") );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
// Add the IStateNotify to our container
m_iStateNotifys.AddIStateNotify( iStateNotify );
}
// Clear all IStateNotifys from our list to be notified
void ClearIStateNotifys()
{
Logger::log_debug( _T("StateMachine::ClearIStateNotifys") );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
m_iStateNotifys.Clear();
}
// Add a new StateHandler to the state machine.
// The ownership and lifetime will be passed to this state machine,
// so be sure to allocate it using "new". It will be deleted when
// removed from the state machine.
void AddStateHandler( StateHandler<Tstate,TeventData,TstateData> *pStateHandler, bool bNotifyState=false )
{
Logger::log_debug( _T("StateMachine::AddStateHandler handler=%x bNotifyState=%d"), pStateHandler, bNotifyState );
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
// Reset the CheckThread for the StateHandler since it now will be running under the stateMachine thread
pStateHandler->ResetCheckThread();
m_stateHandlers.push_back( pStateHandler );
// If notity StateChange on new handler
if ( bNotifyState )
OnStateChange( pStateHandler->getCurrentState(), pStateHandler->getCurrentStateData(), StateChangeReason::AddedHandler );
}
// Remove all the state handlers
void RemoveStateHandlers()
{
Logger::log_debug(_T("StateMachine::RemoveStateHandlers sz=%d"),m_stateHandlers.size());
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
std::list< StateHandler<Tstate,TeventData,TstateData> *>::iterator iter = m_stateHandlers.begin();
while ( iter != m_stateHandlers.end() )
{
// Delete the state handler
delete (*iter);
iter++;
}
m_stateHandlers.clear();
}
// Poll all state handlers, allows them to signal change in state or state data
virtual void PollStateHandlers()
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
// Logger::log_trace(_T("StateMachine::PollStateHandlers enter"));
// Go through all state handlers looking for one that owns the event
std::list< StateHandler<Tstate,TeventData,TstateData> *>::iterator iter = m_stateHandlers.begin();
while ( iter != m_stateHandlers.end() )
{
// Logger::log_trace("StateMachine::PollStateHandlers this=%x checkHandler=%x",this,iter);
if ( (*iter)->PollStateHandler() )
{
Logger::log_debug("StateMachine::PollStateHandlers this=%x checkHandler=%x changed",this,iter);
// Notify state changed
OnStateChange( (*iter)->getCurrentState(), (*iter)->getCurrentStateData(), StateChangeReason::PollHandler );
break;
}
iter++;
}
// Check to see if any state handlers are no longer valid and should be removed.
_checkStateHandlersExist();
// Logger::log_trace(_T("StateMachine::PollStateHandlers exit"));
}
// Returns a list of all State and StateData for all handlers in the StateMachine.
std::list< StateAndStateData<Tstate,TstateData> > GetAllStates()
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
std::list< StateAndStateData<Tstate,TstateData> > ret;
// iterate through list of active state handlers
std::list< StateHandler<Tstate,TeventData,TstateData> * >::iterator iter = m_stateHandlers.begin();
while ( iter != m_stateHandlers.end() )
{
StateHandler<Tstate,TeventData,TstateData> *pStateHandler = *iter;
StateAndStateData<Tstate,TstateData> item( pStateHandler->getCurrentState(), pStateHandler->getCurrentStateData() );
ret.push_back(item);
iter++;
}
Logger::log_debug(_T("StateMachine::GetAllStates this=%x retsz=%d"), this, ret.size() );
return ret;
}
// Signal the state machine with a new event.
// State Machine will send to any existing state handlers.
// If none accept the event, then will call UnknownEvent virtual
// to see if new StateHandler should be created.
// Will return true if event was handled.
// bDeleteEventData = if true and event was not accepted, then delete eventData
bool SignalEvent(TeventData *eventData,bool bDeleteEventData=true)
{
_checkThread.CheckSameThread(); // Verify we are single threaded for this object
Logger::log_debug("StateMachine::SignalEvent this=%x bDeleteEventData=%d eventData=%x enter", this, bDeleteEventData,eventData);
bool bHandled=false;
// If we got eventData, then ask each StateHandler if it it theirs
if ( eventData != NULL )
{
// Go through all state handlers looking for one that owns the event
std::list< StateHandler<Tstate,TeventData,TstateData> *>::iterator iter = m_stateHandlers.begin();
while ( iter != m_stateHandlers.end() )
{
Logger::log_trace("StateMachine::SignalEvent this=%x checkHandler=%x",this,iter);
if ( (*iter)->IsYourEvent(this,eventData) )
{
Logger::log_debug("StateMachine::SignalEvent this=%x checkHandler=%x accepted",this,iter);
bHandled = true;
// Assume state changed, so do virtual notify
OnStateChange( (*iter)->getCurrentState(), (*iter)->getCurrentStateData(), StateChangeReason::IsYourEventHandled );
break;
}
iter++;
}
// If reached the end and no owners, then call UnknownEvent to see if create a new StateHandler
if ( iter == m_stateHandlers.end() )
{
Logger::log_trace("StateMachine::SignalEvent this=%x call UnknownEvent",this);
// Call virtual and see if we create new StateHandler
StateHandler<Tstate,TeventData,TstateData> *newHandler = UnknownEvent(eventData);
// If handler found, then assume it now owns the event and add to our list
if ( newHandler != NULL )
{
Logger::log_debug("StateMachine::SignalEvent this=%x UnknownEvent handler=%x",this,newHandler);
bHandled = true;
m_stateHandlers.push_back(newHandler);
// Assume state changed, so do virtual notify
OnStateChange( newHandler->getCurrentState(), newHandler->getCurrentStateData(), StateChangeReason::NewHandlerCreated );
}
}
}
Logger::log_debug("StateMachine::SignalEvent this=%x stillValid",this);
// If event not handled, and specified to delete the EventData
if ( !bHandled && bDeleteEventData && eventData != NULL )
{
Logger::log_debug("StateMachine::SignalEvent this=%x notHandled, delete=%x",this,eventData);
delete eventData;
}
// Check to see if any state handlers are no longer valid and should be removed.
_checkStateHandlersExist();
Logger::log_debug("StateMachine::SignalEvent this=%x bHandled=%d exit", this, bHandled);
// Return true if the event was handled
return bHandled;
}
};
#endif
|
[
"Owner@.(none)",
"[email protected]",
"Ron@.(none)"
] |
[
[
[
1,
86
],
[
88,
94
],
[
96,
103
],
[
105,
123
],
[
125,
133
],
[
135,
136
],
[
141,
156
],
[
184,
212
],
[
214,
245
],
[
250,
412
],
[
433,
452
],
[
454,
502
]
],
[
[
87,
87
],
[
95,
95
],
[
104,
104
],
[
124,
124
],
[
134,
134
],
[
137,
140
],
[
157,
181
],
[
246,
249
],
[
413,
432
]
],
[
[
182,
183
],
[
213,
213
],
[
453,
453
]
]
] |
aee4eb8e1c54458ae88ef79e2bebd4d39db029f5
|
6f7850c90ed97967998033df615d06eacfabd5fa
|
/whoisalive/scheme.h
|
01acd2891672b7725acb564ef059a9097eb4fca8
|
[] |
no_license
|
vi-k/whoisalive
|
1145b0af6a2a18e951533b00a2103b000abd570a
|
ae86c1982c1e97eeebc50ba54bf53b9b694078b6
|
refs/heads/master
| 2021-01-10T02:00:28.585126 | 2010-08-23T01:58:45 | 2010-08-23T01:58:45 | 44,526,120 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,233 |
h
|
#ifndef WHO_SCHEME_H
#define WHO_SCHEME_H
#include "ipgui.h"
#include "widget.h"
#include "ipimage.h"
#include "object.h"
#include "../common/my_xml.h"
#include "../common/my_thread.h"
#include "../common/my_ptr.h"
#include <cstddef>
#include <map>
#include <string>
#include <sstream>
#include <fstream>
#include <memory>
#include <boost/ptr_container/ptr_list.hpp>
namespace who {
class window;
class scheme : public widget
{
private:
window *window_;
std::wstring name_;
bool first_activation_;
recursive_mutex scheme_mutex_;
float min_scale_;
float max_scale_;
scoped_ptr<Gdiplus::Bitmap> bitmap_;
scoped_ptr<Gdiplus::Bitmap> background_;
bool show_names_;
bool show_map_;
std::size_t background_hash_;
public:
scheme(server &server, const xml::wptree *pt = NULL);
virtual ~scheme() {}
virtual unique_lock<recursive_mutex> create_lock()
{ return unique_lock<recursive_mutex>(scheme_mutex_); }
inline const wchar_t* get_name()
{ return name_.c_str(); }
inline bool first_activation()
{ return first_activation_; }
inline void set_first_activation(bool f)
{ first_activation_ = f; }
virtual Gdiplus::RectF own_rect();
virtual Gdiplus::RectF client_rect();
virtual void paint_self(Gdiplus::Graphics *canvas);
virtual bool animate_calc();
virtual widget* hittest(float x, float y);
virtual void set_parent(widget *parent) {} /* Блокируем изменение parent'а */
virtual window* get_window()
{ return window_; }
inline void set_window(who::window *window)
{ window_ = window; }
virtual scheme* get_scheme()
{ return this; }
virtual void animate();
void repaint()
{ background_hash_ = 0; }
inline void zoom(float ds, float fix_x, float fix_y, int steps = 2)
{ scale__(new_scale_ * ds, fix_x, fix_y, steps); }
void scale__(float new_scale, float fix_x, float fix_y, int steps = 2);
void align(float scr_w, float scr_h, int steps = 2);
static inline int z(float scale)
{
int _z = 0;
int zi = (int)scale;
while (zi)
{
zi = zi >> 1;
_z++;
}
return _z ? _z : 1;
}
inline bool show_names()
{ return show_names_; }
};
}
#endif
|
[
"victor dunaev ([email protected])",
"[email protected]"
] |
[
[
[
1,
31
],
[
33,
44
],
[
47,
100
]
],
[
[
32,
32
],
[
45,
46
]
]
] |
0047e7962c0650460a95adfb98e17db4ffa6ad55
|
3e69b159d352a57a48bc483cb8ca802b49679d65
|
/tags/release-2005-10-27/3d-viewer/3d_frame.cpp
|
aaa41f7b5839b8b80d94ae41cf3c5dbc869caef7
|
[] |
no_license
|
BackupTheBerlios/kicad-svn
|
4b79bc0af39d6e5cb0f07556eb781a83e8a464b9
|
4c97bbde4b1b12ec5616a57c17298c77a9790398
|
refs/heads/master
| 2021-01-01T19:38:40.000652 | 2006-06-19T20:01:24 | 2006-06-19T20:01:24 | 40,799,911 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,001 |
cpp
|
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_frame.cpp
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
#include "fctsys.h"
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include "bitmaps.h"
#include "id.h"
#define VIEWER_MAIN
#include "3d_viewer.h"
#include "trackball.h"
BEGIN_EVENT_TABLE(WinEDA3D_DrawFrame, wxFrame)
EVT_TOOL_RANGE(ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA3D_DrawFrame::Process_Zoom)
EVT_TOOL_RANGE(ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions)
EVT_MENU(wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame)
EVT_MENU(ID_MENU_SCREENCOPY_PNG, WinEDA3D_DrawFrame::Process_Special_Functions)
EVT_MENU(ID_MENU_SCREENCOPY_JPEG, WinEDA3D_DrawFrame::Process_Special_Functions)
EVT_CLOSE(WinEDA3D_DrawFrame::OnCloseWindow)
END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent,
WinEDA_App *app_parent, const wxString& title ):
wxFrame(parent, DISPLAY3D_FRAME, title,
wxPoint(-1,-1), wxSize(-1,-1) )
/*******************************************************************/
{
m_FrameName = "Frame3D";
m_Canvas = NULL;
m_Parent = parent;
m_ParentAppl = app_parent;
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
// Give it an icon
SetIcon(wxICON(icon_w3d));
GetSettings();
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);
ReCreateMenuBar();
ReCreateHToolbar();
// ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
// Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas(this, -1, gl_attrib );
/* init OpenGL once */
m_Canvas->InitGL();
}
/***********************************************************/
void WinEDA3D_DrawFrame::Exit3DFrame(wxCommandEvent& event)
/***********************************************************/
{
Close(TRUE);
}
/***********************************************************/
void WinEDA3D_DrawFrame::OnCloseWindow(wxCloseEvent & Event)
/***********************************************************/
{
SaveSettings();
if ( m_Parent )
{
m_Parent->m_Draw3DFrame = NULL;
}
Destroy();
}
/****************************************/
void WinEDA3D_DrawFrame::GetSettings(void)
/****************************************/
{
wxString text;
if( m_ParentAppl->m_EDA_Config )
{
text = m_FrameName + "Pos_x";
m_ParentAppl->m_EDA_Config->Read(text, &m_FramePos.x);
text = m_FrameName + "Pos_y";
m_ParentAppl->m_EDA_Config->Read(text, &m_FramePos.y);
text = m_FrameName + "Size_x";
m_ParentAppl->m_EDA_Config->Read(text, &m_FrameSize.x, 600);
text = m_FrameName + "Size_y";
m_ParentAppl->m_EDA_Config->Read(text, &m_FrameSize.y, 400);
}
#ifdef __WXMAC__
// for macOSX, the window must be below system (macOSX) toolbar
if ( m_FramePos.y < GetMBarHeight() ) m_FramePos.y = GetMBarHeight();
#endif
}
/****************************************/
void WinEDA3D_DrawFrame::SaveSettings(void)
/****************************************/
{
wxString text;
if( ! m_ParentAppl->m_EDA_Config || IsIconized() ) return;
m_FrameSize = GetSize();
m_FramePos = GetPosition();
text = m_FrameName + "Pos_x";
m_ParentAppl->m_EDA_Config->Write(text, (long)m_FramePos.x);
text = m_FrameName + "Pos_y";
m_ParentAppl->m_EDA_Config->Write(text, (long)m_FramePos.y);
text = m_FrameName + "Size_x";
m_ParentAppl->m_EDA_Config->Write(text, (long)m_FrameSize.x);
text = m_FrameName + "Size_y";
m_ParentAppl->m_EDA_Config->Write(text, (long)m_FrameSize.y);
}
/***********************************************************/
void WinEDA3D_DrawFrame::Process_Zoom(wxCommandEvent& event)
/***********************************************************/
{
int ii;
switch(event.GetId())
{
case ID_ZOOM_PAGE_BUTT:
for ( ii = 0; ii < 4; ii++ ) g_Parm_3D_Visu.m_Rot[ii] = 0.0;
g_Parm_3D_Visu.m_Zoom = 1.0;
Draw3d_dx = Draw3d_dy = 0;
trackball(g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
break;
case ID_ZOOM_PLUS_BUTT:
g_Parm_3D_Visu.m_Zoom /= 1.2;
if ( g_Parm_3D_Visu.m_Zoom <= 0.01)
g_Parm_3D_Visu.m_Zoom = 0.01;
break;
case ID_ZOOM_MOINS_BUTT:
g_Parm_3D_Visu.m_Zoom *= 1.2;
break;
case ID_ZOOM_REDRAW_BUTT:
break;
default:
return;
}
m_Canvas->DisplayStatus();
m_Canvas->Refresh(FALSE);
}
/************************************************************************/
void WinEDA3D_DrawFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
/************************************************************************/
{
}
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/*******************************************************************************/
{
}
/************************************/
int WinEDA3D_DrawFrame::BestZoom(void)
/************************************/
// Retourne le meilleur zoom
{
return 1;
}
/*******************************************************************/
void WinEDA3D_DrawFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
/*******************************************************************/
{
}
/************************************************************************/
void WinEDA3D_DrawFrame::Process_Special_Functions(wxCommandEvent& event)
/************************************************************************/
{
#define ROT_ANGLE 10.0
switch(event.GetId())
{
case ID_RELOAD3D_BOARD:
NewDisplay();
break;
case ID_ROTATE3D_X_POS:
g_Parm_3D_Visu.m_ROTX += ROT_ANGLE;
break;
case ID_ROTATE3D_X_NEG:
g_Parm_3D_Visu.m_ROTX -= ROT_ANGLE;
break;
case ID_ROTATE3D_Y_POS:
g_Parm_3D_Visu.m_ROTY += ROT_ANGLE;
break;
case ID_ROTATE3D_Y_NEG:
g_Parm_3D_Visu.m_ROTY -= ROT_ANGLE;
break;
case ID_ROTATE3D_Z_POS:
g_Parm_3D_Visu.m_ROTZ += ROT_ANGLE;
break;
case ID_ROTATE3D_Z_NEG:
g_Parm_3D_Visu.m_ROTZ -= ROT_ANGLE;
break;
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
case ID_MENU_SCREENCOPY_PNG:
case ID_MENU_SCREENCOPY_JPEG:
m_Canvas->TakeScreenshot(event);
break;
default:
wxMessageBox(
"WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command");
return;
}
m_Canvas->DisplayStatus();
m_Canvas->Refresh(FALSE);
}
/*****************************************/
void WinEDA3D_DrawFrame::NewDisplay(void)
/*****************************************/
{
m_Canvas->ClearLists();
m_Canvas->InitGL();
m_Canvas->DisplayStatus();
m_Canvas->Refresh(FALSE);
}
|
[
"bokeoa@244deca0-f506-0410-ab94-f4f3571dea26"
] |
[
[
[
1,
260
]
]
] |
8b941be41aba226eb8d283a7274e032977533bac
|
288840a48549582b64d2eb312c2e348d588b278b
|
/src/pktk/DiabloItems.h
|
c13f18412d112fc3822591999476fdcae4c9a404
|
[] |
no_license
|
mikegogulski/Mephbot
|
590672d2cf859b2b125514d4f581b9543894ff46
|
efa1e17a447300b763111f0993a6bc91b6a7b0d4
|
refs/heads/master
| 2016-09-06T02:05:43.197714 | 2011-12-10T20:07:46 | 2011-12-10T20:07:46 | 1,107,469 | 9 | 5 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,947 |
h
|
// DiabloItems.h : interface of the CInvDumpView class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "MString.h"
#include "D2Items.h"
#include "D2MagicAffixes.h"
#include "Mouse.h"
/*
9c 00 = monster drop and come within sight range notice
9c 01 = me pick up from ground and float
9c 03 = stuff is here on ground when you come into range of it
*/
/*
*00 = new item on ground (from monster drop or walk with in range)
*01 = pick up to cursor
02 = player (or me) dropped item to ground
*03 = old item on ground
04 = put into inventory (including stash)
05 = me pick from inv // 9D
06 = player wearing item // 9D
0B = in store
0C = removed from store (e.g., when you buy an item)
0E = put into belt
*/
#define MSG_NEWITEM 0x00
#define MSG_TOCURSOR 0x01
#define MSG_PDROPPED 0x02
#define MSG_OLDITEM 0x03
#define MSG_TOINV 0x04 //9C // this is cube and stash too
#define MSG_FROMINV 0x05
#define MSG_TOWORN 0x06 //9D
//7 - something to do with trading?
#define MSG_FROMWORN 0x08
#define MSG_SWAPWORN 0x09 //9D //swap is to drop one item on top of another
//A
#define MSG_INSTORE 0x0B
#define MSG_BOUGHT 0x0C
#define MSG_SWAPINV 0x0D
#define MSG_TOBELT 0x0E
#define MSG_FROMBELT 0x0F
#define MSG_SWAPBELT 0x10
//11
#define MSG_FROMMERC 0x12
#define MSG_TOSOCKET 0x13 //9D
//14
#define MSG_AUTOPOS 0x15 // when the pots slide down; when item fills socket
// also done when identified
//16
#define MSG_WEAPSWITCH 0x17 //9D
// NPC drop item???? figure out act 5 quests; imbue, socket, personalize
// this field matches the "component" field in the 3 txt files
//weapons.txt
#define TYPE_WEAPON 0x05
//cn ???
// damn!!! The buckler I started with on TestAss is 0x06!?!?!
// must have to do with holding the item or something?
#define TYPE_BOW 0x06 // xbows are 0x05
//armor.txt
#define TYPE_HELM 0x00
#define TYPE_ARMOR 0x01
#define TYPE_SHIELD 0x07
#define TYPE_PHEAD 0x0A // only for necro's perserved heads
//armor.txt -OR- misc.txt
#define TYPE_MISC 0x10 // have to use the isMisc flag to determine if armor or misc
// torch=0x07 in misc.txt, but is unused
// these are in the 9th byte of the 9D message and state what the ownerid is for
#define OACT_PLAYER 0x00 // normal for what player's are wearing
#define OACT_MERC 0x01 // my merc has this item (can't know other mercs :( )
#define OACT_INSOCK 0x04 // ownerid is for the item that this item is socketed in
// general location of item
#define POS_STORED 0x00
#define POS_WORN 0x01
#define POS_BELT 0x02
#define POS_GROUND 0x03
#define POS_TOHAND 0x04
// 5??
#define POS_INSOCKET 0x06
// where on the body this is being worn
#define BODY_NOTWORN 0x00
#define BODY_HEAD 0x01
#define BODY_AMMY 0x02
#define BODY_BODY 0x03
#define BODY_WEAPON 0x04
#define BODY_SHEILD 0x05
#define BODY_LRING 0x06
#define BODY_RRING 0x07
#define BODY_BELT 0x08
#define BODY_BOOT 0x09
#define BODY_GLOVES 0x0A
#define BODY_WEAPON2 0x0B
#define BODY_SHEILD2 0x0C
// if player has item, more specific as to where
#define ITEM_WEARING 0x00 // includes pots in belt
#define ITEM_INV 0x01
#define ITEM_CUBE 0x04
#define ITEM_STASH 0x05
//CN - does that gem thing really work? what about crafted? personalized?
// quality of the item
#define QUAL_CRAFTED 0x00
#define QUAL_INFERIOR 0x01
#define QUAL_NORMAL 0x02
#define QUAL_SUPERIOR 0x03
#define QUAL_MAGIC 0x04
#define QUAL_SET 0x05
#define QUAL_RARE 0x06
#define QUAL_UNIQUE 0x07
/*
00 = AR
01 = Max Dmg
02 = AC
03 = AR + Max Dmg
04 = Durability
05 = Durability + AR
06 = Durability + Max Dmg
07 = Durability + AC
*/
// screen coordinates for picture placement
#define PICPOSLEN 29 // the length in X or Y of one square
//PKTK
#define PICPOS_PKTK_HEADX 91
#define PICPOS_PKTK_HEADY 5
#define PICPOS_PKTK_BODYX 91
#define PICPOS_PKTK_BODYY 76
#define PICPOS_PKTK_BELTX 91
#define PICPOS_PKTK_BELTY 177
#define PICPOS_PKTK_WEAPONX 12
#define PICPOS_PKTK_WEAPONY 9
#define PICPOS_PKTK_HANDX 12
#define PICPOS_PKTK_HANDY 149
#define PICPOS_PKTK_SHIELDX 171
#define PICPOS_PKTK_SHIELDY 9
#define PICPOS_PKTK_FOOTX 171
#define PICPOS_PKTK_FOOTY 149
#define PICPOS_PKTK_RINGLEFTX 64
#define PICPOS_PKTK_RINGLEFTY 217
#define PICPOS_PKTK_AMULETX 104
#define PICPOS_PKTK_AMULETY 217
#define PICPOS_PKTK_RINGRIGHTX 142
#define PICPOS_PKTK_RINGRIGHTY 217
//INV-MANAGER
#define PICPOS_INVX 242
#define PICPOS_INVY 297
#define PICPOS_CUBEX 612
#define PICPOS_CUBEY 168
#define PICPOS_STASHX 24
#define PICPOS_STASHY 11
#define PICPOS_INBELTX 612
#define PICPOS_INBELTY 392
#define PICPOS_HEADX 356
#define PICPOS_HEADY 6
#define PICPOS_BODYX 356
#define PICPOS_BODYY 77
#define PICPOS_BELTX 356
#define PICPOS_BELTY 219
#define PICPOS_WEAPONX 259
#define PICPOS_WEAPONY 39
#define PICPOS_HANDX 261
#define PICPOS_HANDY 179
#define PICPOS_SHIELDX 451
#define PICPOS_SHIELDY 39
#define PICPOS_FOOTX 451
#define PICPOS_FOOTY 179
#define PICPOS_RINGLEFTX 332
#define PICPOS_RINGLEFTY 179
#define PICPOS_AMULETX 370
#define PICPOS_AMULETY 179
#define PICPOS_RINGRIGHTX 410
#define PICPOS_RINGRIGHTY 179
#define PICPOS_INBELTX 612
#define PICPOS_INBELTY 392
#define PICPOS_WEAPON2X 564
#define PICPOS_WEAPON2Y 39
#define PICPOS_SHIELD2X 673
#define PICPOS_SHIELD2Y 39
#define PICPOS_MERCHEADX 88
#define PICPOS_MERCHEADY 255
#define PICPOS_MERCBODYX 87
#define PICPOS_MERCBODYY 327
#define PICPOS_MERCWEAPONX 14
#define PICPOS_MERCWEAPONY 298
#define PICPOS_MERCSHIELDX 156
#define PICPOS_MERCSHIELDY 298
#define PICPOS_MAXWEAPONX 56
#define PICPOS_MAXWEAPONY 112
#define PICPOS_MAXBELTY 28
#define ITEMOWNER_FAILED 0
#define ITEMOWNER_PLAYER 1
#define ITEMOWNER_GROUND 2
#define ITEMOWNER_ERROR 3
// this class stores the info to place items pics in the proper spots
class CDiabloItems
{
public:
// sniffed from the packet
unsigned char m_sPacketMsg[100] ;
BitFields m_ItemBits ;
CString m_sItemName ;
DWORD m_bMessageID, // 9C or 9D
m_bActionID, // what are we doing with this item
m_bMessageLen, // bytes in the message
m_bComponent, // the basic type of item so we can look in the right file
m_bWhere, // wearing/belt/stash/inventory/cube
m_bBodyCode, // body code
m_bItemID, // the ID of the item (for this game only)
m_bPosX, // really just small ints that say where in the cube/stash/inv
m_bPosY,
m_bQuality, // normal/rare/unique ect.
m_bQuantity, // number of arrows or scrolls in tomb, ect.
m_bDurability,
m_bDurabilityMax,
m_bPlayerID ; // pid; will be item# for a socketed gem
// the rest is for displaying the item
CString m_sFileName ; // of the picture for this item
int m_iLeft ; // coordinates to draw this item
int m_iTop ;
int m_iRight ;
int m_iBottom ;
// CPtrList m_InfoLines ; // lines for the info box
int m_iOwnerType ; // on player, on ground, unknown
int m_iSocketsPlaced ;
// CPtrList m_pSocketItems ;
//cn - new
//FLAGS
BOOL m_isMiscItem ;
BOOL m_isEar ;
BOOL m_isInSocket ;
BOOL m_isSocketed ;
BOOL m_hasMagicStats ;
BOOL m_isIdentified ;
BOOL m_isPersonalized ;
BOOL m_isRuneWord ;
BOOL m_isMercItem ;
BOOL m_isStackable ;
BOOL m_hasDurability ;
BOOL m_isIndestructable ;
CString m_sCode ;
CString m_sBaseName ;
DWORD m_iDefense ;
DWORD m_iDurabilityMax ;
DWORD m_iDurabilityCur ;
DWORD m_iQuantity ;
int m_iUsedSockets ;
int m_iNumSockets ;
CString m_ModDesc[25] ;
int m_iNumModDesc ;
CString m_sSpecialName ;
CArmor* m_pArmor ;
CWeapon* m_pWeapon ;
CMisc* m_pMisc ;
// stores debug information in case something about this item pops up
BOOL m_bDebug ;
// CStringList m_sDebugTriggers ;
public:
CDiabloItems() ;
~CDiabloItems() ;
void LoadItemAttributes( const unsigned char *pkt_data) ;
void AddInfoLine( CString sText, int iColor) ;
CString PrintItemHex() ;
void PrintDebug(CString sDebugLine, BOOL bTriggerDebug=TRUE) ;
void DumpDebugInfo() ;
protected:
// CPoint getCoordinates() ;
void CommonByteParsing() ;
void ParseFlags() ;
void ParsePos() ;
void PrintEarInfo() ;
void GetBaseItem() ;
void GetBaseAttributes() ;
void GetImage() ;
void GetMiscAttributes() ;
void GetInferiorAttributes() ;
void GetSuperiorAttributes() ;
void GetMagicAttributes() ;
void GetSetAttributes() ;
void GetRareAttributes() ;
void GetUniqueAttributes() ;
BOOL GetDurability() ;
void GetMagicValues() ;
} ;
CDiabloItems* parseItem( const unsigned char *pkt_data) ;
|
[
"[email protected]"
] |
[
[
[
1,
357
]
]
] |
30e7eef94c566cbf0d62aa55c4d64b753c65d782
|
c5176b11a3c23df5f4d9d9788c325ba05aaef545
|
/src/underTest/linklayer/ieee802154/mac/Ieee802154Mac.h
|
ae893437d3ff51dea622d89c6ba87a10250d63c7
|
[] |
no_license
|
canthefason/inetmanet
|
77711b5e42d6e80a68e132a2f525fa448f71ac19
|
f8f3cdf1d5e139dc62cbc60e5e6e73de7ba30b0f
|
refs/heads/master
| 2021-01-18T07:37:08.633900 | 2009-04-14T22:59:13 | 2009-04-14T22:59:13 | 176,460 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 27,588 |
h
|
#ifndef IEEE_802154_MAC_H
#define IEEE_802154_MAC_H
#include "RadioState.h"
#include "Ieee802154Const.h"
#include "Ieee802154Def.h"
#include "Ieee802154Enum.h"
#include "Ieee802154Field.h"
#include "Ieee802154Link.h"
#include "Ieee802154Frame_m.h"
#include "Ieee802154MacPhyPrimitives_m.h"
#include "Ieee802154NetworkCtrlInfo_m.h"
#include "NotificationBoard.h"
#include "NotifierConsts.h"
#include "IPassiveQueue.h"
/**
* IEEE 802.15.4 Media Access Control (MAC) Layer
* Refer to IEEE Std 802.15.4-2006
*
* @author Feng Chen
* @ingroup macLayer
*/
struct taskPending
{
taskPending()
{
init();
}
inline void init()
{
mcps_data_request = false;
mcps_data_request_STEP = 0;
/*mlme_associate_request = false;
mlme_associate_request_STEP = 0;
mlme_associate_response = false;
mlme_associate_response_STEP = 0;
mlme_disassociate_request = false;
mlme_disassociate_request_STEP = 0;
mlme_orphan_response = false;
mlme_orphan_response_STEP = 0;
mlme_reset_request = false;
mlme_reset_request_STEP = 0;
mlme_rx_enable_request = false;
mlme_rx_enable_request_STEP = 0;
mlme_scan_request = false;
mlme_scan_request_STEP = 0;
mlme_start_request = false;
mlme_start_request_STEP = 0;
mlme_sync_request = false;
mlme_sync_request_STEP = 0;
mlme_sync_request_tracking = false;
mlme_poll_request = false;
mlme_poll_request_STEP = 0;*/
CCA_csmaca = false;
CCA_csmaca_STEP = 0;
RX_ON_csmaca = false;
RX_ON_csmaca_STEP = 0;
}
bool &taskStatus(Ieee802154MacTaskType task)
{
switch (task)
{
case TP_MCPS_DATA_REQUEST:
return mcps_data_request;
/*case TP_MLME_ASSOCIATE_REQUEST:
return mlme_associate_request;
case TP_MLME_ASSOCIATE_RESPONSE:
return mlme_associate_response;
case TP_MLME_DISASSOCIATE_REQUEST:
return mlme_disassociate_request;
case TP_MLME_ORPHAN_RESPONSE:
return mlme_orphan_response;
case TP_MLME_RESET_REQUEST:
return mlme_reset_request;
case TP_MLME_RX_ENABLE_REQUEST:
return mlme_rx_enable_request;
case TP_MLME_SCAN_REQUEST:
return mlme_scan_request;
case TP_MLME_START_REQUEST:
return mlme_start_request;
case TP_MLME_SYNC_REQUEST:
return mlme_sync_request;
case TP_MLME_POLL_REQUEST:
return mlme_poll_request;*/
case TP_CCA_CSMACA:
return CCA_csmaca;
case TP_RX_ON_CSMACA:
return RX_ON_csmaca;
default:
ASSERT(0);
// shutup the compiler.
return RX_ON_csmaca;
}
}
UINT_8 &taskStep(Ieee802154MacTaskType task)
{
switch (task)
{
case TP_MCPS_DATA_REQUEST:
return mcps_data_request_STEP;
/*case TP_MLME_ASSOCIATE_REQUEST:
return mlme_associate_request_STEP;
case TP_MLME_ASSOCIATE_RESPONSE:
return mlme_associate_response_STEP;
case TP_MLME_DISASSOCIATE_REQUEST:
return mlme_disassociate_request_STEP;
case TP_MLME_ORPHAN_RESPONSE:
return mlme_orphan_response_STEP;
case TP_MLME_RESET_REQUEST:
return mlme_reset_request_STEP;
case TP_MLME_RX_ENABLE_REQUEST:
return mlme_rx_enable_request_STEP;
case TP_MLME_SCAN_REQUEST:
return mlme_scan_request_STEP;
case TP_MLME_START_REQUEST:
return mlme_start_request_STEP;
case TP_MLME_SYNC_REQUEST:
return mlme_sync_request_STEP;
case TP_MLME_POLL_REQUEST:
return mlme_poll_request_STEP;*/
case TP_CCA_CSMACA:
return CCA_csmaca_STEP;
case TP_RX_ON_CSMACA:
return RX_ON_csmaca_STEP;
default:
ASSERT(0);
// shutup compiler.
return RX_ON_csmaca_STEP;
}
}
char *taskFrFunc(Ieee802154MacTaskType task)
{
switch (task)
{
case TP_MCPS_DATA_REQUEST:
return mcps_data_request_frFunc;
/*case TP_MLME_ASSOCIATE_REQUEST:
return mlme_associate_request_frFunc;
case TP_MLME_ASSOCIATE_RESPONSE:
return mlme_associate_response_frFunc;
case TP_MLME_DISASSOCIATE_REQUEST:
return mlme_disassociate_request_frFunc;
case TP_MLME_ORPHAN_RESPONSE:
return mlme_orphan_response_frFunc;
case TP_MLME_RESET_REQUEST:
return mlme_reset_request_frFunc;
case TP_MLME_RX_ENABLE_REQUEST:
return mlme_rx_enable_request_frFunc;
case TP_MLME_SCAN_REQUEST:
return mlme_scan_request_frFunc;
case TP_MLME_START_REQUEST:
return mlme_start_request_frFunc;
case TP_MLME_SYNC_REQUEST:
return mlme_sync_request_frFunc;
case TP_MLME_POLL_REQUEST:
return mlme_poll_request_frFunc;*/
default:
ASSERT(0);
// shutup compiler.
//return mlme_poll_request_frFunc;
}
}
//----------------
bool mcps_data_request;
UINT_8 mcps_data_request_STEP;
char mcps_data_request_frFunc[81];
Ieee802154TxOption mcps_data_request_TxOption;
Ieee802154Frame* mcps_data_request_pendPkt;
/*----------------
bool mlme_associate_request;
UINT_8 mlme_associate_request_STEP;
char mlme_associate_request_frFunc[81];
bool mlme_associate_request_SecurityEnable;
UINT_8 mlme_associate_request_CoordAddrMode;
Packet *mlme_associate_request_pendPkt;
//----------------
bool mlme_associate_response;
UINT_8 mlme_associate_response_STEP;
char mlme_associate_response_frFunc[81];
IE3ADDR mlme_associate_response_DeviceAddress;
Packet *mlme_associate_response_pendPkt;
//----------------
bool mlme_disassociate_request;
UINT_8 mlme_disassociate_request_STEP;
char mlme_disassociate_request_frFunc[81];
bool mlme_disassociate_request_toCoor;
Packet *mlme_disassociate_request_pendPkt;
//----------------
bool mlme_orphan_response;
UINT_8 mlme_orphan_response_STEP;
char mlme_orphan_response_frFunc[81];
IE3ADDR mlme_orphan_response_OrphanAddress;
//----------------
bool mlme_reset_request;
UINT_8 mlme_reset_request_STEP;
char mlme_reset_request_frFunc[81];
bool mlme_reset_request_SetDefaultPIB;
//----------------
bool mlme_rx_enable_request;
UINT_8 mlme_rx_enable_request_STEP;
char mlme_rx_enable_request_frFunc[81];
UINT_32 mlme_rx_enable_request_RxOnTime;
UINT_32 mlme_rx_enable_request_RxOnDuration;
double mlme_rx_enable_request_currentTime;
//----------------
bool mlme_scan_request;
UINT_8 mlme_scan_request_STEP;
char mlme_scan_request_frFunc[81];
UINT_8 mlme_scan_request_ScanType;
UINT_8 mlme_scan_request_orig_macBeaconOrder;
UINT_8 mlme_scan_request_orig_macBeaconOrder2;
UINT_8 mlme_scan_request_orig_macBeaconOrder3;
UINT_16 mlme_scan_request_orig_macPANId;
UINT_32 mlme_scan_request_ScanChannels;
UINT_8 mlme_scan_request_ScanDuration;
UINT_8 mlme_scan_request_CurrentChannel;
UINT_8 mlme_scan_request_ListNum;
UINT_8 mlme_scan_request_EnergyDetectList[27];
PAN_ELE mlme_scan_request_PANDescriptorList[27];
//----------------
bool mlme_start_request;
UINT_8 mlme_start_request_STEP;
char mlme_start_request_frFunc[81];
UINT_8 mlme_start_request_BeaconOrder;
UINT_8 mlme_start_request_SuperframeOrder;
bool mlme_start_request_BatteryLifeExtension;
bool mlme_start_request_SecurityEnable;
bool mlme_start_request_PANCoordinator;
UINT_16 mlme_start_request_PANId;
UINT_8 mlme_start_request_LogicalChannel;
//----------------
bool mlme_sync_request;
UINT_8 mlme_sync_request_STEP;
char mlme_sync_request_frFunc[81];
UINT_8 mlme_sync_request_numSearchRetry;
bool mlme_sync_request_tracking;
//----------------
bool mlme_poll_request;
UINT_8 mlme_poll_request_STEP;
char mlme_poll_request_frFunc[81];
UINT_8 mlme_poll_request_CoordAddrMode;
UINT_16 mlme_poll_request_CoordPANId;
IE3ADDR mlme_poll_request_CoordAddress;
bool mlme_poll_request_SecurityEnable;
bool mlme_poll_request_autoRequest;
bool mlme_poll_request_pending;
//----------------*/
bool CCA_csmaca;
UINT_8 CCA_csmaca_STEP;
//----------------
bool RX_ON_csmaca;
UINT_8 RX_ON_csmaca_STEP;
//----------------
};
class INET_API Ieee802154Mac: public cSimpleModule, public INotifiable
{
public:
/**
* @name Constructor and destructor
*/
//@{
Ieee802154Mac();
~Ieee802154Mac();
//@}
/** @brief called by other MAC modules in order to translate host name into MAC address */
IE3ADDR getMacAddr() {return aExtendedAddress;}
protected:
/**
* @name Initializtion functions
*/
//@{
virtual void initialize (int);
virtual void initializeQueueModule ();
virtual int numInitStages () const { return 3; }
//@}
virtual void finish ();
virtual void receiveChangeNotification (int, const cPolymorphic*);
// Functions for starting a WPAN with star topology
virtual void startPANCoor ();
virtual void startDevice ();
/**
* @name Message handling functions
*/
//@{
virtual void handleMessage (cMessage*);
virtual void handleSelfMsg (cMessage*);
virtual void handleUpperMsg (cMessage*);
virtual void handleLowerMsg (cMessage*);
virtual void handleMacPhyPrimitive (int, cMessage*);
virtual void handleBeacon (Ieee802154Frame*);
virtual void handleCommand (Ieee802154Frame*);
virtual void handleData (Ieee802154Frame*);
virtual void handleAck (Ieee802154Frame*);
/** @brief MAC frame filter, return true if frame is filtered out */
virtual bool frameFilter (Ieee802154Frame*);
virtual void sendDown (Ieee802154Frame*);
virtual void constructACK (Ieee802154Frame*);
/** @brief request a msg from IFQueue, if it exists */
virtual void reqtMsgFromIFq ();
//@}
/**
* @name Command handling functions
* for convenience, some MAC commands are implemeted in a tricky way in the model
* these functions are only called directly by ohter MAC modules, instead of via messages exchange like in real world
*/
//@{
/** This function is a part of simplified association process in the model.
* After receiving a beacon from the coordinator for the first time and associating with it,
* each device should call this function of its coordinator to register its MAC address and capability info at the coordinator and get the short MAC address from the return value */
virtual UINT_16 associate_request_cmd (IE3ADDR extAddr, const DevCapability& capaInfo);
/** This function is a part of simplified GTS request process in the model.
* After association, each device should call this function of its PAN Coordinator
* to apply for GTS and get its GTS starting number from the return value */
virtual UINT_8 gts_request_cmd (UINT_16 macShortAddr, UINT_8 length, bool isReceive);
/**
* @name MAC-PHY primitives related functions
*/
//@{
virtual void PLME_SET_TRX_STATE_request (PHYenum state);
virtual void PLME_SET_request (PHYPIBenum attribute);
virtual void PLME_CCA_request ();
virtual void handle_PD_DATA_confirm (PHYenum status);
virtual void handle_PLME_CCA_confirm (PHYenum status);
virtual void handle_PLME_SET_TRX_STATE_confirm (PHYenum status);
//@}
/**
* @name SSCS-MAC primitives related functions
*/
//@{
virtual void MCPS_DATA_request (UINT_8 SrcAddrMode, UINT_16 SrcPANId, IE3ADDR SrcAddr,
UINT_8 DstAddrMode, UINT_16 DstPANId, IE3ADDR DstAddr,
cPacket* msdu, Ieee802154TxOption TxOption);
virtual void MCPS_DATA_confirm (MACenum status);
virtual void MCPS_DATA_indication (Ieee802154Frame*);
//@}
/**
* @name CSMA/CA related functions
*/
//@{
virtual void csmacaEntry (char pktType);// 'c': txBcnCmd; 'u': txBcnCmdUpper; 'd': txData
virtual void csmacaResume ();
virtual void csmacaStart (bool firsttime, Ieee802154Frame* frame = 0, bool ackReq = 0);
virtual void csmacaCancel ();
virtual void csmacaCallBack (PHYenum status); // CSMA-CA success or failure
virtual void csmacaReset (bool bcnEnabled);
virtual bool csmacaCanProceed (simtime_t wtime, bool afterCCA = false);
virtual void csmaca_handle_RX_ON_confirm (PHYenum status); // To be called by handle_PLME_SET_TRX_STATE_confirm
virtual void csmacaTrxBeacon (char trx); // To be called each time that a beacon received or transmitted
virtual simtime_t csmacaAdjustTime (simtime_t wtime);
virtual simtime_t csmacaLocateBoundary (bool toParent, simtime_t wtime);
virtual simtime_t getFinalCAP (char trxType);
//@}
/**
* @name State control and task management functions
*/
//@{
virtual void dispatch (PHYenum pStatus, const char *frFunc,
PHYenum req_state = phy_SUCCESS,
MACenum mStatus = mac_SUCCESS);
virtual void taskSuccess (char type, bool csmacaRes = true);
virtual void taskFailed (char type, MACenum status, bool csmacaRes = true);
virtual void checkTaskOverflow (Ieee802154MacTaskType task);
virtual void FSM_MCPS_DATA_request (PHYenum pStatus = phy_SUCCESS, MACenum mStatus = mac_SUCCESS);
virtual void resetTRX ();
//@}
/**
* @name Timer handling functions
*/
//@{
virtual void handleBackoffTimer ();
virtual void handleDeferCCATimer ();
virtual void handleBcnRxTimer ();
virtual void handleBcnTxTimer ();
virtual void handleAckTimeoutTimer ();
virtual void handleTxAckBoundTimer (); // ACK is sent here
virtual void handleTxCmdDataBoundTimer (); // Cmd or data is sent here
virtual void handleIfsTimer ();
virtual void handleSDTimer (); // shared by txSDTimer and rxSDTimer
virtual void handleFinalCapTimer ();
virtual void handleGtsTimer ();
//@}
/**
* @name GTS related functions
*/
//@{
virtual bool gtsCanProceed ();
virtual void gtsScheduler ();
//@}
/**
* @name Timer starting functions
*/
//@{
virtual void startBackoffTimer (simtime_t);
virtual void startDeferCCATimer (simtime_t);
virtual void startBcnRxTimer ();
virtual void startBcnTxTimer (bool txFirstBcn = false, simtime_t startTime = 0.0);
virtual void startAckTimeoutTimer ();
virtual void startTxAckBoundTimer (simtime_t);
virtual void startTxCmdDataBoundTimer (simtime_t);
virtual void startIfsTimer (bool);
virtual void startTxSDTimer ();
virtual void startRxSDTimer ();
virtual void startGtsTimer (simtime_t);
virtual void startFinalCapTimer (simtime_t);
//@}
/**
* @name Utility functions
*/
//@{
/** @brief check if the packet is sent to its parent or not */
virtual bool toParent (Ieee802154Frame*);
/** @brief calculate byte length of frame of certain type */
virtual int calFrmByteLength (Ieee802154Frame*);
/** @brief calculate byte length of frame header */
virtual int calMHRByteLength (UINT_8);
/** @brief calculate duration of the frame transmitted over wireless channel */
virtual simtime_t calDuration (Ieee802154Frame*);
/** @brief return current bit or symbol rate at PHY*/
virtual double getRate (char);
//@}
// member variables
public:
protected:
/**
* @name User-adjustable MAC parameters
*/
//@{
/** @brief debug switch */
bool m_debug;
/** @brief enable or disable ACK for data transmission in CAP*/
bool ack4Data;
/** @brief enable or disable ACK for data transmission in CFP */
bool ack4Gts;
/** @brief enable or disable security for data frames (TBD) */
bool secuData;
/** @brief enable or disable security for beacon frames (TBD) */
bool secuBeacon;
/** @brief I'm the PAN coordinator or not */
bool isPANCoor;
/** @brief data transfer mode: 1: direct; 2: indirect; 3: GTS */
int dataTransMode;
/** @brief when PAN starts */
simtime_t panStartTime;
/** @brief host name of the PAN coordinator in string */
const char* panCoorName;
/** @brief transmit or receive GTS, only used by devices */
bool isRecvGTS;
/** @brief payload of data frames transmitted in GTS, copied from traffic module */
int gtsPayload;
//@}
/**
* @name Static variables
*/
//@{
/** @brief global counter for generating unique MAC extended address */
static IE3ADDR addrCount;
/** @brief default MAC PIB attributes */
static MAC_PIB MPIB;
//@}
/**
* @name Module gate ID
*/
//@{
int mUppergateIn;
int mUppergateOut;
int mLowergateIn;
int mLowergateOut;
//@}
/** @brief pointer to the NotificationBoard module */
NotificationBoard* mpNb;
/** @brief pointer to the passive queue module */
IPassiveQueue* queueModule;
// for task processing
taskPending taskP;
/** @brief current requested radio state sent to PHY via PLME_SET_TRX_STATE_request */
PHYenum trx_state_req;
/**
* @name Variables for PHY parameters
*/
//@{
/** @brief PHY PIB attributes copied from PHY via notificationboard */
PHY_PIB ppib, tmp_ppib;
/** @brief current bit rate at PHY */
double phy_bitrate;
/** @brief current symbol rate at PHY */
double phy_symbolrate;
//@}
/**
* @name Variables for MAC parameters
*/
//@{
/** @brief MAC extended address, in simulation use only 16 bit instead of 64 bit */
IE3ADDR aExtendedAddress;
/** @brief MAC PIB attributes */
MAC_PIB mpib;
/** @brief device capability (TBD) */
DevCapability capability;
//@}
/**
* @name Beacon related variables
*/
//@{
/** @brief beacon order of incoming superframe */
UINT_8 rxBO;
/** @brief superframe order of incoming superframe */
UINT_8 rxSO;
/** @brief duration (in symbol) of a outgoing superframe slot (aBaseSlotDuration * 2^mpib.macSuperframeOrder) */
UINT_32 txSfSlotDuration;
/** @brief duration (in symbol) of a incoming superframe slot (aBaseSlotDuration * 2^rxSO) */
UINT_32 rxSfSlotDuration;
/** @brief duration (in backoff periods) of latest outgoing beacon */
UINT_8 txBcnDuration;
/** @brief duration (in backoff periods) of latest incoming beacon */
UINT_8 rxBcnDuration;
/** @brief length (in s) of a unit of backoff period, aUnitBackoffPeriod/phy_symbolrate */
simtime_t bPeriod;
/** @brief the time that the last beacon was received
updated right after the beacon is received at MAC */
simtime_t bcnRxTime;
/** @brief the scheduled time that the latest beacon should have arrived
sometimes bcnRxTime lags due to beacon loss (assumed impossible in the model) or in the middle of receiving a beacon,
some calculations use this value to avoid incorrectness */
simtime_t schedBcnRxTime;
/** @brief outging superframe specification used by coordinators */
SuperframeSpec txSfSpec;
/** @brief incoming superframe specification used by devices */
SuperframeSpec rxSfSpec;
/** @brief outgoing PAN descriptor transmitted used by coordinators (TBD) */
PAN_ELE txPanDescriptor;
/** @brief incoming PAN descriptor transmitted used by devices (TBD) */
PAN_ELE rxPanDescriptor;
/** @brief flag for using beacon or not */
bool beaconEnabled;
/** @brief indicating a beacon frame waiting for transmission, suppress all other transmissions */
bool beaconWaitingTx;
/** @brief indicating whether associated with a coordinator or not */
bool notAssociated;
/** @brief num of incoming beacons lost in a row */
UINT_8 bcnLossCounter;
//@}
/**
* @name CSMA/CA related variables
*/
//@{
UINT_8 NB;
UINT_8 CW;
UINT_8 BE;
UINT_8 backoffStatus; // 0: no backoff; 1: backoff successful; 2: backoff failed; 99: is backing off
int bPeriodsLeft; // backoff periods left
bool csmacaAckReq;
bool csmacaWaitNextBeacon;
//@}
/**
* @name GTS related variables only for PAN coordinator
*/
//@{
/** @brief number of GTS descriptors being maintained */
UINT_8 gtsCount;
/** @brief list of GTS descriptors for all existing GTS being maintained */
GTSDescriptor gtsList[7];
/** @brief store new value of final superframe slot in the CAP after updating GTS settings
and put into effect when next beacon is transmitted */
UINT_8 tmp_finalCap;
/** @brief index of current running GTS, 99 means not in GTS */
UINT_8 indexCurrGts;
//@}
/**
* @name GTS related variables only for devices
*/
//@{
/** @brief number of superframe slots for the GTS, calculated in handleBeacon() */
UINT_8 gtsLength;
/** @brief GTS starting slot, 0 means no GTS for me, allocated by the PAN coordinator when applying for GTS */
UINT_8 gtsStartSlot;
/** @brief duration of one complete data transaction in GTS, calculated in handleBeacon() */
simtime_t gtsTransDuration;
//@}
/**
* @name Indirect data transfer related variables
*/
//@{
//PendingAddrFields txPaFields; // pengding address fields transmitted as a coordinator
//PendingAddrFields rxPaFields; // pengding address fields received as a device
//@}
/**
* @name Frame buffers
*/
//@{
/** @brief buffer for frames currently being transmitted */
Ieee802154Frame* txPkt;
/** @brief buffer for beacon frames to be transmitted without CSMA/CA */
Ieee802154Frame* txBeacon;
/** @brief buffer for beacon or cmd frames coming from the upper layer,
to be transmitted with CSMA/CA */
Ieee802154Frame* txBcnCmdUpper;
/** @brief buffer for beacon or cmd frames responding to receiving a packet,
to be transmitted with CSMA/CA */
Ieee802154Frame* txBcnCmd;
/** @brief buffer for data frames to be transmitted */
Ieee802154Frame* txData;
/** @brief buffer for data frames to be transmitted in GTS */
Ieee802154Frame* txGTS;
/** @brief buffer for ack frames to be transmitted (no wait) */
Ieee802154Frame* txAck;
/** @brief buffer for frames currently being CSMA/CA performed,
one of txBcnCmdUpper, txBcnCmd or txData */
Ieee802154Frame* txCsmaca;
/** @brief temp buffer for CSMA-CA, set when csmacaStart is called for first time,
cleared when csmacaCallBack or csmacaCancel is called */
Ieee802154Frame* tmpCsmaca;
/** @brief buffer for received beacon frames,
only used by mlme_scan_request and mlme_rx_enable_request (TBD) */
Ieee802154Frame* rxBeacon;
/** @brief buffer for received data frames */
Ieee802154Frame* rxData;
/** @brief buffer for received cmd frames */
Ieee802154Frame* rxCmd;
//@}
/**
* @name Timer messages
*/
//@{
/** @brief backoff timer for CSMA-CA */
cMessage* backoffTimer;
/** @brief timer for locating backoff boundary before sending a CCA request */
cMessage* deferCCATimer;
/** @brief timer for tracking beacons */
cMessage* bcnRxTimer;
/** @brief timer for transmitting beacon periodically */
cMessage* bcnTxTimer;
/** @brief timer for timer for ACK timeout */
cMessage* ackTimeoutTimer;
/** @brief timer for locating backoff boundary before txing ACK if beacon-enabled */
cMessage* txAckBoundTimer;
/** @brief timer for locating backoff boundary before txing Cmd or data if beacon-enabled */
cMessage* txCmdDataBoundTimer;
/** @brief timer for delay of IFS after receiving a data or cmd pkt */
cMessage* ifsTimer;
/** @brief timer for indicating being in the active period of outgoing (txing) superframe */
cMessage* txSDTimer;
/** @brief timer for indicating being in the active period of incoming (rxed) superframe */
cMessage* rxSDTimer;
/** @brief timer for indicating the end of CAP and the starting of CFP
used only by devices to put radio into sleep at the end of CAP if my GTS is not the first one in the CFP */
cMessage* finalCAPTimer;
/** @brief timer for scheduling of GTS, shared by both PAN coordinator and devices */
cMessage* gtsTimer;
//@}
/**
* @name Variables for timers
*/
//@{
simtime_t lastTime_bcnRxTimer;
bool txNow_bcnTxTimer;
/** @brief true while in active period of the outgoing superframe */
bool inTxSD_txSDTimer;
/** @brief true while in active period of the incoming superframe */
bool inRxSD_rxSDTimer;
/** for PAN coordinator: index of GTS descriptor in the GTS list
* that GTS timer is currently scheduling for its starting;
* for devices: 99 indicating currently being in my GTS
*/
UINT_8 index_gtsTimer;
//@}
/**
* @name Data transmission related variables
*/
//@{
/** @brief true while a packet being transmitted at PHY */
bool inTransmission;
/** @brief true while a sent beacon or cmd frame in txBcnCmd is waiting for ACK */
bool waitBcnCmdAck;
/** @brief true while a sent beacon or cmd frame in txBcnCmdUpper is waiting for ACK */
bool waitBcnCmdUpperAck;
/** @brief true while a sent frame in txData is waiting for ACK */
bool waitDataAck;
/** @brief true while a sent frame in txGTS is waiting for ACK */
bool waitGTSAck;
/** @brief number of retries for txing a beacon or cmd frame in txBcnCmd */
UINT_8 numBcnCmdRetry;
/** @brief number of retries for txing a beacon or cmd frame in txBcnCmdUpper */
UINT_8 numBcnCmdUpperRetry;
/** @brief number of retries for txing a data frame in txData */
UINT_8 numDataRetry;
/** @brief number of retries for txing a data frame in txGTS */
UINT_8 numGTSRetry;
//@}
/**
* @name Link objects for beacon and data pkts duplication detection
*/
//@{
HLISTLINK* hlistBLink1;
HLISTLINK* hlistBLink2;
HLISTLINK* hlistDLink1;
HLISTLINK* hlistDLink2;
//@}
/**
* @name Container used by coordinator to store info of associated devices
*/
typedef std::map<UINT_16, DevCapability> DeviceList;
DeviceList deviceList;
/**
* @name Statistical variables
*/
//@{
/** @brief number of data pkts received from upper layer, counted in <handleUpperMsg()> */
double numUpperPkt;
/** @brief number of data pkts from upper layer dropped by MAC due to busy MAC or invalid size (e.g. oversize), counted in <handleUpperMsg()> */
double numUpperPktLost;
/** @brief number of collisions detected at PHY */
double numCollision;
/** @brief number of incoming beacons lost, counted in <handleBcnRxTimer()> */
double numLostBcn;
/** @brief number of transmitted beacons, counted in <taskSuccess('b')> */
double numTxBcnPkt;
/** @brief number of successfully transmitted data frames, counted in <taskSuccess('d')> */
double numTxDataSucc;
/** @brief number of data frames that MAC failed to transmit, counted in <taskFailed()> */
double numTxDataFail;
/** @brief number of successfully transmitted data frames in GTS, counted in <taskSuccess('g')> */
double numTxGTSSucc;
/** @brief number of data frames that MAC failed to transmit in GTS, counted in <taskFailed()> */
double numTxGTSFail;
/** @brief number of transmitted ack frames, counted in <taskSuccess()> */
double numTxAckPkt;
/** @brief number of received beacons, counted in <handleBeacon()> */
double numRxBcnPkt;
/** @brief number of received data frames, counted in <MCPS_DATA_indication()> */
double numRxDataPkt;
/** @brief number of received data frames in GTS, counted in <MCPS_DATA_indication()> */
double numRxGTSPkt;
/** @brief count only ACKs received before timeout, for both Cmd and Data in <handleAck()> */
double numRxAckPkt;
//@}
// tmp variables for debug
double numTxAckInactive;
};
#endif
|
[
"[email protected]"
] |
[
[
[
1,
870
]
]
] |
5f65ead870938b6e03551e20ae541e5825ffd8c3
|
709cd826da3ae55945fd7036ecf872ee7cdbd82a
|
/Term/Bowling/tags/Submittion2/LethalBowling/BasicFunctionsDlg.cpp
|
05dd83274b48d5c041abc713e78dfbfbe2531e9d
|
[] |
no_license
|
argapratama/kucgbowling
|
20dbaefe1596358156691e81ccceb9151b15efb0
|
65e40b6f33c5511bddf0fa350c1eefc647ace48a
|
refs/heads/master
| 2018-01-08T15:27:44.784437 | 2011-06-19T15:23:39 | 2011-06-19T15:23:39 | 36,738,655 | 0 | 0 | null | null | null | null |
UHC
|
C++
| false | false | 20,716 |
cpp
|
// BasicFunctionsDlg.cpp : 구현 파일
//
#include "stdafx.h"
#include "BasicFunctions.h"
#include "BasicFunctionsDlg.h"
#include "afxdialogex.h"
#include "Lighting.h"
#include "DateTime.h"
#include "Physics.h"
#include "Quaternion.h"
#include "TMath.h"
#include <gl/GL.h>
#include <glut.h>
#include <Mmsystem.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
using namespace Virgin;
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 대화 상자 데이터입니다.
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다.
// 구현입니다.
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// CBasicFunctionsDlg 대화 상자
CBasicFunctionsDlg::CBasicFunctionsDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CBasicFunctionsDlg::IDD, pParent)
, rotateLeftButtonDown_(false)
, rotateRightButtonDown_(false)
, rotateUpButtonDown_(false)
, rotateDownButtonDown_(false)
, rollLeftButtonDown_(false)
, rollRightButtonDown_(false)
, moveUpButtonDown_(false)
, moveDownButtonDown_(false)
, moveLeftButtonDown_(false)
, moveRightButtonDown_(false)
, moveFarButtonDown_(false)
, moveNearButtonDown_(false)
, biggerButtonDown_(false)
, smallerButtonDown_(false)
, firstTime_(DateTime::SinceSystemStarted())
, lastTime_(DateTime::SinceSystemStarted())
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CBasicFunctionsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DISPLAY_PANEL, displayPanel_);
DDX_Control(pDX, IDC_FPS_STATIC, fpsStatic_);
DDX_Control(pDX, IDC_SPEED_SLIDER, speedSlider_);
DDX_Control(pDX, IDC_CAMERA_AUTO_ROTATION_CHECK, cameraAutoRotateCheck_);
DDX_Control(pDX, IDC_SHOW_COLLISION_INFO_CHECK, showCollisionInfoCheck_);
DDX_Control(pDX, IDC_PAUSE_CHECK, pauseCheck_);
}
BEGIN_MESSAGE_MAP(CBasicFunctionsDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_ERASEBKGND()
ON_WM_SIZE()
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_ROTATE_LEFT_BUTTON, &CBasicFunctionsDlg::OnBnClickedRotateLeftButton)
ON_BN_CLICKED(IDC_RESET_SPRITE_BUTTON, &CBasicFunctionsDlg::OnBnClickedResetSpriteButton)
ON_BN_CLICKED(IDC_TEST_BUTTON, &CBasicFunctionsDlg::OnBnClickedTestButton)
ON_BN_CLICKED(IDC_DRAW_NORMAL_CHECK, &CBasicFunctionsDlg::OnBnClickedDrawNormalCheck)
ON_BN_CLICKED(IDC_MESH_POINT_BUTTON, &CBasicFunctionsDlg::OnBnClickedMeshPointButton)
ON_BN_CLICKED(IDC_MESH_WIREFRAME_BUTTON, &CBasicFunctionsDlg::OnBnClickedMeshWireframeButton)
ON_BN_CLICKED(IDC_MESH_QUAD_BUTTON, &CBasicFunctionsDlg::OnBnClickedMeshQuadButton)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SPEED_SLIDER, &CBasicFunctionsDlg::OnNMReleasedcaptureSpeedSlider)
ON_WM_MOUSEWHEEL()
ON_BN_CLICKED(IDC_CAMERA_AUTO_ROTATION_CHECK, &CBasicFunctionsDlg::OnBnClickedCameraAutoRotationCheck)
ON_BN_CLICKED(IDC_LIGHT_CHECK, &CBasicFunctionsDlg::OnBnClickedLightCheck)
ON_BN_CLICKED(IDC_FLAT_SHADING_BUTTON, &CBasicFunctionsDlg::OnBnClickedFlatShadingButton)
ON_BN_CLICKED(IDC_GOURAUD_SHADING_BUTTON, &CBasicFunctionsDlg::OnBnClickedGouraudShadingButton)
ON_BN_CLICKED(IDC_USER_VIEW_SELECTED_CHECK, &CBasicFunctionsDlg::OnBnClickedUserViewSelectedCheck)
ON_BN_CLICKED(IDC_RESET_CAMERA_ROTATION_BUTTON, &CBasicFunctionsDlg::OnBnClickedResetCameraRotationButton)
ON_BN_CLICKED(IDC_DRAW_TEXTURE_CHECK, &CBasicFunctionsDlg::OnBnClickedDrawTextureCheck)
ON_BN_CLICKED(IDC_SHOW_COLLISION_INFO_CHECK, &CBasicFunctionsDlg::OnBnClickedShowCollisionInfoCheck)
ON_BN_CLICKED(IDC_TEST2_BUTTON, &CBasicFunctionsDlg::OnBnClickedTest2Button)
ON_BN_CLICKED(IDC_TEST3_BUTTON, &CBasicFunctionsDlg::OnBnClickedTest3Button)
ON_BN_CLICKED(IDC_TEST4_BUTTON, &CBasicFunctionsDlg::OnBnClickedTest4Button)
ON_BN_CLICKED(IDC_TEST5_BUTTON, &CBasicFunctionsDlg::OnBnClickedTest5Button)
ON_BN_CLICKED(IDC_TEST4_BUTTON4, &CBasicFunctionsDlg::OnBnClickedTest4Button4)
ON_BN_CLICKED(IDC_TEST4_BUTTON3, &CBasicFunctionsDlg::OnBnClickedTest4Button3)
END_MESSAGE_MAP()
// CBasicFunctionsDlg 메시지 처리기
BOOL CBasicFunctionsDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
// 프레임워크가 이 작업을 자동으로 수행합니다.
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
RECT rect;
displayPanel_.GetWindowRect(&rect);
ScreenToClient(&rect);
openGlPanel_.Create(rect, this);
InitializeWorld();
InitializeSpriteMassProperties();
InitializeControls();
return TRUE; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다.
}
void CBasicFunctionsDlg::InitializeWorld()
{
World().ResizePinCount(10);
if(!World().GetBall().Load(L"bowling_ball.obj", L"green_ball_skin.bmp"))
{
MessageBox(L"bowling_ball.obj doesn't exist. Please restart this application ^^;;");
}
World().GetBall().TranslateMore(6.0, -0.2, 1.0);
//World().GetBall().TranslateMore(1.0, 6.0, -0.2);
if(!World().GetPin(0).Load(L"bowling_pin.obj", L""))
{
MessageBox(L"bowling_pin.obj doesn't exist. Please restart this application ^^;;");
}
World().GetPin(0).CopyTo(World().GetPin(1));
World().GetPin(0).CopyTo(World().GetPin(2));
World().GetPin(0).CopyTo(World().GetPin(3));
World().GetPin(0).CopyTo(World().GetPin(4));
World().GetPin(0).CopyTo(World().GetPin(5));
World().GetPin(0).CopyTo(World().GetPin(6));
World().GetPin(0).CopyTo(World().GetPin(7));
World().GetPin(0).CopyTo(World().GetPin(8));
World().GetPin(0).CopyTo(World().GetPin(9));
// The Main Light
World().GetLight().MoveTo(0, 20, 30);
World().GetLight().Enable();
for(int i = 0; i < 10; ++i)
{
World().Sprites().push_back(&World().GetPin(i));
}
}
void CBasicFunctionsDlg::InitializeSpriteMassProperties()
{
World().ResetSprites();
}
void CBasicFunctionsDlg::InitializeBall(Virgin::Ball& ball)
{
}
void CBasicFunctionsDlg::InitializePin(Pin& pin)
{
}
void CBasicFunctionsDlg::InitializeControls()
{
// Speed Slider
speedSlider_.SetRange(1, 2000);
speedSlider_.SetRangeMin(1);
speedSlider_.SetRangeMax(2000);
speedSlider_.SetPos(100);
openGlPanel_.SetManipulatingSprite(true);
Lighting().EnableLighting();
}
void CBasicFunctionsDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
// 프레임워크에서 이 작업을 자동으로 수행합니다.
void CBasicFunctionsDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트입니다.
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 아이콘을 그립니다.
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
// 이 함수를 호출합니다.
HCURSOR CBasicFunctionsDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
BOOL CBasicFunctionsDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
return CDialogEx::OnEraseBkgnd(pDC);
}
void CBasicFunctionsDlg::OnSize(UINT nType, int cx, int cy)
{
CDialogEx::OnSize(nType, cx, cy);
}
void CBasicFunctionsDlg::UpdateAndDraw()
{
DateTime currTime = DateTime::SinceSystemStarted();
TimeSpan timeDelta = currTime - lastTime_;
lastTime_ = currTime;
if(timeDelta.TotalSeconds() != 0.0)
{
CString fpsText;
int fps = (double)1.0/timeDelta.TotalSeconds();
fpsText.Format(L"%d", fps);
fpsStatic_.SetWindowText(fpsText);
}
if(!pauseCheck_.GetCheck())
{
static TimeSpan fakeTime(0);
static const TimeSpan fakeTimeDelta(30);
//World().Update(lastTime_ - firstTime_, timeDelta);
World().Update(fakeTime, fakeTimeDelta);
fakeTime += fakeTimeDelta;
}
const float Speed = static_cast<float>(speedSlider_.GetPos() / 100.0);
const float MoveUnit = 0.01 * Speed;
const float RotateUnit = 0.5 * Speed;
const float ScaleRate = 0.01 * Speed;
float moveX = 0.0;
float moveY = 0.0;
float moveZ = 0.0;
float rotateXAngle = 0.0;
float rotateYAngle = 0.0;
float rotateZAngle = 0.0;
float magnitudeRate = 1.0;
if(moveLeftButtonDown_)
{
moveX = -MoveUnit;
}
else if(moveRightButtonDown_)
{
moveX = MoveUnit;
}
if(moveUpButtonDown_)
{
moveY = MoveUnit;
}
else if(moveDownButtonDown_)
{
moveY = -MoveUnit;
}
if(moveFarButtonDown_)
{
moveZ = -MoveUnit;
}
else if(moveNearButtonDown_)
{
moveZ = MoveUnit;
}
if(rotateUpButtonDown_)
{
rotateXAngle = -RotateUnit;
}
else if(rotateDownButtonDown_)
{
rotateXAngle = RotateUnit;
}
if(rotateLeftButtonDown_)
{
rotateYAngle = -RotateUnit;
}
else if(rotateRightButtonDown_)
{
rotateYAngle = RotateUnit;
}
if(rollLeftButtonDown_)
{
rotateZAngle = RotateUnit;
}
else if(rollRightButtonDown_)
{
rotateZAngle = -RotateUnit;
}
if(biggerButtonDown_)
{
magnitudeRate += ScaleRate;
}
else if(smallerButtonDown_)
{
magnitudeRate -= ScaleRate;
}
World().GetBall().TranslateMore(moveZ, moveX, moveY);
World().GetBall().RotateXMore(rotateXAngle);
World().GetBall().RotateYMore(rotateYAngle);
World().GetBall().RotateZMore(rotateZAngle);
World().GetBall().ScaleRate(magnitudeRate, magnitudeRate, magnitudeRate);
World().GetBall2().TranslateMore(moveX, moveY, moveZ);
World().GetBall2().RotateXMore(rotateXAngle);
World().GetBall2().RotateYMore(rotateYAngle);
World().GetBall2().RotateZMore(rotateZAngle);
World().GetBall2().ScaleRate(magnitudeRate, magnitudeRate, magnitudeRate);
Vector3 values;
Vector3 values2;
//
// Camera
//
if(cameraAutoRotateCheck_.GetCheck())
{
//World().GetCamera().RotateYMore(RotateUnit);
World().GetCamera().RotateZMore(RotateUnit);
}
//values.X() = ToFloat(cameraLocationXEdit_);
//values.Y() = ToFloat(cameraLocationYEdit_);
//values.Z() = ToFloat(cameraLocationZEdit_);
//World().GetCamera().MoveTo(values.X(), values.Y(), values.Z());
//values.X() = ToFloat(cameraLookAtXEdit_);
//values.Y() = ToFloat(cameraLookAtYEdit_);
//values.Z() = ToFloat(cameraLookAtZEdit_);
//World().GetCamera().LookAt(values.X(), values.Y(), values.Z());
//values.X() = ToFloat(cameraUpXEdit_);
//values.Y() = ToFloat(cameraUpYEdit_);
//values.Z() = ToFloat(cameraUpZEdit_);
//World().GetCamera().SetUpVector(values.X(), values.Y(), values.Z());
//World().GetCamera().Apply();
//
// Light
//
World().GetLight().SetAmbient(0.5, 0.5, 0.5);
World().GetLight().SetDiffuse(1.0, 1.0, 1.0);
World().GetLight().SetSpecular(0.5, 0.5, 0.5);
openGlPanel_.Invalidate();
}
BOOL CBasicFunctionsDlg::DestroyWindow()
{
// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
return CDialogEx::DestroyWindow();
}
void CBasicFunctionsDlg::OnDestroy()
{
CDialogEx::OnDestroy();
// TODO: 여기에 메시지 처리기 코드를 추가합니다.
}
void CBasicFunctionsDlg::OnOK()
{
DestroyWindow();
}
void CBasicFunctionsDlg::OnCancel()
{
DestroyWindow();
}
void CBasicFunctionsDlg::OnBnClickedRotateLeftButton()
{
}
BOOL CBasicFunctionsDlg::PreTranslateMessage(MSG* pMsg)
{
struct ButtonDownStatus
{
CWnd* control;
bool* isButtonDown;
};
bool isButtonDown;
switch(pMsg->message)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
isButtonDown = pMsg->message == WM_LBUTTONDOWN;
break;
case WM_KEYDOWN:
switch(pMsg->wParam)
{
case VK_LEFT:
//World().GetCamera().RotateZMore(10.0);
World().GetCamera().MoveMore(1.0, 0.0, 0.0);
return true;
case VK_RIGHT:
//World().GetCamera().RotateZMore(-10.0);
World().GetCamera().MoveMore(-1.0, 0.0, 0.0);
return true;
case VK_UP:
//World().GetCamera().RotateYMore(10.0);
World().GetCamera().MoveMore(0.0, 0.0, 1.0);
return true;
case VK_DOWN:
//World().GetCamera().RotateYMore(-10.0);
World().GetCamera().MoveMore(0.0, 0.0, -1.0);
return true;
}
break;
}
return CDialogEx::PreTranslateMessage(pMsg);
}
void CBasicFunctionsDlg::OnBnClickedResetSpriteButton()
{
World().ResetSprites();
}
float CBasicFunctionsDlg::ToFloat(const CWnd& wnd)
{
CString text;
float value;
wnd.GetWindowText(text);
swscanf(text, L"%f", &value);
return value;
}
void CBasicFunctionsDlg::OnEditChange()
{
UpdateAndDraw();
}
void CBasicFunctionsDlg::OnBnClickedTestButton()
{
//World().GetBall().Load(L"HappyBuddha.obj");
//CFileDialog fileDialog(TRUE, L"obj", NULL, OFN_FILEMUSTEXIST | OFN_LONGNAMES, L"Object (*.obj) | *.obj", this);
//INT_PTR result = fileDialog.DoModal();
//if(result == IDOK)
//{
// CString pathName = fileDialog.GetPathName();
// MessageBox(pathName);
//}
World().GetBall().Position().Z() = 10.0f;
}
void CBasicFunctionsDlg::OnBnClickedDrawNormalCheck()
{
//World().GetBall().SetDrawNormal(drawNormalCheck_.GetCheck() != 0);
}
void CBasicFunctionsDlg::OnBnClickedMeshPointButton()
{
World().GetBall().SetMeshMode(MeshMode_Point);
World().GetBall2().SetMeshMode(MeshMode_Point);
}
void CBasicFunctionsDlg::OnBnClickedMeshWireframeButton()
{
World().GetBall().SetMeshMode(MeshMode_Wireframe);
World().GetBall2().SetMeshMode(MeshMode_Wireframe);
}
void CBasicFunctionsDlg::OnBnClickedMeshQuadButton()
{
World().GetBall().SetMeshMode(MeshMode_QuadMesh);
World().GetBall2().SetMeshMode(MeshMode_QuadMesh);
}
void CBasicFunctionsDlg::OnNMReleasedcaptureSpeedSlider(NMHDR *pNMHDR, LRESULT *pResult)
{
*pResult = 0;
}
BOOL CBasicFunctionsDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
//GetSelectedSprite().TranslateMore(0.0, 0.0, zDelta/240.0);
//GetSelectedSprite().TranslateMore(zDelta/240.0, 0.0, 0.0);
World().GetCamera().MoveMore(0, zDelta/60, 0);
return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
}
void CBasicFunctionsDlg::OnBnClickedCameraAutoRotationCheck()
{
}
void CBasicFunctionsDlg::OnBnClickedLightCheck()
{
//Lighting lighting;
//if(lightCheck_.GetCheck())
//{
// lighting.EnableLighting();
//}
//else
//{
// lighting.DisableLighting();
//}
}
void CBasicFunctionsDlg::OnBnClickedFlatShadingButton()
{
Lighting lighting;
lighting.SetShadeModelFlat();
}
void CBasicFunctionsDlg::OnBnClickedGouraudShadingButton()
{
Lighting lighting;
lighting.SetShadeModelSmooth();
}
Virgin::Sprite& CBasicFunctionsDlg::GetSelectedSprite()
{
//if(userViewSelectedCheck_.GetCheck())
//{
// return World().GetBall();
//}
//else
//{
// return World().GetBall2();
//}
}
void CBasicFunctionsDlg::OnBnClickedUserViewSelectedCheck()
{
//if(userViewSelectedCheck_.GetCheck())
//{
// openGlPanel_.SetManipulatingSprite(true);
//}
//else
//{
// openGlPanel_.SetManipulatingSprite(false);
//}
}
void CBasicFunctionsDlg::OnBnClickedResetCameraRotationButton()
{
World().GetCamera().ResetRotation();
}
void CBasicFunctionsDlg::OnBnClickedDrawTextureCheck()
{
//if(drawTextureCheck_.GetCheck())
//{
// World().GetBall().SetDrawTexture(true);
// World().GetBall2().SetDrawTexture(true);
//}
//else
//{
// World().GetBall().SetDrawTexture(false);
// World().GetBall2().SetDrawTexture(false);
//}
}
// World Instance 좀 더 짧은 코드로 구할 수 있도록
World& CBasicFunctionsDlg::World()
{
return World::Instance();
}
void CBasicFunctionsDlg::OnBnClickedShowCollisionInfoCheck()
{
if(showCollisionInfoCheck_.GetCheck())
{
World().ShowCollisionInfo();
}
else
{
World().HideCollisionInfo();
}
}
void CBasicFunctionsDlg::OnBnClickedTest2Button()
{
static bool first = true;
float randomX;
if(first)
{
randomX = Math::IntervalRandom(0.0f, 10000.0f, timeGetTime());
first = false;
}
else
{
randomX = Math::IntervalRandom(0.0f, 10000.0f);
}
if(World().GetBall().GetRigidBody().GetPosition().X() > 0.0f)
{
// 공이 X 쪽에 있으니 -X 쪽으로 던지게 해야 함
if(randomX > 0.0f)
{
randomX = -randomX;
}
}
World().GetBall().GetRigidBody().AppendInternalForce(Vector3(randomX, -100000.0f, 0.0f));
//World().GetBall().SetVelocity(Vector3(0.0f, 1.0f, 0.0f), 0.5f);
//World().GetBall().GetRigidBody().ApplyForce(Vector3(-100.0, 0.0, 0.0));
}
void CBasicFunctionsDlg::OnBnClickedTest3Button()
{
World().GetBall().SetVelocity(Vector3(0.0f, 0.0f, 0.0f), 0.0f);
}
void CBasicFunctionsDlg::OnBnClickedTest4Button()
{
lastTime_ += 50;
World().Update(lastTime_ - firstTime_, TimeSpan(50));
}
void CBasicFunctionsDlg::OnBnClickedButtonCameraLeft()
{
World().GetCamera().RotateZMore(10.0);
UpdateAndDraw();
}
void CBasicFunctionsDlg::OnBnClickedButtonCameraRight()
{
World().GetCamera().RotateZMore(-10.0);
UpdateAndDraw();
}
void CBasicFunctionsDlg::OnBnClickedTest5Button()
{
World().GetPin(0).Position().Z() = 10.0f;
Vector3 tmp(1.0, 0.0, 0.0);
Quaternion ori;
ori.FromAxisAngle(tmp, 1.0f);
World().GetPin(0).GetRigidBody().SetQOrientation(ori);
}
void CBasicFunctionsDlg::OnBnClickedTest4Button4()
{
lastTime_ += 10;
World().Update(lastTime_ - firstTime_, TimeSpan(10));
}
void CBasicFunctionsDlg::OnBnClickedTest4Button3()
{
lastTime_ += 100;
World().Update(lastTime_ - firstTime_, TimeSpan(100));
}
|
[
"[email protected]"
] |
[
[
[
1,
784
]
]
] |
d0ca1b8264af465c7bf01379bf82c2f6a74c35aa
|
b73f27ba54ad98fa4314a79f2afbaee638cf13f0
|
/projects/MainUI/GuiLib1.5/GuiListEdit.h
|
8be7f8c3ef40408d6baa246efe35ac4c7c09b533
|
[] |
no_license
|
weimingtom/httpcontentparser
|
4d5ed678f2b38812e05328b01bc6b0c161690991
|
54554f163b16a7c56e8350a148b1bd29461300a0
|
refs/heads/master
| 2021-01-09T21:58:30.326476 | 2009-09-23T08:05:31 | 2009-09-23T08:05:31 | 48,733,304 | 3 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 2,767 |
h
|
/****************************************************************************
* *
* GuiToolKit *
* (MFC extension) *
* Created by Francisco Campos G. www.beyondata.com [email protected] *
*--------------------------------------------------------------------------*
* *
* This program is free software;so you are free to use it any of your *
* applications (Freeware, Shareware, Commercial),but leave this header *
* intact. *
* *
* These files are provided "as is" without warranty of any kind. *
* *
* GuiToolKit is forever FREE CODE !!!!! *
* *
*--------------------------------------------------------------------------*
* Created by: Francisco Campos G. *
* Bug Fixes and improvements : (Add your name) *
* -Francisco Campos *
* *
****************************************************************************/
#pragma once
// CGuiListEdit
#include "GuiContainer.h"
#include "GuiMiniTool.h"
#include "GuiNormalButton.h"
class OnTextChanged;
class CGuiListEdit : public CStatic
{
DECLARE_DYNAMIC(CGuiListEdit)
public:
enum Border{STYLE3D=0,STYLEPRESS=1,STYLEFRAME=2};
private:
CGuiContainer m_Conta;
CGuiMiniTool m_MiniTool;
CListCtrl* m_list;
COLORREF m_clrface;
Border m_border;
BOOL m_bChange;
public:
void Delete();
void Insert(CString &str=CString(""));
void Edit();
void Up();
void Down();
void SetStyle(Border border);
CString GetText(INT_PTR nItem);
bool AddItem(CString m_szCad);
INT_PTR GetNumItem();
CGuiNormalButton m_toolBtn;
CListCtrl* GetListCtrl();
void EditItem(const INT_PTR nItem, const CString &itemText);
// 设置在规则改变是,处理的指针
void setOnTextChanged(OnTextChanged *onchanged) {onchanged_ = onchanged;}
protected:
void OnDelete(const CString &str);
void OnBeginEdit(const CString &strOld);
bool OnEndEdit(const CString &strNew);
bool OnAdd(const CString &str);
OnTextChanged * onchanged_;
public:
CGuiListEdit();
virtual ~CGuiListEdit();
protected:
DECLARE_MESSAGE_MAP()
virtual void PreSubclassWindow();
public:
afx_msg void OnInsert();
afx_msg void OnPaint();
afx_msg INT_PTR OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, INT_PTR cx, INT_PTR cy);
afx_msg void OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickList(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBeginlabeleditList(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnItemChanged(NMHDR *pNMHDR, LRESULT *pResult);
};
|
[
"[email protected]"
] |
[
[
[
1,
88
]
]
] |
6ceb0921df312d5bf5f23c7645aa00daba08792c
|
57855d23617d6a65298c2ae3485ba611c51809eb
|
/Zen/Core/Plugins/src/ExtensionRegistry.hpp
|
8c7867c9e49e2613400e6afa03c26a3e46393038
|
[] |
no_license
|
Azaezel/quillus-daemos
|
7ff4261320c29e0125843b7da39b7b53db685cd5
|
8ee6eac886d831eec3acfc02f03c3ecf78cc841f
|
refs/heads/master
| 2021-01-01T20:35:04.863253 | 2011-04-08T13:46:40 | 2011-04-08T13:46:40 | 32,132,616 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,558 |
hpp
|
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
// Zen Core Framework
//
// Copyright (C) 2001 - 2009 Tony Richards
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// Tony Richards [email protected]
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
#ifndef ZEN_PLUGINS_EXTENSION_REGISTRY_HPP_INCLUDED
#define ZEN_PLUGINS_EXTENSION_REGISTRY_HPP_INCLUDED
#include <Zen/Core/Plugins/I_ExtensionRegistry.hpp>
#include "PluginInfo.hpp"
#include <map>
#include <string>
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
namespace Zen {
namespace Plugins {
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
class ExtensionRegistry
: public I_ExtensionRegistry
{
/// @name Types
/// @{
public:
//typedef std::map<std::string, extension_point_ptr_type> extension_point_container_type;
typedef std::list<extension_point_ptr_type> extension_point_container_type;
typedef boost::shared_ptr<extension_point_container_type> extension_point_container_ptr_type;
typedef std::map<std::string, extension_point_container_ptr_type> namespace_container_type;
/// @}
/// @name I_ExtensionRegistry implementation
/// @{
public:
virtual extension_point_ptr_type getExtensionPoint(const std::string& _namespace, const std::string& _extensionPointName);
virtual extension_query_ptr_type createQuery();
virtual extension_result_set_ptr_type findExtensions(I_ExtensionQuery* const _pQuery);
virtual void getExtensionPoints(I_ExtensionPointVisitor& _visitor);
virtual class_factory_ref_type getClassFactory(extension_ptr_type _extension);
/// @}
/// @name ExtensionRegistry implementation
/// @{
public:
/// Get the singleton
static ExtensionRegistry& getSingleton() { return *(dynamic_cast<ExtensionRegistry*>(&I_ExtensionRegistry::getSingleton())); }
/// Create an extension point
boost::shared_ptr<ExtensionPoint> createExtensionPoint(const I_ConfigurationElement& _config, PluginInfo& _plugin);
/// Installs an extension point that is fully parsed and ready for use
void installExtensionPoint(boost::shared_ptr<ExtensionPoint> _extensionPoint);
/// Create an extension
boost::shared_ptr<Extension> createExtension(const I_ConfigurationElement& _config, PluginInfo& _plugin);
/// Installs an extension that is fully parsed and ready for use
void installExtension(boost::shared_ptr<Extension> _extension);
/// @}
/// @name 'Structors
/// @{
public:
ExtensionRegistry();
virtual ~ExtensionRegistry();
/// @}
/// @name Member variables
/// @{
private:
/// Extension point namespace map with a list of extension points as the value.
namespace_container_type m_namespaces;
typedef std::map<std::string, boost::shared_ptr<ExtensionPoint> > extension_point_map;
/// Extension point id (fully qualified including namespace) mapped to extension point objects
extension_point_map m_extensionPoints;
/// List of extensions
/// @todo Should this be a map of some sort?
typedef std::list<pExtension_type> Extensions_type;
Extensions_type m_extensions;
/// @}
}; // class ExtensionRegistry
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
} // namespace Plugins
} // namespace Zen
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
#endif // ZEN_PLUGINS_EXTENSION_REGISTRY_HPP_INCLUDED
|
[
"sgtflame@Sullivan"
] |
[
[
[
1,
113
]
]
] |
be21b14a03a9f007866dbc5386033323a7a14840
|
54a53d0c7ff4b2c023406707466c278a3b8c42b1
|
/playerbass.cpp
|
7962e217a28c9bd0c4c59d02825e4b2126410691
|
[] |
no_license
|
POPSuL/smp
|
7141a8326f8612bb5aaa2a85c171a1421d922221
|
427f1dd3d1d59c8ac25c70b6a0aae9339c672dc9
|
refs/heads/master
| 2021-01-10T22:13:51.146302 | 2011-02-16T09:47:50 | 2011-02-16T09:47:50 | 32,326,775 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,498 |
cpp
|
#include "playerbass.h"
#include <QFile>
QMutex PlayerBass::mutex;
PlayerBass * PlayerBass::instance = NULL;
PlayerBass::PlayerBass(QObject *parent)
{
this->bassInitialized = false;
BOOL bassStatus = BASS_Init(-1, 44100, NULL, NULL, NULL);
if(!bassStatus) {
DWORD errorCode = BASS_ErrorGetCode();
ERRM("Failed init BASS. Error code: " + errorCode);
exit(0);
}
if(!BASS_SetConfig(BASS_CONFIG_FLOATDSP, true)) {
#ifdef DBG
qDebug() << "failed set floatdsp. Error code:" << BASS_ErrorGetCode();
#endif
}
this->volume = 0.1f;
this->bassInitialized = true;
}
iMediaPlayer * PlayerBass::getInstance() {
mutex.lock();
if(instance == NULL)
instance = new PlayerBass();
mutex.unlock();
return instance;
}
void PlayerBass::play(const QString& file, bool withFade) {
#ifdef DBG
qDebug() << "Start playing";
#endif
if(this->bassInitialized) {
QFile f(file);
DWORD error;
if(f.exists()) {
if(withFade) {
this->e(this->subChannel);
this->subChannel = this->currentChannel;
this->currentChannel = BASS_StreamCreateFile(false, f.fileName().toLocal8Bit().constData(), 0, 0, BASS_STREAM_AUTOFREE);
error = BASS_ErrorGetCode();
if(this->currentChannel && error == BASS_OK) {
this->_setVolume(this->currentChannel, 0.f);
this->setPan(this->pan);
this->fadeIn(this->currentChannel, this->volume);
if(this->isPlayed())
this->fadeOut(this->subChannel);
else
this->e(this->subChannel);
} else {
this->currentChannel = this->subChannel;
this->subChannel = 0;
#ifdef DBG
qDebug() << "Error" << error;
#endif
}
} else {
this->e(this->subChannel);
this->subChannel = this->currentChannel;
this->currentChannel = BASS_StreamCreateFile(false, f.fileName().toLocal8Bit().constData(), 0, 0, BASS_STREAM_AUTOFREE);
error = BASS_ErrorGetCode();
if(this->currentChannel && error == BASS_OK) {
this->setVolume(this->volume);
this->setPan(this->pan);
this->play();
} else {
this->currentChannel = this->subChannel;
this->subChannel = 0;
#ifdef DBG
qDebug() << "Error" << error;
#endif
}
}
} else {
this->currentChannel = this->subChannel;
this->subChannel = 0;
#ifdef DBG
qDebug() << "File" << f.fileName() << "does't exists";
#endif
}
}
}
void PlayerBass::play() {
if(this->currentChannel) {
if(this->isPaused()) {
BASS_ChannelPlay(this->currentChannel, false);
} else {
if(this->isStopped())
BASS_ChannelPlay(this->currentChannel, true);
}
}
}
void PlayerBass::pause() {
if(this->bassInitialized) {
if(!BASS_ChannelPause(this->currentChannel)) {
#ifdef DBG
qDebug() << "Pause error:" << BASS_ErrorGetCode();
#endif
}
}
}
void PlayerBass::stop(bool withFadeOut) {
if(this->bassInitialized) {
BASS_ChannelStop(this->currentChannel);
}
}
bool PlayerBass::isPaused() const {
return BASS_ChannelIsActive(this->currentChannel) == BASS_ACTIVE_PAUSED;
}
bool PlayerBass::isPlayed() const {
return BASS_ChannelIsActive(this->currentChannel) == BASS_ACTIVE_PLAYING;
}
bool PlayerBass::isStopped() const {
return BASS_ChannelIsActive(this->currentChannel) == BASS_ACTIVE_STOPPED ||
BASS_ChannelIsActive(this->currentChannel == BASS_ACTIVE_STALLED);
}
uint PlayerBass::getCurrentPosition() const {
if(this->bassInitialized) {
QWORD pos = BASS_ChannelGetPosition(this->currentChannel, BASS_POS_BYTE);
return (uint) BASS_ChannelBytes2Seconds(this->currentChannel, pos);
} else {
return 0;
}
}
void PlayerBass::setCurrentPosition(uint newPosition) {
QWORD pos = BASS_ChannelSeconds2Bytes(this->currentChannel, (double) newPosition);
BASS_ChannelSetPosition(this->currentChannel, pos, BASS_POS_BYTE);
}
uint PlayerBass::getDuration() const {
QWORD duration = BASS_ChannelGetLength(this->currentChannel, BASS_POS_BYTE);
return (uint) BASS_ChannelBytes2Seconds(this->currentChannel, duration);
}
float PlayerBass::getVolume() const {
return this->volume;
}
void PlayerBass::setVolume(float newVolume) {
if(newVolume > 1.f || newVolume < 0.f)
return;
this->volume = newVolume;
this->_setVolume(this->currentChannel, this->volume);
}
int PlayerBass::getPan() const {
return this->pan;
}
void PlayerBass::setPan(int newPan) {
if(newPan > 100 || newPan < -100) {
return;
}
this->pan = newPan;
this->_setPan(this->currentChannel, this->pan);
}
const QStringList& PlayerBass::getSupportedExtensions() const {
return QStringList();
}
bool PlayerBass::isSupportedFile(const QString& fileName) const {
return false;
}
float * PlayerBass::getFFTData() {
if(this->bassInitialized) {
memset(this->fft, 0, sizeof(this->fft));
BASS_ChannelGetData(this->currentChannel, fft, BASS_DATA_FFT8192);
return fft;
}
return NULL;
}
void PlayerBass::fadeIn(DWORD channel, float targetVolume) {
//do it!!!
this->_setVolume(channel, targetVolume);
BASS_ChannelPlay(channel, true);
}
void PlayerBass::fadeOut(DWORD channel) {
//do it!!!
BASS_ChannelStop(channel);
this->e(channel);
}
void PlayerBass::e(DWORD c) {
BASS_StreamFree(c);
}
void PlayerBass::_setVolume(DWORD channel, float volume) {
BASS_ChannelSetAttribute(channel, BASS_ATTRIB_VOL, volume);
}
void PlayerBass::_setPan(DWORD channel, int newPan) {
float pan;
pan = newPan / 100.f;
BASS_ChannelSetAttribute(channel, BASS_ATTRIB_PAN, pan);
}
|
[
"[email protected]@dec9defb-d837-5190-24cf-488c772a8b4a",
"[email protected]@dec9defb-d837-5190-24cf-488c772a8b4a"
] |
[
[
[
1,
32
],
[
34,
114
],
[
116,
118
],
[
120,
122
],
[
124,
127
],
[
129,
141
],
[
143,
146
],
[
148,
157
],
[
159,
169
],
[
171,
173
],
[
175,
211
]
],
[
[
33,
33
],
[
115,
115
],
[
119,
119
],
[
123,
123
],
[
128,
128
],
[
142,
142
],
[
147,
147
],
[
158,
158
],
[
170,
170
],
[
174,
174
]
]
] |
07ed42e2b1091a51fc3a3d80f26144b0a9911de5
|
48d325e5c8648382c8f790a5e8762b36ffd7c45a
|
/qtshoot/taskmybullet.h
|
848a64ad3a50648f52e1217b7b2e19f407b31bf5
|
[] |
no_license
|
tomozh/qtshoot
|
46184f4bf7ad9e36f4a358b862ec17e415a0ece0
|
332aaedc89c398cc9f79c908c77bd2dd6978ec44
|
refs/heads/master
| 2020-07-07T10:59:31.554012 | 2011-12-09T18:04:09 | 2011-12-09T18:04:09 | 2,948,875 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 326 |
h
|
#ifndef TASKMYBULLET_H
#define TASKMYBULLET_H
#include "taskchara.h"
class taskMyBullet : public TaskChara
{
public:
taskMyBullet(const QPointF& pt, int zorder);
virtual void oneFrame();
virtual void render(QPainter* painter);
virtual void addDamage(int power);
};
#endif // TASKMYBULLET_H
|
[
"tomo@aspire.(none)"
] |
[
[
[
1,
16
]
]
] |
ce8aeb01f8fc01685e234aee0690d98812cc02c2
|
a77c496f4faefb2c030e6c97deed4d4aa9a3bc0a
|
/rcracki_mt/branches/rcracki_mt_0.6.1/ChainWalkSet.h
|
cfeda5b24c8513b04dc7536680863e77fd6a05cc
|
[] |
no_license
|
0wnrepo/rcracki_mt
|
7cc26abdcc53479cd163bf797645297840643542
|
9e59303c1abd08544b67443df37c2bc5778db94d
|
refs/heads/master
| 2021-01-20T01:11:31.891122 | 2011-01-14T06:08:07 | 2011-01-14T06:08:07 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,621 |
h
|
/*
RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
Copyright (C) Zhu Shuanglei <[email protected]>
*/
#ifndef _CHAINWALKSET_H
#define _CHAINWALKSET_H
#include "Public.h"
struct ChainWalk
{
unsigned char Hash[MAX_HASH_LEN];
//int nHashLen; // Implied
uint64* pIndexE; // mapStartPosIndexE, Len = nRainbowChainLen - 1
};
class CChainWalkSet
{
public:
CChainWalkSet();
virtual ~CChainWalkSet();
private:
string m_sHashRoutineName; // Discard all if not match
string m_sPlainCharsetName; // Discard all if not match
int m_nPlainLenMin; // Discard all if not match
int m_nPlainLenMax; // Discard all if not match
int m_nRainbowTableIndex; // Discard all if not match
int m_nRainbowChainLen; // Discard all if not match
list<ChainWalk> m_lChainWalk;
bool debug;
string sPrecalcPathName;
int preCalcPart;
vector<string> vPrecalcFiles;
private:
void DiscardAll();
bool FindInFile(uint64* pIndexE, unsigned char* pHash, int nHashLen);
string CheckOrRotatePreCalcFile();
void updateUsedPrecalcFiles();
public:
uint64* RequestWalk(unsigned char* pHash, int nHashLen,
string sHashRoutineName,
string sPlainCharsetName, int nPlainLenMin, int nPlainLenMax,
int nRainbowTableIndex,
int nRainbowChainLen,
bool& fNewlyGenerated,
bool setDebug,
string sPrecalc);
void DiscardWalk(uint64* pIndexE);
void StoreToFile(uint64* pIndexE, unsigned char* pHash, int nHashLen);
void removePrecalcFiles();
};
#endif
|
[
"neinbrucke@d3517bff-0f9d-46f7-b303-814026e826cd"
] |
[
[
[
1,
58
]
]
] |
5ca4c51eac695c8f63448fc327e816c11d8a87eb
|
c298ed16e4003b2e88b25adb2eab1ac14dbd6a1f
|
/querysender.cpp
|
372228c66d99718c2fd20681447a74bac1fe6f8a
|
[] |
no_license
|
arktur04/qt-modbus-logger
|
ac18f6fc59d228c8ad83ad3ca4139fcbbbed719a
|
ab16cecf5faf5beb2dd8bb81067eaf6597f2216f
|
refs/heads/master
| 2020-09-30T12:02:44.975007 | 2011-12-28T19:09:54 | 2011-12-28T19:09:54 | 227,284,049 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,361 |
cpp
|
#include "querysender.h"
#include "abstractnetworkclient.h"
#include <QAbstractSocket>
#include <QtDebug>
#include <QObject>
#include <QString>
#include <QList>
#include <QByteArray>
#include <Qt>
//QuerySender::QuerySender(QObject *parent) :
// QObject(parent)
//{
//}
void QuerySender::sendFirst()
{
qDebug() << "QuerySender::sendFirst()" << endl;
if(m_queryList && !m_queryList->isEmpty())
{
isSequenceCompleted = false;
m_nextMsg = m_queryList->constBegin();
sendMsg(*m_nextMsg++);
}
else
{
isSequenceCompleted = true;
};
}
void QuerySender::sendNext()
{
qDebug() << "QuerySender::sendNext()" << endl;
if(m_nextMsg != m_queryList->constEnd())
{
sendMsg(*m_nextMsg++);
}
else
{
isSequenceCompleted = true;
}
}
void QuerySender::run()
{
if(!m_isRunning && m_networkClient)
{
m_isRunning = true;
connect(m_networkClient, SIGNAL(onConnected()), this, SLOT(connected()));
connect(m_networkClient, SIGNAL(onDisconnected()), this, SLOT(disconnected()));
connect(m_networkClient, SIGNAL(onReceive(const QByteArray&)),
this, SLOT(dataRecieved(const QByteArray&)));
connect(m_networkClient, SIGNAL(onError(const QAbstractSocket::SocketError)),
this, SLOT(networkError(const QAbstractSocket::SocketError)));
m_networkClient->connectToServer();
}
}
void QuerySender::stop()
{
if(m_isRunning)
{
m_isRunning = true;
killTimer(m_timerId);
}
}
void QuerySender::connected()
{
if(m_isRunning)
{
m_timerId = startTimer(m_period);
}
}
void QuerySender::disconnected()
{
}
void QuerySender::dataRecieved(const QByteArray& msg)
{
qDebug() << "QuerySender::dataRecieved(" << msg.toHex() << ")" << endl;
emit onDataRecieved(msg);
sendNext();
}
void QuerySender::networkError(const QAbstractSocket::SocketError error)
{
}
void QuerySender::timerEvent(QTimerEvent *event)
{
sendFirst();
}
void QuerySender::sendMsg(const QByteArray& msg)
{
qDebug() << "QuerySender.sendMsg(" << msg.toHex() << ")";
m_networkClient->send(msg);
if(isSequenceCompleted)
{
qDebug() << endl;
}
}
|
[
"[email protected]"
] |
[
[
[
1,
107
]
]
] |
354397ffa6e35f2126c5fa0430757890dd94457c
|
0b79fbac1b2e0816e3923b30393cf3db3afbf821
|
/omap3530/shared/tps65950/tps65950_int.cpp
|
cd6537822d8b5b2185c094cd926ef53cd4a41ed5
|
[] |
no_license
|
SymbianSource/oss.FCL.sf.adapt.beagleboard
|
d8f378ffff2092cd3f9826c2e1db32e5b59b76d1
|
bc11555ace01edea88f2ed753d4938fae4c61295
|
refs/heads/master
| 2020-12-25T14:22:54.807108 | 2010-11-29T13:27:18 | 2010-11-29T13:27:18 | 65,622,008 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 26,480 |
cpp
|
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// \omap3530\omap3530_assp\shared\tps65950\tps65950_int.cpp
// Interrupt dispatcher for TPS65950
// This file is part of the Beagle Base port
//
#include <e32cmn.h>
#include <nk_priv.h>
#include <kernel.h>
//#include <e32atomics.h>
#include <omap3530_i2c.h>
#include <omap3530_i2creg.h>
#include "tps65950.h"
#include <assp/omap3530_assp/locks.h>
// Use a dedicated thread for processing interrupts to prevent deadlocking
// the main TSP65960 thread and to avoid needing a big state machine to
// process interrupts in multiple DFCs
TDfcQue* TheInterruptDfcQue;
_LIT( KInterruptDfcQueName, "TPS65950INT" );
const TInt KInterruptDfcQuePriority = 28;
const TInt KDfcPriority = 2;
#define FULL_RISING_EDGEMASK 0xAA
#define FULL_FALLING_EDGEMASK 0x55
namespace TPS65950
{
struct TInterruptBank
{
TInt iBit[8];
};
struct TSubInterruptBank
{
TUint8 iLen;
TUint16 iRegs[6];
};
enum TMaskPolarity
{
EClearToEnable,
ESetToEnable
};
struct TControl
{
TUint16 iSetReg;
TUint16 iClrReg;
TUint16 iStatReg;
TUint8 iBitMask;
TMaskPolarity iPolarity : 8;
};
NONSHARABLE_CLASS( TPS65950Int ) : public MInterruptDispatcher
{
public:
TPS65950Int();
TInt Init();
virtual TInt Bind(TInt aId, TIsr aIsr, TAny* aPtr);
virtual TInt Unbind(TInt aId);
virtual TInt Enable(TInt aId);
virtual TInt Disable(TInt aId);
virtual TInt Clear(TInt aId);
virtual TInt SetPriority(TInt aId, TInt aPriority);
private:
static void Spurious( TAny* aParam );
static void Dispatch( TAny* aParam );
static void Dfc( TAny* aParam );
TInt InitialiseTPS65950IntController();
private:
TDfc iDfc;
};
static SInterruptHandler TheHandlers[ TPS65950::KNumTPSInts ];
static const TControl KControl[ TPS65950::KNumTPSInts ] =
{
//iimr iReg group bitoffset /*
/*0*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_SC_DETECT, ESetToEnable},
/*1*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_MBCHG, ESetToEnable},
/*2*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_PWROK_TIMEOUT, ESetToEnable},
/*3*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_HOT_DIE, ESetToEnable},
/*4*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_RTC_IT, ESetToEnable},
/*5*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_USB_PRES, ESetToEnable},
/*6*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_CHG_PRES, ESetToEnable},
/*7*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_CHG_PWRONS, ESetToEnable},
/*8*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_USB_ISR1, EClearToEnable},
/*9*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_SW2_ISR1, EClearToEnable},
/*10*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_SW1_ISR1, EClearToEnable},
/*11*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_RT_ISR1, EClearToEnable},
/*12*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO7ISR1, EClearToEnable},
/*13*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO6ISR1, EClearToEnable},
/*14*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO5ISR1, EClearToEnable},
/*15*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO4ISR1, EClearToEnable},
/*16*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO3ISR1, EClearToEnable},
/*17*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO2ISR1, EClearToEnable},
/*18*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO1ISR1, EClearToEnable},
/*19*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO0ISR1, EClearToEnable},
/*20*/ { Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO15ISR2, EClearToEnable},
/*22*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO14ISR2, EClearToEnable},
/*23*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO13ISR2, EClearToEnable},
/*24*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO12ISR2, EClearToEnable},
/*25*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO11ISR2, EClearToEnable},
/*26*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO10ISR2, EClearToEnable},
/*27*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO9ISR2, EClearToEnable},
/*28*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO8ISR2, EClearToEnable},
/*29*/{ Register::GPIO_IMR3A, Register::GPIO_IMR3A, Register::GPIO_ISR3A, GPIO_IMR3A::GPIO17ISR3, EClearToEnable},
/*30*/{ Register::GPIO_IMR3A, Register::GPIO_IMR3A, Register::GPIO_ISR3A, GPIO_IMR3A::GPIO16ISR3, EClearToEnable},
/*31*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_BATSTS_ISR1, EClearToEnable},
/*32*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TBATOR1_ISR1, EClearToEnable},
/*33*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TBATOR2_ISR1, EClearToEnable},
/*34*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_ICHGEOC_ISR1, EClearToEnable},
/*35*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_ICHGLOW_ISR1ASTO, EClearToEnable},
/*36*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_IICHGHIGH_ISR1, EClearToEnable},
/*37*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TMOVF_ISR1, EClearToEnable},
/*38*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_WOVF_ISR1, EClearToEnable},
/*39*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_ACCHGOV_ISR1, EClearToEnable},
/*40*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBUSOV_ISR1, EClearToEnable},
/*41*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBATOV_ISR1, EClearToEnable},
/*42*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBATLVL_ISR1, EClearToEnable},
/*43*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITMISR1, EClearToEnable},
/*44*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITTOISR1, EClearToEnable},
/*45*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITLKISR1, EClearToEnable},
/*46*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITKPISR1, EClearToEnable},
/*46*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_IDGND, ESetToEnable },
/*47*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_SESSEND, ESetToEnable },
/*48*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_SESSVALID, ESetToEnable },
/*49*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_VBUSVALID, ESetToEnable },
/*50*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_HOSTDISCONNECT, ESetToEnable },
/*51*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_CARDP, ESetToEnable },
/*52*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_CARINTDET, ESetToEnable },
/*53*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_IDFLOAT, ESetToEnable },
/*54*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_VB_SESS_VLD, ESetToEnable },
/*55*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_DM_HI, ESetToEnable },
/*56*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_DP_HI, ESetToEnable },
/*57*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_MANU, ESetToEnable },
/*58*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_ABNORMAL_STRESS, ESetToEnable },
/*59*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_FLOAT, ESetToEnable },
/*60*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_440K, ESetToEnable },
/*61*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_200K, ESetToEnable },
/*62*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_102K, ESetToEnable },
/*63*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_PSM_ERROR, ESetToEnable },
/*64*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_PH_ACC, ESetToEnable },
/*65*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_CHARGER, ESetToEnable },
/*66*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_USB_HOST, ESetToEnable },
/*67*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_USB_OTG_B, ESetToEnable },
/*68*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_CARKIT, ESetToEnable },
/*69*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_DISCONNECTED, ESetToEnable },
/*70*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_STOP_PLS_MISS, ESetToEnable },
/*71*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_STEREO_TO_MONO, ESetToEnable },
/*72*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_PHONE_UART, ESetToEnable },
/*73*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_PH_NO_ACK, ESetToEnable }
};
const static TInterruptBank pwrBank = {
ETPS65950_IRQ_PWR_CHG_PWRONS,
ETPS65950_IRQ_PWR_CHG_PRES,
ETPS65950_IRQ_PWR_USB_PRES,
ETPS65950_IRQ_PWR_RTC_IT,
ETPS65950_IRQ_PWR_HOT_DIE,
ETPS65950_IRQ_PWR_PWROK_TIMEOUT,
ETPS65950_IRQ_PWR_MBCHG,
ETPS65950_IRQ_PWR_SC_DETECT,
};
const static TInterruptBank madcBank = {
ETPS65950_IRQ_MADC_RT_ISR1,
ETPS65950_IRQ_MADC_SW1_ISR1,
ETPS65950_IRQ_MADC_SW2_ISR1,
ETPS65950_IRQ_MADC_USB_ISR1,
};
const static TInterruptBank gpioBank0 = {
ETPS65950_IRQ_GPIO_0ISR1,
ETPS65950_IRQ_GPIO_1ISR1,
ETPS65950_IRQ_GPIO_2ISR1,
ETPS65950_IRQ_GPIO_3ISR1,
ETPS65950_IRQ_GPIO_4ISR1,
ETPS65950_IRQ_GPIO_5ISR1,
ETPS65950_IRQ_GPIO_6ISR1,
ETPS65950_IRQ_GPIO_7ISR2
};
const static TInterruptBank gpioBank1 = {
ETPS65950_IRQ_GPIO_8ISR2,
ETPS65950_IRQ_GPIO_9ISR2,
ETPS65950_IRQ_GPIO_10ISR2,
ETPS65950_IRQ_GPIO_11ISR2,
ETPS65950_IRQ_GPIO_12ISR2,
ETPS65950_IRQ_GPIO_13ISR2,
ETPS65950_IRQ_GPIO_14ISR2,
ETPS65950_IRQ_GPIO_15ISR2
};
const static TInterruptBank gpioBank2 = {
ETPS65950_IRQ_GPIO16ISR3,
ETPS65950_IRQ_GPIO17ISR3
};
const static TInterruptBank bciBank0 = {
ETPS65950_IRQ_BCI_WOVF_ISR1,
ETPS65950_IRQ_BCI_TMOVF_ISR1,
ETPS65950_IRQ_BCI_IICHGHIGH_ISR1,
ETPS65950_IRQ_BCI_ICHGLOW_ISR1ASTO,
ETPS65950_IRQ_BCI_ICHGEOC_ISR1,
ETPS65950_IRQ_BCI_TBATOR2_ISR1,
ETPS65950_IRQ_BCI_TBATOR1_ISR1,
ETPS65950_IRQ_BCI_BATSTS_ISR1
};
const static TInterruptBank bciBank1 = {
ETPS65950_IRQ_BCI_VBATLVL_ISR1,
ETPS65950_IRQ_BCI_VBATOV_ISR1,
ETPS65950_IRQ_BCI_VBUSOV_ISR1,
ETPS65950_IRQ_BCI_ACCHGOV_ISR1
};
const static TInterruptBank keypBank = {
ETPS65950_IRQ_KEYP_ITKPISR1,
ETPS65950_IRQ_KEYP_ITLKISR1,
ETPS65950_IRQ_KEYP_ITTOISR1,
ETPS65950_IRQ_KEYP_ITMISR1,
};
const static TInterruptBank usbINTSTSBank = {
ETPS65950_IRQ_USB_INTSTS_IDGND,
ETPS65950_IRQ_USB_INTSTS_SESSEND,
ETPS65950_IRQ_USB_INTSTS_SESSVALID,
ETPS65950_IRQ_USB_INTSTS_VBUSVALID,
ETPS65950_IRQ_USB_INTSTS_HOSTDISCONNECT
};
const static TInterruptBank usbCARKITBank = {
ETPS65950_IRQ_USB_CARKIT_CARDP,
ETPS65950_IRQ_USB_CARKIT_CARINTDET,
ETPS65950_IRQ_USB_CARKIT_IDFLOAT
};
const static TInterruptBank usbOTHERBank = {
ETPS65950_IRQ_USB_OTHER_INT_VB_SESS_VLD,
ETPS65950_IRQ_USB_OTHER_INT_DM_HI,
ETPS65950_IRQ_USB_OTHER_INT_DP_HI,
ETPS65950_IRQ_USB_OTHER_INT_MANU,
ETPS65950_IRQ_USB_OTHER_INT_ABNORMAL_STRESS
};
const static TInterruptBank usbIDINTBank = {
ETPS65950_IRQ_USB_ID_INT_ID_RES_FLOAT,
ETPS65950_IRQ_USB_ID_INT_ID_RES_440K,
ETPS65950_IRQ_USB_ID_INT_ID_RES_200K,
ETPS65950_IRQ_USB_ID_INT_ID_RES_102K
};
const static TInterruptBank usbSM1Bank = {
ETPS65950_IRQ_USB_CARKIT_SM_1_PSM_ERROR,
ETPS65950_IRQ_USB_CARKIT_SM_1_PH_ACC,
ETPS65950_IRQ_USB_CARKIT_SM_1_CHARGER,
ETPS65950_IRQ_USB_CARKIT_SM_1_USB_HOST,
ETPS65950_IRQ_USB_CARKIT_SM_1_USB_OTG_B,
ETPS65950_IRQ_USB_CARKIT_SM_1_CARKIT
};
const static TInterruptBank usbSM2Bank = {
ETPS65950_IRQ_USB_CARKIT_SM_2_STOP_PLS_MISS,
ETPS65950_IRQ_USB_CARKIT_SM_2_STEREO_TO_MONO,
ETPS65950_IRQ_USB_CARKIT_SM_2_PHONE_UART,
ETPS65950_IRQ_USB_CARKIT_SM_2_PH_NO_ACK
};
const static TInterruptBank* TheMapTable [6][6] = {
//maps against PIH_ISR bits
//reg banks sub modules
{&gpioBank0, &gpioBank1, &gpioBank2, NULL, NULL, NULL},
{&keypBank, NULL, NULL, NULL, NULL, NULL},
{&bciBank0, &bciBank1, NULL, NULL, NULL, NULL},
{&madcBank, NULL, NULL, NULL, NULL, NULL},
{&usbINTSTSBank, &usbCARKITBank, &usbOTHERBank, &usbIDINTBank, &usbSM1Bank, &usbSM2Bank},
{&pwrBank, NULL, NULL, NULL, NULL, NULL}
};
const static TSubInterruptBank subBank[6] = {
/*gpio*/{3,{Register::GPIO_ISR1A,Register::GPIO_ISR2A,Register::GPIO_ISR3A,NULL,NULL,NULL}},
/*keyp*/{1,{Register::KEYP_ISR1,NULL,NULL,NULL,NULL,NULL}},
/*bci*/ {2,{Register::BCIISR1A,Register::BCIISR2A,NULL,NULL,NULL,NULL}},
/*madc*/{1,{Register::MADC_ISR1,NULL,NULL,NULL,NULL,NULL}},
/*usb*/ {6,{Register::USB_INT_STS,Register::CARKIT_INT_STS,Register::OTHER_INT_STS,Register::ID_INT_STS, Register::CARKIT_SM_1_INT_STS, Register::CARKIT_SM_2_INT_STS}},
/*pwr*/ {1,{Register::PWR_ISR1,NULL,NULL,NULL,NULL,NULL}},
};
TPS65950Int::TPS65950Int()
: iDfc( Dfc, this, KDfcPriority )
{
for( TInt i = 0; i < TPS65950::KNumTPSInts; ++i )
{
TheHandlers[ i ].iIsr = Spurious;
TheHandlers[ i ].iPtr = (TAny*)( KTPS65950IrqFirst + i );
}
}
TInt TPS65950Int::Init()
{
iDfc.SetDfcQ( TheInterruptDfcQue );
TInt r = InitialiseTPS65950IntController();
if( KErrNone == r )
{
TInt r = Interrupt::Bind( EOmap3530_IRQ7_SYS_NIRQ, Dispatch, this );
if( KErrNone == r )
{
r = Interrupt::Enable( EOmap3530_IRQ7_SYS_NIRQ );
}
}
if( KErrNone == r )
{
Register( EIrqRangeBasePsu );
}
return r;
}
TInt TPS65950Int::InitialiseTPS65950IntController()
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+TPS65950Int:InitIntController"));
struct TInitRegList
{
TUint16 iReg;
TUint8 iValue;
};
static const TInitRegList KInitList[] =
{
{ GPIO_SIH_CTRL::Addr, GPIO_SIH_CTRL::SIH_PENDDIS | GPIO_SIH_CTRL::SIH_COR | GPIO_SIH_CTRL::SIH_EXCLEN },
// { Register::GPIO_CTRL, 0x00 },
{ Register::GPIO_IMR1A , 0xff },
{ Register::GPIO_IMR2A , 0xff },
{ Register::GPIO_IMR3A , 0xff },
{ Register::GPIO_IMR1B , 0xff },
{ Register::GPIO_IMR2B , 0xff },
{ Register::GPIO_IMR3B , 0xff },
{ Register::GPIO_EDR1, 0x00 },
{ Register::GPIO_EDR2, 0x00 },
{ Register::GPIO_EDR3, 0x00 },
{ Register::GPIO_EDR4, 0x00 },
{ Register::GPIO_EDR5, 0x00 },
{ Register::USB_INT_EN_RISE_CLR, 0x1f },
{ Register::USB_INT_EN_FALL_CLR, 0x1f },
{ Register::CARKIT_INT_EN_CLR, 0x1f },
{ Register::OTHER_INT_EN_RISE_CLR,0xe3 },
{ Register::OTHER_INT_EN_FALL_CLR,0xe3 },
{ Register::ID_INT_EN_RISE_CLR, 0x0f },
{ Register::ID_INT_EN_FALL_CLR, 0x0f },
{ Register::CARKIT_SM_1_INT_EN_CLR,0xff },
{ Register::CARKIT_SM_2_INT_EN_CLR,0xff },
{ KEYP_SIH_CTRL::Addr, KEYP_SIH_CTRL::SIH_PENDDIS | KEYP_SIH_CTRL::SIH_COR | KEYP_SIH_CTRL::SIH_EXCLEN },
{ Register::KEYP_IMR1, 0x0f },
{ Register::KEYP_IMR2, 0x0f },
{ Register::KEYP_EDR, FULL_RISING_EDGEMASK },
{ BCISIHCTRL::Addr, BCISIHCTRL::SIH_PENDDIS | BCISIHCTRL::SIH_COR | BCISIHCTRL::SIH_EXCLEN },
{ Register::BCIIMR1A, 0xff },
{ Register::BCIIMR2A, 0xff },
{ Register::BCIIMR1B, 0xff },
{ Register::BCIIMR2B, 0xff },
{ Register::BCIEDR1, FULL_RISING_EDGEMASK },
{ Register::BCIEDR2, FULL_RISING_EDGEMASK },
{ Register::BCIEDR3, FULL_RISING_EDGEMASK },
{ MADC_SIH_CTRL::Addr, MADC_SIH_CTRL::SIH_PENDDIS | MADC_SIH_CTRL::SIH_COR | MADC_SIH_CTRL::SIH_EXCLEN },
{ Register::MADC_IMR1, 0x0f },
{ Register::MADC_IMR2, 0x0f },
{ Register::MADC_EDR, FULL_RISING_EDGEMASK },
{ PWR_SIH_CTRL::Addr, PWR_SIH_CTRL::SIH_PENDDIS | PWR_SIH_CTRL::SIH_COR | PWR_SIH_CTRL::SIH_EXCLEN },
{ Register::PWR_IMR1, 0xff },
{ Register::PWR_IMR2, 0xff },
{ Register::PWR_EDR1, FULL_FALLING_EDGEMASK },
{ Register::PWR_EDR2, FULL_FALLING_EDGEMASK }
};
const TInt KInitListCount = (sizeof( KInitList ) / sizeof( KInitList[0] ) );
static const TUint16 KClearList[] =
{
Register::CARKIT_INT_LATCH,
Register::USB_INT_LATCH,
Register::OTHER_INT_LATCH,
Register::ID_INT_LATCH,
Register::CARKIT_SM_1_INT_LATCH,
Register::CARKIT_SM_2_INT_LATCH,
Register::GPIO_ISR1A,
Register::GPIO_ISR2A,
Register::GPIO_ISR3A,
Register::KEYP_ISR1,
Register::BCIISR1A,
Register::BCIISR2A,
Register::MADC_ISR1,
Register::PWR_ISR1
};
const TInt KClearListCount = (sizeof( KClearList ) / sizeof( KClearList[0] ) );
TInt r = KErrNone;
// Disable all interrupts
for( TInt i = 0; (i < KInitListCount) && (KErrNone == r); ++i )
{
r = WriteSync( KInitList[i].iReg, KInitList[i].iValue );
}
if(r == KErrNone)
{
// Clear all interrupts
for( TInt i = 0; (i < KClearListCount) && (KErrNone == r); ++i )
{
// some registers need more reads to clear them, e.g. PWR_ISR1 needs 3- why is that?
TInt num_attempts = 5;
TUint8 dummy = 3;
while(dummy && (num_attempts > 0))
{
num_attempts--;
r = ReadSync( KClearList[i], dummy );
if(r != KErrNone)
{
break;
}
}
}
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-TPS65950Int:InitIntController:%d", r));
return r;
}
void TPS65950Int::Spurious( TAny* aParam )
{
Kern::Fault("TPS65950SpurioustInt", (TInt)aParam );
}
TInt TPS65950Int::Bind(TInt aId, TIsr aIsr, TAny* aPtr)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Bind:%x->%x", aId, aIsr ));
TInt r = KErrNone;
if( (TUint)aId < KTPS65950IrqLast )
{
TUint tblOffset = aId - KTPS65950IrqFirst;
TInt irq=__SPIN_LOCK_IRQSAVE_W(BeagleExtIVTLock);
TheHandlers[tblOffset ].iIsr = aIsr;
TheHandlers[tblOffset].iPtr = aPtr;
__SPIN_UNLOCK_IRQRESTORE_W(BeagleExtIVTLock,irq);
}
else
{
r = KErrArgument;
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Bind:%x:%d", aId, r ));
return r;
}
TInt TPS65950Int::Unbind(TInt aId)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Unbind:%x", aId ));
TInt r = KErrNone;
if( (TUint)aId < KTPS65950IrqLast )
{
TUint tblOffset = aId - KTPS65950IrqFirst;
TInt irq=__SPIN_LOCK_IRQSAVE_W(BeagleExtIVTLock);
TheHandlers[tblOffset ].iIsr = Spurious;
TheHandlers[tblOffset ].iPtr = NULL;
__SPIN_UNLOCK_IRQRESTORE_W(BeagleExtIVTLock,irq);
}
else
{
r = KErrArgument;
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Unbind:%x:%d", aId, r ));
return r;
}
TInt TPS65950Int::Enable(TInt aId)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Enable:%x", aId ));
TInt r = KErrNone;
if( (TUint)aId < KTPS65950IrqLast )
{
CHECK_PRECONDITIONS(MASK_NOT_ISR | MASK_NOT_IDFC,"tps65950::InterruptEnable Cant enable a slow src in ISR Context");
TUint tblOffset = aId - KTPS65950IrqFirst;
TInt irq=__SPIN_LOCK_IRQSAVE_R(BeagleExtIVTLock);
if( TheHandlers[ tblOffset ].iIsr == Spurious )
{
r = KErrNotReady;
}
__SPIN_UNLOCK_IRQRESTORE_R(BeagleExtIVTLock,irq);
if( r != KErrNone )
{
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Enable:%d NOT BOUND", aId ));
}
else
{
const TControl& control = KControl[ tblOffset ];
TUint8 val;
ReadSync( control.iSetReg, val );
if( EClearToEnable == control.iPolarity )
{
ClearSetSync( control.iSetReg, control.iBitMask, KSetNone );
}
else
{
ClearSetSync( control.iSetReg, KClearNone, control.iBitMask );
}
ReadSync( control.iSetReg, val );
}
}
else
{
r = KErrArgument;
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Enable:%x:%d", aId, r ));
return r;
}
TInt TPS65950Int::Disable(TInt aId)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Disable:%x", aId ));
TInt r = KErrNone;
if( (TUint)aId < KTPS65950IrqLast )
{
CHECK_PRECONDITIONS(MASK_NOT_ISR | MASK_NOT_IDFC,"tps65950::InterruptDisable Cant disable a slow src in ISR Context");
TUint tblOffset = aId - KTPS65950IrqFirst;
TInt irq=__SPIN_LOCK_IRQSAVE_R(BeagleExtIVTLock);
if( TheHandlers[ tblOffset ].iIsr == Spurious )
{
r = KErrNotReady;
}
__SPIN_UNLOCK_IRQRESTORE_R(BeagleExtIVTLock,irq);
if( r != KErrNone )
{
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Disable:%d NOT BOUND", aId ));
}
else
{
const TControl& control = KControl[ tblOffset ];
if( EClearToEnable == control.iPolarity )
{
ClearSetSync( control.iClrReg, KClearNone, control.iBitMask );
}
else
{
ClearSetSync( control.iSetReg, control.iBitMask, KSetNone );
}
}
}
else
{
r = KErrArgument;
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Disable:%x:%d", aId, r ));
return r;
}
TInt TPS65950Int::Clear(TInt aId)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Clear:%x", aId ));
TInt r = KErrNone;
if( (TUint)aId < KTPS65950IrqLast )
{
CHECK_PRECONDITIONS(MASK_NOT_ISR,"tps65950::InterruptClear Cant clear a slow src in ISR Context");
TUint tblOffset = aId - KTPS65950IrqFirst;
TUint8 value;
//clear on read ! //we may lose some of the other ints if many enabled
ReadSync( KControl[ tblOffset ].iStatReg, value );
}
else
{
r = KErrArgument;
}
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Clear:%x:%d", aId, r ));
return r;
}
TInt TPS65950Int::SetPriority(TInt aId, TInt aPriority)
{
__KTRACE_OPT(KTPS65950,Kern::Printf("tps65950:SetPriority:%x", aId ));
return KErrNotSupported;
}
void TPS65950Int::Dispatch(TAny * aParam )
{
Interrupt::Disable(EOmap3530_IRQ7_SYS_NIRQ);
reinterpret_cast<TPS65950Int*>(aParam)->iDfc.Add();
}
void TPS65950Int::Dfc( TAny* aParam )
{
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950Int:Dfc" ));
TUint8 highVectors=0;
TUint8 subVector=0;
ReadSync( PIH_ISR_P1::Addr, highVectors );
__ASSERT_DEBUG( highVectors != 0,Kern::Fault("tps65950 int signalled but no vector ",highVectors));
for(TInt i=0; i<=5;i++,highVectors >>=1)
{
if(highVectors & 0x1)
{
for(TInt8 j=0;j<subBank[i].iLen;j++)
{
ReadSync( subBank[i].iRegs[j], subVector );
for(TInt k=0;k < 8;k++)
{
if(subVector & 0x1)
{
TInt tblOffset = TheMapTable[i][j]->iBit[k] - KTPS65950IrqFirst;
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Dfc:BIT_%d HIGH on REG %x VECTOR is %x ISR %x",
k,subBank[i].iRegs[j], tblOffset, TheHandlers[tblOffset].iIsr));
(TheHandlers[tblOffset].iIsr)(TheHandlers[tblOffset].iPtr);
}
subVector >>= 1;
}
}
}
}
Interrupt::Enable(EOmap3530_IRQ7_SYS_NIRQ);
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Dfc" ));
}
} // namespace TPS65950
GLDEF_C TInt InitInterrupts()
{
TInt r = Kern::DfcQCreate( TheInterruptDfcQue, KInterruptDfcQuePriority, &KInterruptDfcQueName );
if( KErrNone == r )
{
r = KErrNoMemory;
TPS65950::TPS65950Int* dispatcher = new TPS65950::TPS65950Int;
if( dispatcher )
{
r = dispatcher->Init();
}
}
return r;
}
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
44
],
[
46,
50
],
[
52,
96
],
[
99,
100
],
[
102,
105
],
[
107,
110
],
[
112,
113
],
[
115,
119
],
[
121,
131
],
[
133,
140
],
[
142,
145
],
[
147,
150
],
[
153,
154
],
[
156,
156
],
[
158,
160
],
[
162,
166
],
[
168,
171
],
[
174,
179
],
[
181,
207
],
[
209,
213
],
[
215,
258
],
[
260,
261
],
[
263,
287
],
[
289,
303
],
[
305,
310
],
[
312,
313
],
[
315,
358
],
[
360,
389
],
[
391,
444
],
[
446,
446
],
[
463,
464
],
[
466,
534
],
[
536,
541
],
[
543,
544
],
[
546,
549
],
[
551,
583
],
[
585,
590
],
[
592,
593
],
[
595,
598
],
[
600,
627
],
[
629,
650
],
[
652,
652
],
[
654,
656
],
[
658,
661
],
[
663,
664
],
[
666,
667
],
[
669,
675
],
[
677,
680
],
[
682,
682
],
[
684,
685
],
[
687,
687
],
[
690,
713
]
],
[
[
45,
45
],
[
51,
51
],
[
97,
98
],
[
101,
101
],
[
106,
106
],
[
111,
111
],
[
114,
114
],
[
120,
120
],
[
132,
132
],
[
141,
141
],
[
146,
146
],
[
151,
152
],
[
155,
155
],
[
157,
157
],
[
161,
161
],
[
167,
167
],
[
172,
173
],
[
180,
180
],
[
208,
208
],
[
214,
214
],
[
259,
259
],
[
262,
262
],
[
288,
288
],
[
304,
304
],
[
311,
311
],
[
314,
314
],
[
359,
359
],
[
390,
390
],
[
445,
445
],
[
447,
462
],
[
465,
465
],
[
535,
535
],
[
542,
542
],
[
545,
545
],
[
550,
550
],
[
584,
584
],
[
591,
591
],
[
594,
594
],
[
599,
599
],
[
628,
628
],
[
651,
651
],
[
653,
653
],
[
657,
657
],
[
662,
662
],
[
665,
665
],
[
668,
668
],
[
676,
676
],
[
681,
681
],
[
683,
683
],
[
686,
686
],
[
688,
689
]
]
] |
23b609262544f88fc4ba7e55e6c10cbc9dfe3bc4
|
91b964984762870246a2a71cb32187eb9e85d74e
|
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/range/test/iterator_pair.cpp
|
e97e596a965eeda7fa5824c8f6aeb3c5fc8740f3
|
[
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
willrebuild/flyffsf
|
e5911fb412221e00a20a6867fd00c55afca593c7
|
d38cc11790480d617b38bb5fc50729d676aef80d
|
refs/heads/master
| 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,486 |
cpp
|
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# pragma warn -8091 // supress warning in Boost.Test
# pragma warn -8057 // unused argument argc/argv in Boost.Test
#endif
#include <boost/range/functions.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/test/test_tools.hpp>
#include <vector>
using namespace boost;
void check_iterator_pair()
{
typedef std::vector<int> vec_t;
vec_t vec;
vec.push_back( 4 );
typedef std::pair<vec_t::iterator,vec_t::iterator>
pair_t;
typedef std::pair<vec_t::const_iterator,vec_t::const_iterator>
const_pair_t;
typedef const pair_t const_pair_tt;
pair_t pair = std::make_pair( begin( vec ), end( vec ) );
const_pair_t const_pair = std::make_pair( begin( vec ), end( vec ) );
const_pair_tt constness_pair( pair );
BOOST_STATIC_ASSERT(( is_same< range_value<pair_t>::type,
detail::iterator_traits<pair_t::first_type>::value_type>::value ));
BOOST_STATIC_ASSERT(( is_same< range_iterator<pair_t>::type, pair_t::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_const_iterator<pair_t>::type, pair_t::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_difference<pair_t>::type,
detail::iterator_traits<pair_t::first_type>::difference_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_size<pair_t>::type, std::size_t >::value ));
BOOST_STATIC_ASSERT(( is_same< range_result_iterator<pair_t>::type, pair_t::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_result_iterator<const_pair_t>::type, const_pair_t::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_value<const_pair_tt>::type,
detail::iterator_traits<const_pair_t::first_type>::value_type>::value ));
BOOST_STATIC_ASSERT(( is_same< range_iterator<const_pair_tt>::type, const_pair_tt::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_const_iterator<const_pair_tt>::type, const_pair_tt::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_difference<const_pair_tt>::type,
detail::iterator_traits<const_pair_tt::first_type>::difference_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_size<const_pair_tt>::type, std::size_t >::value ));
BOOST_STATIC_ASSERT(( is_same< range_result_iterator<const_pair_tt>::type, const_pair_tt::first_type >::value ));
BOOST_STATIC_ASSERT(( is_same< range_result_iterator<const_pair_tt>::type, const_pair_tt::first_type >::value ));
BOOST_CHECK( begin( pair ) == pair.first );
BOOST_CHECK( end( pair ) == pair.second );
BOOST_CHECK( empty( pair ) == (pair.first == pair.second) );
BOOST_CHECK( size( pair ) == std::size_t( std::distance( pair.first, pair.second ) ) );
BOOST_CHECK( begin( const_pair ) == const_pair.first );
BOOST_CHECK( end( const_pair ) == const_pair.second );
BOOST_CHECK( empty( const_pair ) == (const_pair.first == const_pair.second) );
BOOST_CHECK( size( const_pair ) == std::size_t( std::distance( const_pair.first, const_pair.second ) ) );
BOOST_CHECK( begin( constness_pair ) == constness_pair.first );
BOOST_CHECK( end( constness_pair ) == constness_pair.second );
BOOST_CHECK( empty( constness_pair ) == (constness_pair.first == const_pair.second) );
BOOST_CHECK( size( constness_pair ) == std::size_t( std::distance( constness_pair.first, constness_pair.second ) ) );
}
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;
test_suite* init_unit_test_suite( int argc, char* argv[] )
{
test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
test->add( BOOST_TEST_CASE( &check_iterator_pair ) );
return test;
}
|
[
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] |
[
[
[
1,
96
]
]
] |
8e40bce0672e8313d2307c5011fa9369764c6d5e
|
9277f8b966db2bc75acaf12a75f620853be4ffa4
|
/utils/apex_tensor_iterator.h
|
1ac8cd6013ce69e4ca46067a94254ec597f09743
|
[] |
no_license
|
guochao1/apex-dbn
|
3e6ad9de12564fc206ed08e563ecea1976edfff5
|
d95a606a55ba80687e730b78bd4579f20d616eec
|
refs/heads/master
| 2021-01-22T13:42:09.752260 | 2010-09-29T09:13:39 | 2010-09-29T09:13:39 | 40,700,204 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 986 |
h
|
#ifndef _APEX_TENSOR_ITERATOR_H_
#define _APEX_TENSOR_ITERATOR_H_
#include "../tensor/apex_tensor.h"
namespace apex_utils{
// tensor iterator that iterates over the data
namespace deprecated{
// this file is deprecated!!
template<typename T>
class ITensorIterator{
public:
// set the parameter
virtual void set_param( const char *name, const char *val )=0;
// initalize the iterator
virtual void init( void ) = 0;
// move to next mat trunk
virtual bool next_trunk() = 0;
// get current matrix
virtual const T trunk() const = 0;
// get validation trunk
virtual const T validation_trunk() const = 0;
// set before first of the item
virtual void before_first() = 0;
public:
virtual ~ITensorIterator(){}
};
};
};
#endif
|
[
"workcrow@b861ab8a-2dba-11df-8e64-fd3be38ee323"
] |
[
[
[
1,
31
]
]
] |
e1c211fd2e481e207d844c909f937e10a4eba91f
|
51e1cf5dc3b99e8eecffcf5790ada07b2f03f39c
|
/FileAssistant++/Source/CVector.h
|
94bcc6d8753fe6a266950c9d2bc2e476600ed459
|
[] |
no_license
|
jdek/jim-pspware
|
c3e043b59a69cf5c28daf62dc9d8dca5daf87589
|
fd779e1148caac2da4c590844db7235357b47f7e
|
refs/heads/master
| 2021-05-31T06:45:03.953631 | 2007-06-25T22:45:26 | 2007-06-25T22:45:26 | 56,973,047 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,457 |
h
|
/***********************************************************************************
Module : CVector.h
Description :
Last Modified $Date: $
$Revision: $
Copyright (C) 11 July 2003 T Swann
***********************************************************************************/
#ifndef CVECTOR_H_
#define CVECTOR_H_
//**********************************************************************************
// Include Files
//**********************************************************************************
//**********************************************************************************
// Macros
//**********************************************************************************
//**********************************************************************************
// Types
//**********************************************************************************
struct P2
{
float x;
float y;
};
struct P3
{
float x;
float y;
float z;
};
struct P4
{
float x;
float y;
float z;
float w;
};
//**********************************************************************************
// Constants
//**********************************************************************************
//**********************************************************************************
// Class definitions
//**********************************************************************************
//*********************************************************************************
//*********************************************************************************
//
// V2 class definition
//
//*********************************************************************************
//*********************************************************************************
class V2
{
public:
V2();
V2( const V2 & src );
V2( const float ix, const float iy );
V2( const V2 * const p_src );
public:
V2 & operator = ( const V2 & vec );
const V2 operator + ( const V2 & rhs ) const;
friend V2 operator + ( const V2 & vector, const float & val );
V2 & operator += ( const V2 & vector );
const V2 operator - ( const V2 & rhs ) const;
friend V2 operator - ( const V2 & vector );
friend V2 operator - ( const V2 & vector, const float & val );
V2 & operator -= ( const V2 & vector );
const V2 operator * ( const float rhs ) const;
friend V2 operator * ( const float fScalar, const V2 & vector );
V2 & operator *= ( const float fScalar );
V2 & operator /= ( const float fScalar );
public:
float Length() const;
float LengthSq() const;
float Dot( const V2 & vector ) const;
float Angle() const;
float Normalise( const float tolerance = 1e-06 );
V2 Lerp( const V2 &vector, const float weight ) const;
float Distance( const V2 & vector ) const;
float DistanceSq( const V2 & vector ) const;
public:
float x;
float y;
};
//*********************************************************************************
//*********************************************************************************
//
// V3 class definition
//
//*********************************************************************************
//*********************************************************************************
class V3
{
public:
V3();
V3( const V3 & src );
V3( const V3 * const p_src );
V3( const float ix, const float iy, const float iz );
V3( const float * const p_src );
public:
operator float * ();
operator const float * () const;
V3 operator + () const;
V3 operator - () const;
V3 & operator = ( const V3 & vec );
const V3 operator + ( const V3 & rhs ) const;
friend V3 operator + ( const V3 & vector, const float & val );
V3 & operator += ( const float & val );
V3 & operator += ( const V3 & vector );
const V3 operator - ( const V3 & rhs ) const;
V3 & operator -= ( const float & val );
V3 & operator -= ( const V3 & vector );
const V3 operator * ( const float rhs ) const;
friend V3 operator * ( const float fScalar, const V3 & vector );
V3 & operator *= ( const float fScalar );
V3 & operator /= ( const float fScalar );
bool operator == ( const V3 & rhs ) const;
bool operator != ( const V3 & rhs ) const;
bool operator > ( const V3 & rhs ) const;
bool operator < ( const V3 & rhs ) const;
bool operator >= ( const V3 & rhs ) const;
bool operator <= ( const V3 & rhs ) const;
public:
float Length() const;
float LengthSq() const;
float Distance( const V3 & vector ) const;
float DistanceSq( const V3 & vector ) const;
float HorizontalDistance() const;
float HorizontalDistanceSq() const;
float HorizontalDistance( const V3 & vector ) const;
float HorizontalDistanceSq( const V3 & vector ) const;
float Dot( const V3 & vector ) const;
float Angle() const;
float Pitch() const;
bool IsNormalised() const;
float Normalise();
V3 Normal() const;
V3 Cross( const V3 & vector ) const;
V3 UnitCross( const V3 & vector ) const;
bool IsParallel( const V3 & vector ) const ;
V3 Perpendicular() const;
V3 Minimise( const V3 & vector ) const;
V3 Maximise( const V3 & vector ) const;
V3 Lerp( const V3 & vector, const float weight ) const;
public:
float x;
float y;
float z;
};
//*********************************************************************************
//*********************************************************************************
//
// V4 class definition
//
//*********************************************************************************
//*********************************************************************************
class V4
{
public:
V4();
V4( const V4 & src );
V4( const V4 * const p_src );
V4( const float x, const float y, const float z, const float w );
public:
V4 & operator = ( const V4 & vec );
const V4 operator + ( const V4 & rhs) const;
friend V4 operator + ( const V4 & vector, const float & val );
V4 & operator += ( const float & val );
V4 & operator += ( const V4 & vector );
const V4 operator - ( const V4 & rhs ) const;
friend V4 operator - ( const V4 & vector );
friend V4 operator - ( const V4 & vector, const float & val );
V4 & operator -= ( const float & val );
V4 & operator -= ( const V4 & vector );
const V4 operator * ( const float rhs ) const;
friend V4 operator * ( const float fScalar, const V4 & vector );
V4 & operator *= ( const float fScalar );
V4 & operator /= ( const float fScalar );
public:
float Length() const;
float LengthSq() const;
float Dot( const V4 & vector ) const;
float Normalise();
V4 Normal() const;
V4 Cross( const V4 & vector1, const V4 & vector2 ) const;
V4 UnitCross( const V4 & vector1, const V4 &vector2 ) const;
V4 Lerp( const V4 & vector, const float weight ) const;
public:
float x;
float y;
float z;
float w;
};
//*********************************************************************************
// Externs
//*********************************************************************************
const V3 gZeroVector( 0.f, 0.f, 0.f );
const V3 gAtVector( 0.f, 0.f, 1.f );
const V3 gForwardVector( 0.f, 0.f, 1.f );
const V3 gUpVector( 0.f, 1.f, 0.f );
const V3 gRightVector( 1.f, 0.f, 0.f );
const V4 gZeroVector4( 0.0f, 0.0f, 0.0f, 0.0f );
const V4 gOneVector4( 1.0f, 1.0f, 1.0f, 1.0f );
const V4 gHalfVector4( 0.5f, 0.5f, 0.5f, 0.5f );
//*********************************************************************************
// Prototypes
//*********************************************************************************
V2 Rotate( const V2 & v, float y_angle );
V3 RotateY( const V3 & v, float y_angle );
V3 RotateX( const V3 & v, float x_angle );
V3 RotateZ( const V3 & v, float z_angle );
//**********************************************************************************
// Prototypes
//**********************************************************************************
#endif /* _VECTOR_H_ */
|
[
"71m@ff2c0c17-07fa-0310-a4bd-d48831021cb5"
] |
[
[
[
1,
310
]
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.