blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
16
| author_lines
sequencelengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72520da63a14777d2ced4530a248f46d48b18a75 | 155c4955c117f0a37bb9481cd1456b392d0e9a77 | /Tessa/TessaInstructions/UnaryInstruction.cpp | 39d4b02ecea5bf2aa91fe2c2e22df18d0a6ec682 | [] | no_license | zwetan/tessa | 605720899aa2eb4207632700abe7e2ca157d19e6 | 940404b580054c47f3ced7cf8995794901cf0aaa | refs/heads/master | 2021-01-19T19:54:00.236268 | 2011-08-31T00:18:24 | 2011-08-31T00:18:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,537 | cpp | #include "TessaInstructionheader.h"
/***
* MUST BE DECLARED IN THE SAME ORDER AS THE ACTUAL UNARY OPS ENUM
*/
#define stringify( name ) # name
const char *TessaUnaryOpNames[] =
{
stringify(BITWISE_NOT),
stringify(NOT),
stringify(NEGATE),
stringify(MINUS)
};
#undef stringify
namespace TessaInstructions {
UnaryInstruction::UnaryInstruction(TessaUnaryOp opcode, TessaInstruction* operand, TessaVM::BasicBlock* insertAtEnd)
: TessaInstruction(insertAtEnd)
{
this->setOpcode(opcode);
this->setOperand(operand);
}
TessaInstruction* UnaryInstruction::getOperand() {
return this->operand;
}
TessaUnaryOp UnaryInstruction::getOpcode() {
return this->opcode;
}
void UnaryInstruction::setOperand(TessaInstruction* operand) {
this->operand = operand;
}
void UnaryInstruction::setOpcode(TessaUnaryOp op) {
this->opcode = op;
}
bool UnaryInstruction::isUnary() {
return true;
}
TessaUnaryOp UnaryInstruction::getUnaryOpcodeFromAbcOpcode(AbcOpcode opcode) {
switch (opcode) {
case OP_bitnot:
return BITWISE_NOT;
case OP_not:
return NOT;
case OP_negate:
return NEGATE;
default:
TessaAssertMessage(false, "Unknown Unary Op");
break;
}
TessaAssert(false);
return NOT;
}
void UnaryInstruction::print() {
TessaAssert(opcode < ((sizeof(TessaUnaryOpNames) / sizeof(char*)) ));
char buffer[512];
VMPI_snprintf(buffer, sizeof(buffer), "%s UnaryInstruction %s %s -> (Type %s) \n", getPrintPrefix().c_str(), TessaUnaryOpNames[opcode],
operand->getOperandString().c_str(),
getType()->toString().data()
);
printf("%s", buffer);
}
void UnaryInstruction::visit(TessaVisitorInterface* tessaVisitor) {
tessaVisitor->visit(this);
}
bool UnaryInstruction::producesValue() {
return true;
}
UnaryInstruction* UnaryInstruction::clone(MMgc::GC *gc, MMgc::GCHashtable* originalToCloneMap, TessaVM::BasicBlock* insertCloneAtEnd) {
TessaInstruction* clonedOperand = (TessaInstruction*) originalToCloneMap->get(operand);
UnaryInstruction* clonedUnary = new (gc) UnaryInstruction(this->getOpcode(), clonedOperand, insertCloneAtEnd);
clonedUnary->setType(this->getType());
return clonedUnary;
}
List<TessaValue*, LIST_GCObjects>* UnaryInstruction::getOperands(MMgc::GC* gc) {
avmplus::List<TessaValue*, LIST_GCObjects>* operandList = new (gc) avmplus::List<TessaValue*, LIST_GCObjects>(gc);
operandList->add(getOperand());
return operandList;
}
} | [
"[email protected]"
] | [
[
[
1,
91
]
]
] |
bcca31b6dc3e027c8cb323ac4dc53b9e0ca453f3 | 409d546398e220b18421f7311596ab87574a3543 | /modules/Localization/include/Map.h | ce525331affb4dc0f2778589c41c42320b9ce946 | [] | no_license | aozgelen/RobotController | 7fab87894e80408bf365fcc309c1080579c9d09e | 698b953c3ff6d788f8474490cf600d79c48eb4c2 | refs/heads/master | 2016-09-03T07:25:03.206987 | 2011-06-23T19:43:50 | 2011-06-23T19:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,013 | h | /*
* Map.h
*
* Created on: Dec 21, 2008
* Author: richardmarcley
*/
#ifndef MAP_H_
#define MAP_H_
#include <vector>
#include <math.h>
#include <stdio.h>
#include <string>
#include "MapMarker.h"
#include "MapWall.h"
#include "Position.h"
using namespace std;
class Map {
public:
Map();
Map(int length, int height);
void addMarker(MapMarker marker);
vector<MapMarker> getMarkerById(string id);
MapMarker getMarker(int index);
vector<MapMarker> getMarkers() {
return markers;
}
/* added for walls */
void addWall(MapWall wall);
vector<MapWall> getWallById(string id);
MapWall getWall(int index);
vector<MapWall> getWalls() {
return walls;
}
/* add for walls ends */
int getLength() {
return length;
}
int getHeight() {
return height;
}
int length;
int height;
protected:
vector<MapMarker> markers;
vector<MapWall> walls;
};
#endif /* MAP_H_ */
| [
"agentt@agentt-laptop.(none)"
] | [
[
[
1,
63
]
]
] |
aeb706918d97b4a3b830a36c6d2eca0f2473f01c | 2144da7faeea0a8d5b4d8d3674ac35c474394eef | /TPA06CA_Adjuster/TPA06CA_Adjuster/stdafx.cpp | 76c80f9771c2ab819d3f2c2c1cb60497b33abb36 | [] | no_license | wushenhui1990/kei321test | e29cfbbb9f34ddf74d9421fa05c7af455149299b | 6feff7480f086d6540da2beca5606101398c6b2a | refs/heads/master | 2021-01-21T22:26:03.676609 | 2010-11-30T10:11:15 | 2010-11-30T10:11:15 | 37,236,510 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 216 | cpp | // stdafx.cpp : source file that includes just the standard includes
// TPA06CA_Adjuster.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"cherry.xuu@7dce72e8-8f82-df7a-1f6d-a875c0820ed8"
] | [
[
[
1,
7
]
]
] |
bdf8a22dc1e7ef1f6a71cd9b839f20d739c5e182 | 1d5c2ff3350d099bf57049a3a66915d7ba91c39f | /DreamsMainDialog.cpp | 7c75b6f7b2cd86ae5c1061b076e8b3c6cb14a969 | [] | no_license | kjk/moriarty-sm | f73f9a4f5e1ac9bfa923fdcfd1fc7a308d5db057 | 75cfa46e60e75c6054549800270601448ab5b3b9 | refs/heads/master | 2021-01-20T06:20:11.762112 | 2005-10-17T15:39:11 | 2005-10-17T15:39:11 | 18,798 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,800 | cpp | #include "DreamsMainDialog.h"
#include "LookupManager.h"
#include "InfoMan.h"
#include "HyperlinkHandler.h"
#include "DreamsModule.h"
#include "InfoManPreferences.h"
#include <SysUtils.hpp>
#include <UTF8_Processor.hpp>
#include <Text.hpp>
#include <UniversalDataFormat.hpp>
DreamsMainDialog::DreamsMainDialog():
ModuleDialog(IDR_DONE_SEARCH_MENU),
title_(NULL)
{
}
DreamsMainDialog::~DreamsMainDialog()
{
free(title_);
}
MODULE_DIALOG_CREATE_IMPLEMENT(DreamsMainDialog, IDD_DREAMS_MAIN)
bool DreamsMainDialog::handleInitDialog(HWND fw, long ip)
{
createSipPrefControl();
info_.attachControl(handle(), IDC_DREAMS_INFO);
term_.attachControl(handle(), IDC_SEARCH_TERM);
Rect r;
innerBounds(r);
long h = term_.height() + LogY(2);
renderer_.create(WS_TABSTOP, LogX(1), h, r.width() - 2 * LogX(1), r.height() - h - LogY(1), handle());
renderer_.definition.setInteractionBehavior(
Definition::behavHyperlinkNavigation
| Definition::behavUpDownScroll
//| Definition::behavMenuBarCopyButton
| Definition::behavMouseSelection
);
renderer_.definition.setHyperlinkHandler(GetHyperlinkHandler());
ModuleDialog::handleInitDialog(fw, ip);
overrideBackKey();
DreamsPrefs& prefs = GetPreferences()->dreamsPrefs;
DefinitionModel* model = NULL;
DreamsDataRead(model, title_);
if (NULL != model)
{
renderer_.setModel(model, Definition::ownModel);
term_.setCaption(prefs.downloadedTerm);
info_.hide();
renderer_.show();
renderer_.focus();
}
else
term_.focus();
return false;
}
long DreamsMainDialog::handleResize(UINT st, ushort w, ushort height)
{
term_.anchor(anchorRight, 2 * LogX(1), anchorNone, 0, repaintWidget);
long h = term_.height() + LogY(2);
renderer_.anchor(anchorRight, 2 * LogX(1), anchorBottom, h + LogY(1), repaintWidget);
info_.anchor(anchorRight, 2 * LogX(1), anchorBottom, h + LogY(1), repaintWidget);
return ModuleDialog::handleResize(st, w, height);
}
long DreamsMainDialog::handleCommand(ushort nc, ushort id, HWND sender)
{
switch (id)
{
case ID_SEARCH:
{
ulong_t len;
char_t* term = term_.caption(&len);
if (NULL == term)
{
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
return messageHandled;
}
const char_t* s = term;
strip(s, len);
if (0 != len)
search(s, len);
free(term);
return messageHandled;
}
}
return ModuleDialog::handleCommand(nc, id, sender);
}
bool DreamsMainDialog::handleLookupFinished(Event& event, const LookupFinishedEventData* data)
{
LookupManager* lm = GetLookupManager();
DreamsPrefs& prefs = GetPreferences()->dreamsPrefs;
switch (data->result)
{
case lookupResultDreamData:
{
UniversalDataFormat* udf = NULL;
PassOwnership(lm->udf, udf);
assert(NULL != udf);
DefinitionModel* model = DreamExtractFromUDF(*udf, title_);
delete udf;
if (NULL == model)
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
else
{
info_.hide();
renderer_.setModel(model, Definition::ownModel);
renderer_.show();
renderer_.focus();
}
free(prefs.downloadedTerm);
prefs.downloadedTerm = prefs.pendingTerm;
prefs.pendingTerm = NULL;
return true;
}
}
free(prefs.pendingTerm);
prefs.pendingTerm = NULL;
return ModuleDialog::handleLookupFinished(event, data);
}
void DreamsMainDialog::search(const char_t* term, long len)
{
LookupManager* lm = GetLookupManager();
DreamsPrefs& prefs = GetPreferences()->dreamsPrefs;
free(prefs.pendingTerm);
prefs.pendingTerm = StringCopyN(term, len);
if (NULL == prefs.pendingTerm)
{
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
return;
}
char* utf = UTF8_FromNative(prefs.pendingTerm);
if (NULL == utf)
{
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
return;
}
char* url = StringCopy(urlSchemaGetDream urlSeparatorSchemaStr);
if (NULL == url || NULL == (url = StrAppend(url, -1, utf, -1)))
{
free(utf);
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
return;
}
free(utf);
status_t err = lm->fetchUrl(url);
free(url);
if (errNone != err)
Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
} | [
"andrzejc@9579cb1a-affb-0310-8771-bc50cd49e4fc"
] | [
[
[
1,
162
]
]
] |
709164921defe64c916412eae17dbca563668482 | 1e299bdc79bdc75fc5039f4c7498d58f246ed197 | /App/SecuritySystem.h | 86a4370cbc12311238594a0d807bdfc94d9503aa | [] | no_license | moosethemooche/Certificate-Server | 5b066b5756fc44151b53841482b7fa603c26bf3e | 887578cc2126bae04c09b2a9499b88cb8c7419d4 | refs/heads/master | 2021-01-17T06:24:52.178106 | 2011-07-13T13:27:09 | 2011-07-13T13:27:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,795 | h | //--------------------------------------------------------------------------------
//
// Copyright (c) 2000 MarkCare Solutions
//
// Programming by Rich Schonthal
//
//--------------------------------------------------------------------------------
#if !defined(AFX_SECURITYSYSTEM_H__3FFF6998_C933_11D3_AF10_005004A1C5F3__INCLUDED_)
#define AFX_SECURITYSYSTEM_H__3FFF6998_C933_11D3_AF10_005004A1C5F3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//--------------------------------------------------------------------------------
#include <System.h>
class CSSIOSubSystem;
class CClientSubSystem;
class CDBSubSystem;
class CSystemMonitorThread;
class CLicenseCheckThread;
class CBackupThread;
//--------------------------------------------------------------------------------
class CSecuritySystem : public CSystem
{
private:
CClientSubSystem* m_pClientSubSystem;
CSSIOSubSystem* m_pIOSubSystem;
CDBSubSystem* m_pDBSubSystem;
CLicenseCheckThread* m_pLicCheckThread;
CBackupThread* m_pBackupThread;
time_t m_ttBackupCheckIn;
CEvent m_evtDongleOk;
CEvent m_evtLicenseOk;
CString m_sLicenseFilename;
public:
CSecuritySystem();
virtual ~CSecuritySystem();
CClientSubSystem* GetClientSubSystem() { return m_pClientSubSystem; }
CSSIOSubSystem* GetIOSubSystem() { return m_pIOSubSystem; }
CDBSubSystem* GetDBSubSystem() { return m_pDBSubSystem; }
public:
enum
{
errBadLicenseFile = BeginErrorRange
};
enum
{
// number of minutes after system start before checking for dongle
// this is only for the main server - if this is a backup server
// then this wait period comes from the license file
nMinutesToWaitForDongle = 5
};
// the time the system was started - this is always set
CTime m_ctSystemStart;
// the grace period before the dongle is required to continue running
// on a main server this is set as m_ctSystemStart+MinutesToWaitForDongle
// on a backup server, this is not set until SetIsServing is called
// the value of CSSConfigBackup::m_nMinutesToWaitForDongle is used to calculate
// the dongle deadline
CTime m_ctDongleDeadline;
private:
// true when this server is serving
// (ie not true when running as backup and the main server is operational)
bool m_bIsServing;
enum
{
SERVERMODE_UNKNOWN,
SERVERMODE_MAIN,
SERVERMODE_BACKUP
} m_nServerMode;
private:
CBackupThread* GetBackupThread();
friend class CLicenseCheckThread;
void SetDongleStatus(bool);
friend class CDBSubSystem;
void SetLicenseStatus(bool);
void CreateStartupEmailMessage(CString&) const;
public:
void SetIsServing(bool = true);
bool IsServing() const;
bool IsLicensed();
// these must never be virtual since they're called from LoadFromFile during CSecuritySystem::CSecuritySystem
void StartBackupMode();
void StartMainserverMode();
bool IsBackupServer() const;
bool IsBackupRunning();
void SetBackupIsRunning();
CTime GetDongleDeadlineTime() const;
void GetSystemConfigStringMessage(CStringArray&) const;
void SetLicenseFilename(const CString&);
CString GetLicenseFilename();
};
//--------------------------------------------------------------------------------
inline CBackupThread* CSecuritySystem::GetBackupThread() { return m_pBackupThread; }
inline bool CSecuritySystem::IsBackupServer() const { return m_nServerMode == SERVERMODE_BACKUP; }
inline CTime CSecuritySystem::GetDongleDeadlineTime() const { return m_ctDongleDeadline; }
inline bool CSecuritySystem::IsServing() const { return m_bIsServing; }
#endif // !defined(AFX_SECURITYSYSTEM_H__3FFF6998_C933_11D3_AF10_005004A1C5F3__INCLUDED_)
| [
"[email protected]"
] | [
[
[
1,
124
]
]
] |
434ff2007eeccbed4757ce11e672059cd2c13af8 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/_Interface/ITheme.cpp | 8c687650b114332efb075926dd02c9ee85c09738 | [] | 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 | UHC | C++ | false | false | 86,631 | cpp | // Theme.cpp: implementation of the CWndBase class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
//#include "version.h"
#ifdef __LANG_1013
#include "langman.h"
#endif // __LANG_1013
#ifdef __FLYFF_INITPAGE_EXT
#include "ResData.h"
#endif //__FLYFF_INITPAGE_EXT
char g_szVersion[128]; // file scope global
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTheme::CTheme()
{
m_pVBTexture = NULL;
m_pVBGauge = NULL;
m_bNudeSkin = FALSE;
//m_pActiveDesktop = NULL;
//m_pd3dsdBackBuffer = NULL;
m_pd3dDevice =NULL;
m_pFontStatus = NULL;
#ifdef __FLYFF_INITPAGE_EXT
m_pTitleWorld = NULL;
m_bLoadTerrainScript = FALSE;
m_bRenderTitleWorld = FALSE;
m_dwTexturAlpha1 = 0;
m_dwTexturAlpha2 = 0;
m_dwStartTime = 0;
m_dwEndTime = 0;
m_bStartCameraWork = FALSE;
#endif //__FLYFF_INITPAGE_EXT
// m_pFontAPICaption = NULL;
// m_pFontAPITitle = NULL;
}
CTheme::~CTheme()
{
DeleteTheme();
}
BOOL CTheme::LoadTheme( LPDIRECT3DDEVICE9 pd3dDevice, LPCTSTR lpszFileName)
{
m_pd3dDevice = pd3dDevice;
//DeleteTheme();
CScanner scanner;
if(scanner.Load( MakePath( DIR_THEME, lpszFileName ) )==FALSE)
return FALSE;
scanner.GetToken(); // subject or FINISHED
while(scanner.tok!=FINISHED)
{
if( scanner.Token == "m_d3dcBackground" )
{
scanner.GetToken();
m_d3dcBackground = scanner.GetHex();
}
else
if( scanner.Token == "m_texWallPaper" )
{
scanner.GetToken();
scanner.GetToken();
m_texWallPaper.LoadTexture( m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), scanner.token ), 0xff0000 );
m_texWndPaper.LoadTexture( m_pd3dDevice, MakePath( DIR_THEME, "WindField.bmp" ), 0xff0000 );
}
else
if( scanner.Token == "m_dwWallPaperType" )
{
scanner.GetToken();
m_dwWallPaperType = scanner.GetNumber();
}
scanner.GetToken();
}
#ifdef __GAME_GRADE_SYSTEM
m_GameGradeScreenTexture.LoadTexture( m_pd3dDevice, MakePath( _T( "Theme\\" ), ::GetLanguage(), _T( "GameGradeWarningScreen.tga" ) ), 0xff0000 );
m_pGameGradeTexture = CWndBase::m_textureMng.AddTexture( m_pd3dDevice, MakePath( _T( "Theme\\" ), ::GetLanguage(), _T( "GameGradeMark.bmp" ) ), 0xffff00ff );
#endif // __GAME_GRADE_SYSTEM
#ifdef __LANG_1013
PLANG_DATA pLangData = CLangMan::GetInstance()->GetLangData( ::GetLanguage() );
CD3DFont* pFont;
pFont = new CD3DFont( pLangData->font.afi[0].szFont, 9 );
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( pLangData->font.afi[1].szFont, 8 );
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( pLangData->font.afi[2].szFont, 13 );
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( pLangData->font.afi[3].szFont, 9);
pFont->m_nOutLine = pLangData->font.afi[3].nOutLine;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = pLangData->font.afi[3].dwBgColor;
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( pLangData->font.afi[4].szFont, 9);
pFont->m_nOutLine = pLangData->font.afi[4].nOutLine;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = pLangData->font.afi[4].dwBgColor;
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( pLangData->font.afi[5].szFont, 15 );
pFont->m_nOutLine = pLangData->font.afi[5].nOutLine;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = pLangData->font.afi[5].dwBgColor;
pFont->m_dwFlags = pLangData->font.afi[5].dwFlags;
m_mapFont.SetAt( _T( "gulim20"), pFont );
#if __VER >= 12 // __SECRET_ROOM
pFont = new CD3DFont( pLangData->font.afi[2].szFont, 11, D3DFONT_BOLD );
pFont->m_nOutLine = 1;
m_mapFont.SetAt( _T( "gulim11"), pFont );
pFont = new CD3DFont( pLangData->font.afi[2].szFont, 9, D3DFONT_BOLD );
pFont->m_nOutLine = 1;
m_mapFont.SetAt( _T( "gulim9_2"), pFont );
#endif //__SECRET_ROOM
#else // __LANG_1013
if( ::GetLanguage() == LANG_KOR )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("gulim"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("gulim"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("gulim"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("Arial Black"), 9);//, D3DFONT_BOLD );
//pFont = new CD3DFont( _T("gulim"), 9 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("Arial Black"), 9);//, D3DFONT_BOLD );
//pFont = new CD3DFont( _T("gulim"), 9 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("가을체"), 15 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
/*
m_pFontAPICaption = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 50 );//, D3DFONT_BOLD );
m_pFontAPICaption->m_nOutLine = 2;
m_pFontAPICaption->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPICaption->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPICaption->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPICaption->InitDeviceObjects( m_pApp->m_pd3dDevice );
m_pFontAPITitle = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 20 );//, D3DFONT_BOLD );
m_pFontAPITitle->m_nOutLine = 2;
m_pFontAPITitle->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPITitle->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPITitle->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPITitle->InitDeviceObjects( m_pApp->m_pd3dDevice );
*/
}
else
if( ::GetLanguage() == LANG_JAP )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("MS Gothic"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("MS Gothic"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("gulim"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("MS Gothic"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("MS Gothic"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("MS Gothic"), 15 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
/*
m_pFontAPICaption = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 50 );//, D3DFONT_BOLD );
m_pFontAPICaption->m_nOutLine = 2;
m_pFontAPICaption->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPICaption->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPICaption->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPICaption->InitDeviceObjects( m_pApp->m_pd3dDevice );
m_pFontAPITitle = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 20 );//, D3DFONT_BOLD );
m_pFontAPITitle->m_nOutLine = 2;
m_pFontAPITitle->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPITitle->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPITitle->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPITitle->InitDeviceObjects( m_pApp->m_pd3dDevice );
*/
}
else
if( ::GetLanguage() == LANG_THA )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("MS Sans Serif"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("MS Sans Serif"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("MS Sans Serif"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("MS Sans Serif"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("MS Sans Serif"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("MS Sans Serif"), 13 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 250 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
/*
m_pFontAPICaption = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 50 );//, D3DFONT_BOLD );
m_pFontAPICaption->m_nOutLine = 2;
m_pFontAPICaption->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPICaption->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPICaption->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPICaption->InitDeviceObjects( m_pApp->m_pd3dDevice );
m_pFontAPITitle = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 20 );//, D3DFONT_BOLD );
m_pFontAPITitle->m_nOutLine = 2;
m_pFontAPITitle->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPITitle->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPITitle->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPITitle->InitDeviceObjects( m_pApp->m_pd3dDevice );
*/
}
else
if( ::GetLanguage() == LANG_TWN || ::GetLanguage() == LANG_HK )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("MingLiU"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 13 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 250 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
}
else
if( ::GetLanguage() == LANG_CHI )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("MingLiU"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("MingLiU"), 13 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 250 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
/*
m_pFontAPICaption = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 50 );//, D3DFONT_BOLD );
m_pFontAPICaption->m_nOutLine = 2;
m_pFontAPICaption->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPICaption->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPICaption->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPICaption->InitDeviceObjects( m_pApp->m_pd3dDevice );
m_pFontAPITitle = new CD3DFontAPI( _T("휴먼매직체"), rectClient.Width() / 20 );//, D3DFONT_BOLD );
m_pFontAPITitle->m_nOutLine = 2;
m_pFontAPITitle->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
m_pFontAPITitle->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
m_pFontAPITitle->m_dwFlags = D3DFONT_FILTERED;
m_pFontAPITitle->InitDeviceObjects( m_pApp->m_pd3dDevice );
*/
}
else
if( ::GetLanguage() == LANG_ENG )
{
CD3DFont* pFont;
// 폰트 로드 생성
pFont = new CD3DFont( _T("Arial"), 9 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim9"), pFont );
pFont = new CD3DFont( _T("Arial"), 8 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim8"), pFont );
pFont = new CD3DFont( _T("Arial"), 13 );//, D3DFONT_BOLD );
//pFont->m_nOutLine = 3;
m_mapFont.SetAt( _T( "gulim13"), pFont );
pFont = new CD3DFont( _T("Arial"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 217, 91, 51);
m_mapFont.SetAt( _T( "Arial Black9"), pFont );
pFont = new CD3DFont( _T("Arial"), 9);//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = 0xffffffff;
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 60, 60, 60 );
m_mapFont.SetAt( _T( "FontWorld"), pFont );
pFont = new CD3DFont( _T("Arial"), 15 );//, D3DFONT_BOLD );
pFont->m_nOutLine = 2;
pFont->m_dwColor = D3DCOLOR_ARGB( 255, 255, 255, 255);
pFont->m_dwBgColor = D3DCOLOR_ARGB( 255, 40, 100, 220 );
pFont->m_dwFlags = D3DFONT_FILTERED;
m_mapFont.SetAt( _T( "gulim20"), pFont );
}
#endif // __LANG_1013
SetVersion( ::GetLanguage() );
// 폰트 세팅
m_mapFont.Lookup( _T("gulim9"), (void*&)m_pFontChat );
m_mapFont.Lookup( _T("gulim9"), (void*&)m_pFontText );
m_mapFont.Lookup( _T("gulim8"), (void*&)m_pFontStatus );
m_mapFont.Lookup( _T("Arial Black9"), (void*&)m_pFontWndTitle );
m_mapFont.Lookup( _T("FontWorld"), (void*&)m_pFontWorld );
m_mapFont.Lookup( _T("gulim20"), (void*&)m_pFontCaption );
m_mapFont.Lookup( _T("gulim13"), (void*&)m_pFontGuildCombatText );
#if __VER >= 12 // __SECRET_ROOM
m_mapFont.Lookup( _T("gulim11"), (void*&)m_pFontSRMyGiuld );
m_mapFont.Lookup( _T("gulim9_2"), (void*&)m_pFontSRGiuld );
#endif //__SECRET_ROOM
#ifdef __FLYFF_INITPAGE_EXT
ReadTitleWorld();
#endif //__FLYFF_INITPAGE_EXT
return TRUE;
}
BOOL CTheme::SaveTheme(LPCTSTR lpszFileName)
{
return TRUE;
}
void CTheme::DeleteTheme()
{
DeleteDeviceObjects();
}
HRESULT CTheme::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
{
m_pd3dDevice = pd3dDevice;
POSITION pos = m_mapFont.GetStartPosition();
CString strFont; CD3DFont* pFont;
while(pos)
{
m_mapFont.GetNextAssoc( pos, strFont, (void*&)pFont );
pFont->InitDeviceObjects( pd3dDevice );
}
// g_mesh.InitDeviceObjects( m_pd3dDevice );
//g_mesh.OpenMesh( _T("obj_rideferriswheel.mes") );
// g_mesh.OpenMesh( _T("obj_starship.mes") );
return TRUE;//m_pFontGameTitle->InitDeviceObjects( pd3dDevice );
}
HRESULT CTheme::InvalidateDeviceObjects()
{
#ifdef __YDEBUG
m_texWallPaper.Invalidate();
m_texWndPaper.Invalidate();
#endif //__YDEBUG
HRESULT h = S_OK;
SAFE_RELEASE( m_pVBTexture );
SAFE_RELEASE( m_pVBGauge );
//g_mesh.InvalidateDeviceObjects();
POSITION pos = m_mapFont.GetStartPosition();
CString strFont; CD3DFont* pFont;
while(pos)
{
m_mapFont.GetNextAssoc( pos, strFont, (void*&)pFont );
pFont->InvalidateDeviceObjects();
}
return h;
}
HRESULT CTheme::DeleteDeviceObjects()
{
HRESULT h = S_OK;
m_texWallPaper.DeleteDeviceObjects();
m_texWndPaper.DeleteDeviceObjects();
#ifdef __GAME_GRADE_SYSTEM
m_GameGradeScreenTexture.DeleteDeviceObjects();
#endif // __GAME_GRADE_SYSTEM
//g_mesh.DeleteDeviceObjects();
POSITION pos = m_mapFont.GetStartPosition();
CString strFont; CD3DFont* pFont;
while(pos)
{
m_mapFont.GetNextAssoc( pos, strFont, (void*&)pFont );
pFont->DeleteDeviceObjects();
SAFE_DELETE( pFont );
}
m_mapFont.RemoveAll();
#ifdef __FLYFF_INITPAGE_EXT
if(m_pTitleWorld != NULL)
{
m_pTitleWorld->InvalidateDeviceObjects();
m_pTitleWorld->DeleteDeviceObjects();
SAFE_DELETE(m_pTitleWorld);
}
#endif //__FLYFF_INITPAGE_EXT
return h;
}
HRESULT CTheme::RestoreDeviceObjects( )
{
#ifdef __YDEBUG
m_texWallPaper.SetInvalidate(m_pd3dDevice);
m_texWndPaper.SetInvalidate(m_pd3dDevice);
#endif //__YDEBUG
if( m_pVBTexture )
return S_OK;
//g_mesh.RestoreDeviceObjects();
POSITION pos = m_mapFont.GetStartPosition();
CString strFont; CD3DFont* pFont;
while(pos)
{
m_mapFont.GetNextAssoc( pos, strFont, (void*&)pFont );
pFont->RestoreDeviceObjects();
}
HRESULT hr = S_OK;
m_pd3dDevice->CreateVertexBuffer( sizeof(TEXTUREVERTEX)*24, D3DUSAGE_WRITEONLY| D3DUSAGE_DYNAMIC, D3DFVF_TEXTUREVERTEX, D3DPOOL_SYSTEMMEM, &m_pVBTexture , NULL);
m_pd3dDevice->CreateVertexBuffer( sizeof(DRAWVERTEX)*42, D3DUSAGE_WRITEONLY| D3DUSAGE_DYNAMIC, D3DFVF_DRAWVERTEX, D3DPOOL_SYSTEMMEM, &m_pVBGauge , NULL );
return hr;
}
#ifdef __FLYFF_INITPAGE_EXT
void CTheme::ReadTitleWorld()
{
if(m_pTitleWorld == NULL)
{
m_pTitleWorld = new CWorld;
if(m_pTitleWorld != NULL)
{
if(!m_bLoadTerrainScript)
m_bLoadTerrainScript = prj.m_terrainMng.LoadScript("terrain.inc");
if(m_bLoadTerrainScript)
{
if(m_pTitleWorld->InitDeviceObjects( m_pd3dDevice ) == S_OK)
{
if(m_pTitleWorld->OpenWorld( MakePath( DIR_WORLD, "WdArena" ), TRUE ))
{
D3DXVECTOR3 vecWorld(128.0f, 128.0f, 128.0f);
m_pTitleWorld->ReadWorld(vecWorld);
D3DXVECTOR3 vecPos(149.0f, 105.0f, 170.0f);
D3DXVECTOR3 vecLookat(213.0f, 116.0f, 184.0f);
CCamera camera;
camera.SetPos(vecPos);
camera.m_vLookAt = vecLookat;
m_pTitleWorld->SetCamera(&camera);
m_pFlyffLogo = CWndBase::m_textureMng.AddTexture( m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), _T( "flyfftitletest.bmp" ) ), 0xffff00ff );
m_pGameGrade = CWndBase::m_textureMng.AddTexture( m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), _T( "gamegradetest.bmp" ) ), 0xffff00ff );
m_pAeonLogo = CWndBase::m_textureMng.AddTexture( m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), _T( "aeonsoftlogotest.bmp" ) ), 0xffff00ff );
m_pGalaLogo = CWndBase::m_textureMng.AddTexture( m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), _T( "galalogotest.bmp" ) ), 0xffff00ff );
m_bRenderTitleWorld = TRUE;
}
else
SAFE_DELETE(m_pTitleWorld);
}
}
}
}
}
void CTheme::DestoryTitleWorld()
{
if(m_pTitleWorld != NULL)
{
m_pTitleWorld->InvalidateDeviceObjects();
m_pTitleWorld->DeleteDeviceObjects();
SAFE_DELETE(m_pTitleWorld);
}
m_dwTexturAlpha1 = 0;
m_dwTexturAlpha2 = 0;
}
#endif //__FLYFF_INITPAGE_EXT
HRESULT CTheme::FrameMove()
{
#ifdef __FLYFF_INITPAGE_EXT
if(m_pTitleWorld != NULL)
{
m_pTitleWorld->Process();
if(!m_bStartCameraWork)
{
static const DWORD MAX_ALPHA = 255;
static const DWORD EVENT_ALPHA = 155;
static const DWORD EFFECT_ALPHA = 100;
static const float ALPHA_FRAME = 2.0f;
static bool bEffect = false;
if( bEffect == false )
{
if(m_dwTexturAlpha1 < MAX_ALPHA)
{
m_dwTexturAlpha1 += static_cast<DWORD>(ALPHA_FRAME);
if(m_dwTexturAlpha1 > MAX_ALPHA)
m_dwTexturAlpha1 = MAX_ALPHA;
}
if(m_dwTexturAlpha1 > EVENT_ALPHA && m_dwTexturAlpha2 < MAX_ALPHA)
{
m_dwTexturAlpha2 += static_cast<DWORD>(ALPHA_FRAME);
if(m_dwTexturAlpha2 > MAX_ALPHA)
m_dwTexturAlpha2 = MAX_ALPHA;
}
}
else
{
if(m_dwTexturAlpha1 > EFFECT_ALPHA)
{
m_dwTexturAlpha1 -= static_cast<DWORD>(ALPHA_FRAME);
if(m_dwTexturAlpha1 < EFFECT_ALPHA)
m_dwTexturAlpha1 = EFFECT_ALPHA;
}
if(m_dwTexturAlpha2 > EFFECT_ALPHA)
{
m_dwTexturAlpha2 -= static_cast<DWORD>(ALPHA_FRAME);
if(m_dwTexturAlpha2 < EFFECT_ALPHA)
m_dwTexturAlpha2 = EFFECT_ALPHA;
}
}
if( m_dwTexturAlpha1 == MAX_ALPHA && m_dwTexturAlpha2 == MAX_ALPHA )
{
bEffect = true;
}
if( m_dwTexturAlpha1 == EFFECT_ALPHA && m_dwTexturAlpha2 == EFFECT_ALPHA )
{
bEffect = false;
}
}
}
#endif //__FLYFF_INITPAGE_EXT
return S_OK;
}
void CTheme::RenderTitle( C2DRender* p2DRender )
{
}
void CTheme::RenderDesktop( C2DRender* p2DRender )
{
#ifdef __FLYFF_INITPAGE_EXT
D3DVIEWPORT9 viewport;
viewport.X = 0;
viewport.Y = 0;
viewport.Width = 1360;
viewport.Height = 768;
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
// 프로젝션
FLOAT fAspect = (FLOAT)viewport.Width / (FLOAT)viewport.Height;
float fFov = D3DX_PI / 4.0f;
float fNear = CWorld::m_fNearPlane;
D3DXMatrixPerspectiveFovLH( &m_pTitleWorld->m_matProj, fFov, fAspect, fNear - 0.01f, CWorld::m_fFarPlane );
p2DRender->m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &m_pTitleWorld->m_matProj );
DWORD dwColor = CWorld::GetDiffuseColor();
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, dwColor /*D3DCOLOR_ARGB( 255, 255, 255, 255 )*/, 1.0f, 0 ) ;
// 필드 출력
if(m_pTitleWorld != NULL)
{
//static float fCameraPositionX = 445.0f;
//static float fCameraPositionY = 160.0f;
//static float fCameraPositionY = 572.0f;
static const float START_X = 345.0f;
static const float END_X = 445.0f;
static const float START_TO_END_X = END_X - START_X;
static const float START_Y = 110.0f;
static const float END_Y = 160.0f;
static const float START_TO_END_Y = END_Y - START_Y;
static const float START_Z = 572.0f;
static const float END_Z = 572.0f;
static const float START_TO_END_Z = END_Z - START_Z;
static const float SPEED_RATE = 500.0f;
static float fCameraPositionX = START_X;
static float fCameraSpeedX = START_TO_END_X / SPEED_RATE;
if( fCameraPositionX <= END_X )
{
fCameraPositionX += fCameraSpeedX;
}
static float fCameraPositionY = START_Y;
static float fCameraSpeedY = START_TO_END_Y / SPEED_RATE;
if( fCameraPositionY <= END_Y )
{
fCameraPositionY += fCameraSpeedY;
}
static float fCameraPositionZ = START_Z;
static float fCameraSpeedZ = START_TO_END_Z / SPEED_RATE;
if( fCameraPositionZ <= END_Z )
{
fCameraPositionZ += fCameraSpeedZ;
}
D3DXVECTOR3 vecPos( fCameraPositionX, fCameraPositionY, fCameraPositionZ );
D3DXVECTOR3 vecLookat(663.0f, 123.0f, 632.0f);
CCamera camera;
camera.SetPos(vecPos);
camera.m_vLookAt = vecLookat;
m_pTitleWorld->SetCamera( &camera );
m_pTitleWorld->Render( p2DRender->m_pd3dDevice, m_pFontWorld );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 );
if(m_pFlyffLogo != NULL)
{
CPoint ptPos;
ptPos.x = (g_Option.m_nResWidth / 2) - (m_pFlyffLogo->m_size.cx / 2);
ptPos.y = g_Option.m_nResHeight / 9;
m_pFlyffLogo->Render( p2DRender, ptPos, m_dwTexturAlpha1 );
}
if(m_pGameGrade != NULL)
{
CPoint ptPos;
ptPos.x = (g_Option.m_nResWidth - 10) - m_pGameGrade->m_size.cx;
ptPos.y = 20;
m_pGameGrade->Render( p2DRender, ptPos, m_dwTexturAlpha2 );
}
if(m_pAeonLogo != NULL)
{
CPoint ptPos;
ptPos.x = (g_Option.m_nResWidth - 10) - m_pAeonLogo->m_size.cx;
ptPos.y = g_Option.m_nResHeight - m_pAeonLogo->m_size.cy - 10;
m_pAeonLogo->Render( p2DRender, ptPos, m_dwTexturAlpha2 );
}
if(m_pGalaLogo != NULL)
{
CPoint ptPos;
ptPos.x = 10;
ptPos.y = g_Option.m_nResHeight - m_pGalaLogo->m_size.cy - 10;
m_pGalaLogo->Render( p2DRender, ptPos, m_dwTexturAlpha2 );
}
}
#else //__FLYFF_INITPAGE_EXT
#if __VER >= 9 // __CSC_VER9_RESOLUTION
int xOffset = 0;
int rectWidth = 0;
BOOL isWide = FALSE;
#endif //__CSC_VER9_RESOLUTION
CTexture texture
= m_texWallPaper;
texture.SetAutoFree( FALSE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
CRect rectWindow = p2DRender->m_clipRect;
if( m_dwWallPaperType == WPT_STRETCH ) // 전체 늘리기
{
#if __VER >= 9 // __CSC_VER9_RESOLUTION
if(rectWindow.Width() == 1280 && (rectWindow.Height() == 720 || rectWindow.Height() == 768 || rectWindow.Height() == 800)) //Wide
{
rectWidth = 960;
isWide = TRUE;
}
else
{
switch(rectWindow.Width())
{
case 1360:
rectWidth = 1024;
isWide = TRUE;
break;
case 1440:
rectWidth = 1200;
isWide = TRUE;
break;
case 1680:
rectWidth = 1400;
isWide = TRUE;
break;
}
}
if(isWide)
{
texture.m_size.cx = rectWidth;
texture.m_size.cy = rectWindow.Height();
xOffset = (rectWindow.Width() - rectWidth) / 2;
}
else
{
texture.m_size.cx = rectWindow.Width();
texture.m_size.cy = rectWindow.Height();
}
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( CPoint( xOffset, 0 ), &texture );
#else //__CSC_VER9_RESOLUTION
texture.m_size.cx = rectWindow.Width();
texture.m_size.cy = rectWindow.Height();
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( CPoint( 0, 0 ), &texture );
#endif //__CSC_VER9_RESOLUTION
}
else
if( m_dwWallPaperType == WPT_CENTER ) // 중앙 정렬
{
CPoint pt( ( rectWindow.Width() / 2 ) - ( texture.m_size.cx / 2 ), ( rectWindow.Height() / 2 ) - ( texture.m_size.cy / 2 ) );
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( pt, &texture );
}
else
if( m_dwWallPaperType == WPT_CENTERSTRETCH ) // 중앙 늘리기
{
if(( (int) rectWindow.Width() - texture.m_size.cx ) < ( (int)rectWindow.Height() - texture.m_size.cy ) )
{
// texture.m_size.cx : m_pd3dsdBackBuffer->Width = texture.m_size.cy : y;
texture.m_size.cy = rectWindow.Width() * texture.m_size.cy / texture.m_size.cx;
texture.m_size.cx = rectWindow.Width();
}
else
{
// texture.m_size.cy : m_pd3dsdBackBuffer->Height = texture.m_size.cx : x;
texture.m_size.cx = rectWindow.Height() * texture.m_size.cx / texture.m_size.cy;
texture.m_size.cy = rectWindow.Height();
}
CPoint pt( ( rectWindow.Width() / 2 ) - ( texture.m_size.cx / 2 ), ( rectWindow.Height() / 2 ) - ( texture.m_size.cy / 2 ) );
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( pt, &texture );
}
else
if( m_dwWallPaperType == WPT_TILE ) // 타일 정렬
{
FLOAT fu = (FLOAT)rectWindow.Width() / texture.m_size.cx;
FLOAT fv = (FLOAT)rectWindow.Height() / texture.m_size.cy;
texture.m_size.cx = rectWindow.Width();
texture.m_size.cy = rectWindow.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( CPoint( 0, 0), &texture );
}
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
#if __VER >= 9 // __CSC_VER9_RESOLUTION
p2DRender->TextOut( 1 + xOffset, 1, "Version", 0xffffffff );
p2DRender->TextOut( 50 + xOffset, 1, g_szVersion, 0xffffffff );
#else //__CSC_VER9_RESOLUTION
p2DRender->TextOut( 1, 1, "Version", 0xffffffff );
p2DRender->TextOut( 50, 1, g_szVersion, 0xffffffff );
#endif //__CSC_VER9_RESOLUTION
#endif //__FLYFF_INITPAGE_EXT
}
#ifdef __GAME_GRADE_SYSTEM
void CTheme::RenderGameGradeScreen( C2DRender* p2DRender )
{
int xOffset = 0;
int rectWidth = 0;
BOOL isWide = FALSE;
CTexture texture;
texture = m_GameGradeScreenTexture;
texture.SetAutoFree( FALSE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
CRect rectWindow = p2DRender->m_clipRect;
if( g_WndMng.m_Theme.m_dwWallPaperType == WPT_STRETCH ) // 전체 늘리기
{
if(rectWindow.Width() == 1280 && (rectWindow.Height() == 720 || rectWindow.Height() == 768 || rectWindow.Height() == 800)) //Wide
{
rectWidth = 960;
isWide = TRUE;
}
else
{
switch(rectWindow.Width())
{
case 1360:
rectWidth = 1024;
isWide = TRUE;
break;
case 1440:
rectWidth = 1200;
isWide = TRUE;
break;
case 1680:
rectWidth = 1400;
isWide = TRUE;
break;
}
}
if(isWide)
{
texture.m_size.cx = rectWidth;
texture.m_size.cy = rectWindow.Height();
xOffset = (rectWindow.Width() - rectWidth) / 2;
}
else
{
texture.m_size.cx = rectWindow.Width();
texture.m_size.cy = rectWindow.Height();
}
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, g_WndMng.m_Theme.m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( CPoint( xOffset, 0 ), &texture );
}
else if( g_WndMng.m_Theme.m_dwWallPaperType == WPT_CENTER ) // 중앙 정렬
{
CPoint pt( ( rectWindow.Width() / 2 ) - ( texture.m_size.cx / 2 ), ( rectWindow.Height() / 2 ) - ( texture.m_size.cy / 2 ) );
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, g_WndMng.m_Theme.m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( pt, &texture );
}
else if( g_WndMng.m_Theme.m_dwWallPaperType == WPT_CENTERSTRETCH ) // 중앙 늘리기
{
if(( (int) rectWindow.Width() - texture.m_size.cx ) < ( (int)rectWindow.Height() - texture.m_size.cy ) )
{
// texture.m_size.cx : m_pd3dsdBackBuffer->Width = texture.m_size.cy : y;
texture.m_size.cy = rectWindow.Width() * texture.m_size.cy / texture.m_size.cx;
texture.m_size.cx = rectWindow.Width();
}
else
{
// texture.m_size.cy : m_pd3dsdBackBuffer->Height = texture.m_size.cx : x;
texture.m_size.cx = rectWindow.Height() * texture.m_size.cx / texture.m_size.cy;
texture.m_size.cy = rectWindow.Height();
}
CPoint pt( ( rectWindow.Width() / 2 ) - ( texture.m_size.cx / 2 ), ( rectWindow.Height() / 2 ) - ( texture.m_size.cy / 2 ) );
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, g_WndMng.m_Theme.m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( pt, &texture );
}
else if( g_WndMng.m_Theme.m_dwWallPaperType == WPT_TILE ) // 타일 정렬
{
FLOAT fu = (FLOAT)rectWindow.Width() / texture.m_size.cx;
FLOAT fv = (FLOAT)rectWindow.Height() / texture.m_size.cy;
texture.m_size.cx = rectWindow.Width();
texture.m_size.cy = rectWindow.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
p2DRender->m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, g_WndMng.m_Theme.m_d3dcBackground, 1.0f, 0 ) ;
p2DRender->RenderTexture( CPoint( 0, 0), &texture );
}
}
void CTheme::RenderGameGradeMark( C2DRender* p2DRender, DWORD dwAlpha )
{
if( m_pGameGradeTexture )
{
CPoint ptPos( ( g_Option.m_nResWidth - 10 ) - m_pGameGradeTexture->m_size.cx, 20 );
m_pGameGradeTexture->Render( p2DRender, ptPos, dwAlpha );
}
}
#endif // __GAME_GRADE_SYSTEM
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CTheme::GradationRect( C2DRender* p2DRender, CRect* pRect, DWORD dwColor1t, DWORD dwColor1b, DWORD dwColor2b, int nMidPercent )
{
int nFirstHeight = pRect->Height() * nMidPercent / 100;
CRect rect1 = *pRect; rect1.bottom = rect1.top + nFirstHeight;
CRect rect2 = *pRect; rect2.top = rect2.top + nFirstHeight;
p2DRender->RenderFillRect( rect1, dwColor1t, dwColor1t, dwColor1b, dwColor1b );
p2DRender->RenderFillRect( rect2, dwColor1b, dwColor1b, dwColor2b, dwColor2b );
}
void CTheme::RenderWndBaseTitleBar( C2DRender* p2DRender, CRect* pRect, LPCTSTR lpszTitle, DWORD dwColor )
{
//DWORD dwColor1 = D3DCOLOR_ARGB( 250, 255, 255, 255 );//D3DCOLOR_ARGB( 255, 130, 130, 230 );//
//DWORD dwColor2 = D3DCOLOR_ARGB( 50, 0, 0, 00 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
//DWORD dwColor3 = D3DCOLOR_ARGB( 200, 150, 150, 150 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
DWORD dwColor1 = D3DCOLOR_ARGB( 255, 255, 255, 255 );//D3DCOLOR_ARGB( 255, 130, 130, 230 );//
DWORD dwColor2 = D3DCOLOR_ARGB( 255, 150, 150, 150 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
DWORD dwColor3 = D3DCOLOR_ARGB( 255, 230, 230, 230 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
GradationRect( p2DRender, pRect, dwColor1 ,dwColor2, dwColor3 );
//p2DRender->RenderLine( CPoint( pRect->left, pRect->top ), CPoint( pRect->right, pRect->top ), dwColor3 );
p2DRender->TextOut( 17, 7, lpszTitle, dwColor);
//p2DRender->TextOut( 16, 6, lpszTitle, 0xffffffff);
}
void CTheme::RenderWndBaseFrame( C2DRender* p2DRender, CRect* pRect )
{
//DWORD dwColor1 = D3DCOLOR_ARGB( 100, 0, 0, 0 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
//DWORD dwColor2 = D3DCOLOR_ARGB( 100, 80, 80, 80 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
//DWORD dwColor3 = D3DCOLOR_ARGB( 150, 160, 160, 160 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
//DWORD dwColor4 = D3DCOLOR_ARGB( 100, 0, 0, 0 );//D3DCOLOR_ARGB( 255, 50, 50, 150 );//
DWORD dwColor1 = D3DCOLOR_ARGB( 255, 0, 0, 0 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
DWORD dwColor2 = D3DCOLOR_ARGB( 255, 80, 80, 80 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
DWORD dwColor3 = D3DCOLOR_ARGB( 255, 160, 160, 160 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
DWORD dwColor4 = D3DCOLOR_ARGB( 255, 0, 0, 0 );//D3DCOLOR_ARGB( 255, 50, 50, 150 );//
//CRect rectTemp = *pRect;
//rectTemp.DeflateRect(2,2);
//rectTemp.bottom = 20;
if( m_bNudeSkin == FALSE )
{
CTexture texture
= m_texWndPaper;
texture.SetAutoFree( FALSE );
FLOAT fu, fv;
// p2DRender->RenderTexture( CPoint( 0, 0), &texture, 0 );
//////////////////////////////////
CRect rect, rectOrg = *pRect;
rectOrg += p2DRender->m_ptOrigin;
TEXTUREVERTEX* pVertices;
m_pVBTexture->Lock( 0, sizeof(TEXTUREVERTEX) * 24, (void**) &pVertices, 0 );
// horizon
rect.SetRect( rectOrg.left, rectOrg.top, rectOrg.right, rectOrg.top + 16 + 4 );
fu = (FLOAT)rect.Width() / texture.m_size.cx;
fv = (FLOAT)rect.Height() / texture.m_size.cy;
texture.m_size.cx = rect.Width();
texture.m_size.cy = rect.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.top, texture. m_fuLT + 0.000001f, texture.m_fvLT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom ,texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom, texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.bottom ,texture. m_fuRB + 0.000001f, texture.m_fvRB + 0.000001f ); pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLT + 0.000001f; pVertices->v = texture.m_fvLT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRB + 0.000001f; pVertices->v = texture.m_fvRB + 0.000001f; pVertices++;
texture = m_texWndPaper;
texture.SetAutoFree( FALSE );
rect.SetRect( rectOrg.left, rectOrg.bottom - 4, rectOrg.right, rectOrg.bottom );
fu = (FLOAT)rect.Width() / texture.m_size.cx;
fv = (FLOAT)rect.Height() / texture.m_size.cy;
texture.m_size.cx = rect.Width();
texture.m_size.cy = rect.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.top, texture. m_fuLT + 0.000001f, texture.m_fvLT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom ,texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom, texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.bottom ,texture. m_fuRB + 0.000001f, texture.m_fvRB + 0.000001f ); pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLT + 0.000001f; pVertices->v = texture.m_fvLT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRB + 0.000001f; pVertices->v = texture.m_fvRB + 0.000001f; pVertices++;
// vertical
texture = m_texWndPaper;
texture.SetAutoFree( FALSE );
rect.SetRect( rectOrg.left, rectOrg.top + 16 + 4, rectOrg.left + 4, rectOrg.bottom - 4 );
fu = (FLOAT)rect.Width() / texture.m_size.cx;
fv = (FLOAT)rect.Height() / texture.m_size.cy;
texture.m_size.cx = rect.Width();
texture.m_size.cy = rect.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.top, texture. m_fuLT + 0.000001f, texture.m_fvLT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom ,texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom, texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.bottom ,texture. m_fuRB + 0.000001f, texture.m_fvRB + 0.000001f ); pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLT + 0.000001f; pVertices->v = texture.m_fvLT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRB + 0.000001f; pVertices->v = texture.m_fvRB + 0.000001f; pVertices++;
texture = m_texWndPaper;
texture.SetAutoFree( FALSE );
rect.SetRect( rectOrg.right - 4, rectOrg.top + 16 + 4, rectOrg.right, rectOrg.bottom - 4 );
fu = (FLOAT)rect.Width() / texture.m_size.cx;
fv = (FLOAT)rect.Height() / texture.m_size.cy;
texture.m_size.cx = rect.Width();
texture.m_size.cy = rect.Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.top, texture. m_fuLT + 0.000001f, texture.m_fvLT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom ,texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.top, texture. m_fuRT + 0.000001f, texture.m_fvRT + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.left, (FLOAT)rect.bottom, texture. m_fuLB + 0.000001f, texture.m_fvLB + 0.000001f ); pVertices++;
SetTextureVertex( pVertices, (FLOAT)rect.right, (FLOAT)rect.bottom ,texture. m_fuRB + 0.000001f, texture.m_fvRB + 0.000001f ); pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLT + 0.000001f; pVertices->v = texture.m_fvLT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.top ; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRT + 0.000001f; pVertices->v = texture.m_fvRT + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.left ; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuLB + 0.000001f; pVertices->v = texture.m_fvLB + 0.000001f; pVertices++;
//pVertices->x = (FLOAT)rect.right; pVertices->y = (FLOAT)rect.bottom; pVertices->z = 0.0f; pVertices->rhw = 1.0f; pVertices->u = texture.m_fuRB + 0.000001f; pVertices->v = texture.m_fvRB + 0.000001f; pVertices++;
m_pVBTexture->Unlock();
//p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, 1 );
//p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, 1 );
//p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_NONE );
//p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_NONE );
p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
p2DRender->m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
p2DRender->m_pd3dDevice->SetTexture( 0, texture.m_pTexture );
p2DRender->m_pd3dDevice->SetFVF( D3DFVF_TEXTUREVERTEX );
p2DRender->m_pd3dDevice->SetStreamSource( 0, m_pVBTexture, 0,sizeof( TEXTUREVERTEX ) );
p2DRender->m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 8);
//
}
///////////////////////////////////////////////
//return;
// 테두리 박스
p2DRender->RenderRoundRect( *pRect, dwColor1 );
pRect->DeflateRect(1,1);
p2DRender->RenderRoundRect( *pRect, dwColor3 );
pRect->DeflateRect(1,1);
p2DRender->RenderRect( *pRect, 0xffffffff );
pRect->DeflateRect(1,1);
p2DRender->RenderRect( *pRect, dwColor3 );
/*
p2DRender->RenderRoundRect( *pRect, dwColor1 );
pRect->DeflateRect(1,1);
p2DRender->RenderRoundRect( *pRect, dwColor2 );
pRect->DeflateRect(1,1);
p2DRender->RenderRoundRect( *pRect, dwColor3 );
pRect->DeflateRect(1,1);
p2DRender->RenderRoundRect( *pRect, dwColor4 );
*/
}
void CTheme::RenderEdge( C2DRender* p2DRender, CRect* pRect, BOOL bClient )
{
DWORD dwColor1 = D3DCOLOR_ARGB( 100, 0, 0, 0 );//D3DCOLOR_TEMP( 255, 0, 0, 50 );//
DWORD dwColor2 = D3DCOLOR_ARGB( 255, 240, 240, 240 );//D3DCOLOR_TEMP( 255, 80, 80, 120 );//
DWORD dwColor3 = D3DCOLOR_ARGB( 100, 200, 200, 200 );//D3DCOLOR_TEMP( 255, 80, 80, 120 );//
if( bClient )
p2DRender->RenderFillRect ( *pRect, dwColor1 );
p2DRender->RenderRoundRect( *pRect, dwColor2 );
pRect->DeflateRect( 1 , 1 );
p2DRender->RenderRect( *pRect, dwColor2 );
pRect->DeflateRect( 1 , 1 );
p2DRender->RenderRect( *pRect, dwColor3 );
}
void CTheme::RenderWndBaseBkgr( C2DRender* p2DRender, CRect* pRect )
{
if( m_bNudeSkin == FALSE )
{
// 테두리 박스
DWORD dwColor1t = D3DCOLOR_ARGB( 155, 100, 100, 100 );//D3DCOLOR_ARGB( 255, 250, 250, 255 );//
DWORD dwColor1b = D3DCOLOR_ARGB( 155, 70, 70, 70 );//D3DCOLOR_ARGB( 255, 200, 200, 210 );//
DWORD dwColor2b = D3DCOLOR_ARGB( 155, 43, 73, 45 );//D3DCOLOR_ARGB( 255, 143, 173, 245 );//
//adationRect( p2DRender, pRect, dwColor1t, dwColor1b, dwColor2b );
CTexture texture
= m_texWndPaper;
texture.SetAutoFree( FALSE );
FLOAT fu = (FLOAT)pRect->Width() / texture.m_size.cx;
FLOAT fv = (FLOAT)pRect->Height() / texture.m_size.cy;
texture.m_size.cx = pRect->Width();
texture.m_size.cy = pRect->Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
p2DRender->RenderTexture( CPoint( 0, 0), &texture );
// p2DRender->RenderFillRect( *pRect, 0xa0ffffff );
}
else
{
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->RenderFillRect( *pRect, D3DCOLOR_ARGB( 100, 0, 0, 0 ) );
}
}
void CTheme::RenderWndEditFrame( C2DRender* p2DRender, CRect* pRect )
{
#ifdef __IMPROVE_MAP_SYSTEM
DWORD dwColor1 = D3DCOLOR_ARGB( 255, 200, 200, 200 );//D3DCOLOR_ARGB(255,200,200,250);//
DWORD dwColor2 = D3DCOLOR_ARGB( 255, 255, 255, 255 );//D3DCOLOR_ARGB(255,150,150,200);//
#else __IMPROVE_MAP_SYSTEM
DWORD dwColor1 = D3DCOLOR_ARGB( 255, 255, 255, 255 );//D3DCOLOR_ARGB(255,200,200,250);//
DWORD dwColor2 = D3DCOLOR_ARGB( 255, 200, 200, 200 );//D3DCOLOR_ARGB(255,150,150,200);//
#endif // __IMPROVE_MAP_SYSTEM
p2DRender->RenderRoundRect( *pRect, dwColor1 );
pRect->DeflateRect(1,1);
p2DRender->RenderFillRect( *pRect, dwColor2 );
}
void CTheme::RenderWndTextFrame( C2DRender* p2DRender, CRect* pRect )
{
//DWORD dwColor1 = D3DCOLOR_ARGB( 88, 50, 50, 50 );//D3DCOLOR_ARGB( 255, 0, 0, 50 );//
DWORD dwColor1 = D3DCOLOR_ARGB( CWndBase::m_nAlpha - 32, 255,255,255 );//D3DCOLOR_ARGB( 255, 0, 0, 50 );//
DWORD dwColor2 = D3DCOLOR_ARGB( CWndBase::m_nAlpha - 32, 226,198,181 );//D3DCOLOR_ARGB( 255, 80, 80, 120 );//
p2DRender->RenderFillRect ( *pRect, dwColor1 );
p2DRender->RenderRoundRect( *pRect, dwColor2 );
}
//////////////////////////
DWORD CTheme::GetButtonFontColor( CWndButton* pWndButton )
{
if( pWndButton->IsWindowEnabled() )
{
if( pWndButton->IsHighLight() )
return pWndButton->GetHighLightColor();
return pWndButton->IsPush() ? pWndButton->GetPushColor() : pWndButton->GetFontColor();
}
return pWndButton->GetDisableColor();
}
POINT CTheme::GetButtonTextPos( C2DRender* p2DRender, CWndButton* pWndButton )
{
if( ! ( pWndButton->GetStyle() & WBS_NOCENTER ) )
return pWndButton->GetStrCenter( p2DRender, pWndButton->GetTitle() );
return CPoint( 0, 0);
}
void CTheme::RenderWndButton( C2DRender* p2DRender, CWndButton* pWndButton )
{
int nCheck = pWndButton->GetCheck();
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
DWORD dwColor = GetButtonFontColor( pWndButton );
POINT pt = GetButtonTextPos( p2DRender, pWndButton );
//#ifdef __NEWINTERFACE
if( pWndButton->m_pTexture )
{
RenderWndButton_4Texture( p2DRender, pWndButton );
return;
}
if( nCheck )
{
dwColor = D3DCOLOR_ARGB( 0, 0, 0, 0);
}
//DWORD dwColor1 = ( bHighLight ? D3DCOLOR_ARGB( 255, 200, 200, 250 ) : D3DCOLOR_ARGB( 255, 150, 150, 250 ) );
//DWORD dwColor2 = ( bHighLight ? D3DCOLOR_ARGB( 255, 130, 130, 200 ) : D3DCOLOR_ARGB( 255, 30, 30, 100 ) );
//DWORD dwColor1 = ( bHighLight ? D3DCOLOR_ARGB( 100, 100, 100, 150 ) : D3DCOLOR_ARGB( 200, 200, 200, 200 ) );
//DWORD dwColor2 = ( bHighLight ? D3DCOLOR_ARGB( 55, 30, 30, 100 ) : D3DCOLOR_ARGB( 55, 0, 0, 00 ) );
//DWORD dwColor1 = D3DCOLOR_ARGB( 250, 255, 255, 255 );//D3DCOLOR_ARGB( 255, 130, 130, 230 );//
//DWORD dwColor2 = D3DCOLOR_ARGB( 50, 0, 0, 00 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
//DWORD dwColor3 = D3DCOLOR_ARGB( 200, 150, 150, 150 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
DWORD dwColor1 = ( bPush ? D3DCOLOR_ARGB( 255, 100, 255, 255 ) : D3DCOLOR_ARGB( 250, 255, 255, 255 ) );
DWORD dwColor2 = ( bPush ? D3DCOLOR_ARGB( 50, 0, 0, 0 ) : D3DCOLOR_ARGB( 50, 0, 0, 0 ) );
DWORD dwColor3 = ( bPush ? D3DCOLOR_ARGB( 200, 0, 150, 150 ) : D3DCOLOR_ARGB( 200, 150, 150, 150 ) );
// DWORD dwColor = ( bHighLight ? D3DCOLOR_ARGB( 250, 0, 255, 255 ) : D3DCOLOR_ARGB( 250, 255, 255, 255 ) );
//p2DRender->TextOut( 17, 7, lpszTitle, 0xff000000);
//p2DRender->TextOut( 16, 6, lpszTitle, 0xffffffff);
p2DRender->TextOut( pt.x+1, pt.y+1, pWndButton->GetTitle(), 0xff000000 );
p2DRender->TextOut( pt.x, pt.y, pWndButton->GetTitle(), dwColor );
// if( pWndButton->IsWndStyle( WBS_NODRAWFRAME ) )
// return;
CRect rect = pWndButton->GetClientRect();
rect.DeflateRect( 2, 2);
GradationRect( p2DRender, &rect, dwColor1 ,dwColor2, dwColor3 );
p2DRender->RenderLine( CPoint( rect.left, rect.top ), CPoint( rect.right, rect.top ), dwColor3 );
//CRect rect = pWndButton->GetClientRect();
rect.InflateRect(1,1);
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 200, 200, 200 ) );
rect.InflateRect(1,1);
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 50, 50, 50 ) );
/*
if( bPush )
p2DRender->RenderFillRect( rect, dwColor2, dwColor2, dwColor1, dwColor1 );
else
p2DRender->RenderFillRect( rect, dwColor1, dwColor1, dwColor2, dwColor2 );
*/
}
void CTheme::RenderWndButton_4Texture( C2DRender* p2DRender, CWndButton* pWndButton )
{
int nCheck = pWndButton->GetCheck();
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
DWORD dwColor = GetButtonFontColor( pWndButton );
// POINT pt = GetButtonTextPos( p2DRender, pWndButton );
if( pWndButton->m_pTexture == FALSE )
return;
CTexture* pTexture = pWndButton->m_pTexture;
CSize sizeOld = pTexture->m_size;
pTexture->m_size.cx /= 4;
if( bEnable == FALSE )
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvLB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
else
if( bPush == FALSE && nCheck == 0)
{
if( bHighLight )
{
pTexture->m_fuLT = 0.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = 0.0f;
pTexture->m_fvLB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
pTexture->m_fuRB = (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
else
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 1.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 1.0f;
pTexture->m_fvLB = ( (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy );
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
}
else
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvLB = ( (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy );
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
pTexture->Render( p2DRender, CPoint( 0, 0 ), pWndButton->m_nAlphaCount );
pTexture->m_size = sizeOld;
}
void CTheme::RenderWndButton_6Texture( C2DRender* p2DRender, CWndButton* pWndButton )
{
int nCheck = pWndButton->GetCheck();
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
DWORD dwColor = GetButtonFontColor( pWndButton );
// POINT pt = GetButtonTextPos( p2DRender, pWndButton );
if( pWndButton->m_pTexture )
{
CTexture* pTexture = pWndButton->m_pTexture;
CSize sizeOld = pTexture->m_size;
pTexture->m_size.cx /= 6;
if( bEnable == FALSE )
{
if( bPush == FALSE && nCheck == 0 )
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 5.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvLB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 5.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
else
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 5.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 6.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 5.0f;
pTexture->m_fvLB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 6.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
}
else
if( bPush == FALSE && nCheck == 0 )
{
if( bHighLight )
{
pTexture->m_fuLT = 0.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = (FLOAT) pTexture->m_size.cx / (FLOAT)pTexture->m_sizePitch.cx;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = 0.0f;
pTexture->m_fvLB = (FLOAT) pTexture->m_size.cy / (FLOAT)pTexture->m_sizePitch.cy;
pTexture->m_fuRB = (FLOAT) pTexture->m_size.cx / (FLOAT)pTexture->m_sizePitch.cx;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / (FLOAT)pTexture->m_sizePitch.cy;
}
else
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 1.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 1.0f;
pTexture->m_fvLB = ( (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy );
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
}
else
{
if( bHighLight )
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 2.0f;
pTexture->m_fvLB = ( (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy );
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
else
{
pTexture->m_fuLT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvLT = 0.0f;
pTexture->m_fuRT = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvRT = 0.0f;
pTexture->m_fuLB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 3.0f;
pTexture->m_fvLB = ( (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy );
pTexture->m_fuRB = ( (FLOAT) pTexture->m_size.cx / pTexture->m_sizePitch.cx ) * 4.0f;
pTexture->m_fvRB = (FLOAT) pTexture->m_size.cy / pTexture->m_sizePitch.cy;
}
}
pTexture->Render( p2DRender, CPoint( 0, 0 ), pWndButton->m_nAlphaCount );
pTexture->m_size = sizeOld;
}
}
void CTheme::RenderWndButtonCheck( C2DRender* p2DRender, CWndButton* pWndButton )
{
int nFontHeight = pWndButton->GetFontHeight();
DWORD dwColor = GetButtonFontColor( pWndButton );
if( pWndButton->m_pTexture ) // pWndButton->IsWndStyle( WBS_PUSHLIKE ) )
{
RenderWndButton_6Texture( p2DRender, pWndButton );
p2DRender->TextOut( pWndButton->m_pTexture->m_size.cx / 6 + 2, p2DRender->m_clipRect.Height() / 2 - nFontHeight / 2, pWndButton->GetTitle(), dwColor );
}
else
{
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
// POINT pt = GetButtonTextPos( p2DRender, pWndButton );
int nFontColor = p2DRender->GetTextColor();
p2DRender->RenderRect( CRect( 0, 0, 10, 10 ), dwColor );
if( pWndButton->GetCheck() )
{
p2DRender->RenderLine( CPoint( 2, 2), CPoint( 5, 8), dwColor );
p2DRender->RenderLine( CPoint( 2, 2), CPoint( 6, 8), dwColor );
p2DRender->RenderLine( CPoint( 5, 8), CPoint( 8, 3), dwColor );
}
p2DRender->TextOut( nFontHeight + 5, 0, pWndButton->GetTitle(), dwColor );
}
}
void CTheme::RenderWndButtonRadio( C2DRender* p2DRender, CWndButton* pWndButton )
{
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
DWORD dwColor = GetButtonFontColor( pWndButton );
// POINT pt = GetButtonTextPos( p2DRender, pWndButton );
int nFontHeight = pWndButton->GetFontHeight();
int nFontColor = p2DRender->GetTextColor();
if( pWndButton->m_pTexture ) // pWndButton->IsWndStyle( WBS_PUSHLIKE ) )
{
RenderWndButton_6Texture( p2DRender, pWndButton );
p2DRender->TextOut( pWndButton->m_pTexture->m_size.cx / 6 + 2, p2DRender->m_clipRect.Height() / 2 - nFontHeight / 2, pWndButton->GetTitle(), dwColor );
}
else
{
CRect rect( 0, 0, 10, 10 );
p2DRender->RenderRoundRect( rect, dwColor );
if( pWndButton->GetCheck() )
{
rect.DeflateRect( 2, 2, 2, 2 );
p2DRender->RenderFillRect( rect, dwColor );
}
p2DRender->TextOut( nFontHeight + 5, 0, pWndButton->GetTitle(), dwColor );
}
/*
if(m_bCheck && m_bEnable == TRUE)
;//p2DRender->PaintImage(lpRadioBitmap2,CPtSz(1,1,14,14),0);
else
;//p2DRender->PaintImage(lpRadioBitmap1,CPtSz(1,1,14,14),0);
p2DRender->TextOut( nFontHeight, 0, m_strTitle );
*/
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CTheme::RenderWndButtonText( C2DRender* p2DRender, CWndButton* pWndButton )
{
BOOL bHighLight = pWndButton->IsHighLight();
BOOL bEnable = pWndButton->IsWindowEnabled();
BOOL bPush = pWndButton->IsPush();
DWORD dwColor = GetButtonFontColor( pWndButton );
POINT pt = GetButtonTextPos( p2DRender, pWndButton );
p2DRender->TextOut( pt.x, pt.y, pWndButton->GetTitle(), dwColor);
}
void CTheme::RenderWndTaskBar( C2DRender* p2DRender, CRect* pRect )
{
CRect rect = *pRect;
CTexture texture
= m_texWndPaper;
texture.SetAutoFree( FALSE );
FLOAT fu = (FLOAT)pRect->Width() / texture.m_size.cx;
FLOAT fv = (FLOAT)pRect->Height() / texture.m_size.cy;
texture.m_size.cx = pRect->Width();
texture.m_size.cy = pRect->Height();
texture.m_fuLT = 0.0f; texture.m_fvLT = 0.0f;
texture.m_fuRT = fu ; texture.m_fvRT = 0.0f;
texture.m_fuLB = 0.0f; texture.m_fvLB = fv ;
texture.m_fuRB = fu ; texture.m_fvRB = fv ;
p2DRender->RenderTexture( CPoint( 0, 0), &texture );
// 테두리 박스
/*
DWORD dwColor1t = D3DCOLOR_ARGB( 255, 91, 104, 205 );
DWORD dwColor2t = D3DCOLOR_ARGB( 255, 116, 128, 220 );
DWORD dwColor3t = D3DCOLOR_ARGB( 255, 143, 173, 245 );
DWORD dwColor1b = D3DCOLOR_ARGB( 255, 41, 104, 155 );
DWORD dwColor2b = D3DCOLOR_ARGB( 255, 66, 78, 170 );
DWORD dwColor3b = D3DCOLOR_ARGB( 255, 3, 33, 105 );
*/
DWORD dwColor0 = D3DCOLOR_ARGB( 150, 100, 100, 100 );
DWORD dwColor1 = D3DCOLOR_ARGB( 250, 255, 255, 255 );//D3DCOLOR_ARGB( 255, 130, 130, 230 );//
DWORD dwColor2 = D3DCOLOR_ARGB( 50, 0, 0, 00 );//D3DCOLOR_ARGB( 255, 50, 50, 100 );//
DWORD dwColor3 = D3DCOLOR_ARGB( 200, 150, 150, 150 );//D3DCOLOR_ARGB( 255, 180, 180, 220 );//
//DWORD dwColor1 = D3DCOLOR_ARGB( 100, 0, 0, 0 );
//DWORD dwColor2 = D3DCOLOR_ARGB( 150, 255, 255, 255 );
//DWORD dwColor3 = D3DCOLOR_ARGB( 100, 00, 00, 00 );
GradationRect( p2DRender, &rect, dwColor1 ,dwColor2, dwColor3, 40 );
//p2DRender->RenderLine( CPoint( rect.left, rect.top ), CPoint( rect.right, rect.top ), dwColor3);
rect = *pRect;//GetWindowRect();
rect.DeflateRect( 3, 3);
rect.left = 65;
//rect.right = 240;
rect.right -= 90;
//p2DRender->RenderRoundRect( rect, dwColor0 );
rect.DeflateRect( 1, 1);
// rect = *pRect;//GetWindowRect();
int i; for( i = 0; i < rect.Width() / 32; i++ )
;//p2DRender->RenderTriangle( CPoint( rect.left+ 16 + i * 32, 3 ), CPoint( rect.left + 3 + i * 32, 32 - 3 ), CPoint( rect.left + 32 - 3 + i * 32, 32 - 3 ), D3DCOLOR_ARGB( 100, 200, 170, 170 ) );
//GradationRect( p2DRender, &rect, dwColor3 ,dwColor2, dwColor1, 80 );
}
void CTheme::RenderWndMenuTask( C2DRender* p2DRender, CRect* pRect )
{
}
void CTheme::RenderWndMenu( C2DRender* p2DRender, CRect* pRect )
{
RenderWndBaseFrame( p2DRender, pRect );
/*
CRect rect = *pRect;
// 테두리 박스
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 100, 100, 200 ) );
rect.DeflateRect(1,1);
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 180, 180, 220 ) );
rect.DeflateRect(1,1);
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 180, 180, 220 ) );
rect.DeflateRect(1,1);
p2DRender->RenderRoundRect( rect, D3DCOLOR_ARGB( 155, 50, 50, 150 ) );
*/
}
void CTheme::RenderWndMenuItem( C2DRender* p2DRender, CWndButton* pWndButton )
{
}
BOOL CTheme::MakeGaugeVertex( LPDIRECT3DDEVICE9 pd3dDevice, CRect* pRect, DWORD dwColor, LPDIRECT3DVERTEXBUFFER9 pVB, CTexture* pTexture )
{
CPoint pt = pRect->TopLeft();
CPoint ptCenter = pTexture->m_ptCenter;
pt -= ptCenter;
///////////////////////////////////////////////////////////////
int nTexWidth = ( pTexture->m_size.cx ) / 3;
int nTexHeight = pTexture->m_size.cy;
FLOAT left = (FLOAT)( pt.x );
FLOAT top = (FLOAT)( pt.y );
FLOAT right = (FLOAT)( pt.x + nTexWidth );//( pTexture->m_size.cx );
FLOAT bottom = (FLOAT)( pt.y + nTexHeight );//( pTexture->m_size.cy );
int nWidth = ( pRect->Width() / nTexWidth );// - 2;
// 기본 패턴으로 완성될 수 있는건 2이다. 2보다 작으면 이미지가 깨질 수 있으니 리턴.
if( nWidth < 2 )
return FALSE;
int nTileNum = 3;
int nVertexNum = 3 * 6;
TEXTUREVERTEX2* pVertices,* pVertices_;
HRESULT hr = pVB->Lock( 0, sizeof(TEXTUREVERTEX2) * nVertexNum, (void**) &pVertices_, D3DLOCK_DISCARD );
if(hr != D3D_OK) return FALSE;
{
SIZE size = pTexture->m_size;//
SIZE sizePitch = pTexture->m_sizePitch;//
size.cx /= 3;
pVertices = pVertices_;
int i; for( i = 0; i < nVertexNum; i++ )
{
pVertices->vec.z = 0;
pVertices->rhw = 1.0f;
pVertices->color = dwColor;
pVertices++;
}
pVertices = pVertices_;
left = (FLOAT)( pt.x );
right = (FLOAT)( pt.x + nTexWidth );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = 0.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = 0.0f;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = 0.0f;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
//////////////////////////////////
left = (FLOAT)( pt.x + nTexWidth );
right = (FLOAT)( pt.x + nTexWidth + ( ( nWidth - 2 ) * nTexWidth ) );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
//////////////////////////////////
left = (FLOAT)( pt.x + ( ( nWidth - 1 ) * nTexWidth ) );
right = (FLOAT)( pt.x + ( ( nWidth ) * nTexWidth ) );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;//(FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
}
pVB->Unlock();
return TRUE;
}
void CTheme::RenderGauge( LPDIRECT3DDEVICE9 pd3dDevice, LPDIRECT3DVERTEXBUFFER9 pVB, CTexture* pTexture )
{
///////////////////////////////////////////////////////////////
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, 1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, 1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
//pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
//pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 );
//pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
//pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
//pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
//pd3dDevice->SetRenderState( D3DRS_STENCILENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
//pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
//pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE,
// D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN |
// D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
//pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );
//pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
int nVertexNum = 3 * 6;
pd3dDevice->SetVertexShader( NULL );
pd3dDevice->SetTexture( 0, pTexture->m_pTexture );
pd3dDevice->SetFVF( D3DFVF_TEXTUREVERTEX2 );
pd3dDevice->SetStreamSource( 0, pVB, 0,sizeof( TEXTUREVERTEX2 ) );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, nVertexNum / 3 );
}
void CTheme::RenderGauge( C2DRender* p2DRender, CRect* pRect, DWORD dwColor, LPDIRECT3DVERTEXBUFFER9 pVB, CTexture* pTexture )
{
// pTexture = &m_texGauEmptyNormal;
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
CPoint pt = pRect->TopLeft();
pt += p2DRender->m_ptOrigin;
CPoint ptCenter = pTexture->m_ptCenter;
pt -= ptCenter;
///////////////////////////////////////////////////////////////
int nTexWidth = ( pTexture->m_size.cx ) / 3;
int nTexHeight = pTexture->m_size.cy;
FLOAT left = (FLOAT)( pt.x );
FLOAT top = (FLOAT)( pt.y );
FLOAT right = (FLOAT)( pt.x + nTexWidth );//( pTexture->m_size.cx );
FLOAT bottom = (FLOAT)( pt.y + nTexHeight );//( pTexture->m_size.cy );
int nWidth = ( pRect->Width() / nTexWidth );// - 2;
// 기본 패턴으로 완성될 수 있는건 2이다. 2보다 작으면 이미지가 깨질 수 있으니 리턴.
if( nWidth < 2 )
return;
int nTileNum = 3;
int nVertexNum = 3 * 6;
TEXTUREVERTEX2* pVertices,* pVertices_;
HRESULT hr = pVB->Lock( 0, sizeof(TEXTUREVERTEX2) * nVertexNum, (void**) &pVertices_, D3DLOCK_DISCARD );
if(hr != D3D_OK) return;
{
SIZE size = pTexture->m_size;//
SIZE sizePitch = pTexture->m_sizePitch;//
size.cx /= 3;
pVertices = pVertices_;
int i; for( i = 0; i < nVertexNum; i++ )
{
pVertices->vec.z = 0;
pVertices->rhw = 1.0f;
pVertices->color = dwColor;
pVertices++;
}
pVertices = pVertices_;
left = (FLOAT)( pt.x );
right = (FLOAT)( pt.x + nTexWidth );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = 0.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = 0.0f;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = 0.0f;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = (FLOAT)size.cx / sizePitch.cx;
pVertices->v = (FLOAT)size.cy / sizePitch.cy;
pVertices++;
//////////////////////////////////
left = (FLOAT)( pt.x + nTexWidth );
right = (FLOAT)( pt.x + nTexWidth + ( ( nWidth - 2 ) * nTexWidth ) );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 1.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
//////////////////////////////////
left = (FLOAT)( pt.x + ( ( nWidth - 1 ) * nTexWidth ) );
right = (FLOAT)( pt.x + ( ( nWidth ) * nTexWidth ) );
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = 0.0f;//(FLOAT)size.cy / sizePitch.cy;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)top - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = 0.0f;
pVertices++;
pVertices->vec.x = (FLOAT)left - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 2.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
pVertices->vec.x = (FLOAT)right - 0.5f;
pVertices->vec.y = (FLOAT)bottom - 0.5f;
pVertices->u = ( (FLOAT)size.cx / sizePitch.cx ) * 3.0f;
pVertices->v = ( (FLOAT)size.cy / sizePitch.cy ) * 1.0f;
pVertices++;
}
pVB->Unlock();
///////////////////////////////////////////////////////////////
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, 1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, 1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
//pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
//pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 );
//pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
//pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
//pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
//pd3dDevice->SetRenderState( D3DRS_STENCILENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
//pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
//pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
//pd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE,
// D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN |
// D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
//pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );
//pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
//pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
pd3dDevice->SetVertexShader( NULL );
pd3dDevice->SetTexture( 0, pTexture->m_pTexture );
pd3dDevice->SetFVF( D3DFVF_TEXTUREVERTEX2 );
pd3dDevice->SetStreamSource( 0, pVB, 0,sizeof( TEXTUREVERTEX2 ) );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, nVertexNum / 3 );
}
void CTheme::SetVersion(int Lang)
{
sprintf( g_szVersion, "%s %s %d", __DATE__, __TIME__, Lang );
}
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] | [
[
[
1,
2132
]
]
] |
69157b0132370dcfb78720d1e4f6c2253f69ce6c | 3da0b0276bc8c3d7d1bcdbabfb0e763a38d3a24c | /zju.finished/2401.cpp | 72e64917a6edf75431c3165485a3f75d9166273c | [] | no_license | usherfu/zoj | 4af6de9798bcb0ffa9dbb7f773b903f630e06617 | 8bb41d209b54292d6f596c5be55babd781610a52 | refs/heads/master | 2021-05-28T11:21:55.965737 | 2009-12-15T07:58:33 | 2009-12-15T07:58:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 930 | cpp | #include<iostream>
#include<map>
using namespace std;
map<int,int> table;
char firststr[204];
char secondstr[204];
char compound[408];
int fun(int i, int j , int k){
if(compound[k] ==0)
return 1;
int key = (i<<16) + (j<<8) + k;
if(table.find(key) != table.end())
return table[key];
int t = 0;
if(firststr[i] == compound[k]){
if(secondstr[j] == compound[k]) {
t = fun(i,j+1,k+1);
if(t)
goto end;
}
t = fun(i+1,j,k+1);
goto end;
}
if(secondstr[j] == compound[k]){
t = fun(i,j+1,k+1);
goto end;
}
end:
table[key] = t;
return t;
}
char *ans[2] = {
"no",
"yes"
};
int main(){
int tstnum;
int i = 0;
int t;
cin>>tstnum;
while(i< tstnum){
i++;
table.clear();
cin>>firststr>>secondstr>>compound;
t = fun(0,0,0);
cout<<"Data set " << i <<": " << ans[t] << endl;
}
return 0;
}
| [
"[email protected]"
] | [
[
[
1,
55
]
]
] |
d3197275ad71a54c898418e3eb0710430841b962 | b2d46af9c6152323ce240374afc998c1574db71f | /cursovideojuegos/UAB_Videojocs/Source/snake/Snake.h | 6af4e576bda4be5065f3b21dac37d44aed896105 | [] | no_license | bugbit/cipsaoscar | 601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4 | 52aa8b4b67d48f59e46cb43527480f8b3552e96d | refs/heads/master | 2021-01-10T21:31:18.653163 | 2011-09-28T16:39:12 | 2011-09-28T16:39:12 | 33,032,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,045 | h | #ifndef _SNAKE_H
#define _SNAKE_H
#include <vector>
#include "../DebugPrintText2D.h"
#define BODY_SIZE 10.f
#define MOVE_TIME 0.1f
struct SBody
{
float m_fPosX;
float m_fPosY;
};
typedef enum Direction {DIR_RIGHT, DIR_LEFT, DIR_UP, DIR_DOWN, DIR_NOTHING};
class CSnake
{
public:
CSnake(float posx,float posy,int nsnake);
~CSnake(void);
void SetDirection(Direction direction);
void Render (CDebugPrintText2D& printText2d);
void Update (float dt);
inline SBody GetBodyHead() const
{
return m_Snake[0];
}
inline int GetNSnake() const { return m_NSnake; }
inline void Move() { m_bMove=true; }
inline void Grow() { m_bGrow=true; }
bool IsCollision (float posx,float posy);
private:
std::vector<SBody> m_Snake;
Direction m_Direction;
Direction m_DirectionOld;
bool m_bMove;
bool m_bGrow;
float m_fMoveTime;
int m_NSnake;
Direction GetDireccionContraria(const Direction &) const;
};
#endif
| [
"ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a"
] | [
[
[
1,
55
]
]
] |
20c9cf7ddd874d5b6efc8d06969e06f7d6d8e083 | 814b49df11675ac3664ac0198048961b5306e1c5 | /Code/Game/IA/Miner.cpp | 6d9c9a4873aabb40bb1ac7d325a7c6d95851de18 | [] | no_license | Atridas/biogame | f6cb24d0c0b208316990e5bb0b52ef3fb8e83042 | 3b8e95b215da4d51ab856b4701c12e077cbd2587 | refs/heads/master | 2021-01-13T00:55:50.502395 | 2011-10-31T12:58:53 | 2011-10-31T12:58:53 | 43,897,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 299 | cpp | #include "Miner.h"
void CMiner::InitTemplate(CXMLTreeNode& _XMLParams)
{
CEnemy::InitTemplate(_XMLParams);
m_fRotateSpeed = (_XMLParams.GetFloatProperty("rotate_speed",false));
}
void CMiner::InitInstance(CXMLTreeNode& _XMLParams)
{
CEnemyInstance::InitInstance(_XMLParams);
}
| [
"edual1985@576ee6d0-068d-96d9-bff2-16229cd70485"
] | [
[
[
1,
13
]
]
] |
1114274a2cf5977545d9bb2676dd8796ef3c3212 | 7f30cb109e574560873a5eb8bb398c027f85eeee | /src/wxPacsListBox.h | a1ffcff95788d76dd796669f322eb9882fbaeb6f | [] | no_license | svn2github/MITO | e8fd0e0b6eebf26f2382f62660c06726419a9043 | 71d1269d7666151df52d6b5a98765676d992349a | refs/heads/master | 2021-01-10T03:13:55.083371 | 2011-10-14T15:40:14 | 2011-10-14T15:40:14 | 47,415,786 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,360 | h | /**
* \file wxPacsListBox.h
* \brief File per la gestione di una lista per la memorizzazione di informazioni provenienti dal PACS
* \author ICAR-CNR Napoli
*/
#ifndef _wxPacsListBox_h_
#define _wxPacsListBox_h_
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#include "wx/listbox.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
/**
* \brief Struttura che definisce un campo della lista
*/
struct PacsObject {
wxString str;
void* data;
PacsObject* next;
};
/**
* \brief Definizione di un puntatore alla struttura PacsObject
*/
typedef PacsObject* Ptr;
/**
* \class wxPacsListBox
* \brief Classe atta alla gestione di una lista. Deriva da wxListBox
*/
class wxPacsListBox : public wxListBox {
private:
/**
* \var Ptr ptrPacsObject
* \brief Puntatore alla struttura PacsObject
*/
Ptr ptrPacsObject;
/**
* \fn void* GetPacsDataRic(const Ptr p, const wxString str)
* \brief Ottiene un dato dalla lista attraverso una ricerca ricorsiva
* \param p Puntatore alla lista corrente
* \param str Stringa da ricercare
* \return Il dato trovato
*/
void* GetPacsDataRic(const Ptr p, const wxString str);
public:
/** Costruttore con parametri la finestra padre, l'identificativo, il titolo, la posizione, la dimensione, lo stile, il validator e il nome della finestra */
wxPacsListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listBox");
/** Distruttore */
~wxPacsListBox();
/**
* \fn void Add(const wxString str, void* data)
* \brief Aggiunge un campo nella lista
* \param str Stringa da inserire
* \param data Dato da inserire
*/
void Add(const wxString str, void* data);
/**
* \fn void Add(const wxString str, void* data)
* \brief Restituisce un elemento dalla lista, invocando il metodo privato GetPacsDataRic
* \param str Stringa da ricercare
* \return Il dato trovato
*/
void* GetPacsData(const wxString str);
/**
* \fn void Add(const wxString str, void* data)
* \brief Restituisce il puntatore alla lista
* \return Il puntatore alla lista
*/
inline Ptr GetPtrObject() const {
return ptrPacsObject;
}
};
#endif _wxPacsListBox_h_ | [
"kg_dexterp37@fde90bc1-0431-4138-8110-3f8199bc04de"
] | [
[
[
1,
86
]
]
] |
3f97e439bd6a103d8ba987065d39a3638e7ef87d | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/nGENE Proj/TypeInfo.h | 34294d3dec1f44679da3c5d07b236e853d6e2dda | [] | no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,985 | h | /*
---------------------------------------------------------------------------
This source file is part of nGENE Tech.
Copyright (c) 2006- Wojciech Toman
This program is free software.
File: TypeInfo.h
Version: 0.04
---------------------------------------------------------------------------
*/
#pragma once
#ifndef __INC_TYPEINFO_H_
#define __INC_TYPEINFO_H_
#include <string>
#include "Prerequisities.h"
namespace nGENE
{
/** Dynamic type information.
@remarks
To make use of dynamic type information classes have to declare
static member of TypeInfo type which should be initialized with
the proper class and its parent's name.
@par
If you want to find out object's type just call getTypeName() method.
*/
class nGENEDLL TypeInfo
{
protected:
TypeInfo* m_pParentType; ///< Type of the parent
wstring m_stTypeName; ///< Name of the class
static const wstring s_NoParent;
public:
TypeInfo();
TypeInfo(const wstring& _type, TypeInfo* _parent);
virtual ~TypeInfo();
/// Sets type name.
void setTypeName(const wstring& _type);
/// Sets parent's type name.
void setParentType(TypeInfo* _type) {m_pParentType=_type;}
/// Gets name of the class.
const wstring& getTypeName() const {return m_stTypeName;}
/// Gets name of the class.
const wstring& Type() const {return m_stTypeName;}
/// Gets name of the super-class.
const wstring& getParentTypeName() const;
/// Gets name of the super-class.
const wstring& ParentType() const;
/// Gets type of the parental class.
TypeInfo* getParentType() const {return m_pParentType;}
/// Gets type of the parental class.
TypeInfo* Parent() const {return m_pParentType;}
/// Checks if specified type belongs to hierarchy.
bool isChild(TypeInfo* _type);
};
/// Use following macro to add type info support to the class.
#define EXPOSE_TYPE public: static TypeInfo Type;
}
#endif | [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] | [
[
[
1,
76
]
]
] |
3e09db2b9939eb697170d06e7355879b22a55389 | 13f30850677b4b805aeddbad39cd9369d7234929 | / astrocytes --username [email protected]/CT_tutorial/painting.cpp | 70a95464177ccfd5f4d8830796272aeafe63444f | [] | 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 | UTF-8 | C++ | false | false | 5,000 | cpp |
#include "globals.h"
#include "table.h"
#include "PN_Triangle.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_for.h"
#include "tbb/blocked_range2d.h"
#include "tbb/tick_count.h"
int painting_rad_nm=300;
float painting_rad=painting_rad_nm*0.001;
std::string painting_svr_fn = "painting_svr_"+str::ToString(painting_rad_nm);
void LoadPainting(std::string fn);
void SetPaintingRadius(int rad_nm)
{
painting_rad_nm = rad_nm;
painting_rad = rad_nm*0.001;
painting_svr_fn = "painting_svr_"+str::ToString(rad_nm);
LoadPainting(painting_svr_fn);
}
float CalcSVR(vec3 cc,float rr)
{
Geometry*gs = new Geometry();
Geometry* g1 = new Geometry();
Geometry* g2 = new Geometry();
AddSphere(gs,rr,20,20);
//mat34 mt(RND11*5,vec3(1,1,1).normalized());
//gs->Transform(mt);
gs->Move(cc+vec3(RND11,RND11,RND11)*0.00001f);
gs->UpdateBox();
gs->RebuildTrBB();
//gs->RebuildTrBB2();
for(int as=0;as<neuron[0].size();as++)
{
GetSection(gs,&neuron[0][as],g1,1,0);
GetSection(&neuron[0][as],gs,g2,1,0);
}
delete gs;
float ss = g2->CalcArea();
float vv = g2->CalcVolume() + g1->CalcVolume();
delete g1;
delete g2;
float svr = (vv>0)?ss/vv:0;
//printf(" (%g %g %g) ",ss,vv,svr);
return svr;
}
float mc_CalcSVR(vec3 cc,float rr, vec3 c1,bool ins)
{
Geometry*g0=new Geometry();
for(int as=0;as<neuron[0].size();as++)
{
GetInSphere(&neuron[0][as],cc,rr,g0);
}
float ss = mc_CalcArea(g0,cc,rr);
float vv = mc_CalcVolume(g0,cc,rr,c1,ins);
float svr = (vv>0)?ss/vv:0;
delete g0;
return svr;
}
float CalcSVR_safe(vec3 center,float rr)
{
float old_c;
int ct=0,nct=5;
while(ct!=nct)
{
float cc = CalcSVR( center, rr);
if(cc>0)
{
if(ct && abs(cc-old_c)>1)
{
printf("[%g,%g]",cc,old_c);
ct=0;
}else
{
old_c=cc;
ct++;
}
}else printf("=");
}
return old_c;
}
void SavePainting(std::string fn)
{
std::ofstream fs1(fn.c_str(),std::ios::out | std::ios::binary);
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g=&neuron[0][as];
SaveVector(fs1,g->vert_val);
}
fs1.close();
}
void LoadPainting(std::string fn)
{
std::ifstream fs1(fn.c_str(),std::ios::in | std::ios::binary);
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g=&neuron[0][as];
if(!fs1){g->vert_val.resize(g->vert.size());for(int i=0;i<g->vert.size();i++)g->vert_val[i]=-1;}else
OpenVector(fs1,g->vert_val);
}
fs1.close();
}
void PaintTrue(float brightness)
{
float max_svr=0;
LoadPainting(painting_svr_fn);
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g=&neuron[0][as];
for(int i=0;i<g->vert_val.size();i++)
if(g->vert_val[i]>=0)
{
if(max_svr<g->vert_val[i])max_svr=g->vert_val[i];
}
}
printf("max svr: %g ",max_svr);
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_val[i]>=0)
{
float cl = g->vert_val[i];
cl = min(1,cl*brightness);
//if(g->vert_val[i]>brightness)g->vert_col[i].set(cl,1,1,1);else
g->vert_col[i].set(cl,0,1-cl,1);
/*
if(cl<5)g->vert_col[i].set(0,0,1,1);else
if(cl<10)g->vert_col[i].set(0.5,0.5,1,1);else
if(cl<15)g->vert_col[i].set(0,0.5,0,1);else
if(cl<20)g->vert_col[i].set(1,1,0,1);else
g->vert_col[i].set(1,0,0,1);
*/
//g->vert_col[i].set(cl,0,0,1);
}else
//g->vert_col[i] = g->color;
g->vert_col[i].set(0.3,0.3,0.3,1);
//Geometry g1;
//MakeSmoothed(g,&g1,10);
//g->vbo_mesh.Build(g1.vert,g1.norm,g1.vert_col,g1.face);
g->vbo_mesh.Build(g->vert,g->norm,g->vert_col,g->face);
}
}
#define MAX_SVR 100
void PaintAs(vec3 cc,float rr)
{
srand(glfwGetTime());
int total_iters=0,it_l;
LoadPainting(painting_svr_fn);
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g=&neuron[0][as];
if(g->vert_val.size()!=g->vert.size())
{
g->vert_val.resize(g->vert.size());
for(int i=0;i<g->vert.size();i++)
{
g->vert_val[i]=-1;
}
}
for(int i=0;i<g->vert.size();i++)
if(g->vert[i].lengthSQR(cc)<rr*rr)
if(g->vert_val[i]<0)
total_iters++;
}
it_l = total_iters;
double start1 = glfwGetTime();
for(int as=0;as<neuron[0].size();as++)
{
Geometry*g=&neuron[0][as];
for(int i=0;i<g->vert.size();i++)
if(g->vert[i].lengthSQR(cc)<rr*rr)
if(g->vert_val[i]<0)
{
//if(g->vert_val[i]==0 || g->vert_val[i]>MAX_SVR)printf("-");
float svr = mc_CalcSVR(g->vert[i],painting_rad ,g->vert[i]+g->norm[i]*0.01f,0);
//float svr1 = mc_CalcSVR(g->vert[i],0.6f,g->vert[i]+g->norm[i]*0.0001f,0);
if(svr>0)g->vert_val[i] = svr;
it_l--;
if(!(it_l%10))SavePainting(painting_svr_fn);
printf("%g min {%g}\n",(it_l*(glfwGetTime ( )-start1)/(total_iters-it_l))/60,svr);
}
}
SavePainting(painting_svr_fn);
//PaintTrue(1);
} | [
"[email protected]"
] | [
[
[
1,
221
]
]
] |
58b825dcc017b226b145ca02882e742cbe9bf7ec | f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0 | /Depend/MyGUI/Tools/SkinEditor/TextureToolControl.h | b8c4cc02150d2a3ead179d3caf8a3479cf6c19bb | [] | 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 | UTF-8 | C++ | false | false | 900 | h | /*!
@file
@author Albert Semenov
@date 08/2010
*/
#ifndef __TEXTURE_TOOL_CONTROL_H__
#define __TEXTURE_TOOL_CONTROL_H__
#include "TextureControl.h"
#include "ColourPanel.h"
namespace tools
{
class TextureToolControl :
public TextureControl
{
public:
TextureToolControl(MyGUI::Widget* _parent);
virtual ~TextureToolControl();
private:
void notifyEndDialog(Dialog* _sender, bool _result);
void notifyComboChangePosition(MyGUI::ComboBox* _sender, size_t _index);
void notifyMouseButtonClick(MyGUI::Widget* _sender);
void fillColours(MyGUI::ComboBox* _combo);
void fillScale();
void updateColour(MyGUI::ComboBox* _sender);
private:
MyGUI::ComboBox* mBackgroundColour;
MyGUI::ComboBox* mScale;
MyGUI::Widget* mBackgroundButton;
ColourPanel* mColourPanel;
};
} // namespace tools
#endif // __TEXTURE_TOOL_CONTROL_H__
| [
"albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c"
] | [
[
[
1,
42
]
]
] |
14ddba13208d4db8bd81967bd327e094589d9a86 | 25fd79ea3a1f2c552388420c5a02433d9cdf855d | /Pool/PoolGame/PrecompiledHeaders.cpp | 1a5f467374a380a4cef38d2e1772753d2c94aa23 | [] | no_license | k-l-lambda/klspool | 084cbe99a1dc3b9703233fccea3f2f6570df9d63 | b57703169828f9d406e7d0a6cd326063832b12c6 | refs/heads/master | 2021-01-23T07:03:59.086914 | 2009-09-06T09:14:51 | 2009-09-06T09:14:51 | 32,123,777 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 488 | cpp | /*
** This source file is part of Pool.
**
** Copyright (c) 2009 K.L.<[email protected]>, Lazy<[email protected]>
** This program is free software without any warranty.
*/
// PrecompiledHeaders.cpp : 只包括标准包含文件的源文件
// Pool.pch 将成为预编译头
// PrecompiledHeaders.obj 将包含预编译类型信息
#include "StableHeaders.h"
// TODO: 在 StableHeaders.h 中
//引用任何所需的附加头文件,而不是在此文件中引用
| [
"xxxK.L.xxx@64c72148-2b1e-11de-874f-bb9810f3bc79"
] | [
[
[
1,
15
]
]
] |
fbe18d721306e99b7947327be6150237fafadeaa | 857b85d77dfcf9d82c445ad44fedf5c83b902b7c | /source/Headers/Game.h | 828f64fe5922b684ea8275b39499e14f590de867 | [] | no_license | TheProjecter/nintendo-ds-homebrew-framework | 7ecf88ef5b02a0b1fddc8939011adde9eabf9430 | 8ab54265516e20b69fbcbb250677557d009091d9 | refs/heads/master | 2021-01-10T15:13:28.188530 | 2011-05-19T12:24:39 | 2011-05-19T12:24:39 | 43,224,572 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,906 | h | #ifndef GAME_H
#define GAME_H
#include "Singleton.h"
#include "EventHandler.h"
#include "GameObject.h"
#include "BackgroundTypes.h"
// sound header
#include <maxmod9.h>
#include <map>
#include <vector>
class IGraphicsRenderer;
class GameState;
class Game : public EventHandler
{
public:
typedef std::map<int, GameObject*> GameObjects;
~Game() {}
bool Init();
void Clean();
void ChangeState(GameState* state);
void PushState(GameState* state);
void PopState();
void Reset();
void ResetScores() { m_p1Score = 0; m_p2Score = 0; }
bool CheckLoadState() { return m_bStateLoaded;}
void Update(float gameSpeed);
void Draw(IGraphicsRenderer* renderer);
const GameObjects& GetGameObjects() { return m_gameObjects; }
int GetNextGameObjectID() { return m_nextGameObjectID; }
void IncrementGameObjectID() { m_nextGameObjectID++; }
void AddGameObject(GameObject* pGO);
GameObject* GetGameObject(int id) { return m_gameObjects[id]; }
void LoadGameObjects(const char* gameObjectfile);
void SetPlayStateObjectFile(const char* stateFile) { m_playStateObjectFile = stateFile; }
void SetPlayStateResourceFile(const char* stateFile) { m_playStateResourcesFile = stateFile; }
const char* GetPlayStateObjectFile() { return m_playStateObjectFile; }
const char* GetPlaystateResourceFile() { return m_playStateResourcesFile; }
void IncrementP1Score() { m_p1Score++; }
void IncrementP2Score() { m_p2Score++; }
int GetP1Score() { return m_p1Score; }
int GetP2Score() { return m_p2Score; }
private:
Game();
friend class Singleton<Game>;
std::vector<GameState*> states;
int m_nextGameObjectID;
GameObjects m_gameObjects;
const char* m_playStateObjectFile;
const char* m_playStateResourcesFile;
bool m_bStateLoaded;
int m_p1Score;
int m_p2Score;
};
typedef Singleton<Game> TheGame;
#endif | [
"[email protected]"
] | [
[
[
1,
84
]
]
] |
4721b05112dd062ff02d0c951a537aabb75708ac | 252e638cde99ab2aa84922a2e230511f8f0c84be | /reflib/src/BusEditForm.h | 2bbc681765b5e8fc9bcc1f6184b99f8237942416 | [] | no_license | openlab-vn-ua/tour | abbd8be4f3f2fe4d787e9054385dea2f926f2287 | d467a300bb31a0e82c54004e26e47f7139bd728d | refs/heads/master | 2022-10-02T20:03:43.778821 | 2011-11-10T12:58:15 | 2011-11-10T12:58:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 982 | h | //---------------------------------------------------------------------------
#ifndef BusEditFormH
#define BusEditFormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "BusProcessForm.h"
#include "VStringStorage.h"
#include <Db.hpp>
#include <DBCtrls.hpp>
#include <Mask.hpp>
//---------------------------------------------------------------------------
class TTourRefBookBusEditForm : public TTourRefBookBusProcessForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TTourRefBookBusEditForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TTourRefBookBusEditForm *TourRefBookBusEditForm;
//---------------------------------------------------------------------------
#endif
| [
"[email protected]"
] | [
[
[
1,
26
]
]
] |
f1e4c958e475a87c528d1e59700573aff0141664 | ea12fed4c32e9c7992956419eb3e2bace91f063a | /zombie/code/renaissance/rnsgameplay/src/rnsgameplay/ncgameplay_main.cc | 74fc0cd9068335ab5aa9be4a73c5740d49b514e4 | [] | 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 | 12,696 | cc | //------------------------------------------------------------------------------
// ncgameplay_main.cc
// (C) 2005 Conjurer Services, S.A.
//------------------------------------------------------------------------------
#include "precompiled/pchrnsgameplay.h"
#include "rnsgameplay/ncgameplay.h"
#include "ngpbasicaction/ngpbasicaction.h"
#include "ncfsm/ncfsm.h"
#include "ncaimovengine/ncaimovengine.h"
#include "entity/nentityobjectserver.h"
#include "ntrigger/ngameevent.h"
#include "nworldinterface/nworldinterface.h"
#include "ngpactionmanager/ngpactionmanager.h"
#include "ncnetwork/ncnetwork.h"
#include "nnetworkmanager/nnetworkmanager.h"
#include "nclogicanimator/nclogicanimator.h"
#ifndef NGAME
#include "ndebug/ndebugserver.h"
#include "gfx2/ngfxserver2.h"
#endif//NGAME
#ifdef __NEBULA_STATS__
#include "kernel/nprofiler.h"
namespace
{
nProfiler profGPrun;
}
#endif
//------------------------------------------------------------------------------
nNebulaComponentObject(ncGameplay,nComponentObject);
//------------------------------------------------------------------------------
/**
Constructor
*/
ncGameplay::ncGameplay() :
foregroundAction(0),
backgroundAction(0),
movEngine(0),
valid(true)
{
#ifdef __NEBULA_STATS__
if ( !profGPrun.IsValid() )
{
profGPrun.Initialize( "profGPrun", true );
}
#endif
}
//------------------------------------------------------------------------------
/**
Destructor
*/
ncGameplay::~ncGameplay()
{
this->movEngine = 0;
this->DestroyBasicAction (BA_BACKGROUND | BA_FOREGROUND);
this->ClearQueue();
}
//------------------------------------------------------------------------------
/**
DestroyBasicAction
*/
void
ncGameplay::DestroyBasicAction (UINT flags)
{
bool foreground = (flags & BA_FOREGROUND) != 0;
bool background = (flags & BA_BACKGROUND) != 0;
if ( foreground && this->foregroundAction )
{
this->foregroundAction->Release();
this->foregroundAction = 0;
}
if ( background && this->backgroundAction )
{
this->backgroundAction->Release();
this->backgroundAction = 0;
}
}
//------------------------------------------------------------------------------
/**
SetBasicAction
*/
void
ncGameplay::SetBasicAction (nGPBasicAction* basicAction, UINT flags)
{
bool clearQueue = (flags & BA_CLEARQUEUE) != 0;
bool foreground = (flags & BA_FOREGROUND) != 0;
this->DestroyBasicAction (flags);
if ( foreground )
{
this->foregroundAction = basicAction;
if ( clearQueue )
{
this->ClearQueue();
}
}
else
{
this->backgroundAction = basicAction;
}
};
//------------------------------------------------------------------------------
/**
InitInstance
*/
void
ncGameplay::InitInstance (nObject::InitInstanceMsg initType )
{
n_assert(this->entityObject);
if ( this->entityObject )
{
this->movEngine = this->entityObject->GetComponent <ncAIMovEngine>();
}
// Make sure to clear any previous basic action if this component is being reused
if ( initType == nObject::ReloadedInstance )
{
this->DestroyBasicAction( BA_BACKGROUND | BA_FOREGROUND );
this->ClearQueue();
}
#ifndef NGAME
// When the entity isn't being loaded, give it a default name with the format <class name>_<low ip>_<count>
if ( initType == nObject::NewInstance )
{
this->name = this->GetEntityObject()->GetEntityClass()->GetName();
this->name += "_";
this->name += nString( int( nEntityObjectServer::Instance()->GetHighId() >> 24 ) );
this->name += "_";
// Look for the first free count index available for the same class name and low ip
const int MaxCount = 10000;
int count = 0;
while ( count < MaxCount ) // Put some boundary, just in case something goes wrong and it hangs
{
nString desiredName( name + nString(count) );
if ( !nWorldInterface::Instance()->GetGameEntity( desiredName.Get() ) )
{
this->name = desiredName;
break;
}
++count;
}
n_assert2( count < MaxCount, "An unknown error occurred while assigning a new default name to the entity" );
}
#endif
}
//------------------------------------------------------------------------------
/**
Run
@param deltaTime time from last update
*/
void
ncGameplay::Run ( const float deltaTime )
{
// Run movement
if ( this->movEngine )
{
this->movEngine->Run(deltaTime);
}
#ifdef __NEBULA_STATS__
profGPrun.StartAccum();
#endif
// Run current basic action
if ( this->foregroundAction )
{
nArg outArg;
this->foregroundAction->Call ("run", 1, &outArg);
if ( outArg.GetB() )
{
this->DestroyBasicAction (BA_FOREGROUND);
this->SignalActionDone();
#ifdef __NEBULA_STATS__
profGPrun.StopAccum();
#endif
ncNetwork * netcomp = this->GetComponent<ncNetwork>();
if( netcomp )
{
netcomp->UpdateState();
}
#ifdef __NEBULA_STATS__
profGPrun.StartAccum();
#endif
}
}
// Run the background action
if ( this->backgroundAction )
{
nArg outArg;
this->backgroundAction->Call ("run", 1, &outArg);
if ( outArg.GetB() )
{
this->DestroyBasicAction (BA_BACKGROUND);
this->SignalActionDone();
}
}
// By now, this only works for foreground basic actions
if ( !this->foregroundAction )
{
this->GetQueuedAction();
}
#ifdef __NEBULA_STATS__
profGPrun.StopAccum();
#endif
}
//------------------------------------------------------------------------------
/**
AbortCurrentAction
*/
void
ncGameplay::AbortCurrentAction (UINT flags)
{
this->DestroyBasicAction (flags);
}
//------------------------------------------------------------------------------
/**
SignalActionDone
*/
void
ncGameplay::SignalActionDone()
{
nNetworkManager * network = nNetworkManager::Instance();
if( network && network->IsServer() )
{
// @todo When the single action is updated to an actions queue,
// do NOT signal an action done event for each action,
// but only when the actions queue is empty.
ncFSM* fsm = this->GetComponent<ncFSM>();
if ( fsm )
{
fsm->OnActionEvent( nGameEvent::ACTION_DONE );
}
}
}
//------------------------------------------------------------------------------
/**
@param actionName name of the action to check
@returns true if the action is in the entity
*/
bool
ncGameplay::HasAction (const nString& actionName, UINT flags) const
{
nGPBasicAction* basicAction = 0;
bool foreground = (flags & BA_FOREGROUND) != 0;
basicAction = foreground ? this->foregroundAction : this->backgroundAction;
if ( basicAction && basicAction->GetClass() )
{
if( basicAction->GetClass()->GetName() == actionName )
{
return true;
}
}
return false;
}
#ifndef NGAME
//------------------------------------------------------------------------------
/**
DebugDraw
*/
void
ncGameplay::DebugDraw (nGfxServer2* const gfxServer)
{
bool debugTexts = nDebugServer::Instance()->GetFlagEnabled( "rnsview", "debugtexts" );
if( debugTexts )
{
nString text;
if( this->foregroundAction )
{
text = "Foreground Action : ";
text.Append( this->foregroundAction->GetClass()->GetName() );
gfxServer->Text( text.Get(), vector4( 1, 0.8f, 0.8f, 0.8f), -0.9f, 0.3f );
}
if( this->backgroundAction )
{
text = "Background Action : ";
text.Append( this->backgroundAction->GetClass()->GetName() );
nGfxServer2::Instance()->Text( text.Get(), vector4( 1, 0.8f, 0.8f, 0.8f), -0.9f, 0.4f );
}
ncLogicAnimator * animator = this->GetComponent<ncLogicAnimator>();
if( animator )
{
text = "1 Animation : ";
int index = animator->GetFirstPersonStateIndex();
if( index != -1 )
{
text.Append( animator->GetFirstPersonStateName( index ) );
text.Append( " [ " );
text.AppendFloat( animator->GetRemainingTime( index, true ) );
text.Append( " / " );
text.AppendFloat( animator->GetStateDuration( index, true ) );
text.Append( " ] " );
}
else
{
text.Append( "???" );
}
nGfxServer2::Instance()->Text( text.Get(), vector4( 0.8f, 1, 0.8f, 0.8f), -0.9f, 0.5f );
text = "3 animation (lower): ";
index = animator->GetStateIndex();
if( index != -1 )
{
text.Append( animator->GetStateName( index ) );
text.Append( " [ " );
text.AppendFloat( animator->GetRemainingTime( index, false ) );
text.Append( " / " );
text.AppendFloat( animator->GetStateDuration( index, false ) );
text.Append( " ] " );
}
else
{
text.Append( "???" );
}
nGfxServer2::Instance()->Text( text.Get(), vector4( 0.8f, 1, 0.8f, 0.8f), -0.9f, 0.55f );
text = "3 animation (upper): ";
index = animator->GetUpperStateIndex();
if( index != -1 )
{
text.Append( animator->GetStateName( index ) );
text.Append( " [ " );
text.AppendFloat( animator->GetRemainingTime( index, false ) );
text.Append( " / " );
text.AppendFloat( animator->GetStateDuration( index, false ) );
text.Append( " ] " );
}
else
{
text.Append( "???" );
}
nGfxServer2::Instance()->Text( text.Get(), vector4( 0.8f, 1, 0.8f, 0.8f), -0.9f, 0.60f );
}
}
}
#endif//!NGAME
//------------------------------------------------------------------------------
/**
ClearQueue
*/
void
ncGameplay::ClearQueue()
{
while ( this->queueActions.Size() > 0 )
{
this->PopBasicAction();
}
}
//------------------------------------------------------------------------------
/**
AddBasicAction
*/
void
ncGameplay::AddBasicAction (const char* name, int numArgs, nArg* args, bool foreground)
{
actionsSpec* spec = n_new (actionsSpec);
if ( spec )
{
spec->name = n_new_array (char, strlen(name)+1);
strcpy (spec->name, name);
spec->args = n_new_array (nArg, numArgs);
for ( int i=0; i<numArgs; i++ )
{
// Using the copy constructor
spec->args[i] = args[i];
}
spec->params = numArgs;
spec->foreground = foreground;
this->queueActions.PushBack (spec);
}
}
//------------------------------------------------------------------------------
/**
PopBasicAction
*/
void
ncGameplay::PopBasicAction()
{
if ( this->queueActions.Size() > 0 )
{
actionsSpec* spec = this->queueActions[0];
n_assert(spec);
n_delete_array (spec->name);
n_delete_array (spec->args);
n_delete (spec);
this->queueActions.Erase(0);
}
}
//------------------------------------------------------------------------------
/**
GetTopQueue
*/
ncGameplay::actionsSpec*
ncGameplay::GetTopQueue() const
{
actionsSpec* spec = 0;
if ( this->queueActions.Size() > 0 )
{
spec = this->queueActions[0];
}
return spec;
}
//------------------------------------------------------------------------------
/**
GetQueuedAction
*/
void
ncGameplay::GetQueuedAction()
{
if ( this->queueActions.Size() > 0 )
{
nGPActionManager* actionManager = nGPActionManager::Instance();
n_assert(actionManager);
if ( actionManager )
{
actionsSpec* action = this->GetTopQueue();
n_assert(action);
actionManager->SetAction (action->name, action->params, action->args, action->foreground, false);
this->PopBasicAction();
}
}
}
//------------------------------------------------------------------------------
| [
"magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91"
] | [
[
[
1,
470
]
]
] |
786cb84f5dfa476b5ede4373b26cd44286c5f5f7 | 59166d9d1eea9b034ac331d9c5590362ab942a8f | /glslDebug/MainNode/Triangle/Triangle.h | 42dbe3ffab1a66575f8d9148a8728e493ba09192 | [] | no_license | seafengl/osgtraining | 5915f7b3a3c78334b9029ee58e6c1cb54de5c220 | fbfb29e5ae8cab6fa13900e417b6cba3a8c559df | refs/heads/master | 2020-04-09T07:32:31.981473 | 2010-09-03T15:10:30 | 2010-09-03T15:10:30 | 40,032,354 | 0 | 3 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 589 | h | #ifndef _TRIANGLE_H_
#define _TRIANGLE_H_
#include <osg/ref_ptr>
#include <osg/Geode>
#include <osg/MatrixTransform>
class Triangle : public osg::Referenced
{
public:
Triangle();
~Triangle();
//инициализация простой геометрии
void Init();
//вернуть узел с геометрией
osg::ref_ptr< osg::MatrixTransform > GetNode(){ return m_Node.get(); };
private:
//создать геометрию
osg::ref_ptr< osg::Geode > CreateGeode();
osg::ref_ptr< osg::MatrixTransform > m_Node;
};
#endif //_TRIANGLE_H_ | [
"asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b"
] | [
[
[
1,
27
]
]
] |
75e4faa4c374c1ccd649d335bd066653f25bf0ee | 10dc90bdd65a8e0e9fbec4424729b868577f701d | /simple_ga.cpp | 36741d3f0f1c14746c651a27ceb70a8820a1c341 | [] | no_license | tvo/ga | 9974a6eca93ce889ba436c12017c8e2a449c266e | 19bffe021188c8b2ac5825c8c7d7c986647e2c88 | refs/heads/master | 2021-01-01T06:10:11.627664 | 2010-02-09T11:22:22 | 2010-02-09T11:22:22 | 456,117 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,400 | cpp | /* ---------------------------------------------------------------------------
simple_ga.cpp
a simple genetic algorithm implementation
Copyright (C) 2005 Hans-Gerhard Gross, EWI TUDelft, NL
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: write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------ */
#include <algorithm>
#include <fstream>
#include <iostream>
#include <time.h>
#include "ga.h"
#include "simple_ga.h"
// ----------------------------------------------------------------
//
// SIMPLE_GA INDIVIDUAL --- IMPLEMENTATION
//
// ----------------------------------------------------------------
// ---------- constructor
Simple_Invid::Simple_Invid(void) {
chr = NULL;
csz = 0;
gaf = dflt_fitness;
}
// ---------- initializer
void Simple_Invid::Init(unsigned int size) {
csz = size; // set size
chr = new unsigned char[csz]; // create a chrom for invid
}
// ---------- destructor
Simple_Invid::~Simple_Invid(void) {
delete[] chr; // delete the chrom of invid
}
// ---------- copy operator
Simple_Invid& Simple_Invid::operator=(Simple_Invid& I) {
if (this != &I) {
if (csz != I.csz) {
csz = I.csz; // copy size from FROM
delete[] chr; // delete TO chrom
chr = new unsigned char[csz]; // create new chrom
}
gaf = I.gaf; // copy fitness from FROM
for (unsigned int i = 0; i < csz; i++)
*(chr + i) = *(I.chr + i); // copy chrom values from FROM into TO
}
return *this;
}
// ---------- initiate chrom
void Simple_Invid::Randomise(double(*FF)(unsigned char*, unsigned int)) {
for (unsigned int i = 0; i < csz; i++)
chr[i] = (char) rand(); // initialize chrom randomly
if (FF != NULL) {
gaf = (*FF)(chr, csz); // invoke fitness function
}
}
// ---------- initiate with data from file
void Simple_Invid::Randomise(double(*FF)(unsigned char*, unsigned int), char* fname) {
unsigned int counter = 0;
ifstream ins;
ins.open(fname); // read chrom from (binary) file
while ((ins.read((char*) chr + counter, 1)) && (counter < csz))
counter++;
if (FF != NULL)
gaf = (*FF)(chr, csz); // invoke fitness function
ins.close();
}
// ---------- mutate chrom
void Simple_Invid::Mutation(float pm) {
static char mask;
static unsigned int i, j;
for (i = 0; i < csz; i++) { // for each byte in the variable
mask = 0; // set mask to zero
for (j = 0; j < 8; j++) { // put a 1 into each randomly
mask <<= 1; // selected bit to determine
if (drand48() < pm) // which bit is swapped
mask += 1;
}
chr[i] ^= mask; // apply mask to every chrom byte
}
}
// ---------- recombination of two invids
void Simple_Invid::Crossover(Simple_Invid& I, float pc) {
if (this != &I) {
unsigned char mask_xor, mask_and, bit = 0;
unsigned int i, j;
for (i = 0; i < csz; i++) { // for each byte in the chrom
mask_and = 0; // set and_mask to zero
for (j = 0; j < 8; j++) {
if (drand48() < pc) // determine crossover locations
bit ^= 1;
mask_and <<= 1; // put a 1 into each randomly
mask_and |= bit;
} // bits are swapped
mask_xor = chr[i] ^ I.chr[i];
mask_xor &= ~mask_and; // swap the bits
chr[i] ^= mask_xor;
I.chr[i] ^= mask_xor;
}
}
}
// ---------- call the fitness function
double Simple_Invid::Fitness(double(*FF)(unsigned char*, unsigned int)) {
gaf = (*FF)(chr, csz);
return gaf;
}
// ---------- save invid to ofstream
int Simple_Invid::Save(ofstream& fdout) {
fdout.write((char*) &gaf, sizeof(gaf));
fdout.write((char*) &csz, sizeof(csz));
fdout.write((char*) &chr, csz);
return 0;
}
// ---------- load invid from ifstream
int Simple_Invid::Load(ifstream& fdin) {
fdin.read((char*) &gaf, sizeof(gaf));
fdin.read((char*) &csz, sizeof(csz));
fdin.read((char*) &chr, csz);
return 0;
}
// -----------------------------------------------------------------
//
// SIMPLE_GA POPULATION --- IMPLEMENTATION
//
// -----------------------------------------------------------------
// ---------- constructor
Simple_Popul::Simple_Popul(void) {
SS = bubble_sort_max; // default is maximisation
pc = dflt_crossover_rate;
pm = dflt_mutation_rate;
tour = dflt_tour_size;
pasz = dflt_pa_size; // number of parents
chsz = dflt_ch_size; // number of children
psz = pasz + chsz; // total number of invids
pop = new Simple_Invid[psz]; // create new population
ppop = new Simple_Invid*[psz]; // create pointerlist
// connect pointerlist to the population
for (unsigned int i = 0; i < psz; i++) {
ppop[i] = &(pop[i]);
}
}
// ---------- initialiser
void Simple_Popul::Init(double(*f)(unsigned char*, unsigned int), unsigned int size) {
FF = f;
csz = size;
for (unsigned int i = 0; i < psz; i++) {
ppop[i]->Init(csz); // init individuals using pointers
}
cpop = ppop + pasz; // init pointerlist for children
}
// ---------- destructor
Simple_Popul::~Simple_Popul(void) {
delete[] pop;
delete[] ppop;
}
// ---------- initiate individuals in the population
void Simple_Popul::Randomise(void) {
static bool seeded = false;
if (!seeded) {
seeded = true;
srand(time(NULL)); // init random generator (Windows)
#ifndef WIN32
srand48(time(NULL)); // Linux uses different rand init
#endif
}
for (unsigned int i = 0; i < pasz + chsz; i++)
ppop[i]->Randomise(FF);
SS(ppop, psz); // sort the population min or max
}
// ---------- Overwrite Invid <number> (parents only) with data from file
void Simple_Popul::Randomise(unsigned int number, char* fname) {
if ((number >= 0) && (number <= pasz)) {
ppop[number]->Randomise(FF, fname);
}
}
// ---------- perform <number> generations
void Simple_Popul::Generation(unsigned int number) {
// for number generations
for (unsigned int loop = 0; loop < number; loop++) {
// for each child
for (unsigned int child = 0; child < chsz - 1; child += 2) {
// clone two parents
int p1 = Tournament_Selection(ppop, pasz, tour);
int p2 = Tournament_Selection(ppop, pasz, tour);
*(cpop[child]) = *(ppop[p1]);
*(cpop[child + 1]) = *(ppop[p2]);
// crossover the clones
cpop[child]->Crossover(*(cpop[child + 1]), pc);
// mutate the two new children
cpop[child]->Mutation(pm);
cpop[child + 1]->Mutation(pm);
// call fitness function for both new invids
cpop[child]->Fitness(FF);
cpop[child + 1]->Fitness(FF);
}
SS(ppop, psz); // sort population min or max
}
}
// ---------- save popul to filestream
// note, that the fitness is not saved (must be re-run)
int Simple_Popul::Save(ofstream& fdout) {
fdout.write((char*) &pasz, sizeof(pasz));
fdout.write((char*) &chsz, sizeof(chsz));
fdout.write((char*) &psz, sizeof(psz));
fdout.write((char*) &csz, sizeof(csz));
fdout.write((char*) &pc, sizeof(pc));
fdout.write((char*) &pm, sizeof(pm));
fdout.write((char*) &tour, sizeof(tour));
// save the invids
for (unsigned int i = 0; i < psz; i++) {
ppop[i]->Save(fdout);
}
return 0;
}
// ---------- load popul from filestream
// note, that the fitness is not loaded (must be re-run)
int Simple_Popul::Load(ifstream& fdin) {
fdin.read((char*) &pasz, sizeof(pasz));
fdin.read((char*) &chsz, sizeof(chsz));
fdin.read((char*) &psz, sizeof(psz));
fdin.read((char*) &csz, sizeof(csz));
fdin.read((char*) &pc, sizeof(pc));
fdin.read((char*) &pm, sizeof(pm));
fdin.read((char*) &tour, sizeof(tour));
// delete actual population
delete[] pop;
delete[] ppop;
pop = new Simple_Invid[psz]; // create new population
ppop = new Simple_Invid*[psz]; // create pointerlist
// connect pointerlist to the population
for (unsigned int i = 0; i < psz; i++) {
ppop[i] = &(pop[i]);
}
// load the invids
for (unsigned int j = 0; j < psz; j++) {
ppop[j]->Load(fdin);
}
return 0;
}
// ---------- write the popul's chrom's to a text file
// (for cluster analysis for example)
int Simple_Popul::Write(ofstream& fdout) {
for (unsigned int i = 0; i < pasz; i++) {
for (unsigned int j = 0; j < csz; j++) {
fdout << (float) (ppop[i]->chr[j]) << " ";
}
fdout << endl;
}
return 0;
}
// ---------- change the number of parents
void Simple_Popul::Pa(unsigned int size) {
// set new population size
psz = size + chsz;
// create two new lists (objects and pointers)
Simple_Invid* tmp = new Simple_Invid[psz];
Simple_Invid** ptmp = new Simple_Invid*[psz];
// connect pointerlist to the population
for (unsigned int i = 0; i < psz; i++) {
ptmp[i] = &(tmp[i]);
}
// initiate the new individuals by using pointerlist
for (unsigned int j = 0; j < psz; j++) {
ptmp[j]->Init(csz);
}
// copy the old individuals into the new ones
unsigned int copy_size = Min(size, pasz) + chsz;
for (unsigned int k = 0; k < copy_size; k++) {
*(ptmp[k]) = *(ppop[k]); // copy the individuals into new list
}
delete[] pop;
delete[] ppop;
// set up pointers properly
pasz = size;
pop = tmp;
ppop = ptmp;
cpop = ptmp + pasz;
}
// ---------- change the number of children
void Simple_Popul::Ch(unsigned int size) {
// set new population size
psz = size + pasz;
// create two new lists (objects and pointers)
Simple_Invid* tmp = new Simple_Invid[psz];
Simple_Invid** ptmp = new Simple_Invid*[psz];
// connect pointerlist to the population
for (unsigned int i = 0; i < psz; i++) {
ptmp[i] = &(tmp[i]);
}
// initiate the new individuals by using pointerlist
for (unsigned int j = 0; j < psz; j++) {
ptmp[j]->Init(csz);
}
// copy the old individuals into the new ones
unsigned int copy_size = Min(size, chsz) + pasz;
for (unsigned int k = 0; k < copy_size; k++) {
*(ptmp[k]) = *(ppop[k]); // copy the individuals into new list
}
delete[] pop;
delete[] ppop;
// set up pointers properly
chsz = size;
pop = tmp;
ppop = ptmp;
cpop = ptmp + pasz;
}
// ---------- Simple_Population printout
ostream& operator<<(ostream& out, Simple_Popul& p) {
//for (unsigned int i=0; i<p.psz; i++)
out << *(p.ppop[0]) << " ";
out << endl;
return out;
}
static bool compare_max(Simple_Invid* a, Simple_Invid* b) {
return *a > *b;
}
static bool compare_min(Simple_Invid* a, Simple_Invid* b) {
return *a < *b;
}
// ---------- FRIEND bubble sort for the population pointer list
void bubble_sort_max(Simple_Invid** List, unsigned int size) {
std::sort(List, List + size, compare_max);
}
// ---------- FRIEND bubble sort for the population pointer list
void bubble_sort_min(Simple_Invid** List, unsigned int size) {
std::sort(List, List + size, compare_min);
}
// ---------- FRIEND TOURNAMENT Selection Algorithm
unsigned int Tournament_Selection(Simple_Invid** List, unsigned int size, unsigned int tour) {
unsigned int n_pos;
unsigned int pos = (unsigned int) rand() % size;
double fit = List[pos]->Gaf();
for (unsigned int i = 0; i < tour; i++) {
n_pos = (unsigned int) rand() % size;
if (List[n_pos]->Gaf() > fit) {
fit = List[n_pos]->Gaf();
pos = n_pos;
}
}
return pos; // return position in the population
}
double Simple_Popul::getFitnessMedian() {
// since psz is always even, median is always average between 2 invids
return (ppop[psz / 2 - 1]->Gaf() + ppop[psz / 2]->Gaf()) * 0.5;
}
double Simple_Popul::getFitnessAverage() {
double average = 0.0;
for (unsigned int i = 0; i < psz; ++i) {
double gaf = ppop[i]->Gaf();
average += gaf;
}
return average / psz;
}
double Simple_Popul::getFitnessVariance() {
double average = getFitnessAverage();
double variance = 0.0;
for (unsigned int i = 0; i < psz; ++i) {
double gaf = ppop[i]->Gaf();
variance += (gaf - average) * (gaf - average);
}
return variance / psz;
}
| [
"[email protected]"
] | [
[
[
1,
412
]
]
] |
03cfd27ea9c2d5aca420daaa410d9736eb57d5af | 14a00dfaf0619eb57f1f04bb784edd3126e10658 | /lab4/LevelSet.cpp | 66b1672d23a931a3b33ebf5382107d0918917ede | [] | no_license | SHINOTECH/modanimation | 89f842262b1f552f1044d4aafb3d5a2ce4b587bd | 43d0fde55cf75df9d9a28a7681eddeb77460f97c | refs/heads/master | 2021-01-21T09:34:18.032922 | 2010-04-07T12:23:13 | 2010-04-07T12:23:13 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 14,066 | cpp | /*************************************************************************************************
*
* Modeling and animation (TNM079) 2007
* Code base for lab assignments. Copyright:
* Gunnar Johansson ([email protected])
* Ken Museth ([email protected])
* Michael Bang Nielsen ([email protected])
* Ola Nilsson ([email protected])
* Andreas Söderström ([email protected])
*
*************************************************************************************************/
#include "LevelSet.h"
#include "Util.h"
static const float oneByThree(1.0f/3.0f);
static const float oneBySix(1.0f/6.0f);
static const float fiveBySix(5.0f/6.0f);
static const float sevenBySix(7.0f/6.0f);
static const float elevenBySix(11.0f/6.0f);
static const float oneByFour(1.0f/4.0f);
static const float thirteenByTwelve(13.0f/12.0f);
LevelSet::LevelSet(float dx) : mDx(dx)
{
}
LevelSet::LevelSet(float dx, const Implicit & impl) : mDx(dx)
{
// Get the bounding box (in world space) from the implicit
// function to initialize the level set's bounding box.
Bbox b = impl.getBoundingBox();
setBoundingBox(b);
// Loop over volume and sample the implicit function
int i = 0, j = 0, k = 0;
for(float x = mBox.pMin.x(); x < mBox.pMax.x()+0.5*mDx; x += mDx, i++) {
for(float y = mBox.pMin.y(); y < mBox.pMax.y()+0.5*mDx; y += mDx, j++) {
for(float z = mBox.pMin.z(); z < mBox.pMax.z()+0.5*mDx; z += mDx, k++ ) {
mGrid.setValue(i,j,k, impl.getValue(x,y,z));
}
k = 0;
}
j = 0;
}
}
LevelSet::LevelSet(float dx, const Implicit & impl, const Bbox & box) : mDx(dx)
{
setBoundingBox(box);
// Loop over volume and sample the implicit function
int i = 0, j = 0, k = 0;
for(float x = mBox.pMin.x(); x < mBox.pMax.x()+0.5*mDx; x += mDx, i++) {
for(float y = mBox.pMin.y(); y < mBox.pMax.y()+0.5*mDx; y += mDx, j++) {
for(float z = mBox.pMin.z(); z < mBox.pMax.z()+0.5*mDx; z += mDx, k++ ) {
mGrid.setValue(i,j,k, impl.getValue(x,y,z));
}
k = 0;
}
j = 0;
}
}
float LevelSet::getValue(float x, float y, float z) const
{
transformWorld2Obj(x,y,z);
//int i = (int)((x - mBox.pMin.x()) / mDx);
//int j = (int)((y - mBox.pMin.y()) / mDx);
//int k = (int)((z - mBox.pMin.z()) / mDx);
int i,j,k;
world2Grid(x,y,z, i,j,k);
float bx = (x - mBox.pMin.x()) / mDx - i;
float by = (y - mBox.pMin.y()) / mDx - j;
float bz = (z - mBox.pMin.z()) / mDx - k;
if (i == mGrid.getDimX()-1) {
i--;
bx = 1-bx;
}
if (j == mGrid.getDimY()-1) {
j--;
by = 1-by;
}
if (k == mGrid.getDimZ()-1) {
k--;
bz = 1-bz;
}
float val =
mGrid.getValue(i, j, k ) * (1-bx) * (1-by) * (1-bz) +
mGrid.getValue(i+1, j, k ) * bx * (1-by) * (1-bz) +
mGrid.getValue(i+1, j+1, k ) * bx * by * (1-bz) +
mGrid.getValue(i, j+1, k ) * (1-bx) * by * (1-bz) +
mGrid.getValue(i, j, k+1) * (1-bx) * (1-by) * bz +
mGrid.getValue(i+1, j, k+1) * bx * (1-by) * bz +
mGrid.getValue(i+1, j+1, k+1) * bx * by * bz +
mGrid.getValue(i, j+1, k+1) * (1-bx) * by * bz;
return val;
}
/*!
* Evaluates gradient at (x,y,z) through discrete finite difference scheme.
*/
Vector3<float> LevelSet::getGradient(float x, float y, float z, float delta) const
{
transformWorld2Obj(x,y,z);
int i = (int)((x - mBox.pMin.x()) / mDx);
int j = (int)((y - mBox.pMin.y()) / mDx);
int k = (int)((z - mBox.pMin.z()) / mDx);
//printf("[%f, %f, %f]\n", diffXpm(x,y,z), diffYpm(x,y,z), diffZpm(x,y,z) );
return Vector3<float>( diffXpm(i,j,k), diffYpm(i,j,k), diffZpm(i,j,k) );
//return Implicit::getGradient(x, y, z, delta);
}
void LevelSet::setBoundingBox(const Bbox & b)
{
// Loop over existing grid to find the maximum and minimum values
// stored. These are used to initialize the new grid with decent values.
LevelSetGrid::Iterator iter = mGrid.beginNarrowBand();
LevelSetGrid::Iterator iend = mGrid.endNarrowBand();
float maxVal = -std::numeric_limits<float>::max();
float minVal = std::numeric_limits<float>::max();
while (iter != iend) {
int i = iter.getI();
int j = iter.getJ();
int k = iter.getK();
float val = mGrid.getValue(i,j,k);
if (maxVal < val) maxVal = val;
if (minVal > val) minVal = val;
iter++;
}
// Create a new grid with requested size
Vector3<float> extent = b.pMax - b.pMin;
int dimX = (int)round(extent.x()/mDx) + 1;
int dimY = (int)round(extent.y()/mDx) + 1;
int dimZ = (int)round(extent.z()/mDx) + 1;
LevelSetGrid grid(dimX, dimY, dimZ, minVal, maxVal);
// Copy all old values to new grid
iter = mGrid.beginNarrowBand();
while (iter != iend) {
int i = iter.getI();
int j = iter.getJ();
int k = iter.getK();
// Get the (x,y,z) coordinates of grid point (i,j,k)
float x = i*mDx + mBox.pMin.x();
float y = j*mDx + mBox.pMin.y();
float z = k*mDx + mBox.pMin.z();
// Check that (x,y,z) is inside the new bounding box
if (x < b.pMin.x() || x > b.pMax.x() ||
y < b.pMin.y() || y > b.pMax.y() ||
z < b.pMin.z() || z > b.pMax.z()) {
iter++;
continue;
}
// Compute the new grid point (l,m,n)
int l = (int)round((x - b.pMin.x()) / mDx);
int m = (int)round((y - b.pMin.y()) / mDx);
int n = (int)round((z - b.pMin.z()) / mDx);
grid.setValue(l,m,n, mGrid.getValue(i,j,k));
iter++;
}
// Set inside and outside constants
grid.setInsideConstant( mGrid.getInsideConstant() );
grid.setOutsideConstant( mGrid.getOutsideConstant() );
// Set the new bounding box
Implicit::setBoundingBox(b);
// Reassign the new grid
mGrid = grid;
std::cerr << "Level set created with grid size: " << mGrid.getDimensions() << std::endl;
}
void LevelSet::setNarrowBandWidth(float width)
{
beta = width*0.5f*mDx;
gamma = beta * 1.5f;
mGrid.setInsideConstant(-gamma);
mGrid.setOutsideConstant(gamma);
mGrid.rebuild();
}
//! \lab4
float LevelSet::diffXm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float previous = mGrid.getValue(i-1,j,k);
return (current-previous) / mDx;
}
//! \lab4
float LevelSet::diffXp(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i+1,j,k);
return (next - current) / mDx;
}
//! \lab4
float LevelSet::diffXpm(int i, int j, int k) const
{
float next = mGrid.getValue(i+1,j,k);
float previous = mGrid.getValue(i-1,j,k);
return (next-previous) / (2.0f*mDx); }
//! \lab4
float LevelSet::diff2Xpm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i+1,j,k);
float previous = mGrid.getValue(i-1,j,k);
return (next-2.0f*current+previous)/(mDx*mDx);
}
//////Y
//! \lab4
float LevelSet::diffYm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float previous = mGrid.getValue(i,j-1,k);
return (current-previous) / mDx;
}
//! \lab4
float LevelSet::diffYp(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i,j+1,k);
return (next - current) / mDx;
}
//! \lab4
float LevelSet::diffYpm(int i, int j, int k) const
{
float next = mGrid.getValue(i,j+1,k);
float previous = mGrid.getValue(i,j-1,k);
return (next-previous) / (2.0f*mDx);
}
//! \lab4
float LevelSet::diff2Ypm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i,j+1,k);
float previous = mGrid.getValue(i,j-1,k);
return (next-2.0f*current+previous)/(mDx*mDx);
}
/////Z
//! \lab4
float LevelSet::diffZm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float previous = mGrid.getValue(i,j,k-1);
return (current-previous) / mDx;
}
//! \lab4
float LevelSet::diffZp(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i,j,k+1);
return (next - current) / mDx;
}
//! \lab4
float LevelSet::diffZpm(int i, int j, int k) const
{
float next = mGrid.getValue(i,j,k+1);
float previous = mGrid.getValue(i,j,k-1);
return (next-previous) / (2.0f*mDx);
}
//! \lab4
float LevelSet::diff2Zpm(int i, int j, int k) const
{
float current = mGrid.getValue(i,j,k);
float next = mGrid.getValue(i,j,k+1);
float previous = mGrid.getValue(i,j,k-1);
return (next-2.0f*current+previous)/(mDx*mDx);
}
//! \lab4
float LevelSet::diff2XYpm(int i, int j, int k) const
{
float nextI_nextJ = mGrid.getValue(i+1,j+1,k);
float nextI_prevJ = mGrid.getValue(i+1,j-1,k);
float prevI_prevJ = mGrid.getValue(i-1,j-1,k);
float prevI_nextJ = mGrid.getValue(i-1,j+1,k);
return (nextI_nextJ - nextI_prevJ + prevI_prevJ - prevI_nextJ )/(4.0f*mDx*mDx);
}
//! \lab4
float LevelSet::diff2YZpm(int i, int j, int k) const
{
float nextJ_nextK = mGrid.getValue(i,j+1,k+1);
float nextJ_prevK = mGrid.getValue(i,j+1,k-1);
float prevJ_prevK = mGrid.getValue(i,j-1,k-1);
float prevJ_nextK = mGrid.getValue(i,j-1,k+1);
return (nextJ_nextK - nextJ_prevK + prevJ_prevK - prevJ_nextK )/(4.0f*mDx*mDx);
}
//! \lab4
float LevelSet::diff2ZXpm(int i, int j, int k) const
{
float nextK_nextI = mGrid.getValue(i+1,j,k+1);
float nextK_prevI = mGrid.getValue(i-1,j,k+1);
float prevK_prevI = mGrid.getValue(i-1,j,k-1);
float prevK_nextI = mGrid.getValue(i+1,j,k-1);
return (nextK_nextI - nextK_prevI + prevK_prevI - prevK_nextI )/(4.0f*mDx*mDx);
}
void LevelSet::draw()
{
Implicit::draw();
}
void LevelSet::world2Grid( float x, float y, float z, int& i, int& j, int& k ) const
{
i = (int)((x - mBox.pMin.x()) / mDx);
j = (int)((y - mBox.pMin.y()) / mDx);
k = (int)((z - mBox.pMin.z()) / mDx);
}
void LevelSet::grid2World( int i, int j, int k, float& x, float& y, float& z ) const
{
/************************************************************************/
/* SHOULD WE ALSO TRANSFORM X, Y AND Z TO WORLD?? BB IN LOCAL OR WC? */
/************************************************************************/
x = i * mDx + mBox.pMin.x();
y = j * mDx + mBox.pMin.y();
z = k * mDx + mBox.pMin.z();
}
float LevelSet::diffXmWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffXm( i-2, j, k);
float v2 = diffXm( i-1, j, k);
float v3 = diffXm( i, j, k);
float v4 = diffXm( i+1, j, k);
float v5 = diffXm( i+2, j, k);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::diffXpWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffXp( i-2, j, k);
float v2 = diffXp( i-1, j, k);
float v3 = diffXp( i, j, k);
float v4 = diffXp( i+1, j, k);
float v5 = diffXp( i+2, j, k);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::diffYmWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffYm( i, j-2, k);
float v2 = diffYm( i, j-1, k);
float v3 = diffYm( i, j, k);
float v4 = diffYm( i, j+1, k);
float v5 = diffYm( i, j+2, k);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::diffYpWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffYp( i, j-2, k);
float v2 = diffYp( i, j-1, k);
float v3 = diffYp( i, j, k);
float v4 = diffYp( i, j+1, k);
float v5 = diffYp( i, j+2, k);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::diffZmWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffZm( i, j, k-2);
float v2 = diffZm( i, j, k-1);
float v3 = diffZm( i, j, k );
float v4 = diffZm( i, j, k+1);
float v5 = diffZm( i, j, k+2);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::diffZpWENO( int i, int j, int k ) const
{
//define variables for HJ ENO approximation
// ie. v1 = (D-)phi_i-2
float v1 = diffZp( i, j, k-2);
float v2 = diffZp( i, j, k-1);
float v3 = diffZp( i, j, k );
float v4 = diffZp( i, j, k+1);
float v5 = diffZp( i, j, k+2);
return weno(v1, v2, v3, v4, v5);
}
float LevelSet::weno( const float& v1, const float& v2, const float& v3, const float& v4, const float& v5 ) const
{
//float maxV = std::max( std::max( std::max( std::max(v1, v2), v3 ),v4 ),v5 );
//float epsilon = ((1e-6)* maxV*maxV) + (1e-99); //1e-99 to avoid div by 0
float maxV = std::max( std::max( std::max( std::max(v1*v1, v2*v2), v3*v3 ),v4*v4 ),v5*v5 );
float epsilon = ((1e-6)* maxV) + (1e-99); //1e-99 to avoid div by 0
//Possible HJ ENO approximations
float phi1 = oneByThree * v1 - sevenBySix * v2 + elevenBySix * v3;
float phi2 = -oneBySix * v2 + fiveBySix * v3 + oneByThree * v4;
float phi3 = oneByThree * v3 + fiveBySix * v4 - oneBySix * v5;
//Approximate Stencil Smoothness
float term1 = (v1 - 2.0f * v2 + v3 );
float term2 = (v1 - 4.0f * v2 + 3.0f * v3);
float S1 = thirteenByTwelve * ( term1*term1 ) + oneByFour * (term2 * term2);
term1 = (v2 - 2.0f*v3 + v4);
term2 = (v2-v4);
float S2 = thirteenByTwelve * ( term1*term1 ) + oneByFour * (term2 * term2);
term1 = (v3 - 2.0f*v4 + v5);
term2 = (3.0f*v3 - 4.0f*v4 +v5);
float S3 = thirteenByTwelve * ( term1*term1 ) + oneByFour * (term2 * term2);
//Calculate alphas with smoothness
S1 += epsilon;
float alpha1 = 0.1f / (S1*S1);
S2 += epsilon;
float alpha2 = 0.6f / (S2*S2);
S3 += epsilon;
float alpha3 = 0.3f / (S3*S3);
//calculate weights with alphas
float denominator( 1.0f /(alpha1 + alpha2 + alpha3) );
float w1 = alpha1 * denominator;
float w2 = alpha2 * denominator;
float w3 = alpha3 * denominator;
//return the weighted ENO
return ( w1*phi1 + w2*phi2 + w3*phi3 );
}
| [
"onnepoika@da195381-492e-0410-b4d9-ef7979db4686",
"jpjorge@da195381-492e-0410-b4d9-ef7979db4686"
] | [
[
[
1,
357
],
[
359,
364
],
[
366,
366
],
[
372,
498
]
],
[
[
358,
358
],
[
365,
365
],
[
367,
371
]
]
] |
e80d9574b5c048c010f03ceefb326afc270b1b93 | 9907be749dc7553f97c9e51c5f35e69f55bd02c0 | /FrameworkMenu/FrameworkMenu/globals.h | e6f27413d30e0b44401904c12c75faa0c266f016 | [] | no_license | jdeering/csci476winthrop | bc8907b9cc0406826de76aca05e6758810377813 | 2bc485781f819c8fd82393ac86de33404e7ad6d3 | refs/heads/master | 2021-01-10T19:53:14.853438 | 2009-04-24T14:26:36 | 2009-04-24T14:26:36 | 32,223,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 885 | h | //globals
#ifndef GLOBALS_H
#define GLOBALS_H
#define ALLEGRO_AND_MFC
#define ALLEGRO_NO_MAGIC_MAIN
// Allegro and Speech API
#include "allegro.h"
#include "winalleg.h"
#include "sapi.h"
// STL paths
#include <vector>
#include <string>
#include <iostream>
#include <string>
#include <map>
#include <sstream>
//#include "Board.h"
//#include "Dictionary.h"
//#include "Tile.h"
//#include "GFSprite.h"
//#include "GFText.h"
//#include "GFAudio.h"
using namespace std;
// The index for the game to launch.
// This should reflect the game's relative
// location to other games in the Games.XML
// file. 0 is the first game.
#define GAMENUM -1
#define MAXSPRITES 500
#define MAXFILES 100
#define MAXGAMES 4
#define XOFFSET 200
// Audio Values
#define PAN 128
#define FREQ 1000
#define MAX_VOLUME 255
#define MIN_VOLUME 0
#endif | [
"deeringj2@2656ef14-ecf4-11dd-8fb1-9960f2a117f8"
] | [
[
[
1,
49
]
]
] |
bbe437fbc6a58b287af5f2ec83b418431e863606 | e97d9a408c920684eb1a62ead7a846fe2e6f6261 | /test/test.cpp | a3c237d36d46ba9baa15f6c41ef062a7ea560b9a | [] | no_license | crnt/mwebsockc | e73ecf7315ea2dec313b80164b02bd9a932e5e54 | 52a4ed093d56a5ce5a838bc2c1b8c20a7ac3bf39 | refs/heads/master | 2021-01-01T20:42:18.562442 | 2011-03-19T04:59:57 | 2011-03-19T04:59:57 | 2,248,550 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,617 | cpp | #include <iostream>
#include "websocket_client.hpp"
class chat_client
: public mwebsock::client
{
public:
chat_client( const std::string& name )
:name_(name)
{}
void on_message( const std::string& msg)
{
std::cout << msg << std::endl;
}
void on_open()
{
this->send("c:" + name_);
std::cout << ">> server connected." << std::endl;
}
void on_close()
{
std::cout << ">> server closed." << std::endl;
}
void on_error( int error_code, const std::string& msg )
{
std::cout << "error:" << msg << std::endl;
}
private:
std::string name_;
};
int main(int argc, char** argv)
{
if( argc < 2 )
{
std::cout << "test [user_name]" << std::endl;
return 1;
}
try
{
chat_client client(argv[2]);
// client.set_ssl_verify_file("..\\dist\\org.mitsuji.server.crt");
client.connect(argv[1]);
std::string line;
while(std::getline(std::cin, line ))
{
char c = line.at(0);
switch(c)
{
case 'q':
{
client.close();
std::cout << ">> client closed." << std::endl;
return 0;
}
break;
case 'u':
{
client.close();
std::cout << ">> client closed." << std::endl;
}
break;
case 'c':
{
client.connect(argv[1]);
}
break;
default:
{
client.send("m:" + line );
}
break;
}
}
}
catch (std::exception& e)
{
std::cout << "Exception: " << e.what() << "\n";
}
return 0;
}
| [
"[email protected]"
] | [
[
[
1,
94
]
]
] |
a9620127af408a0593c73d308a3d2f20028d9307 | 59ce53af7ad5a1f9b12a69aadbfc7abc4c4bfc02 | /publish/skinxmlctrlx.h | 218a23436b49c595109853e1cd89aceb35230768 | [] | no_license | fingomajom/skinengine | 444a89955046a6f2c7be49012ff501dc465f019e | 6bb26a46a7edac88b613ea9a124abeb8a1694868 | refs/heads/master | 2021-01-10T11:30:51.541442 | 2008-07-30T07:13:11 | 2008-07-30T07:13:11 | 47,892,418 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,187 | h | /********************************************************************
* CreatedOn: 2008-4-3 11:45
* FileName: skinxmlctrlx.h
* CreatedBy: lidengwang <[email protected]>
* $LastChangedDate$
* $LastChangedRevision$
* $LastChangedBy$
* $HeadURL: $
* Purpose:
*********************************************************************/
#pragma once
namespace KSGUI{
class skinxmlstaticex : public skinxmlwin
{
public:
skinxmlstaticex(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmlstaticex& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmlstaticex");
}
BOOL GetPaintStyle(int& nStype )
{
return GetObject(_T("PaintStyle"), nStype);
}
BOOL GetDrawTextFlags( DWORD& dwFlag)
{
return GetObject(_T("DrawTextFlags"), dwFlag);
}
BOOL GetLineColor( COLORREF& clrLine )
{
return GetColor( _T("LineColor"), clrLine );
}
};
class skinxmlbmpbtn : public skinxmlwin
{
public:
skinxmlbmpbtn(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmlbmpbtn& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmlbmpbtn");
}
BOOL GetBmpResName( KSGUI::CString& strBmpResName)
{
return GetObject(_T("BmpResName"), strBmpResName);
}
BOOL GetBmpCount( int& nBmpCount )
{
nBmpCount = 3;
return GetObject(_T("BmpCount"), nBmpCount);
}
};
class skinxmlclrbtn : public skinxmlwin
{
public:
skinxmlclrbtn(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmlclrbtn& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmlclrbtn");
}
};
class skinxmlhyperlink : public skinxmlwin
{
public:
skinxmlhyperlink(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmlhyperlink& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmlhyperlink");
}
BOOL GetToolTipText( KSGUI::CString& strText)
{
return GetObject(_T("ToolTipText"), strText);
}
BOOL GetLinkFont( HFONT& hLinkFont )
{
return GetFont( _T("LinkFont"), hLinkFont );
}
};
class skinxmltablectrlex: public skinxmlwin
{
public:
skinxmltablectrlex(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmltablectrlex& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmltablectrlex");
}
BOOL GetHotTextFont( HFONT& hFont )
{
return GetFont( _T("HotTextFont"), hFont );
}
BOOL GetHotTextColor( COLORREF& clr )
{
return GetColor( _T("HotTextColor"), clr );
}
BOOL GetMainColor( COLORREF& clr )
{
return GetColor( _T("MainColor"), clr );
}
};
class skinxmlhtmlctrl: public skinxmlwin
{
public:
skinxmlhtmlctrl(const SkinXmlElement& xmlElement = SkinXmlElement())
: skinxmlwin(xmlElement)
{
}
const skinxmlhtmlctrl& operator = (const SkinXmlElement& xmlElement)
{
m_xmlResElement = xmlElement;
return *this;
}
static LPCTSTR GetSkinWndClassName()
{
return _T("skinxmlhtmlctrl");
}
};
}; | [
"[email protected]"
] | [
[
[
1,
204
]
]
] |
71c7e118cb90bd2f26be81d201cb13ee77ba7168 | 37426b6752e2a3f0a254f76168f55fed549594da | /unit_test++/src/MemoryOutStream.cpp | 052e7a348c70c67fa2aa1b2934ed66a50e632503 | [
"MIT"
] | permissive | Over-Zero/amf3lib | 09c3db95b3b60bcdd78791e282a9803fc6e2cfee | 527c3e1c66b5fb858a859c4bc631733e23c91132 | refs/heads/master | 2021-01-22T03:01:28.063344 | 2011-11-08T15:42:04 | 2011-11-08T15:42:04 | 2,732,494 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,084 | cpp | #include "MemoryOutStream.h"
#ifndef UNITTEST_USE_CUSTOM_STREAMS
namespace UnitTest {
Char const* MemoryOutStream::GetText() const
{
m_text = this->str();
return m_text.c_str();
}
}
#else
#include <cstdio>
namespace UnitTest {
namespace {
template<typename ValueType>
void FormatToStream(MemoryOutStream& stream, Char const* format, ValueType const& value)
{
Char txt[32];
#ifdef _UNICODE
swprintf(txt, format, value);
#else
sprintf(txt, format, value);
#endif
stream << txt;
}
int RoundUpToMultipleOfPow2Number (int n, int pow2Number)
{
return (n + (pow2Number - 1)) & ~(pow2Number - 1);
}
}
MemoryOutStream::MemoryOutStream(int const size)
: m_capacity (0)
, m_buffer (0)
{
GrowBuffer(size);
}
MemoryOutStream::~MemoryOutStream()
{
delete [] m_buffer;
}
Char const* MemoryOutStream::GetText() const
{
return m_buffer;
}
MemoryOutStream& MemoryOutStream::operator << (Char const* txt)
{
int const bytesLeft = m_capacity - (int)Strings::StrLen(m_buffer);
int const bytesRequired = (int)Strings::StrLen(txt) + 1;
if (bytesRequired > bytesLeft)
{
int const requiredCapacity = bytesRequired + m_capacity - bytesLeft;
GrowBuffer(requiredCapacity);
}
Strings::StrCat(m_buffer, txt);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (int const n)
{
FormatToStream(*this, UNITTEST_TEXT("%i"), n);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (long const n)
{
FormatToStream(*this, UNITTEST_TEXT("%li"), n);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (unsigned long const n)
{
FormatToStream(*this, UNITTEST_TEXT("%lu"), n);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (float const f)
{
FormatToStream(*this, UNITTEST_TEXT("%ff"), f);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (void const* p)
{
FormatToStream(*this, UNITTEST_TEXT("%p"), p);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (unsigned int const s)
{
FormatToStream(*this, UNITTEST_TEXT("%u"), s);
return *this;
}
MemoryOutStream& MemoryOutStream::operator <<(double const d)
{
FormatToStream(*this, UNITTEST_TEXT("%f"), d);
return *this;
}
MemoryOutStream& MemoryOutStream::operator << (const String& txt)
{
*this << txt.c_str();
return *this;
}
int MemoryOutStream::GetCapacity() const
{
return m_capacity;
}
void MemoryOutStream::GrowBuffer(int const desiredCapacity)
{
int const newCapacity = RoundUpToMultipleOfPow2Number(desiredCapacity, GROW_CHUNK_SIZE);
Char* buffer = new Char[newCapacity];
if (m_buffer)
Strings::StrCpy(buffer, m_buffer);
else
Strings::StrCpy(buffer, UNITTEST_TEXT(""));
delete [] m_buffer;
m_buffer = buffer;
m_capacity = newCapacity;
}
}
#endif
| [
"[email protected]"
] | [
[
[
1,
151
]
]
] |
6b9467c0fca8bd910b49761223833cbaa0f536b7 | b14d5833a79518a40d302e5eb40ed5da193cf1b2 | /cpp/extern/xercesc++/2.6.0/src/xercesc/util/InvalidCastException.hpp | f7a57b0e33274952bacb9faba63435f052fb7923 | [
"Apache-2.0"
] | permissive | andyburke/bitflood | dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf | fca6c0b635d07da4e6c7fbfa032921c827a981d6 | refs/heads/master | 2016-09-10T02:14:35.564530 | 2011-11-17T09:51:49 | 2011-11-17T09:51:49 | 2,794,411 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,018 | hpp | /*
* Copyright 1999-2000,2004 The Apache Software Foundation.
*
* 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.
*/
/*
* $Id: InvalidCastException.hpp,v 1.3 2004/09/08 13:56:22 peiyongz Exp $
*/
#if !defined(INVALIDCASTEXCEPTION_HPP)
#define INVALIDCASTEXCEPTION_HPP
#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLException.hpp>
XERCES_CPP_NAMESPACE_BEGIN
MakeXMLException(InvalidCastException, XMLUTIL_EXPORT)
XERCES_CPP_NAMESPACE_END
#endif
| [
"[email protected]"
] | [
[
[
1,
34
]
]
] |
9d1c71435e569b0d504a47696cb9a4ce6159a23c | 25a408954fdda07b6a27f84f74c9b9b6af1a282c | /ReLips/PlayState.cpp | 82d842f4dfd0eecd24ee968647d3a4f7bf85d8f4 | [] | no_license | nkuln/relips | 6a6f9b99d72157d038bc9badff42a644fe094bf5 | f6ec7614710e7b3785469b2e670f3abc854b9e2e | refs/heads/master | 2016-09-11T02:58:48.354657 | 2009-02-17T15:29:02 | 2009-02-17T15:29:02 | 33,202,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,901 | cpp | #include "stdafx.h"
#include "PlayState.h"
#include "Note.h"
#include "ResultGameState.h"
#include "ResultStateParam.h"
#include "PlayStateParam.h"
#define CUSTOM_SHININESS 1
#define CUSTOM_DIFFUSE 2
#define CUSTOM_SPECULAR 3
PlayState::PlayState(char *name)
: GameState(name),
m_recChan(NULL),
m_playChan(NULL),
m_timer(NULL),
m_stage(NULL),
m_score(0),
m_displayScore(0),
m_pos(0),
m_lastNote(-1),
m_lastPos(0),
m_lastCents(0),
m_markerPos(0),
m_transStart1(0),
m_transEnd1(0),
m_transFlag1(false)
{
}
PlayState::~PlayState(void)
{
}
bool PlayState::Update( const FrameEvent& evt )
{
DWORD currentStat = BASS_ChannelIsActive(m_playChan);
if(currentStat == BASS_ACTIVE_STOPPED){
ResultStateParam* param = new ResultStateParam();
param->Score(m_score);
m_paramToPass = param;
m_changeToStateName = "ResultGameState";
m_reqChangeState = true;
}else{
// Get current position in song
long lpos = GetCurrentPosition();
// Update Fragment note
UpdateFragment(lpos);
// Update Score
SetScore(m_score);
// Set marker pos
SetMarkerPosition(m_markerPos);
// Add note that still not visible
AddNotes(lpos);
// Animtations
Animate(evt);
}
return true;
}
void PlayState::Initialize()
{
// Init Animations
InitAnimations();
// Show Overlay
GETOVERLAY(scoreOverlay,"ScoreOverlay");
scoreOverlay->show();
m_stage = new Stage(static_cast<PlayStateParam *>(m_param)->Filename().c_str());
m_queue = new deque<Fragment *>();
// Setup Scene
m_sceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
m_sceneMgr->setAmbientLight(ColourValue(0.8,0.8,0.8));
m_sceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
// Setup Camera
//m_camera->setPosition(0,150,1400);
//m_camera->lookAt(0,0,-1000);
// Setup Lights
Light *light = m_sceneMgr->createLight("OverHeadLight");
light->setPosition(0.0,40,800);
light->setType(Light::LT_POINT);
light->setDiffuseColour(ColourValue::White);
light->setSpecularColour(ColourValue::White);
light->setAttenuation(7000, 0.0, 0.0007, 0.000002);
Light *light2 = m_sceneMgr->createLight("OverHeadLight2");
light2->setPosition(0.0,100,1400);
light2->setType(Light::LT_POINT);
light2->setDiffuseColour(ColourValue::White);
light2->setSpecularColour(ColourValue::White);
light2->setAttenuation(7000, 0.0, 0.0007, 0.000002);
// Setup Plane
Plane ground(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("GroundPlane",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, ground,
5000,2600,20,20,true,1,50,26,-Vector3::UNIT_Z);
Entity *ent = m_sceneMgr->createEntity("GroundPlaneEnt","GroundPlane");
ent->setMaterialName("Examples/TextureEffect4");
ent->setCastShadows(false);
CREATEROOTCHILD(groundNode,"GroundSceneNode");
groundNode->attachObject(ent);
groundNode->setPosition(0,-1,0);
Plane plane(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("NotePlane",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
500,2600,20,20,true,1,1,1,-Vector3::UNIT_Z);
ent = m_sceneMgr->createEntity("NotePlaneEnt","NotePlane");
ent->setMaterialName("ReLips/NotePlane01");
ent->setCastShadows(false);
CREATEROOTCHILD(planeNode,"PlaneSceneNode");
planeNode->attachObject(ent);
// Setup Fragments Node
CREATEROOTCHILD(fragParentNode,"FragmentParentNode");
fragParentNode->setPosition(0,0,1000);
SceneNode *fragNode = fragParentNode->createChildSceneNode("FragmentNode");
// Setup Limiting plane
Plane limit(Vector3::UNIT_Y, 0);
MeshManager::getSingleton().createPlane("LimitPlane",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, limit,
500,800,20,20,true,1,5,8,-Vector3::UNIT_Z);
Entity *limitEnt = m_sceneMgr->createEntity("LimitEnt","LimitPlane");
limitEnt->setMaterialName("Examples/Rockwall");
limitEnt->setCastShadows(false);
CREATEROOTCHILD(limitNode,"LimitNode");
limitNode->attachObject(limitEnt);
limitNode->setPosition(0,1.0,1400);
//Entity *limitEnt = m_sceneMgr->createEntity("LimitEnt",SceneManager::PrefabType::PT_PLANE);
//limitEnt->setCastShadows(false);
//CREATEROOTCHILD(limitNode,"LimitNode");
//limitEnt->setMaterialName("Examples/Rockwall");
//limitNode->setPosition(0.0,1.0,1400);
//limitNode->attachObject(limitEnt);
//limitNode->setScale(2.5,4,4);
//limitNode->rotate(Quaternion(Degree(-90),Vector3::UNIT_X),Node::TransformSpace::TS_WORLD);
// Setup Singing Pitch Marker
Entity *marker = m_sceneMgr->createEntity("MarkerEnt",SceneManager::PrefabType::PT_PLANE);
marker->setCastShadows(false);
CREATEROOTCHILD(markerNode,"MarkerNode");
marker->setMaterialName("ReLips/Star");
markerNode->setPosition(0.0,2.0,1000);
markerNode->attachObject(marker);
markerNode->setScale(0.5,0.5,0.5);
markerNode->rotate(Quaternion(Degree(-90),Vector3::UNIT_X),Node::TransformSpace::TS_WORLD);
// Create shared node for 2 fountains
SceneNode *foundtainNode = m_sceneMgr->getRootSceneNode()->createChildSceneNode();
// fountain 1
m_particleSystem = m_sceneMgr->createParticleSystem("fountain1",
"Examples/PurpleFountain");
// Point the fountain at an angle
m_particleNode = markerNode->createChildSceneNode();
// fNode->translate(200,-100,0);
// fNode->rotate(Vector3::UNIT_X, Degree(20));
m_particleNode->setOrientation(Quaternion(Degree(-30),Vector3::UNIT_X));
m_particleNode->attachObject(m_particleSystem);
// Start BASS
BassInitAndPlay();
}
void PlayState::TimerTick(){
DWORD level = BASS_ChannelGetLevel(m_recChan);
int leftLevel = LOWORD(level);
int rightLevel = HIWORD(right);
long lpos = GetCurrentPosition();
//OverlayElement *elem = OverlayManager::getSingleton().getOverlayElement("TextAreaOverlay");
//if(leftLevel > 10000){
// char buff[100];
// Note::ToSymbolString(note, buff);
// stringstream s;
// s << "Note: " << buff << " " << cents << " " << lpos;
// elem->setCaption(s.str());
// m_markerPos = Note::GetPositionOnScale(note, cents, 400) - 200;
//}else{
// elem->setCaption("-- ");
//}
//OverlayElement *elem = OverlayManager::getSingleton().getOverlayElement("TextAreaOverlay");
//char buff[100];
//Note::ToSymbolString(note, buff);
//stringstream s;
//s << "Size : " << m_queue->size();
//elem->setCaption(s.str());
if(m_queue->size() != 0){
Fragment *front = m_queue->front();
if(lpos > front->End()){
m_queue->pop_front();
delete front;
}else{
if(m_queue->size() != 0){
front = m_queue->front();
float fft[4096];
BASS_ChannelGetData(m_recChan, fft, BASS_DATA_FFT8192); // get the FFT data
double freq = Note::DetectPitch(fft,44100,8192);
double cents = 0;
int note = Note::ToSymbol(freq, cents);
//note = Note::NT_D;
//leftLevel = 5000;
if(leftLevel >= 1500){
if(lpos >= front->Start() && (m_lastNote == note) && (note == front->Note())){
if(m_lastPos >= front->Start()){
m_score += (int)((lpos - m_lastPos)*1.0/FRAGMENT_SCALING);
}
}
m_particleNode->setOrientation(Quaternion(Degree(70),Vector3::UNIT_X));
m_markerPos = Note::GetPositionOnScale(note, cents, 400) - 200;
}else{
m_particleNode->setOrientation(Quaternion(Degree(-30),Vector3::UNIT_X));
}
m_lastNote = note;
m_lastCents = cents;
m_lastPos = lpos;
}
}
}
}
//////////////////////////////////////////////////////////////////////////
// Keyboard Handling
//////////////////////////////////////////////////////////////////////////
bool PlayState::KeyPressed( const OIS::KeyEvent &arg )
{
switch(arg.key){
case OIS::KC_R:
{
m_reqChangeState = true;
m_changeToStateName = "MenuGameState";
m_paramToPass = NULL;
break;
}
case OIS::KC_ESCAPE:
{
m_reqExitGame = true;
break;
}
}
return true;
}
bool PlayState::KeyReleased( const OIS::KeyEvent &arg )
{
return true;
}
//////////////////////////////////////////////////////////////////////////
// Utility Functions
//////////////////////////////////////////////////////////////////////////
void PlayState::AddNotes( long frameLength )
{
while(m_stage && m_stage->Frags()->size() != 0){
Fragment *front = m_stage->Frags()->front();
if(frameLength + 100000> front->Start()){
stringstream uname;
uname << "Frag" << front->Start();
GETNODE(fragNode,"FragmentNode");
SceneNode *t = fragNode->createChildSceneNode();
Entity *e = m_sceneMgr->createEntity(uname.str() + "Ent",SceneManager::PrefabType::PT_CUBE);
e->setMaterialName("Examples/TransparentTest");
e->setCastShadows(true);
/* SubEntity* sub = e->getSubEntity(0);
sub->setMaterialName("Examples/CelShading");
sub->setCustomParameter(CUSTOM_SHININESS, Vector4(100.0f, 0.0f, 0.0f, 0.0f));
sub->setCustomParameter(CUSTOM_DIFFUSE, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
sub->setCustomParameter(CUSTOM_SPECULAR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));*/
t->attachObject(e);
double length = 1.0 * front->Length()/FRAGMENT_SCALING;
t->setScale(0.2, 0.02, length/100);
double xpos = Note::GetPositionOnScale(front->Note(), 400) - 200;
t->setPosition(xpos,
10,
-1.0 * (front->Start() / FRAGMENT_SCALING + length/2) );
m_stage->Frags()->pop_front();
m_queue->push_back(front);
}else{
break;
} // end lpos
}
}
void PlayState::SetScore(int score){
stringstream s;
s << "score " << (score);
GETOVERLAYELEM(scoreText,"ScoreText1");
scoreText->setCaption(s.str());
}
void PlayState::SetMarkerPosition(int pos)
{
GETNODE(marker,"MarkerNode");
Vector3 mpos = marker->getPosition();
mpos.x = pos;
marker->setPosition(mpos);
}
void CALLBACK SpectrumReceived( UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 )
{
PlayState *p = (PlayState *)dwUser;
p->TimerTick();
}
BOOL CALLBACK DuffRecording( HRECORD handle, const void *buffer, DWORD length, void *user )
{
return TRUE; // continue recording
}
PlayState *PlayState::CreateInstance()
{
return new PlayState("PlayState");
}
long PlayState::GetCurrentPosition()
{
QWORD pos = BASS_ChannelGetPosition(m_playChan,BASS_POS_BYTE);
long lpos = (long)pos/4;
return lpos;
}
void PlayState::CleanUp()
{
if (m_timer)
timeKillEvent(m_timer);
delete m_stage;
m_stage = NULL;
BASS_RecordFree();
BASS_Free();
GETOVERLAY(scoreOverlay,"ScoreOverlay");
scoreOverlay->hide();
}
void PlayState::BassInitAndPlay()
{
// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
LOG("An incorrect version of BASS.DLL was loaded")
exit(-1);
}
// initialize BASS recording (default device)
if (!BASS_RecordInit(-1)) {
LOG("Can't initialize device")
exit(-1);
}
// start recording (44100hz mono 16-bit)
if (!(m_recChan = BASS_RecordStart(44100, 1, 0, &DuffRecording, 0))) {
LOG("Can't start recording")
exit(-1);
}
// setup update timer (40hz)
m_timer = timeSetEvent(25, 25, (LPTIMECALLBACK)&SpectrumReceived, (DWORD)this, TIME_PERIODIC);
// Play sound
if(!BASS_Init(-1, 44100, 0, 0, NULL)){
LOG("Can't initialize device")
exit(-1);
}
DWORD act,time,level;
BOOL ismod;
QWORD pos;
if(m_playChan = BASS_StreamCreateFile(FALSE,
static_cast<PlayStateParam *>(m_param)->MusicFilename().c_str(),
0, 0, BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE)){
pos = BASS_ChannelGetLength(m_playChan, BASS_POS_BYTE);
// printf("streaming file [%I64u bytes]",pos);
}else{
LOG("Cannot play file")
exit(-1);
}
BASS_ChannelPlay(m_playChan, FALSE);
}
//////////////////////////////////////////////////////////////////////////
// Animation
//////////////////////////////////////////////////////////////////////////
void PlayState::InitAnimations(){
// Camera
m_transFlag1 = true;
m_transStart1 = 500;
m_transEnd1 = 150;
m_camera->setPosition(0, m_transStart1,1600);
m_camera->lookAt(0,0,-1000);
}
void PlayState::Animate(const FrameEvent& evt){
if(m_transFlag1){ // Camera
if(m_camera->getPosition().y > 150){
Vector3 v = m_camera->getPosition();
v.y -= evt.timeSinceLastFrame * 200;
m_camera->setPosition(v);
}else{
Vector3 v = m_camera->getPosition();
v.y = 150;
m_camera->setPosition(v);
m_transFlag1 = false;
}
m_camera->lookAt(0,0,-1000);
}
GETNODE(m, "MarkerNode");
m->rotate(Quaternion(Degree(100*evt.timeSinceLastFrame),Vector3::UNIT_Y),Node::TransformSpace::TS_PARENT);
}
void PlayState::UpdateFragment( long lpos )
{
GETNODE(nn,"FragmentNode");
if(nn)
nn->setPosition(Vector3(0,0, 1.0 * lpos / FRAGMENT_SCALING));
else
exit(-1);
} | [
"m3rlinez@4e9c09b0-ef73-11dd-a70c-37889e090ee0"
] | [
[
[
1,
484
]
]
] |
8a3df929fc0c839a7ce2e0cbc3788b4ef63ecdf9 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/addons/pa/ParticleUniverse/include/ParticleAffectors/ParticleUniverseCollisionAvoidanceAffector.h | 44b5fb3813a12826f5120abf20b69e9b8ab59094 | [] | no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | ISO-8859-2 | C++ | false | false | 1,865 | h | /*
-----------------------------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2010 Henry van Merode
Usage of this program is licensed under the terms of the Particle Universe Commercial License.
You can find a copy of the Commercial License in the Particle Universe package.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_COLLISION_AVOIDANCE_AFFECTOR_H__
#define __PU_COLLISION_AVOIDANCE_AFFECTOR_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseAffector.h"
namespace ParticleUniverse
{
/** The CollisionAvoidanceAffector is used to prevent particles from colliding with each other.
@remarks
The current implementation doesn´t take avoidance of colliders (box, sphere, plane) into account (yet).
*/
class _ParticleUniverseExport CollisionAvoidanceAffector : public ParticleAffector
{
public:
// Constants
static const Ogre::Real DEFAULT_RADIUS;
CollisionAvoidanceAffector(void);
virtual ~CollisionAvoidanceAffector(void){};
/** Todo
*/
Ogre::Real getRadius(void) const;
/** Todo
*/
void setRadius(Ogre::Real radius);
/** @copydoc ParticleAffector::_prepare */
virtual void _prepare(ParticleTechnique* particleTechnique);
/** @copydoc ParticleAffector::_unprepare */
virtual void _unprepare(ParticleTechnique* particleTechnique);
/** @copydoc ParticleAffector::_affect */
virtual void _affect(ParticleTechnique* particleTechnique, Particle* particle, Ogre::Real timeElapsed);
/** @copydoc ParticleAffector::copyAttributesTo */
virtual void copyAttributesTo (ParticleAffector* affector);
protected:
Ogre::Real mRadius;
};
}
#endif
| [
"[email protected]"
] | [
[
[
1,
58
]
]
] |
3edf1ac8a7469f31c872e7bc9555ea8db056869d | 14bc620a0365e83444dad45611381c7f6bcd052b | /ITUEngine/Events/EventObject.cpp | dd94417619072bacada0d4073b8ddf2d700bc3f8 | [] | no_license | jumoel/itu-gameengine | a5750bfdf391ae64407217bfc1df8b2a3db551c7 | 062dd47bc1be0f39a0add8615e81361bcaa2bd4c | refs/heads/master | 2020-05-03T20:39:31.307460 | 2011-12-19T10:54:10 | 2011-12-19T10:54:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 200 | cpp | #include <Events/EventObject.hpp>
EventObject::EventObject(short type)
{
this->type = type;
}
EventObject::~EventObject(void)
{
}
short EventObject::GetType()
{
return type;
}
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
1
]
],
[
[
2,
17
]
]
] |
a238b859a9b5d28973debd8d2cdb1ef6c6b9aa26 | 6e563096253fe45a51956dde69e96c73c5ed3c18 | /os/AX_Thread_Hook.h | bbf58d720e1b80a355ecfac677af28301641234c | [] | no_license | 15831944/phoebemail | 0931b76a5c52324669f902176c8477e3bd69f9b1 | e10140c36153aa00d0251f94bde576c16cab61bd | refs/heads/master | 2023-03-16T00:47:40.484758 | 2010-10-11T02:31:02 | 2010-10-11T02:31:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,216 | h | #ifndef _AX_THREAD_HOOK
#define _AX_THREAD_HOOK
#include "AX_OS.h"
/**
* @class ACE_Thread_Hook
*
* @brief This class makes it possible to provide user-defined "start"
* hooks that are called before the thread entry point function
* is invoked.
*/
class AX_Thread_Hook
{
public:
AX_Thread_Hook();
/// Destructor.
virtual ~AX_Thread_Hook (void);
/**
* This method can be overridden in a subclass to customize this
* pre-function call "hook" invocation that can perform
* initialization processing before the thread entry point <func>
* method is called back. The @a func and @a arg passed into the
* start hook are the same as those passed by the application that
* spawned the thread.
*/
virtual AX_thr_func_return start (AX_THR_FUNC func,
void *arg);
int add(AX_Hook_Routine *);
void remove();
int size();
//void run();
private:
stack<AX_Hook_Routine*> Hook_Stack;
///// sets the system wide thread hook, returns the previous thread
///// hook or 0 if none is set.
static AX_Thread_Hook *thread_hook (AX_Thread_Hook *hook);
bool hook_;
///// Returns the current system thread hook.
//static AX_Thread_Hook *thread_hook (void);
};
#endif
| [
"guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd"
] | [
[
[
1,
46
]
]
] |
b4c05a11a22f55a34ab262a76b24a4fbde49ea3b | ce262ae496ab3eeebfcbb337da86d34eb689c07b | /SEFoundation/SEIntersection/SEIntrRay3Box3.cpp | 5ec189a6572bf267a71d10e88cf29836d7ced1a9 | [] | 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 | 4,208 | 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 "SEIntrRay3Box3.h"
using namespace Swing;
//----------------------------------------------------------------------------
SEIntrRay3Box3f::SEIntrRay3Box3f(const SERay3f& rRay, const SEBox3f& rBox)
:
m_pRay(&rRay),
m_pBox(&rBox)
{
}
//----------------------------------------------------------------------------
const SERay3f& SEIntrRay3Box3f::GetRay() const
{
return *m_pRay;
}
//----------------------------------------------------------------------------
const SEBox3f& SEIntrRay3Box3f::GetBox() const
{
return *m_pBox;
}
//----------------------------------------------------------------------------
bool SEIntrRay3Box3f::Test()
{
float afWdU[3], afAWdU[3], afDdU[3], afADdU[3], afAWxDdU[3], fRhs;
SEVector3f vec3fDiff = m_pRay->Origin - m_pBox->Center;
afWdU[0] = m_pRay->Direction.Dot(m_pBox->Axis[0]);
afAWdU[0] = SEMath<float>::FAbs(afWdU[0]);
afDdU[0] = vec3fDiff.Dot(m_pBox->Axis[0]);
afADdU[0] = SEMath<float>::FAbs(afDdU[0]);
if( afADdU[0] > m_pBox->Extent[0] && afDdU[0]*afWdU[0] >= 0.0f )
{
return false;
}
afWdU[1] = m_pRay->Direction.Dot(m_pBox->Axis[1]);
afAWdU[1] = SEMath<float>::FAbs(afWdU[1]);
afDdU[1] = vec3fDiff.Dot(m_pBox->Axis[1]);
afADdU[1] = SEMath<float>::FAbs(afDdU[1]);
if( afADdU[1] > m_pBox->Extent[1] && afDdU[1]*afWdU[1] >= 0.0f )
{
return false;
}
afWdU[2] = m_pRay->Direction.Dot(m_pBox->Axis[2]);
afAWdU[2] = SEMath<float>::FAbs(afWdU[2]);
afDdU[2] = vec3fDiff.Dot(m_pBox->Axis[2]);
afADdU[2] = SEMath<float>::FAbs(afDdU[2]);
if( afADdU[2] > m_pBox->Extent[2] && afDdU[2]*afWdU[2] >= 0.0f )
{
return false;
}
SEVector3f vec3fWxD = m_pRay->Direction.Cross(vec3fDiff);
afAWxDdU[0] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[0]));
fRhs = m_pBox->Extent[1]*afAWdU[2] + m_pBox->Extent[2]*afAWdU[1];
if( afAWxDdU[0] > fRhs)
{
return false;
}
afAWxDdU[1] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[1]));
fRhs = m_pBox->Extent[0]*afAWdU[2] + m_pBox->Extent[2]*afAWdU[0];
if( afAWxDdU[1] > fRhs )
{
return false;
}
afAWxDdU[2] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[2]));
fRhs = m_pBox->Extent[0]*afAWdU[1] + m_pBox->Extent[1]*afAWdU[0];
if( afAWxDdU[2] > fRhs )
{
return false;
}
return true;
}
//----------------------------------------------------------------------------
bool SEIntrRay3Box3f::Find()
{
float fT0 = 0.0f, fT1 = SEMath<float>::MAX_REAL;
return SEIntrLine3Box3f::DoClipping(fT0, fT1, m_pRay->Origin,
m_pRay->Direction, *m_pBox, true, m_iCount, m_aPoint,
m_iIntersectionType);
}
//----------------------------------------------------------------------------
int SEIntrRay3Box3f::GetCount() const
{
return m_iCount;
}
//----------------------------------------------------------------------------
const SEVector3f& SEIntrRay3Box3f::GetPoint(int i) const
{
SE_ASSERT( 0 <= i && i < m_iCount );
return m_aPoint[i];
}
//----------------------------------------------------------------------------
| [
"[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac"
] | [
[
[
1,
123
]
]
] |
5d5c3c8ea7f132389e0699c564343fa6d7319809 | 83ed25c6e6b33b2fabd4f81bf91d5fae9e18519c | /code/ImporterRegistry.cpp | 1bf27f8d2a38fa95f51b729ef3c7204fe0e6f12d | [
"BSD-3-Clause"
] | permissive | spring/assimp | fb53b91228843f7677fe8ec18b61d7b5886a6fd3 | db29c9a20d0dfa9f98c8fd473824bba5a895ae9e | refs/heads/master | 2021-01-17T23:19:56.511185 | 2011-11-08T12:15:18 | 2011-11-08T12:15:18 | 2,017,841 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,941 | cpp | /*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2010, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software 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 ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
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.
---------------------------------------------------------------------------
*/
/** @file ImporterRegistry.cpp
Central registry for all importers available. Do not edit this file
directly (unless you are adding new loaders), instead use the
corresponding preprocessor flag to selectively disable formats.
*/
#include "AssimpPCH.h"
// ------------------------------------------------------------------------------------------------
// Importers
// (include_new_importers_here)
// ------------------------------------------------------------------------------------------------
#ifndef ASSIMP_BUILD_NO_X_IMPORTER
# include "XFileImporter.h"
#endif
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
# include "3DSLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_MD3_IMPORTER
# include "MD3Loader.h"
#endif
#ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
# include "MDLLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_MD2_IMPORTER
# include "MD2Loader.h"
#endif
#ifndef ASSIMP_BUILD_NO_PLY_IMPORTER
# include "PlyLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
# include "ASELoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
# include "ObjFileImporter.h"
#endif
#ifndef ASSIMP_BUILD_NO_HMP_IMPORTER
# include "HMPLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_SMD_IMPORTER
# include "SMDLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_MDC_IMPORTER
# include "MDCLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_MD5_IMPORTER
# include "MD5Loader.h"
#endif
#ifndef ASSIMP_BUILD_NO_STL_IMPORTER
# include "STLLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
# include "LWOLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
# include "DXFLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_NFF_IMPORTER
# include "NFFLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_RAW_IMPORTER
# include "RawLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_OFF_IMPORTER
# include "OFFLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_AC_IMPORTER
# include "ACLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
# include "BVHLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
# include "IRRMeshLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
# include "IRRLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_Q3D_IMPORTER
# include "Q3DLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
# include "B3DImporter.h"
#endif
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
# include "ColladaLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
# include "TerragenLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
# include "CSMLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_3D_IMPORTER
# include "UnrealLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_LWS_IMPORTER
# include "LWSLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
# include "OgreImporter.h"
#endif
#ifndef ASSIMP_BUILD_NO_MS3D_IMPORTER
# include "MS3DLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
# include "COBLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
# include "BlenderLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
# include "Q3BSPFileImporter.h"
#endif
#ifndef ASSIMP_BUILD_NO_NDO_IMPORTER
# include "NDOLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
# include "IFCLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_M3_IMPORTER
# include "M3Importer.h"
#endif
namespace Assimp {
// ------------------------------------------------------------------------------------------------
void GetImporterInstanceList(std::vector< BaseImporter* >& out)
{
// ----------------------------------------------------------------------------
// Add an instance of each worker class here
// (register_new_importers_here)
// ----------------------------------------------------------------------------
out.reserve(64);
#if (!defined ASSIMP_BUILD_NO_X_IMPORTER)
out.push_back( new XFileImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_OBJ_IMPORTER)
out.push_back( new ObjFileImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
out.push_back( new Discreet3DSImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_MD3_IMPORTER)
out.push_back( new MD3Importer());
#endif
#if (!defined ASSIMP_BUILD_NO_MD2_IMPORTER)
out.push_back( new MD2Importer());
#endif
#if (!defined ASSIMP_BUILD_NO_PLY_IMPORTER)
out.push_back( new PLYImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_MDL_IMPORTER)
out.push_back( new MDLImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_ASE_IMPORTER)
out.push_back( new ASEImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_HMP_IMPORTER)
out.push_back( new HMPImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_SMD_IMPORTER)
out.push_back( new SMDImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_MDC_IMPORTER)
out.push_back( new MDCImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_MD5_IMPORTER)
out.push_back( new MD5Importer());
#endif
#if (!defined ASSIMP_BUILD_NO_STL_IMPORTER)
out.push_back( new STLImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_LWO_IMPORTER)
out.push_back( new LWOImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_DXF_IMPORTER)
out.push_back( new DXFImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_NFF_IMPORTER)
out.push_back( new NFFImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_RAW_IMPORTER)
out.push_back( new RAWImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_OFF_IMPORTER)
out.push_back( new OFFImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_AC_IMPORTER)
out.push_back( new AC3DImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_BVH_IMPORTER)
out.push_back( new BVHLoader());
#endif
#if (!defined ASSIMP_BUILD_NO_IRRMESH_IMPORTER)
out.push_back( new IRRMeshImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_IRR_IMPORTER)
out.push_back( new IRRImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_Q3D_IMPORTER)
out.push_back( new Q3DImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_B3D_IMPORTER)
out.push_back( new B3DImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_COLLADA_IMPORTER)
out.push_back( new ColladaLoader());
#endif
#if (!defined ASSIMP_BUILD_NO_TERRAGEN_IMPORTER)
out.push_back( new TerragenImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_CSM_IMPORTER)
out.push_back( new CSMImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_3D_IMPORTER)
out.push_back( new UnrealImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_LWS_IMPORTER)
out.push_back( new LWSImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_OGRE_IMPORTER)
out.push_back( new Ogre::OgreImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_MS3D_IMPORTER)
out.push_back( new MS3DImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_COB_IMPORTER)
out.push_back( new COBImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_BLEND_IMPORTER)
out.push_back( new BlenderImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_Q3BSP_IMPORTER)
out.push_back( new Q3BSPFileImporter() );
#endif
#if (!defined ASSIMP_BUILD_NO_NDO_IMPORTER)
out.push_back( new NDOImporter() );
#endif
#if (!defined ASSIMP_BUILD_NO_IFC_IMPORTER)
out.push_back( new IFCImporter() );
#endif
#if ( !defined ASSIMP_BUILD_NO_M3_IMPORTER )
out.push_back( new M3::M3Importer() );
#endif
}
}
| [
"aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f",
"kimmi@67173fc5-114c-0410-ac8e-9d2fd5bffc1f"
] | [
[
[
1,
162
],
[
166,
284
],
[
288,
290
]
],
[
[
163,
165
],
[
285,
287
]
]
] |
920d1dc3c390c562003fc001d9299795c6308e6b | 0b88542ea778e7cb8a4e8fc2b735c5dc53284ff4 | /cpp/encrypt/md5.h | 045bc2f423b3f6c424f25308ad69ec5d67da7e1f | [] | no_license | GuoGuo-wen/library | 49cf889ef493ba779278932b6dcc8847b926dee3 | 680bc647f231f3dd1a8c095fef998f6afd54113b | refs/heads/master | 2021-11-23T21:25:00.693887 | 2011-10-28T00:32:35 | 2011-10-28T00:32:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,112 | h | /* -*- mode: C++; -*- */
/**
* Copyright (C) 2008 Meteor Liu
*
* This code has been released into the Public Domain.
* You may do whatever you like with it.
*
* @file
* @author Meteor Liu <[email protected]>
* @date 2009-01-01
*/
#ifndef MD5_H
#define MD5_H
// #include <standard library headers>
#include <string>
// #include <other library headers>
// #include "customer headers"
namespace encrypt
{
/**
* MD5 declaration.
*/
class MD5
{
public:
MD5();
~MD5();
private:
MD5(const MD5& rhs);
MD5& operator=(const MD5& rhs);
public:
void Init();
void Update(const void* in, unsigned int length);
void Final();
const unsigned char* GetDigest() { return _digest; }
std::string ToString() { return BytesToHexString(_digest, 16); }
std::string ToString16() { return BytesToHexString(&_digest[4], 8); }
private:
void Transform(const unsigned char block[64]);
void Encode(const unsigned int *input, unsigned char *output,
unsigned int length);
void Decode(const unsigned char *input, unsigned int *output,
unsigned int length);
std::string BytesToHexString(const unsigned char *input,
unsigned int length);
private:
unsigned int _state[4]; // state (ABCD)
unsigned int _count[2]; // number of bits,
// modulo 2^64 (low-order word first)
unsigned char _buffer[64]; // input buffer
unsigned char _digest[16]; // message digest
};
// helper function
std::string MD5Data(const void* data, unsigned int length);
std::string MD5String(const std::string& str);
std::string MD5File(const std::string& file);
std::string MD5Data16(const void* data, unsigned int length);
std::string MD5String16(const std::string& str);
std::string MD5File16(const std::string& file);
}
#endif // MD5_H
| [
"[email protected]"
] | [
[
[
1,
80
]
]
] |
de4da627bd116e6031ab7c845fe47f9e3e7c71b3 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/_Interface/WndPetSys.cpp | bc486f91c5736d9b2b7000ddebc03b16a4415caa | [] | 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 | UHC | C++ | false | false | 80,663 | cpp | #include "stdafx.h"
#include "defineText.h"
#include "AppDefine.h"
#include "WndManager.h"
#include "WndPetSys.h"
#include "DPClient.h"
extern CDPClient g_DPlay;
#if __VER >= 15 // __PETVIS
#include "definesound.h"
#endif
#if __VER >= 12 // __PET_0519
CWndPetAwakCancel::CWndPetAwakCancel()
{
m_pItemElem = NULL;
m_pEItemProp = NULL;
m_pTexture = NULL;
}
CWndPetAwakCancel::~CWndPetAwakCancel()
{
}
void CWndPetAwakCancel::OnDraw( C2DRender* p2DRender )
{
ItemProp* pItemProp;
if(m_pItemElem != NULL)
{
pItemProp = m_pItemElem->GetProp();
LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_STATIC1 );
if(m_pTexture != NULL)
m_pTexture->Render( p2DRender, CPoint( wndCtrl->rect.left, wndCtrl->rect.top ) );
}
}
void CWndPetAwakCancel::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 여기에 코딩하세요
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
if(::GetLanguage() == LANG_FRE)
pButton->SetTexture(g_Neuz.m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), _T( "ButOk2.bmp" ) ), TRUE);
pButton->EnableWindow(FALSE);
m_pText = (CWndText*)GetDlgItem( WIDC_TEXT1 );
SetDescription();
MoveParentCenter();
}
// 처음 이 함수를 부르면 윈도가 열린다.
BOOL CWndPetAwakCancel::Initialize( CWndBase* pWndParent, DWORD /*dwWndId*/ )
{
// Daisy에서 설정한 리소스로 윈도를 연다.
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_AWAK_CANCEL, 0, CPoint( 0, 0 ), pWndParent );
}
void CWndPetAwakCancel::OnDestroy()
{
if(m_pItemElem != NULL)
{
if( !g_pPlayer->m_vtInfo.IsTrading( m_pItemElem ) )
m_pItemElem->SetExtra(0);
}
}
BOOL CWndPetAwakCancel::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
void CWndPetAwakCancel::OnSize( UINT nType, int cx, int cy )
{
CWndNeuz::OnSize( nType, cx, cy );
}
void CWndPetAwakCancel::OnLButtonUp( UINT nFlags, CPoint point )
{
}
void CWndPetAwakCancel::OnLButtonDown( UINT nFlags, CPoint point )
{
}
BOOL CWndPetAwakCancel::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if( nID == WIDC_BUTTON1 )
{
if(m_pItemElem != NULL)
{
CWndButton* pButton;
pButton = (CWndButton*)GetDlgItem( WIDC_BUTTON1 );
pButton->EnableWindow(FALSE);
g_DPlay.SendPickupPetAwakeningCancel( m_pItemElem->m_dwObjId );
Destroy();
}
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndPetAwakCancel::OnLButtonDblClk( UINT nFlags, CPoint point )
{
if(!m_pItemElem) return;
CRect rect;
LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_STATIC1 );
rect = wndCtrl->rect;
if( rect.PtInRect( point ) )
{
m_pItemElem->SetExtra(0);
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
pButton->EnableWindow(FALSE);
m_pItemElem = NULL;
m_pEItemProp = NULL;
m_pTexture = NULL;
}
}
BOOL CWndPetAwakCancel::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
CItemElem* pTempElem= NULL;
if(g_pPlayer != NULL) pTempElem = (CItemElem*)g_pPlayer->GetItemId( pShortcut->m_dwId );
if( pTempElem != NULL)
{
// 픽업펫 확인 // 각성 여부는 서버 검사
if( !pTempElem->IsEatPet() )
return FALSE;
// 확인 버튼 활성
if(m_pItemElem) m_pItemElem->SetExtra(0);
m_pItemElem = (CItemElem*)g_pPlayer->GetItemId( pShortcut->m_dwId );
m_pEItemProp = m_pItemElem->GetProp();
m_pItemElem->SetExtra(m_pItemElem->GetExtra()+1);
if(m_pEItemProp != NULL)
{
m_pTexture = m_pItemElem->m_pTexture;
//m_pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, m_pEItemProp->szIcon), 0xffff00ff );
}
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_BUTTON1);
pButton->EnableWindow(TRUE);
}
return TRUE;
}
void CWndPetAwakCancel::SetDescription()
{
CScript scanner;
BOOL checkflag;
CHAR* szChar;
checkflag = scanner.Load( MakePath( DIR_CLIENT, _T( "PetAwakCancel.inc" ) ));
szChar = scanner.m_pProg;
if(m_pText != NULL && checkflag)
{
m_pText->m_string.AddParsingString( szChar );
m_pText->ResetString();
}
}
#endif
#if __VER >= 9 // __CSC_VER9_1
//////////////////////////////////////////////////////////////////////////
// CWndPetStatus
//////////////////////////////////////////////////////////////////////////
CWndPetStatus::CWndPetStatus()
{
m_nDisplay = 2;
m_nHPWidth = -1;
m_nEXPWidth = -1;
m_pVBHPGauge = NULL;
m_pVBEXPGauge = NULL;
m_bVBHPGauge = TRUE;
m_bVBEXPGauge = TRUE;
m_bHPVisible = TRUE;
m_bExpVisible = TRUE;
m_pPetElem = NULL;
m_bExtension = FALSE;
m_nLockLevel[0] = -1;
m_nLockLevel[1] = -1;
m_nBackUpLevel[0] = -1;
m_nBackUpLevel[1] = -1;
m_strPathLvImage[0] = MakePath( DIR_ICON, "Icon_PetLevel1_S.dds");
m_strPathLvImage[1] = MakePath( DIR_ICON, "Icon_PetLevel2_S.dds");
m_strPathLvImage[2] = MakePath( DIR_ICON, "Icon_PetLevel3_S.dds");
m_strPathLvImage[3] = MakePath( DIR_ICON, "Icon_PetLevel4_S.dds");
m_strPathLvImage[4] = MakePath( DIR_ICON, "Icon_PetLevel5_S.dds");
m_strPathLvImage[5] = MakePath( DIR_ICON, "Icon_PetLevel6_S.dds");
m_strPathLvImage[6] = MakePath( DIR_ICON, "Icon_PetLevel7_S.dds");
m_strPathLvImage[7] = MakePath( DIR_ICON, "Icon_PetLevel8_S.dds");
m_strPathLvImage[8] = MakePath( DIR_ICON, "Icon_PetLevel9_S.dds");
m_nChoiceLevel = -1;
m_pPetModel = NULL;
for(int i=0; i<6; i++)
m_pTexPetLv[i] = NULL;
m_pTexPetLvBg = NULL;
m_pTexPetStatusBg = NULL;
memset(m_aPetLv, 0, sizeof(int) * 6);
SetPetCamTable();
}
CWndPetStatus::~CWndPetStatus()
{
DeleteDeviceObjects();
}
void CWndPetStatus::SetPetCamTable()
{
//백호
m_PetCameTable[0].CamPos.x = 1.2f;
m_PetCameTable[0].CamPos.y = 4.6f;
m_PetCameTable[0].CamPos.z = -7.0f;
m_PetCameTable[0].CamLook.x = -2.4f;
m_PetCameTable[0].CamLook.y = 3.0f;
m_PetCameTable[0].CamLook.z = 0.0f;
m_PetCameTable[0].Scale = 6.0f;
//바바리 사자
m_PetCameTable[1].CamPos.x = 0.7f;
m_PetCameTable[1].CamPos.y = 3.0f;
m_PetCameTable[1].CamPos.z = -5.2f;
m_PetCameTable[1].CamLook.x = -2.2f;
m_PetCameTable[1].CamLook.y = 2.5f;
m_PetCameTable[1].CamLook.z = 1.0f;
m_PetCameTable[1].Scale = 6.0f;
//토끼
m_PetCameTable[2].CamPos.x = 2.0f;
m_PetCameTable[2].CamPos.y = 2.2f;
m_PetCameTable[2].CamPos.z = -4.0f;
m_PetCameTable[2].CamLook.x = -2.2f;
m_PetCameTable[2].CamLook.y = 1.0f;
m_PetCameTable[2].CamLook.z = 3.0f;
m_PetCameTable[2].Scale = 7.0f;
//구미호
m_PetCameTable[3].CamPos.x = 1.4f;
m_PetCameTable[3].CamPos.y = 4.2f;
m_PetCameTable[3].CamPos.z = -8.0f;
m_PetCameTable[3].CamLook.x = -2.2f;
m_PetCameTable[3].CamLook.y = 2.0f;
m_PetCameTable[3].CamLook.z = 3.0f;
m_PetCameTable[3].Scale = 6.0f;
//새끼 드래곤
m_PetCameTable[4].CamPos.x = 1.4f;
m_PetCameTable[4].CamPos.y = 6.8f;
m_PetCameTable[4].CamPos.z = -6.0f;
m_PetCameTable[4].CamLook.x = -2.0f;
m_PetCameTable[4].CamLook.y = 6.0f;
m_PetCameTable[4].CamLook.z = 3.0f;
m_PetCameTable[4].Scale = 5.5f;
//새끼 그리핀
m_PetCameTable[5].CamPos.x = 3.0f;
m_PetCameTable[5].CamPos.y = 6.0f;
m_PetCameTable[5].CamPos.z = -12.0f;
m_PetCameTable[5].CamLook.x = -2.0f;
m_PetCameTable[5].CamLook.y = 3.0f;
m_PetCameTable[5].CamLook.z = 3.0f;
m_PetCameTable[5].Scale = 4.5f;
//유니콘
m_PetCameTable[6].CamPos.x = 4.0f;
m_PetCameTable[6].CamPos.y = 3.0f;
m_PetCameTable[6].CamPos.z = -10.0f;
m_PetCameTable[6].CamLook.x = -6.0f;
m_PetCameTable[6].CamLook.y = 6.0f;
m_PetCameTable[6].CamLook.z = 3.0f;
m_PetCameTable[6].Scale = 5.0f;
}
void CWndPetStatus::MakeGaugeVertex()
{
LPWNDCTRL lpHP = GetWndCtrl( WIDC_CUSTOM2 );
LPWNDCTRL lpExp = GetWndCtrl( WIDC_CUSTOM3 );
if( m_pPetElem != NULL && m_pPetElem->m_pPet != NULL )
{
CRect rect = GetClientRect();
CRect rectTemp;
int nWidthClient = lpHP->rect.Width();
int nWidth;
// HP
nWidth = nWidthClient * m_pPetElem->m_pPet->GetEnergy() / m_pPetElem->m_pPet->GetMaxEnergy();
if( m_nHPWidth != nWidth )
{
m_nHPWidth = nWidth;
rect = lpHP->rect;
rectTemp = rect;
rectTemp.right = rectTemp.left + nWidth;
ClientToScreen( rectTemp );
m_bVBHPGauge = m_pTheme->MakeGaugeVertex( m_pApp->m_pd3dDevice, &rectTemp, 0x64ff0000, m_pVBHPGauge, &m_texGauFillNormal );
}
// Exp
nWidth = (int)( ( (float) nWidthClient / m_pPetElem->m_pPet->GetMaxExp() ) * m_pPetElem->m_pPet->GetExp() );
if( m_nEXPWidth != nWidth )
{
m_nEXPWidth = nWidth;
rect = lpExp->rect;
rectTemp = rect;
rectTemp.right = rectTemp.left + nWidth;
ClientToScreen( rectTemp );
m_bVBEXPGauge = m_pTheme->MakeGaugeVertex( m_pApp->m_pd3dDevice, &rectTemp, 0x847070ff, m_pVBEXPGauge, &m_texGauFillNormal );
}
}
}
void CWndPetStatus::PaintFrame( C2DRender* p2DRender )
{
if(!IsValidObj(g_pPlayer))
return;
CRect rect = GetWindowRect();
if( g_pPlayer->HasActivatedSystemPet() )
{
m_pPetElem = g_pPlayer->GetPetItem();
if( m_pTexture && m_pPetElem != NULL && m_pPetElem->m_pPet != NULL)
{
RenderWnd();
// 여기는 타이틀 바의 텍스트를 출력하는 곳
if( IsWndStyle( WBS_CAPTION ) )
{
int y = 4;
CD3DFont* pOldFont = p2DRender->GetFont();
p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndTitle );
p2DRender->TextOut( 10, y, m_strTitle, m_dwColor );
char szNameLevel[128] = {0,};
ItemProp* pProp = m_pPetElem->GetProp();
CString strName = pProp->szName;
if( m_pPetElem->m_pPet->GetLevel() > PL_EGG )
{
MoverProp* pMoverProp = prj.GetMoverProp( m_pPetElem->m_pPet->GetIndex() );
if( pMoverProp )
strName = pMoverProp->szName;
}
#ifdef __PET_1024
if( m_pPetElem->m_pPet->HasName() )
strName = m_pPetElem->m_pPet->GetName();
#endif // __PET_1024
sprintf( szNameLevel, "%s", strName );
SetTitle( szNameLevel );
p2DRender->SetFont( pOldFont );
}
}
else
{
m_pTheme->RenderWndBaseFrame( p2DRender, &rect );
if( IsWndStyle( WBS_CAPTION ) )
{
// 타이틀 바
rect.bottom = 21;
{
m_pTheme->RenderWndBaseTitleBar( p2DRender, &rect, m_strTitle, m_dwColor );
}
}
}
}
}
void CWndPetStatus::DrawPetInformation(C2DRender* p2DRender)
{
// Draw Bg Text
p2DRender->TextOut( 74, 4, prj.GetText(TID_GAME_PET_STATUS_LEVEL), D3DCOLOR_ARGB(255, 74, 74, 173), D3DCOLOR_ARGB(255, 160, 160, 240));
p2DRender->TextOut( 74, 18, prj.GetText(TID_GAME_PET_STATUS_ABILITY), D3DCOLOR_ARGB(255, 74, 74, 173), D3DCOLOR_ARGB(255, 160, 160, 240));
p2DRender->TextOut( 74, 46, prj.GetText(TID_GAME_PET_STATUS_HP), D3DCOLOR_ARGB(255, 74, 74, 173), D3DCOLOR_ARGB(255, 160, 160, 240));
p2DRender->TextOut( 74, 61, prj.GetText(TID_GAME_PET_STATUS_EXP), D3DCOLOR_ARGB(255, 74, 74, 173), D3DCOLOR_ARGB(255, 160, 160, 240));
DWORD dwColor = D3DCOLOR_ARGB(255, 255, 28, 174);
if(m_pPetElem->m_pPet)
{
int nLevel = m_pPetElem->m_pPet->GetLevel();
CString strTemp;
DWORD dwLevelText;
switch(nLevel)
{
case PL_EGG:
dwLevelText = TID_GAME_PETGRADE_E;
break;
case PL_D:
dwLevelText = TID_GAME_PETGRADE_D;
break;
case PL_C:
dwLevelText = TID_GAME_PETGRADE_C;
break;
case PL_B:
dwLevelText = TID_GAME_PETGRADE_B;
break;
case PL_A:
dwLevelText = TID_GAME_PETGRADE_A;
break;
case PL_S:
dwLevelText = TID_GAME_PETGRADE_S;
break;
}
strTemp.Format( "%s", prj.GetText(dwLevelText) );
p2DRender->TextOut( 112, 4, strTemp, dwColor);
DWORD dwDstParam;
int nParam;
DWORD dwTooltip;
m_pPetElem->m_pPet->GetAvailDestParam(dwDstParam, nParam);
switch(dwDstParam)
{
case DST_STR:
dwTooltip = TID_TOOLTIP_STR;
break;
case DST_DEX:
dwTooltip = TID_TOOLTIP_DEX;
break;
case DST_INT:
dwTooltip = TID_TOOLTIP_INT;
break;
case DST_STA:
dwTooltip = TID_TOOLTIP_STA;
break;
case DST_ATKPOWER:
dwTooltip = TID_TOOLTIP_ATKPOWER_VALUE;
break;
case DST_ADJDEF:
dwTooltip = TID_TOOLTIP_DEFENCE;
break;
case DST_HP_MAX:
dwTooltip = TID_TOOLTIP_HP;
break;
}
CSize size = g_Neuz.m_2DRender.m_pFont->GetTextExtent( prj.GetText(TID_GAME_PET_STATUS_ABILITY) );
if(dwDstParam != 0 && nParam != 0)
strTemp.Format("%s +%d", prj.GetText(dwTooltip), nParam);
else
strTemp.Format("%s", prj.GetText(TID_GAME_PET_EGG_ABILITY));
p2DRender->TextOut( 76 + size.cx, 18, strTemp, dwColor); //'Ability'자간이 넓어 겹치는 국가 발생하여 위치 조정
int nLife = m_pPetElem->m_pPet->GetLife();
strTemp.Format("%d", nLife);
p2DRender->TextOut( 100, 32, strTemp, dwColor);
if(m_bExtension)
{
//Draw Level Background Image
CPoint point;
point = CPoint( GetWndCtrl( WIDC_CUSTOM4 )->rect.left-2, GetWndCtrl( WIDC_CUSTOM4 )->rect.top-2 );
if(m_pTexPetLvBg != NULL)
m_pTexPetLvBg->Render( p2DRender, point );
//Draw Level Image
dwColor = D3DCOLOR_ARGB(255, 0, 0, 0);
for(int i=PL_D; i<=nLevel; i++)
{
BYTE bLevel = m_pPetElem->m_pPet->GetAvailLevel(i);
if(bLevel != 0)
{
if(m_aPetLv[i] != bLevel)
{
CString strPath;
if(m_nLockLevel[0] == i)
strPath = m_strPathLvImage[m_nBackUpLevel[0]-1];
else if(m_nLockLevel[1] == i)
strPath = m_strPathLvImage[m_nBackUpLevel[1]-1];
else
strPath = m_strPathLvImage[bLevel-1];
m_pTexPetLv[i] = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, strPath, 0xffff00ff );
m_aPetLv[i] = bLevel;
}
if(m_pTexPetLv[i] != NULL)
{
if(m_nChoiceLevel == i)
m_pTexPetLv[i]->Render( p2DRender, point );
else
m_pTexPetLv[i]->Render( p2DRender, point, 120 );
}
point.x += 35;
}
}
}
}
}
void CWndPetStatus::OnDraw(C2DRender* p2DRender)
{
if( g_pPlayer == NULL || m_pPetElem == NULL || m_pPetElem->m_pPet == NULL )
return;
//Draw Status Background Image
CPoint point;
point = CPoint( GetWndCtrl( WIDC_CUSTOM1 )->rect.left-12, GetWndCtrl( WIDC_CUSTOM1 )->rect.top-6 );
if(m_pTexPetStatusBg != NULL)
m_pTexPetStatusBg->Render( p2DRender, point );
CRect rect = GetClientRect();
int nWidthClient = GetClientRect().Width() - 110;
CRect rectTemp;
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM1 );
LPWNDCTRL lpHP = GetWndCtrl( WIDC_CUSTOM2 );
LPWNDCTRL lpExp = GetWndCtrl( WIDC_CUSTOM3 );
MakeGaugeVertex();
if( m_bVBHPGauge )
{
int nMax = m_pPetElem->m_pPet->GetMaxEnergy();
int nHitPercent = MulDiv( m_pPetElem->m_pPet->GetEnergy(), 100, nMax );
#if __VER < 9 // __S_9_ADD
if( nHitPercent < CRITICAL_BERSERK_HP )
m_bHPVisible = !m_bHPVisible;
else
#endif // __S_9_ADD
m_bHPVisible = TRUE;
if( m_bHPVisible )
m_pTheme->RenderGauge( p2DRender->m_pd3dDevice, m_pVBHPGauge, &m_texGauFillNormal );
}
if( m_bVBEXPGauge )
m_pTheme->RenderGauge( p2DRender->m_pd3dDevice, m_pVBEXPGauge, &m_texGauFillNormal );
//Pet Information
DrawPetInformation(p2DRender);
if( m_nDisplay != 0 )
{
DWORD dwColor = D3DCOLOR_ARGB(255, 255, 255, 255);
char cbufHp[16] = {0,};
char cbufExp[16] = {0,};
int nCharHP, nCharEXP;
if(m_nDisplay == 1)
{
int nMax = m_pPetElem->m_pPet->GetMaxEnergy();
int nHitPercent = MulDiv( m_pPetElem->m_pPet->GetEnergy(), 100, nMax );
wsprintf(cbufHp, "%d%%", nHitPercent);
p2DRender->TextOut( lpHP->rect.right - 70, lpHP->rect.top - 0, cbufHp, dwColor, 0xff000000 );
nCharHP = wsprintf(cbufHp, "%dp", m_pPetElem->m_pPet->GetEnergy());
int x = lpHP->rect.right-7;
p2DRender->TextOut( x - (int)(nCharHP*5.8f) , lpHP->rect.top - 0, cbufHp, dwColor, 0xff000000 );
}
else
{
nCharHP = wsprintf(cbufHp, "%d", m_pPetElem->m_pPet->GetEnergy());
int x = lpHP->rect.right - 76 + 15;
p2DRender->TextOut( x - (int)(nCharHP*2.6f), lpHP->rect.top - 0, cbufHp, dwColor, 0xff000000 );
nCharHP = wsprintf(cbufHp, "%d", m_pPetElem->m_pPet->GetMaxEnergy());
x = lpHP->rect.right - 38 + 15;
p2DRender->TextOut( x - nCharHP*2, lpHP->rect.top - 0, cbufHp, dwColor, 0xff000000 );
p2DRender->TextOut( lpHP->rect.right - 42, lpHP->rect.top - 0, "/", dwColor, 0xff000000 );
}
EXPINTEGER nExpResult = m_pPetElem->m_pPet->GetExp() * (EXPINTEGER)10000 / m_pPetElem->m_pPet->GetMaxExp();
float fExp = (float)nExpResult / 100.0f;
if( fExp >= 99.99f )
nCharEXP = sprintf( cbufExp, "99.99%%" ); // sprintf함수 내부에서 반올림되어 100.00으로 표시되는 것을 막기 위해서
else
nCharEXP = sprintf( cbufExp, "%.2f%%", fExp );
int x = lpHP->rect.right-7; // -40
p2DRender->TextOut( x - (int)(nCharEXP*5.8f), lpExp->rect.top - 0, cbufExp, dwColor, 0xff000000 );
}
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 ) ;
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
// 뷰포트 세팅
D3DVIEWPORT9 viewport;
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
// 프로젝션
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
FLOAT fAspect = ((FLOAT)viewport.Width) / (FLOAT)viewport.Height;
FLOAT fov = D3DX_PI/4.0f;//796.0f;
FLOAT h = cos(fov/2) / sin(fov/2);
FLOAT w = h * fAspect;
D3DXMatrixOrthoLH( &matProj, w, h, CWorld::m_fNearPlane - 0.01f, CWorld::m_fFarPlane );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
D3DXMATRIX matView;
// 월드
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot1, matRot2;
D3DXMATRIXA16 matTrans;
// 초기화
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matRot1);
D3DXMatrixIdentity(&matRot2);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
//펫 종류에 따라 설정.
D3DXVECTOR3 vecPos;
D3DXVECTOR3 vecLookAt;
float fScale = 1.0f;
if( m_pPetElem->m_pPet->GetLevel() == PL_EGG )
{
vecPos.x = 0.0f;
vecPos.y = 5.0f;
vecPos.z = -4.0f;
vecLookAt.x = 0.0f;
vecLookAt.y = 0.0f;
vecLookAt.z = 3.0f;
fScale = 5.0f;
}
else
{
int petkind = m_pPetElem->m_pPet->GetKind();
vecPos = m_PetCameTable[petkind].CamPos;
vecLookAt = m_PetCameTable[petkind].CamLook;
fScale = m_PetCameTable[petkind].Scale;
}
D3DXMatrixScaling(&matScale, fScale, fScale, fScale);
D3DXMatrixLookAtLH( &matView, &vecPos, &vecLookAt, &D3DXVECTOR3(0.0f,1.0f,0.0f) );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld,&matRot1);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
// 랜더링
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, CWorld::m_dwBgColor, 1.0f, 0 ) ;
//CModelObject* pPetModel = g_pPlayer->GetPetModel();
//if( pPetModel )
if(m_pPetModel != NULL)
{
// Pet LOD가 들어갔기 때문에 LodGroup setting.
if(g_pPlayer && g_pPlayer->m_pet.GetObj() )
{
float fDist = 50.0f;
switch( g_Option.m_nObjectDetail )
{
case 0 : fDist = 20.0f; break;
case 1 : fDist = 10.0f; break;
case 2 : fDist = 5.0f; break;
}
int nLevel = (int)( g_pPlayer->m_pet.GetObj()->m_fDistCamera / fDist );
if( nLevel >= 2 ) nLevel = 2;
if( nLevel < 0 )
{
//Error( "CMover::Render : %s, lod lv=%d %f", m_szName, nLevel, m_fDistCamera );
nLevel = 0;
}
m_pPetModel->SetGroup( nLevel );
}
::SetTransformView( matView );
::SetTransformProj( matProj );
int nMax = m_pPetElem->m_pPet->GetMaxEnergy();
int nHitPercent = MulDiv( m_pPetElem->m_pPet->GetEnergy(), 100, nMax );
#if __VER < 9 // __S_9_ADD
if( nHitPercent < CRITICAL_BERSERK_HP )
{
::SetLight( TRUE );
SetDiffuse( 1.0f, 0.3f, 0.3f );
D3DXVECTOR3 vDir( 0.0f, 1.0f, 0.0f );
SetAmbient( 0.55f, 0.55f, 0.55f );
SetLightVec( vDir );
}
else
#endif // __S_9_ADD
{
SetDiffuse( 0.0f, 0.0f, 0.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
}
m_pPetModel->SetTextureEx( m_pPetModel->m_pModelElem->m_nTextureEx );
m_pPetModel->Render(pd3dDevice, &matWorld);
SetDiffuse( 0.0f, 0.0f, 0.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
}
pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
}
HRESULT CWndPetStatus::RestoreDeviceObjects()
{
CWndBase::RestoreDeviceObjects();
if( m_pVBHPGauge == NULL )
{
m_pApp->m_pd3dDevice->CreateVertexBuffer( sizeof( TEXTUREVERTEX2 ) * 3 * 6, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, D3DFVF_TEXTUREVERTEX2, D3DPOOL_DEFAULT, &m_pVBHPGauge, NULL );
m_pApp->m_pd3dDevice->CreateVertexBuffer( sizeof( TEXTUREVERTEX2 ) * 3 * 6, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, D3DFVF_TEXTUREVERTEX2, D3DPOOL_DEFAULT, &m_pVBEXPGauge, NULL );
m_nHPWidth = -1;
m_nEXPWidth = -1;
}
return S_OK;
}
HRESULT CWndPetStatus::InvalidateDeviceObjects()
{
CWndBase::InvalidateDeviceObjects();
SAFE_RELEASE( m_pVBHPGauge );
SAFE_RELEASE( m_pVBEXPGauge );
SAFE_DELETE( m_pPetModel );
return S_OK;
}
HRESULT CWndPetStatus::DeleteDeviceObjects()
{
CWndBase::DeleteDeviceObjects();
return InvalidateDeviceObjects();
}
void CWndPetStatus::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
RestoreDeviceObjects();
m_texGauEmptyNormal.LoadTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "GauEmptyNormal.bmp" ), 0xffff00ff, TRUE );
m_texGauFillNormal.LoadTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "GauEmptyNormal.bmp" ), 0xffff00ff, TRUE );
m_pTexPetLvBg = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "PetLevelBg.tga"), 0xffff00ff );
m_pTexPetStatusBg = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "PetStatusBg.tga"), 0xffff00ff, TRUE );
// 장착, 게이지에 나올 캐릭터 오브젝트 설정
if( g_pPlayer->HasActivatedSystemPet() )
m_pPetElem = g_pPlayer->GetPetItem();
//Size Control
SetExtension(m_bExtension);
//Position Control
CWndStatus* pWndStatus = (CWndStatus*)GetWndBase( APP_STATUS1 );
if(pWndStatus != NULL)
{
CRect rectRoot = pWndStatus->GetWndRect();
CRect rect = GetWindowRect();
int x = rectRoot.right;
int y = rectRoot.top;
Move( CPoint(x, y));
}
else
{
CRect rectRoot = m_pWndRoot->GetLayoutRect();
CPoint point( rectRoot.left+192, rectRoot.top );
Move( point );
}
}
void CWndPetStatus::OnMouseWndSurface(CPoint point)
{
if(!m_bExtension || m_pPetElem->m_pPet == NULL)
return;
CRect baseRect = GetWndCtrl(WIDC_CUSTOM4)->rect;
CRect testRect;
BOOL bCheckChoice = FALSE;
testRect = baseRect;
testRect.right = testRect.left + 34;
int nLevel = m_pPetElem->m_pPet->GetLevel();
for(int i=PL_D; i<nLevel+1; i++)
{
if( testRect.PtInRect(point) )
{
CPoint point2 = point;
ClientToScreen( &point2 );
ClientToScreen( &testRect );
DWORD dwDstParam;
int nParam;
DWORD dwTooltip;
CString strTemp;
CEditString strEdit;
PPETAVAILPARAM pAvailParam = CPetProperty::GetInstance()->GetAvailParam( m_pPetElem->m_pPet->GetKind() );
dwDstParam = pAvailParam->dwDstParam;
nParam = pAvailParam->m_anParam[m_pPetElem->m_pPet->GetAvailLevel(i) - 1];
switch(dwDstParam)
{
case DST_STR:
dwTooltip = TID_TOOLTIP_STR;
break;
case DST_DEX:
dwTooltip = TID_TOOLTIP_DEX;
break;
case DST_INT:
dwTooltip = TID_TOOLTIP_INT;
break;
case DST_STA:
dwTooltip = TID_TOOLTIP_STA;
break;
case DST_ATKPOWER:
dwTooltip = TID_TOOLTIP_ATKPOWER_VALUE;
break;
case DST_ADJDEF:
dwTooltip = TID_TOOLTIP_DEFENCE;
break;
case DST_HP_MAX:
dwTooltip = TID_TOOLTIP_DST_HP_MAX;
break;
}
strTemp.Format( "%s +%d", prj.GetText(dwTooltip), nParam );
strEdit.AddString( strTemp, D3DCOLOR_XRGB(255, 0, 0) );
g_toolTip.PutToolTip(m_pPetElem->m_dwItemId, strEdit, &testRect, point2, 0 );
bCheckChoice = TRUE;
m_nChoiceLevel = i;
}
testRect.left = testRect.right;
testRect.right = testRect.left + 34;
}
if(!bCheckChoice)
m_nChoiceLevel = -1;
}
void CWndPetStatus::SetExtension(BOOL eflag)
{
CRect rect = GetWindowRect(TRUE);
if(eflag)
rect.bottom += 48;
else
rect.bottom -= 48;
SetWndRect(rect);
}
BOOL CWndPetStatus::Initialize(CWndBase* pWndParent,DWORD dwWndId)
{
return InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_STATUS );
}
BOOL CWndPetStatus::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
void CWndPetStatus::OnSize(UINT nType, int cx, int cy)
{
CWndNeuz::OnSize( nType, cx, cy );
}
void CWndPetStatus::SetWndRect( CRect rectWnd, BOOL bOnSize )
{
m_nHPWidth = -1;
m_nEXPWidth = -1;
CWndNeuz::SetWndRect( rectWnd, bOnSize );
}
void CWndPetStatus::OnLButtonUp(UINT nFlags, CPoint point)
{
}
void CWndPetStatus::OnLButtonDown(UINT nFlags, CPoint point)
{
if(++m_nDisplay > 2)
m_nDisplay = 0;
}
BOOL CWndPetStatus::OnEraseBkgnd(C2DRender* p2DRender)
{
return CWndBase::OnEraseBkgnd( p2DRender );
CRect rect = GetClientRect();
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->RenderFillRect( rect, D3DCOLOR_ARGB( 100, 0, 0, 0 ) );
return TRUE;
}
BOOL CWndPetStatus::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if( nID == WIDC_BUTTON1 )
{
m_bExtension = !m_bExtension;
SetExtension(m_bExtension);
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
BOOL CWndPetStatus::Process()
{
if(!IsValidObj(g_pPlayer))
return FALSE;
// 장착, 게이지에 나올 캐릭터 오브젝트 설정
if( g_pPlayer->HasActivatedSystemPet() )
{
m_pPetElem = g_pPlayer->GetPetItem();
if( m_pPetElem != NULL )
{
if( g_pPlayer->GetPetModel() == NULL && m_pPetModel != NULL )
{
SAFE_DELETE(m_pPetModel);
}
else if( m_pPetElem->m_pPet != NULL && g_pPlayer->GetPetModel() != NULL && m_pPetModel == NULL )
{
m_pPetModel = new CModelObject;
m_pPetModel->InitDeviceObjects( g_Neuz.m_pd3dDevice );
CString textFile;
textFile.Format("Mvr_%s.chr", g_pPlayer->GetPetModel()->m_pModelElem->m_szName);
m_pPetModel->LoadBone( textFile );
textFile.Format("Mvr_%s.o3d", g_pPlayer->GetPetModel()->m_pModelElem->m_szName);
m_pPetModel->LoadElement( textFile, 0 );
m_pPetModel->m_pModelElem = g_pPlayer->GetPetModel()->m_pModelElem;
if( m_pPetElem->m_pPet->GetLevel() == PL_EGG )
textFile.Format("Mvr_%s_idle.ani", g_pPlayer->GetPetModel()->m_pModelElem->m_szName);
else
textFile.Format("Mvr_%s_stand.ani", g_pPlayer->GetPetModel()->m_pModelElem->m_szName);
m_pPetModel->LoadMotion( textFile );
}
}
}
if(m_pPetModel != NULL)
m_pPetModel->FrameMove();
return TRUE;
}
void CWndPetStatus::LockShowLevel(BOOL lFlag, int nLevel, int nPos)
{
if(lFlag)
{
m_nLockLevel[nPos] = nLevel;
if(m_pPetElem->m_pPet)
m_nBackUpLevel[nPos] = m_pPetElem->m_pPet->GetAvailLevel(nLevel);
}
else
{
m_nLockLevel[nPos] = -1;
m_nBackUpLevel[nPos] = -1;
CString strPath;
BYTE bLevel = m_pPetElem->m_pPet->GetAvailLevel(nLevel);
if(bLevel != 0)
{
strPath = m_strPathLvImage[bLevel-1];
m_pTexPetLv[nLevel] = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, strPath, 0xffff00ff );
}
}
}
//////////////////////////////////////////////////////////////////////////
// CWndFoodConfirm Class
//////////////////////////////////////////////////////////////////////////
CWndFoodConfirm::CWndFoodConfirm()
{
m_pItemElem = NULL;
m_pEdit = NULL;
m_nParent = 0;
}
CWndFoodConfirm::CWndFoodConfirm(int nParent)
{
m_pItemElem = NULL;
m_pEdit = NULL;
m_nParent = nParent;
}
CWndFoodConfirm::~CWndFoodConfirm()
{
}
void CWndFoodConfirm::SetItem(DWORD dwObjId)
{
m_pItemElem = (CItemElem*)g_pPlayer->GetItemId( dwObjId );
}
void CWndFoodConfirm::OnDraw( C2DRender* p2DRender )
{
LPCTSTR szNumber;
szNumber = m_pEdit->GetString();
int nNumber = atoi( szNumber );
if(m_pItemElem == NULL)
return;
if( m_pItemElem->m_nItemNum == 1 )
{
m_pEdit->SetString( "1" );
}
else
{
if( nNumber > 1000 ) // 0723
{
char szNumberbuf[16] = {0, };
nNumber = 1000;
_itoa( 1000, szNumberbuf, 10 );
m_pEdit->SetString( szNumberbuf );
}
else if( m_pItemElem->m_nItemNum < nNumber )
{
char szNumberbuf[16] = {0, };
nNumber = m_pItemElem->m_nItemNum;
_itoa( m_pItemElem->m_nItemNum, szNumberbuf, 10 );
m_pEdit->SetString( szNumberbuf );
}
int i; for( i = 0 ; i < 8 ; i++ )
{
char szNumberbuf[8] = {0, };
strncpy( szNumberbuf, szNumber, 8 );
// 0 : 공백, 48 : 숫자 0, 57 : 숫자 9
if( 47 >= szNumberbuf[i] || szNumberbuf[i] >= 58 )
{
if( szNumberbuf[i] != 0 )
{
nNumber = m_pItemElem->m_nItemNum;
_itoa( m_pItemElem->m_nItemNum, szNumberbuf, 10 );
m_pEdit->SetString( szNumberbuf );
break;
}
}
}
}
}
void CWndFoodConfirm::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 여기에 코딩하세요
m_pEdit = (CWndEdit *)GetDlgItem( WIDC_EDIT1 );
CWndButton* pWndOk = (CWndButton *)GetDlgItem( WIDC_OK );
pWndOk->SetDefault( TRUE );
m_pEdit->SetFocus();
if(m_pItemElem == NULL)
{
Destroy();
return;
}
if( m_pItemElem->m_nItemNum == 1 )
{
m_pEdit->SetString( "1" );
}
else
{
TCHAR szNumber[ 64 ];
if( m_pItemElem->m_nItemNum > 1000 ) // 0723
_itot( 1000, szNumber, 10 );
else
_itot( m_pItemElem->m_nItemNum, szNumber, 10 );
m_pEdit->SetString( szNumber );
}
CWndStatic* pStatic = (CWndStatic*)GetDlgItem(WIDC_STATIC1);
if(m_nParent == 1)
pStatic->SetTitle(prj.GetText(TID_GAME_PETFOOD_COUNTCONFIRM));
else if(m_nParent == 2)
pStatic->SetTitle(prj.GetText(TID_GAME_ITEMCOUNT_QUESTION));
// 윈도를 중앙으로 옮기는 부분.
MoveParentCenter();
}
// 처음 이 함수를 부르면 윈도가 열린다.
BOOL CWndFoodConfirm::Initialize( CWndBase* pWndParent, DWORD /*dwWndId*/ )
{
// Daisy에서 설정한 리소스로 윈도를 연다.
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_ITEM, 0, CPoint( 0, 0 ), pWndParent );
}
BOOL CWndFoodConfirm::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
void CWndFoodConfirm::OnSize( UINT nType, int cx, int cy ) \
{
CWndNeuz::OnSize( nType, cx, cy );
}
void CWndFoodConfirm::OnLButtonUp( UINT nFlags, CPoint point )
{
}
void CWndFoodConfirm::OnLButtonDown( UINT nFlags, CPoint point )
{
}
BOOL CWndFoodConfirm::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if( nID == WIDC_OK || message == EN_RETURN )
{
short DropNum = 0;
if(m_pItemElem != NULL)
{
if( m_pItemElem->m_nItemNum >= 1 )
{
DropNum = atoi( m_pEdit->GetString() );
}
if( DropNum != 0 && DropNum <= 1000 ) // 0723
{
if(m_nParent == 1) //Pet Food
{
//Send to Server...
#if __VER < 12 // __PET_0519
g_DPlay.SendUsePetFeed(m_pItemElem->m_dwObjId, DropNum);
#endif // __PET_0519
//PLAYSND( "Feed.wav" );
}
else if(m_nParent == 2) //Food Mill
{
CWndPetFoodMill* pWndPetFoodMill = (CWndPetFoodMill*)g_WndMng.GetWndBase(APP_PET_FOODMILL);
if(pWndPetFoodMill != NULL)
pWndPetFoodMill->SetItemForFeed(m_pItemElem, DropNum);
}
}
}
Destroy();
}
else if( nID == WIDC_CANCEL )
{
Destroy();
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndFoodConfirm::PaintFrame( C2DRender* p2DRender )
{
CRect rect = GetWindowRect();
if( m_pTexture )
{
RenderWnd();
// 여기는 타이틀 바의 텍스트를 출력하는 곳
if( IsWndStyle( WBS_CAPTION ) )
{
int y = 4;
CD3DFont* pOldFont = p2DRender->GetFont();
p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndTitle );
p2DRender->TextOut( 10, y, m_strTitle, m_dwColor );
char szNameLevel[128] = {0,};
if(m_nParent == 1)
sprintf( szNameLevel, "%s", prj.GetText(TID_GAME_PETFOOD_CONFIRM) );
else if(m_nParent == 2)
sprintf( szNameLevel, "%s", prj.GetText(TID_GAME_ITEMCOUNT_CONFIRM) );
SetTitle( szNameLevel );
p2DRender->SetFont( pOldFont );
}
}
else
{
m_pTheme->RenderWndBaseFrame( p2DRender, &rect );
if( IsWndStyle( WBS_CAPTION ) )
{
// 타이틀 바
rect.bottom = 21;
{
m_pTheme->RenderWndBaseTitleBar( p2DRender, &rect, m_strTitle, m_dwColor );
}
}
}
}
//////////////////////////////////////////////////////////////////////////
// CWndPetMiracle Class
//////////////////////////////////////////////////////////////////////////
CWndPetMiracle::CWndPetMiracle()
{
m_nCount[0] = 0;
m_nDelay[0] = 1;
m_nStatus[0] = -1;
m_nCount[1] = 0;
m_nDelay[1] = 1;
m_nStatus[1] = -1;
m_nPreLvCount = -1;
m_nCurLvCount = -1;
m_nResPreLevel = -1;
m_nResCurLevel = -1;
m_nPetLevel = -1;
m_dwObjId = -1;
m_bReciveResult[0] = FALSE;
m_bReciveResult[1] = FALSE;
m_bEnd = FALSE;
m_pText = NULL;
m_bLocked[0] = FALSE;
m_bLocked[1] = FALSE;
m_strPathLvImage[0] = MakePath( DIR_ICON, "Icon_PetLevel1_L.dds");
m_strPathLvImage[1] = MakePath( DIR_ICON, "Icon_PetLevel2_L.dds");
m_strPathLvImage[2] = MakePath( DIR_ICON, "Icon_PetLevel3_L.dds");
m_strPathLvImage[3] = MakePath( DIR_ICON, "Icon_PetLevel4_L.dds");
m_strPathLvImage[4] = MakePath( DIR_ICON, "Icon_PetLevel5_L.dds");
m_strPathLvImage[5] = MakePath( DIR_ICON, "Icon_PetLevel6_L.dds");
m_strPathLvImage[6] = MakePath( DIR_ICON, "Icon_PetLevel7_L.dds");
m_strPathLvImage[7] = MakePath( DIR_ICON, "Icon_PetLevel8_L.dds");
m_strPathLvImage[8] = MakePath( DIR_ICON, "Icon_PetLevel9_L.dds");
}
CWndPetMiracle::~CWndPetMiracle()
{
}
void CWndPetMiracle::OnDestroy()
{
CWndPetStatus* pWndStatus = (CWndPetStatus*)g_WndMng.GetWndBase( APP_PET_STATUS );
if(pWndStatus != NULL && m_bLocked[0])
{
pWndStatus->LockShowLevel(FALSE, m_nPetLevel-1, 0);
m_bLocked[0] = FALSE;
}
if(pWndStatus != NULL && m_bLocked[1])
{
pWndStatus->LockShowLevel(FALSE, m_nPetLevel, 1);
m_bLocked[1] = FALSE;
}
}
void CWndPetMiracle::OnDraw( C2DRender* p2DRender )
{
CTexture* pTexture;
CString strPath;
CEditString strEdit;
//레벨 텍스트 그리기.
strEdit.SetString(m_strPetLevel[0], D3DCOLOR_XRGB( 255, 255, 255 ), ESSTY_BOLD);
p2DRender->TextOut_EditString(GetWndCtrl( WIDC_STATIC1 )->rect.left + 8, GetWndCtrl( WIDC_STATIC1 )->rect.top + 3, strEdit);
strEdit.SetString(m_strPetLevel[1], D3DCOLOR_XRGB( 255, 255, 255 ), ESSTY_BOLD);
p2DRender->TextOut_EditString(GetWndCtrl( WIDC_STATIC2 )->rect.left + 8, GetWndCtrl( WIDC_STATIC2 )->rect.top + 3, strEdit);
//이전 레벨의 특성치 레벨 이미지 그리기.
if(m_bReciveResult[0])
strPath = m_strPathLvImage[m_nPreLvCount];
else
strPath = m_strPathLvImage[m_nMiracleLv[0] - 1];
if(strPath.GetLength() > 0)
{
pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, strPath, 0xffff00ff );
if(pTexture != NULL)
pTexture->Render( p2DRender, CPoint( GetWndCtrl( WIDC_STATIC3 )->rect.left, GetWndCtrl( WIDC_STATIC3 )->rect.top + 4 ) );
}
//현재 레벨의 특성치 레벨 이미지 그리기.
if(m_bReciveResult[1])
strPath = m_strPathLvImage[m_nCurLvCount];
else
strPath = m_strPathLvImage[m_nMiracleLv[1] - 1];
if(strPath.GetLength() > 0)
{
pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, strPath, 0xffff00ff );
if(pTexture != NULL)
pTexture->Render( p2DRender, CPoint( GetWndCtrl( WIDC_STATIC4 )->rect.left, GetWndCtrl( WIDC_STATIC4 )->rect.top + 4 ) );
}
}
void CWndPetMiracle::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 미국 버튼 이미지 변경
CWndButton* pWndButton = (CWndButton*)GetDlgItem(WIDC_BUTTON2);
if(pWndButton)
{
if(::GetLanguage() == LANG_ENG || ::GetLanguage() == LANG_VTN)
pWndButton->SetTexture( m_pApp->m_pd3dDevice, MakePath( "Theme\\", ::GetLanguage(), "ButChance.bmp" ), 0xffff00ff );
}
//B/A/S 급 펫만 해당 기능을 이용할 수 있다.
if( g_pPlayer->HasActivatedSystemPet() )
{
CItemElem* m_pPetElem = g_pPlayer->GetPetItem();
m_nPetLevel = m_pPetElem->m_pPet->GetLevel();
if(m_pPetElem->m_pPet != NULL && (m_nPetLevel == PL_B || m_nPetLevel == PL_A || m_nPetLevel == PL_S))
{
switch(m_nPetLevel)
{
case PL_B:
m_strPetLevel[0] = prj.GetText(TID_GAME_PET_GRADE_C); //"Lv. C"
m_strPetLevel[1] = prj.GetText(TID_GAME_PET_GRADE_B); //"Lv. B"
break;
case PL_A:
m_strPetLevel[0] = prj.GetText(TID_GAME_PET_GRADE_B); //"Lv. B"
m_strPetLevel[1] = prj.GetText(TID_GAME_PET_GRADE_A); //"Lv. A"
break;
case PL_S:
m_strPetLevel[0] = prj.GetText(TID_GAME_PET_GRADE_A); //"Lv. A"
m_strPetLevel[1] = prj.GetText(TID_GAME_PET_GRADE_S); //"Lv. S"
break;
}
m_nMiracleLv[0] = m_pPetElem->m_pPet->GetAvailLevel(m_nPetLevel-1);
m_nMiracleLv[1] = m_pPetElem->m_pPet->GetAvailLevel(m_nPetLevel);
m_nPreLvCount = m_nMiracleLv[0] - 1;
m_nCurLvCount = m_nMiracleLv[1] - 1;
m_pText = (CWndText *)GetDlgItem( WIDC_TEXT_DESC );
SetDescription(NULL);
CWndButton* pButton;
pButton = (CWndButton*)GetDlgItem( WIDC_OK );
pButton->EnableWindow(FALSE);
pButton->SetVisible(FALSE);
//만약 Status창이 활성화된 상태라면 레벨값이 변하지 않도록 고정을 요청하자.
CWndPetStatus* pWndStatus = (CWndPetStatus*)g_WndMng.GetWndBase( APP_PET_STATUS );
if(pWndStatus != NULL)
{
pWndStatus->LockShowLevel(TRUE, m_nPetLevel-1, 0);
pWndStatus->LockShowLevel(TRUE, m_nPetLevel, 1);
m_bLocked[0] = m_bLocked[1] = TRUE;
}
MoveParentCenter();
}
else
Destroy();
}
else
Destroy();
}
BOOL CWndPetMiracle::Initialize( CWndBase* pWndParent, DWORD /*dwWndId*/ )
{
// Daisy에서 설정한 리소스로 윈도를 연다.
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_MIRACLE, 0, CPoint( 0, 0 ), pWndParent );
}
BOOL CWndPetMiracle::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if(message == WNM_CLICKED)
{
if(nID == WIDC_BUTTON2)
{
CWndButton* pButton;
pButton = (CWndButton*)GetDlgItem( WIDC_BUTTON2 );
pButton->EnableWindow(FALSE);
//Send to Server
if(m_dwObjId != -1)
g_DPlay.SendPetTamerMiracle(m_dwObjId);
}
else if(nID == WIDC_OK || nID == WIDC_CLOSE)
Destroy();
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndPetMiracle::ReceiveResult(int nPreLevel, int nCurLevel)
{
m_nResPreLevel = nPreLevel;
m_nResCurLevel = nCurLevel;
m_nMiracleLv[0] = m_nResPreLevel;
m_nMiracleLv[1] = m_nResCurLevel;
m_nStatus[0] = 0;
m_nStatus[1] = 0;
m_bReciveResult[0] = TRUE;
m_bReciveResult[1] = TRUE;
}
void CWndPetMiracle::SetItem(DWORD dwObjId)
{
m_dwObjId = dwObjId;
}
BOOL CWndPetMiracle::Process()
{
//Start버튼 누를 경우 컴퓨터의 선택이 회전하도록 함.
PreLevelImgProcess();
CurLevelImgProcess();
return TRUE;
}
void CWndPetMiracle::PreLevelImgProcess()
{
if(m_nStatus[0] == 0)
{
if(m_nCount[0]%4 == 0)
{
if(m_nCount[0] > 60)
{
m_nCount[0] = 0;
m_nStatus[0] = 1;
}
else
{
PLAYSND( "InfOpen.wav" );
int randnum = rand() % 9;
if(randnum == m_nPreLvCount)
{
randnum++;
( randnum > 8 ) ? randnum = 0 : randnum;
}
m_nPreLvCount = randnum;
}
}
m_nCount[0]++;
}
else if(m_nStatus[0] == 1)
{
if(m_nCount[0] > m_nDelay[0])
{
if(m_nDelay[0] < 10)
{
PLAYSND( "InfOpen.wav" );
m_nDelay[0] += 1;
}
else
{
PLAYSND( "InfOpen.wav" );
//초기화 및 상태창이 열려있을 경우 상태창의 Level Lock을 푼다.
m_nPreLvCount = m_nResPreLevel;
m_nStatus[0] = -1;
m_nDelay[0] = 1;
m_nCount[0] = 0;
m_bReciveResult[0] = FALSE;
m_bEnd = TRUE;
CWndPetStatus* pWndStatus = (CWndPetStatus*)g_WndMng.GetWndBase( APP_PET_STATUS );
if(pWndStatus != NULL && m_bLocked[0])
{
pWndStatus->LockShowLevel(FALSE, m_nPetLevel-1, 0);
m_bLocked[0] = FALSE;
}
}
int randnum = rand() % 9;
if(randnum == m_nPreLvCount)
{
randnum++;
( randnum > 8 ) ? randnum = 0 : randnum;
}
m_nPreLvCount = randnum;
m_nCount[0] = 0;
}
m_nCount[0]++;
}
}
void CWndPetMiracle::CurLevelImgProcess()
{
if(m_nStatus[1] == 0)
{
if(m_nCount[1]%4 == 0)
{
if(m_nCount[1] > 80)
{
m_nCount[1] = 0;
m_nStatus[1] = 1;
}
else
{
PLAYSND( "InfOpen.wav" );
int randnum = rand() % 9;
if(randnum == m_nCurLvCount)
{
randnum++;
( randnum > 8 ) ? randnum = 0 : randnum;
}
m_nCurLvCount = randnum;
}
}
m_nCount[1]++;
}
else if(m_nStatus[1] == 1)
{
if(m_nCount[1] > m_nDelay[1])
{
if(m_nDelay[1] < 20)
{
PLAYSND( "InfOpen.wav" );
m_nDelay[1] += 1;
}
else
{
PLAYSND( "InfOpen.wav" );
//초기화 및 상태창이 열려있을 경우 상태창의 Level Lock을 푼다.
m_nCurLvCount = m_nResCurLevel;
m_nStatus[1] = -1;
m_nDelay[1] = 1;
m_nCount[1] = 0;
m_bReciveResult[1] = FALSE;
m_bEnd = TRUE;
CWndPetStatus* pWndStatus = (CWndPetStatus*)g_WndMng.GetWndBase( APP_PET_STATUS );
if(pWndStatus != NULL && m_bLocked[1])
{
pWndStatus->LockShowLevel(FALSE, m_nPetLevel, 1);
m_bLocked[1] = FALSE;
}
CWndButton* pButton;
pButton = (CWndButton*)GetDlgItem( WIDC_BUTTON2 );
pButton->SetVisible(FALSE);
pButton = (CWndButton*)GetDlgItem( WIDC_OK );
pButton->SetVisible(TRUE);
pButton->EnableWindow(TRUE);
}
int randnum = rand() % 9;
if(randnum == m_nCurLvCount)
{
randnum++;
( randnum > 8 ) ? randnum = 0 : randnum;
}
m_nCurLvCount = randnum;
m_nCount[1] = 0;
}
m_nCount[1]++;
}
}
void CWndPetMiracle::SetDescription( CHAR* szChar )
{
CScript scanner;
BOOL checkflag;
checkflag = scanner.Load( MakePath( DIR_CLIENT, _T( "PetMiracle.inc" ) ));
szChar = scanner.m_pProg;
if(m_pText != NULL && checkflag)
{
m_pText->m_string.AddParsingString( szChar );
m_pText->ResetString();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CWndPetFoodMill Class
////////////////////////////////////////////////////////////////////////////////////////////////////////////
CWndPetFoodMill::CWndPetFoodMill()
{
m_dwObjId = NULL_ID;
m_pItemElem = NULL;
m_pWndFoodConfrim = NULL;
m_pTexture = NULL;
}
CWndPetFoodMill::~CWndPetFoodMill()
{
}
void CWndPetFoodMill::OnDestroy()
{
if(m_pItemElem != NULL)
{
if( !g_pPlayer->m_vtInfo.IsTrading( m_pItemElem ) )
m_pItemElem->SetExtra(0);
m_pItemElem = NULL;
}
if(m_pWndFoodConfrim != NULL)
m_pWndFoodConfrim->Destroy();
}
void CWndPetFoodMill::OnDraw(C2DRender* p2DRender)
{
//Draw Food
ItemProp* pItemProp;
if(m_pItemElem != NULL)
{
pItemProp = m_pItemElem->GetProp();
if(pItemProp != NULL)
{
CPoint point;
point.x = GetWndCtrl( WIDC_STATIC2 )->rect.left;
point.y = GetWndCtrl( WIDC_STATIC2 )->rect.top;
if(m_pTexture != NULL)
m_pTexture->Render( p2DRender, point );
TCHAR szTemp[ 32 ];
_stprintf( szTemp, prj.GetText(TID_GAME_KWAIBAWIBO_PRESENT_NUM), m_nItemCount );
CSize size = m_p2DRender->m_pFont->GetTextExtent( szTemp );
m_p2DRender->TextOut( point.x + 36 - size.cx, point.y + 48 - size.cy, szTemp, 0xff0000ff );
}
}
}
void CWndPetFoodMill::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
CWndStatic* pStatic = (CWndStatic*)GetDlgItem(WIDC_STATIC1);
pStatic->SetTitle(prj.GetText(TID_GAME_PETFOODMILL_DESC));
#if __VER >= 15 // __IMPROVE_SYSTEM_VER15
CWndInventory* pWndInventory = (CWndInventory*)g_WndMng.CreateApplet(APP_INVENTORY);
#endif // __IMPROVE_SYSTEM_VER15
MoveParentCenter();
}
BOOL CWndPetFoodMill::Initialize(CWndBase* pWndParent,DWORD dwWndId)
{
return InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_FOODMILL );
}
BOOL CWndPetFoodMill::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if(nID == WIDC_OK)
{
if(m_pItemElem != NULL)
{
ItemProp* pItemProp = m_pItemElem->GetProp();
// if( ( pItemProp->dwParts != NULL_ID || pItemProp->dwItemKind3 == IK3_GEM ) && m_pItemElem->IsCharged() == FALSE && pItemProp->dwCost > 0 )
// if( pItemProp && (pItemProp->dwItemKind1 == IK1_WEAPON || pItemProp->dwReferStat1 == IK1_ARMOR ||
// pItemProp->dwItemKind3 == IK3_GEM) && pItemProp->dwCost > 0)
if( pItemProp->dwItemKind3 == IK3_GEM && m_pItemElem->IsCharged() == FALSE && pItemProp->dwCost > 0 )
{
//Send to Server...
g_DPlay.SendMakePetFeed(m_pItemElem->m_dwObjId, (short)m_nItemCount, m_dwObjId);
}
else
g_WndMng.PutString( prj.GetText(TID_GAME_NOTFOOD), NULL, prj.GetTextColor(TID_GAME_NOTFOOD) );
}
}
else if(nID == WIDC_CANCEL || nID == WTBID_CLOSE)
Destroy();
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndPetFoodMill::OnLButtonDblClk( UINT nFlags, CPoint point )
{
CRect rect;
LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_STATIC2 );
rect = wndCtrl->rect;
if( m_pItemElem != NULL && rect.PtInRect( point ) )
{
m_pItemElem->SetExtra(0);
m_pItemElem = NULL;
}
}
BOOL CWndPetFoodMill::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
#if __VER >= 11
CWndBase* pWndFrame = pShortcut->m_pFromWnd->GetFrameWnd();
if( pWndFrame && pWndFrame->GetWndId() == APP_BAG_EX )
{
g_WndMng.OpenMessageBox( _T( prj.GetText(TID_GAME_ERROR_FOOD_MILL_POCKET) ) );
return FALSE;
}
#endif //__VER >= 11
CItemElem* pTempElem;
pTempElem = (CItemElem*)g_pPlayer->GetItemId( pShortcut->m_dwId );
LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_STATIC2 );
if( wndCtrl->rect.PtInRect( point ) )
{
if(pTempElem != NULL)
{
if(m_pItemElem != NULL)
{
if( !g_pPlayer->m_vtInfo.IsTrading( m_pItemElem ) )
m_pItemElem->SetExtra(0);
m_pItemElem = NULL;
}
SAFE_DELETE( m_pWndFoodConfrim );
m_pWndFoodConfrim = new CWndFoodConfirm(2);
m_pWndFoodConfrim->m_pItemElem = pTempElem;
m_pWndFoodConfrim->Initialize(NULL);
}
}
return TRUE;
}
void CWndPetFoodMill::SetItem(DWORD dwObjId)
{
m_dwObjId = dwObjId;
}
void CWndPetFoodMill::SetItemForFeed(CItemElem* pItemElem, int nCount)
{
if(pItemElem != NULL)
{
m_pItemElem = pItemElem;
m_nItemCount = nCount;
m_pItemElem->SetExtra( nCount );
ItemProp* pItemProp = m_pItemElem->GetProp();
if(pItemProp != NULL)
m_pTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff );
}
}
void CWndPetFoodMill::ReceiveResult(int nResult, int nCount)
{
switch(nResult)
{
case 0:
g_WndMng.PutString( prj.GetText(TID_GAME_LACKSPACE), NULL, prj.GetTextColor(TID_GAME_LACKSPACE) );
break;
case 1:
CString strtmp;
strtmp.Format(prj.GetText(TID_GAME_PETFEED_MAKE), nCount);
g_WndMng.PutString( strtmp, NULL, prj.GetTextColor(TID_GAME_PETFEED_MAKE) );
if(m_pItemElem != NULL)
{
if( !g_pPlayer->m_vtInfo.IsTrading( m_pItemElem ) )
m_pItemElem->SetExtra(0);
m_pItemElem = NULL;
}
if(m_pTexture != NULL)
m_pTexture = NULL;
break;
}
}
//////////////////////////////////////////////////////////////////////////
// CWndPetLifeConfirm
//////////////////////////////////////////////////////////////////////////
CWndPetLifeConfirm::CWndPetLifeConfirm()
{
m_nId = -1;
}
CWndPetLifeConfirm::~CWndPetLifeConfirm()
{
}
void CWndPetLifeConfirm::OnDestroy()
{
}
void CWndPetLifeConfirm::SetItem(int nId)
{
m_nId = nId;
}
void CWndPetLifeConfirm::OnDraw( C2DRender* p2DRender )
{
}
void CWndPetLifeConfirm::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 여기에 코딩하세요
CRect rect = GetClientRect();
int x = m_rectClient.Width() / 2;
int y = m_rectClient.Height() - 30;
CSize size = CSize(60,25);
CRect rect2_1( x - size.cx - 10, y, ( x - size.cx - 10 ) + size.cx, y + size.cy );
CRect rect2_2( x + 10 , y, ( x + 10 ) + size.cx, y + size.cy );
rect.DeflateRect( 10, 10, 10, 35 );
m_wndText.AddWndStyle( WBS_VSCROLL );
m_wndText.Create( WBS_NODRAWFRAME, rect, this, 0 );
m_strText = prj.GetText( TID_GAME_PET_USELIFE );
m_wndText.SetString( m_strText, 0xff000000 );
m_wndText.ResetString();
m_wndButton1.Create("YES" , 0, rect2_1, this, IDYES);
m_wndButton2.Create("NO", 0, rect2_2, this, IDNO);
m_wndButton1.SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtYes.tga" ) );
m_wndButton2.SetTexture( m_pApp->m_pd3dDevice, MakePath( DIR_THEME, "ButtNo.tga" ) );
m_wndButton1.FitTextureSize();
m_wndButton2.FitTextureSize();
MoveParentCenter();
}
// 처음 이 함수를 부르면 윈도가 열린다.
BOOL CWndPetLifeConfirm::Initialize( CWndBase* pWndParent, DWORD dwWndId )
{
// Daisy에서 설정한 리소스로 윈도를 연다.
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_MESSAGEBOX, 0, CPoint( 0, 0 ), pWndParent );
}
BOOL CWndPetLifeConfirm::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
void CWndPetLifeConfirm::OnSize( UINT nType, int cx, int cy ) \
{
CWndNeuz::OnSize( nType, cx, cy );
}
void CWndPetLifeConfirm::OnLButtonUp( UINT nFlags, CPoint point )
{
}
void CWndPetLifeConfirm::OnLButtonDown( UINT nFlags, CPoint point )
{
}
BOOL CWndPetLifeConfirm::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if( nID == IDYES )
{
//Send to Server..
if( m_nId != -1 )
g_DPlay.SendDoUseItem( MAKELONG( 0, m_nId ), NULL_ID, -1, FALSE);
}
else if( nID == IDNO )
{
//그냥 종료
}
Destroy();
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
#if __VER >= 12 // __CSC_VER12_5
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CWndPetTransEggs Class
////////////////////////////////////////////////////////////////////////////////////////////////////////////
CWndPetTransEggs::CWndPetTransEggs()
{
ResetEgg();
}
CWndPetTransEggs::~CWndPetTransEggs()
{
}
void CWndPetTransEggs::OnDestroy()
{
for(int i=0; i<MAX_TRANS_EGG; i++)
{
if(m_pItemElem[i] != NULL)
m_pItemElem[i]->SetExtra(0);
}
}
void CWndPetTransEggs::OnDraw( C2DRender* p2DRender )
{
LPWNDCTRL wndCtrl;
for(int i=0; i<MAX_TRANS_EGG; i++)
{
if(m_pItemElem[i] != NULL)
{
wndCtrl = GetWndCtrl( m_nCtrlId[i] );
m_pEggTexture->Render( p2DRender, CPoint( wndCtrl->rect.left, wndCtrl->rect.top ) );
}
}
}
void CWndPetTransEggs::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
// 여기에 코딩하세요
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_OK);
pButton->EnableWindow(FALSE);
m_pText = (CWndText*)GetDlgItem( WIDC_TEXT1 );
m_nCtrlId[0] = WIDC_STATIC1;
m_nCtrlId[1] = WIDC_STATIC2;
m_nCtrlId[2] = WIDC_STATIC3;
m_nCtrlId[3] = WIDC_STATIC4;
m_nCtrlId[4] = WIDC_STATIC5;
m_nCtrlId[5] = WIDC_STATIC6;
m_nCtrlId[6] = WIDC_STATIC7;
m_nCtrlId[7] = WIDC_STATIC8;
m_nCtrlId[8] = WIDC_STATIC9;
m_nCtrlId[9] = WIDC_STATIC10;
ItemProp* pItemProp = prj.GetItemProp( II_PET_EGG );
if(pItemProp)
m_pEggTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon), 0xffff00ff );
SetDescription(NULL);
MoveParentCenter();
}
// 처음 이 함수를 부르면 윈도가 열린다.
BOOL CWndPetTransEggs::Initialize( CWndBase* pWndParent, DWORD /*dwWndId*/ )
{
// Daisy에서 설정한 리소스로 윈도를 연다.
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_PET_TRANS_EGGS, 0, CPoint( 0, 0 ), pWndParent );
}
void CWndPetTransEggs::OnLButtonDblClk( UINT nFlags, CPoint point )
{
CRect rect;
for(int i=0; i<MAX_TRANS_EGG; i++)
{
LPWNDCTRL wndCtrl = GetWndCtrl( m_nCtrlId[i] );
if(wndCtrl)
{
rect = wndCtrl->rect;
if(rect.PtInRect( point ))
{
if(m_pItemElem[i])
{
m_pItemElem[i]->SetExtra(0);
m_pItemElem[i] = NULL;
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_OK);
pButton->EnableWindow(FALSE);
}
}
}
}
}
void CWndPetTransEggs::OnMouseWndSurface(CPoint point)
{
CRect rect;
LPWNDCTRL wndCtrl;
for(int i=0; i<MAX_TRANS_EGG; i++)
{
if(m_pItemElem[i] != NULL)
{
wndCtrl = GetWndCtrl( m_nCtrlId[i] );
rect = wndCtrl->rect;
if( rect.PtInRect( point ) )
{
ClientToScreen( &point );
ClientToScreen( &rect );
g_WndMng.PutToolTip_Item( (CItemBase*)m_pItemElem[i], point, &rect );
}
}
}
}
BOOL CWndPetTransEggs::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
CRect rect;
CItemElem* pItemElem;
pItemElem = (CItemElem*)g_pPlayer->GetItemId( pShortcut->m_dwId );
if(g_pPlayer->IsUsing(pItemElem))
{
g_WndMng.PutString( prj.GetText( TID_GAME_TRANS_EGGS_ERROR2 ), NULL, prj.GetTextColor( TID_GAME_TRANS_EGGS_ERROR2 ) );
}
else
{
if( (pItemElem->GetProp()->dwItemKind3 == IK3_EGG && pItemElem->m_pPet == NULL) ||
(pItemElem->GetProp()->dwItemKind3 == IK3_EGG && pItemElem->m_pPet && pItemElem->m_pPet->GetLevel() == PL_EGG) )
{
if( IsUsableItem( pItemElem ) )
{
for(int i=0; i<MAX_TRANS_EGG; i++)
{
LPWNDCTRL wndCtrl = GetWndCtrl( m_nCtrlId[i] );
if(wndCtrl)
{
rect = wndCtrl->rect;
if(rect.PtInRect( point ))
{
if(m_pItemElem[i] == NULL)
{
m_pItemElem[i] = pItemElem;
m_pItemElem[i]->SetExtra(m_pItemElem[i]->GetExtra()+1);
}
}
}
}
CheckFull();
}
}
else
g_WndMng.PutString( prj.GetText( TID_GAME_TRANS_EGGS_ERROR1 ), NULL, prj.GetTextColor( TID_GAME_TRANS_EGGS_ERROR1 ) );
}
return TRUE;
}
void CWndPetTransEggs::SetItem(CItemElem* pItemElem)
{
int nEmpty = -1;
for(int i=0; i<MAX_TRANS_EGG; i++)
{
if(m_pItemElem[i] == NULL)
{
nEmpty = i;
i = MAX_TRANS_EGG;
}
}
if(nEmpty != -1)
{
m_pItemElem[nEmpty] = pItemElem;
m_pItemElem[nEmpty]->SetExtra(m_pItemElem[nEmpty]->GetExtra()+1);
}
CheckFull();
}
BOOL CWndPetTransEggs::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
if( nID == WIDC_OK )
{
CTransformStuff stuff( 0 );
for(int i=0; i<MAX_TRANS_EGG; i++)
stuff.AddComponent( m_pItemElem[i]->m_dwObjId, 1 );
g_DPlay.SendTransformItem( stuff );
Destroy();
}
else if( nID == WIDC_CANCEL )
{
Destroy();
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndPetTransEggs::SetDescription( CHAR* szChar )
{
CScript scanner;
BOOL checkflag;
checkflag = scanner.Load( MakePath( DIR_CLIENT, _T( "PetTransEggs.inc" ) ));
szChar = scanner.m_pProg;
if(m_pText != NULL && checkflag)
{
m_pText->m_string.AddParsingString( szChar );
m_pText->ResetString();
}
}
void CWndPetTransEggs::ResetEgg()
{
for(int i=0; i<MAX_TRANS_EGG; i++)
m_pItemElem[i] = NULL;
}
void CWndPetTransEggs::CheckFull()
{
BOOL bFull = TRUE;
for(int i=0; i<MAX_TRANS_EGG; i++)
{
if(m_pItemElem[i] == NULL)
{
bFull = FALSE;
i = MAX_TRANS_EGG;
}
}
if(bFull)
{
CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_OK);
pButton->EnableWindow(TRUE);
}
}
#endif //__CSC_VER12_5
#endif //__CSC_VER9_1
#if __VER >= 15 // __PETVIS
////////////////////////////////////////////////////////////////////////////////////////////////////
// CWndBuffPetStatus
////////////////////////////////////////////////////////////////////////////////////////////////////
CWndBuffPetStatus::CWndBuffPetStatus( )
{
m_pPetModel = NULL;
m_pWndConfirmVis = NULL;
int i; for( i = 0; i < MAX_VIS; ++i )
m_pItemElem[ i ] = NULL;
m_pTexPetStatusBg = NULL;
m_fRadius = 0.0f;
}
CWndBuffPetStatus::~CWndBuffPetStatus( )
{
DeleteDeviceObjects();
}
HRESULT CWndBuffPetStatus::RestoreDeviceObjects()
{
CWndBase::RestoreDeviceObjects();
return S_OK;
}
HRESULT CWndBuffPetStatus::InvalidateDeviceObjects()
{
CWndBase::InvalidateDeviceObjects();
SAFE_DELETE( m_pWndConfirmVis );
int i; for( i = 0; i < MAX_VIS; ++i )
{
SAFE_DELETE( m_pItemElem[ i ] );
}
return S_OK;
}
HRESULT CWndBuffPetStatus::DeleteDeviceObjects()
{
CWndBase::DeleteDeviceObjects();
return InvalidateDeviceObjects();
}
void CWndBuffPetStatus::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
RestoreDeviceObjects();
// 장착, 게이지에 나올 캐릭터 오브젝트 설정
//Position Control
CWndStatus* pWndStatus = (CWndStatus*)GetWndBase( APP_STATUS1 );
if(pWndStatus != NULL)
{
CRect rectRoot = pWndStatus->GetWndRect();
CRect rect = GetWindowRect();
int x = rectRoot.right;
int y = rectRoot.top;
CRect kWRect;
CWndWorld* pWndWorld = (CWndWorld*)g_WndMng.GetWndBase( APP_WORLD );
if( pWndWorld )
{
kWRect = pWndWorld->GetClientRect( );
if( ( x + rect.Width() ) > kWRect.right )
x = rectRoot.left - rect.Width();
}
Move( CPoint(x, y));
}
else
{
CRect rectRoot = m_pWndRoot->GetLayoutRect();
CPoint point( rectRoot.left+192, rectRoot.top );
Move( point );
}
m_nCtrlId[0] = WIDC_BUFFPET_SLOT1;
m_nCtrlId[1] = WIDC_BUFFPET_SLOT2;
m_nCtrlId[2] = WIDC_BUFFPET_SLOT3;
m_nCtrlId[3] = WIDC_BUFFPET_SLOT4;
m_nCtrlId[4] = WIDC_BUFFPET_SLOT5;
m_nCtrlId[5] = WIDC_BUFFPET_SLOT6;
m_nCtrlId[6] = WIDC_BUFFPET_SLOT7;
m_nCtrlId[7] = WIDC_BUFFPET_SLOT8;
m_nCtrlId[8] = WIDC_BUFFPET_SLOT9;
m_pTexPetStatusBg = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "BuffpetStatusBg .tga"), 0xffff00ff, TRUE );
}
BOOL CWndBuffPetStatus::Initialize(CWndBase* pWndParent,DWORD dwWndId)
{
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_BUFFPET_STATUS, 0, CPoint( 0, 0 ), pWndParent );
}
/*void CWndBuffPetStatus::PaintFrame( C2DRender* p2DRender )
{
if(!IsValidObj(g_pPlayer))
return;
CRect rect = GetWindowRect();
if( g_pPlayer->HasActivatedVisPet() )
{
RenderWnd();
CD3DFont* pOldFont = p2DRender->GetFont();
p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndTitle );
p2DRender->TextOut( 10, 4, m_strTitle, m_dwColor );
p2DRender->SetFont( pOldFont );
}
}*/
void CWndBuffPetStatus::OnDraw(C2DRender* p2DRender)
{
if( g_pPlayer == NULL )
return;
//Draw slots
DrawSlotItems( p2DRender );
if( !m_pPetModel )
return;
CRect rect = GetClientRect();
int nWidthClient = GetClientRect().Width() - 110;
CRect rectTemp;
LPWNDCTRL lpFace = GetWndCtrl( WIDC_CUSTOM1 );
CPoint point;
point = CPoint( lpFace->rect.left-12, lpFace->rect.top-22 );
if(m_pTexPetStatusBg != NULL)
m_pTexPetStatusBg->Render( p2DRender, point );
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 ) ;
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
// pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
// pd3dDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_ARGB( 255, 255,255,255) );
// 뷰포트 세팅
D3DVIEWPORT9 viewport;
viewport.X = p2DRender->m_ptOrigin.x + lpFace->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpFace->rect.top;
viewport.Width = lpFace->rect.Width();
viewport.Height = lpFace->rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
// 프로젝션
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
FLOAT fAspect = ((FLOAT)viewport.Width) / (FLOAT)viewport.Height;
FLOAT fov = D3DX_PI/4.0f;//796.0f;
FLOAT h = cos(fov/2) / sin(fov/2);
FLOAT w = h * fAspect;
D3DXMatrixOrthoLH( &matProj, w, h, CWorld::m_fNearPlane - 0.01f, CWorld::m_fFarPlane );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
D3DXMATRIX matView;
// 월드
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot1, matRot2;
D3DXMATRIXA16 matTrans;
// 초기화
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matRot1);
D3DXMatrixIdentity(&matRot2);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
//펫 종류에 따라 설정.
D3DXVECTOR3 vecPos;
D3DXVECTOR3 vecLookAt;
float fScale = 1.0f;
CMover* pMoverPet = prj.GetMover( g_pPlayer->GetEatPetId( ) );
if( !pMoverPet )
return;
CModelObject* pModel = (CModelObject *)pMoverPet->m_pModel;
CObject3D* pObj3D = pModel->GetObject3D( );
if( !pObj3D )
return;
//CModelObject에는 이벤트 좌표가 없는데 CObject3D는 있고?
vecPos = pObj3D->m_vEvent[ 0 ];
// mdldyna.inc에서 스케일을 조정한경우 그에 맞게 보정을 해주는데, 어떤 원리인지 내가 했지만 이상함. 나중에 다시 정확히 잡아볼까?
float fModelScale = pModel->m_pModelElem->m_fScale;
if( fModelScale < 1.0f && fModelScale > 0.001f )
vecPos *= ( fModelScale - fModelScale * (0.5f + ( 1.0f - fModelScale ) * 0.01f ) ); //스케일 변동치가 클수록
else if ( fModelScale > 1.0f )
vecPos *= ( fModelScale - fModelScale * (0.9f + fModelScale * 0.01f) );
m_fRadius = pModel->GetRadius( );
vecPos.x += 0.5f;
vecPos.y += 1.8f;
vecPos.z -= ( 3.0f ); //* fRadius );
vecLookAt.x = -0.24f;
vecLookAt.y = 0.28f;
vecLookAt.z = 1.0f;
fScale = (1 / m_fRadius ) * 1.5f; // ( 2.0f * fRadius );
D3DXMatrixScaling(&matScale, fScale, fScale, fScale);
D3DXMatrixLookAtLH( &matView, &vecPos, &vecLookAt, &D3DXVECTOR3(0.0f,1.0f,0.0f) );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld,&matRot1);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
// 랜더링
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, CWorld::m_dwBgColor, 1.0f, 0 ) ;
::SetTransformView( matView );
::SetTransformProj( matProj );
//gmpbigsun : 윈도 페이스 고정라이트
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
m_pPetModel->SetTextureEx( m_pPetModel->m_pModelElem->m_nTextureEx );
m_pPetModel->Render(pd3dDevice, &matWorld);
// SetDiffuse( 0.0f, 0.0f, 0.0f );
// SetAmbient( 1.0f, 1.0f, 1.0f );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
}
BOOL CWndBuffPetStatus::Process()
{
if(!IsValidObj(g_pPlayer))
return FALSE;
// 장착, 게이지에 나올 캐릭터 오브젝트 설정
if( g_pPlayer->HasActivatedVisPet( ) )
{
CMover* pMyBuffPet = NULL;
if( !m_pPetModel )
{
pMyBuffPet = prj.GetMover( g_pPlayer->GetEatPetId( ) );
if( pMyBuffPet )
{
lstrcpy( pMyBuffPet->m_szCharacterKey, "MaFl_BuffPet" );
m_pPetModel = (CModelObject*)pMyBuffPet->GetModel( ); // 버프펫이 생성됐다면 모델공유
//버프펫 모델이 준비되면 타이틀 (펫이름) 세팅!
m_strTitle = pMyBuffPet->GetName( );
}
else
return TRUE;
}
}
return TRUE;
}
void CWndBuffPetStatus::UpdateVisState( )
{
if( g_pPlayer )
m_cVisStates = g_pPlayer->GetValidVisTable( g_pPlayer->GetVisPetItem( ) );
}
BOOL CWndBuffPetStatus::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
CWndBase* pWndFrame = pShortcut->m_pFromWnd->GetFrameWnd();
if( !pWndFrame )
{
assert( 0 );
return FALSE;
}
int selectedSlot = GetSlotIndexByPoint( point );
if( selectedSlot < 0 )
return FALSE;
if( !IsFreeSlot( selectedSlot ) )
return FALSE;
if( APP_INVENTORY == pWndFrame->GetWndId( ) ) // 인벤에서 온 아이템은 조건검사
{
CItemElem* pItem = g_pPlayer->m_Inventory.GetAtId( pShortcut->m_dwId );
if( !IsUsableItem( pItem ) )
return FALSE;
if( !pItem->GetProp( )->IsVis( ) )
return FALSE;
}
if( pWndFrame->GetWndId( ) != APP_INVENTORY )
{
if( APP_BUFFPET_STATUS == pWndFrame->GetWndId( ) ) //같은 창 내에서 이동일 경우
{
int selectedSlot = GetSlotIndexByPoint( point );
if( selectedSlot < 0 )
return FALSE;
if( pShortcut->m_dwData == selectedSlot ) // 아이콘을 같은자리에 놓았다.
return FALSE;
//스왑요청
g_DPlay.SendSwapVis( pShortcut->m_dwData, selectedSlot );
}
return TRUE;
}
//확인창 띄워주고 확인창에서 OK시 SendDoUseItem
if( APP_INVENTORY == pWndFrame->GetWndId( ) )
DoModal_ConfirmQuestion( pShortcut->m_dwId, g_pPlayer->GetId(), ((CItemElem*)pShortcut->m_dwData)->m_dwItemId );
else
DoModal_ConfirmQuestion( pShortcut->m_dwId, g_pPlayer->GetId(), pShortcut->m_dwIndex );
return TRUE;
}
BOOL CWndBuffPetStatus::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
BOOL CWndBuffPetStatus::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndBuffPetStatus::OnDestroy()
{
for(int i=0; i<MAX_VIS; i++)
{
// if(m_pItemElem[i] != NULL)
// m_pItemElem[i]->SetExtra(0);
SAFE_DELETE( m_pItemElem[ i ] );
}
}
//비스는 필요비스의 활성화 여부에 따라 자기의 활성화 여부가 결정되므로
//재귀검사로 Leaf까지 탐색한다.
//주석화 되있는 부분은 단순히 필요비스가 있다면 모든 필요비스를 찾아서 장착되어있는지 검사한다.
//현재는 서버와 같은 함수를 사용함.
/*BOOL IsEquipedVis( DWORD visIndex )
{
CItemElem* pPetItem = g_pPlayer->GetVisPetItem( );
if( !pPetItem )
return FALSE;
// gmpbigsun: 비스를 착용하고 있는가?
int i; for( i = 0; i < MAX_VIS; ++i )
{
DWORD dwIndex = pPetItem->GetPiercingItem( i );
if( dwIndex == visIndex )
return TRUE;
}
return FALSE;
}
BOOL IsValidIndex( DWORD dwIndex )
{
return ( 0 != dwIndex && NULL_ID != dwIndex );
}
BOOL GetRequireVis( vector< DWORD >& cNeedVises, DWORD visIndex )
{
if( !IsValidIndex( visIndex ) )
return FALSE;
ItemProp* pProp = prj.GetItemProp( visIndex );
if( !pProp )
return FALSE;
DWORD dwNeeds[2] = { pProp->dwReferTarget1, pProp->dwReferTarget2 };
BOOL bRequire1 = TRUE;
BOOL bRequire2 = TRUE;
cNeedVises.push_back( visIndex );
if( !IsValidIndex( dwNeeds[ 0 ] ) && !IsValidIndex( dwNeeds[ 1 ] ) ) // 필요비스가 없다면
return TRUE;
if( IsValidIndex( dwNeeds[ 0 ] ) ) //필요비스가 있다!
{
cNeedVises.push_back( dwNeeds[ 0 ] );
bRequire1 = GetRequireVis( cNeedVises, dwNeeds[ 0 ] ); //필요비스 저장
}
if( !bRequire1 )
return FALSE;
if( IsValidIndex( dwNeeds[ 1 ] ) )
{
cNeedVises.push_back( dwNeeds[ 1 ] );
bRequire2 = GetRequireVis( cNeedVises, dwNeeds[ 1 ] );
}
if( !bRequire2 )
return FALSE;
if( bRequire1 && bRequire2 )
return TRUE;
return TRUE;
}
BOOL IsEquipedRequireVis( CItemElem* pPetItem, DWORD visIndex, BOOL bSelfCheck )
{
//gmpbigsun: 해당 비스의 필요 비스를 모두 착용하고 있고 활성화 되어 있는가?
//algorithm : 필요 비스에 대한 정보를 모은후 모두 장착되어있는지 검사
if( !IsValidIndex( visIndex ) )
return FALSE;
ItemProp* pProp = prj.GetItemProp( visIndex );
if( !pProp )
return FALSE;
vector< DWORD > cNeedVis;
if( bSelfCheck )
cNeedVis.push_back( visIndex );
GetRequireVis( cNeedVis, pProp->dwReferTarget1 );
GetRequireVis( cNeedVis, pProp->dwReferTarget2 );
for( vector< DWORD >::iterator iter = cNeedVis.begin(); iter != cNeedVis.end(); ++iter )
{
if( !IsEquipedVis( *iter ) )
return FALSE;
}
return TRUE;
}*/
void CWndBuffPetStatus::DrawSlotItems( C2DRender* p2DRender )
{
if( !g_pPlayer )
return;
CItemElem* pItem = g_pPlayer->GetVisPetItem();
if( !pItem )
return;
int nAvailableSlot = pItem->GetPiercingSize( );
if( nAvailableSlot > MAX_VIS )
return;
UpdateVisState( );
LPWNDCTRL wndCtrl = NULL;
for( int i=0; i<MAX_VIS; ++i )
{
if( i < nAvailableSlot )
{
DWORD dwItemIndex = pItem->GetPiercingItem( i );
ItemProp* pProp = prj.GetItemProp( dwItemIndex );
if( !pProp )
continue;
m_pTexture[ i ] = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pProp->szIcon), 0xffff00ff );
if(m_pTexture[ i ] != NULL)
{
DWORD color = ( m_cVisStates[i] == SUCCSESS_NEEDVIS ? 0xffffffff : 0x4fffffff );
wndCtrl = GetWndCtrl( m_nCtrlId[i] );
if( wndCtrl )
{
CPoint pt2 = CPoint( wndCtrl->rect.left, wndCtrl->rect.top );
m_pTexture[ i ]->Render2( p2DRender, CPoint( wndCtrl->rect.left, wndCtrl->rect.top ), color );
}
}
}
else
{
//사용불가능 슬롯
wndCtrl = GetWndCtrl( m_nCtrlId[i] );
CTexture* pTexClosed = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ICON, "Icon_Lock.dds" ), 0xffff00ff );
if( pTexClosed )
pTexClosed->Render( p2DRender, CPoint( wndCtrl->rect.left, wndCtrl->rect.top ) );
}
}
}
BOOL CWndBuffPetStatus::DoModal_ConfirmQuestion( DWORD dwItemId, OBJID dwObjid, DWORD dwIndex, int nSlot, CWndConfirmVis::ConfirmVisSection eSection )
{
SAFE_DELETE( m_pWndConfirmVis );
m_pWndConfirmVis = new CWndConfirmVis;
m_pWndConfirmVis->m_dwItemId = dwItemId;
m_pWndConfirmVis->m_objid = dwObjid;
m_pWndConfirmVis->m_nSlot = nSlot;
m_pWndConfirmVis->m_eSection = eSection;
m_pWndConfirmVis->m_dwItemIndex = dwIndex;
m_pWndConfirmVis->Initialize( this, APP_CONFIRM_ENTER );
return TRUE;
}
int CWndBuffPetStatus::GetSlotIndexByPoint( const CPoint& point )
{
LPWNDCTRL wndCtrl = NULL;
CRect rect;
int i; for( i = 0; i < MAX_VIS; ++i )
{
wndCtrl = GetWndCtrl( m_nCtrlId[i] ); // 슬롯으로 만들어진 윈도우에 대하여
rect = wndCtrl->rect;
if( rect.PtInRect( point ) )
return i;
}
return -1;
}
void CWndBuffPetStatus::OnLButtonDown( UINT nFlags, CPoint point )
{
//해당 슬롯을 판별해서 정보를 shortcut에 넣어준다.
LPWNDCTRL wndCtrl = NULL;
CRect rect;
int selectedSlot = GetSlotIndexByPoint( point );
if( selectedSlot < 0 )
return;
CItemElem* pItem = g_pPlayer->GetVisPetItem();
if( !pItem )
return;
DWORD dwItemIndex = pItem->GetPiercingItem( selectedSlot ); // 클릭을 했으나 비스가 없는 슬롯은 패스
if( 0 == dwItemIndex )
return;
assert( selectedSlot >= 0 && selectedSlot < MAX_VIS );
assert( m_pTexture[ selectedSlot ] );
m_GlobalShortcut.m_pFromWnd = this;
m_GlobalShortcut.m_dwShortcut = SHORTCUT_ITEM;
m_GlobalShortcut.m_dwType = ITYPE_ITEM;
m_GlobalShortcut.m_dwId = 0;
m_GlobalShortcut.m_dwIndex = dwItemIndex;
m_GlobalShortcut.m_pTexture = m_pTexture[ selectedSlot ];
m_GlobalShortcut.m_dwData = selectedSlot;
}
void CWndBuffPetStatus::OnLButtonDblClk( UINT nFlags, CPoint point)
{
//파괴
int selectedSlot = GetSlotIndexByPoint( point );
if( selectedSlot < 0 )
return;
CItemElem* pItem = g_pPlayer->GetVisPetItem();
if( !pItem )
return;
DWORD dwItemIndex = pItem->GetPiercingItem( selectedSlot ); // 클릭을 했으나 비스가 없는 슬롯은 패스
if( 0 == dwItemIndex )
return;
DoModal_ConfirmQuestion( 0, 0, dwItemIndex, selectedSlot, CWndConfirmVis::CVS_UNEQUIP_VIS );
}
BOOL CWndBuffPetStatus::IsVisItem( DWORD index )
{
ItemProp* pProp = prj.GetItemProp( index );
if( !pProp )
return FALSE;
return pProp->IsVis();
}
BOOL CWndBuffPetStatus::IsFreeSlot( const int index )
{
CItemElem* pItem = g_pPlayer->GetVisPetItem();
if( !pItem )
return FALSE;
int nAvailableSlot = pItem->GetPiercingSize( );
return ( index < nAvailableSlot );
}
void CWndBuffPetStatus::OnMouseWndSurface( CPoint point )
{
CRect rect;
LPWNDCTRL wndCtrl = NULL;
CItemElem* pItem = g_pPlayer->GetVisPetItem( );
assert( pItem );
if( pItem->GetPiercingSize( ) == 0 )
return;
for(int i=0; i<MAX_VIS; i++)
{
wndCtrl = GetWndCtrl( m_nCtrlId[i] );
rect = wndCtrl->rect;
if( rect.PtInRect( point ) )
{
ClientToScreen( &point );
ClientToScreen( &rect );
DWORD dwIndex = pItem->GetPiercingItem( i );
if( 0 != dwIndex )
{
if( NULL == m_pItemElem[ i ] )
m_pItemElem[ i ] = new CItemElem;
m_pItemElem[ i ]->m_dwItemId = dwIndex;
time_t endTime = pItem->GetVisKeepTime( i );
//DWORD remainTime = endTime - timeGetTime( );
m_pItemElem[ i ]->m_dwKeepTime = endTime;
}else
{
SAFE_DELETE( m_pItemElem[ i ] );
continue;
}
g_WndMng.PutToolTip_Item( (CItemBase*)m_pItemElem[i], point, &rect );
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//CWndConfirmVis : 비스 꼽고 뺄때 확인창
//////////////////////////////////////////////////////////////////////////////////////////////////
CWndConfirmVis::CWndConfirmVis()
{
m_dwItemId = NULL_ID;
m_objid = NULL_ID;
m_nSlot = 0;
m_dwItemIndex = 0;
m_eSection = CVS_EQUIP_VIS;
}
CWndConfirmVis::~CWndConfirmVis()
{
}
void CWndConfirmVis::OnDraw( C2DRender* p2DRender )
{
}
void CWndConfirmVis::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
CWndButton* pOk = (CWndButton*)GetDlgItem( WIDC_BUTTON1 );
CWndButton* pCancel = (CWndButton*)GetDlgItem( WIDC_BUTTON2 );
CWndEdit* pEdit = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
AddWndStyle( WBS_MODAL );
pOk->SetDefault( TRUE );
ItemProp* pProp = prj.GetItemProp( m_dwItemIndex );
assert( pProp );
if( !pProp )
return;
CWndText* pText = ( CWndText* )GetDlgItem( WIDC_TEXT1 );
CString strTitle;
switch( m_eSection )
{
case CVS_EQUIP_VIS : strTitle.Format( GETTEXT( TID_GAME_BUFFPET_EQUIP ), pProp->szName ); break;
case CVS_UNEQUIP_VIS : strTitle.Format( GETTEXT( TID_GAME_BUFFPET_CANCEL ), pProp->szName ); break;
case CVS_EQUIP_VISKEY : // 비스 슬롯 확장 키 쓸려고 할때
{
MoverProp* pProp = NULL;
if( g_pPlayer )
{
CMover* pPet = prj.GetMover( g_pPlayer->GetEatPetId( ) );
if( pPet )
pProp = pPet->GetProp( );
}
if( pProp )
strTitle.Format( GETTEXT( TID_GAME_BUFFPET_KET01 ), pProp->szName );
}break;
case CVS_PICKUP_TO_BUFF:
strTitle = GETTEXT( TID_GAME_PET_TRAN ); // 소환되어 있는 픽업펫 버프펫으로 변환?
break;
#ifdef __PROTECT_AWAKE
case ETC_PROTECT_AWAKE:
strTitle = GETTEXT( TID_GAME_REGARDLESS_USE01 ); //"진짜러 각성보호 쓸래염? 의 아이디 필요";
break;
#endif //AWAKE_PROTECT
}
pText->SetString( strTitle );
//에디트창을 안보이는곳으로 보내버리고 ENTER받을준비
pEdit->Move( -100, -100 );
pEdit->SetFocus( );
}
BOOL CWndConfirmVis::Initialize( CWndBase* pWndParent, DWORD dwWndId )
{
InitDialog( g_Neuz.GetSafeHwnd(), APP_CONFIRM_ENTER, WBS_KEY, 0, pWndParent );
MoveParentCenter();
return TRUE;
}
BOOL CWndConfirmVis::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
return CWndNeuz::OnCommand( nID, dwMessage, pWndBase );
}
void CWndConfirmVis::OnLButtonUp( UINT nFlags, CPoint point )
{
}
void CWndConfirmVis::OnLButtonDown( UINT nFlags, CPoint point )
{
}
void CWndConfirmVis::SendEquipPacket( )
{
switch( m_eSection )
{
case CVS_EQUIP_VIS: g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, m_dwItemId ), m_objid ); break;
case CVS_UNEQUIP_VIS : g_DPlay.SendRemoveVis( m_nSlot ); break;
case CVS_EQUIP_VISKEY : g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, m_dwItemId ), m_objid ); break;
case CVS_PICKUP_TO_BUFF : g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, m_dwItemId ), m_objid ); break;
#ifdef __PROTECT_AWAKE
case ETC_PROTECT_AWAKE: g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, m_dwItemId ), m_objid ); break;
#endif //__PROTECT_AWAKE
default :
assert( 0 ); break;
}
}
BOOL CWndConfirmVis::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
// 엔터 입력 처리
if( WIDC_EDIT1 == nID && EN_RETURN == message )
{
SendEquipPacket( );
Destroy();
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
if( message == WNM_CLICKED )
{
switch(nID)
{
case WIDC_BUTTON2:
Destroy();
break;
case WIDC_BUTTON1:
SendEquipPacket( );
Destroy();
break;
}
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
#endif //#ifdef __PETVIS | [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] | [
[
[
1,
2966
]
]
] |
ce48035d0f9f2c0b3613e43e8129909d2566dad8 | de98f880e307627d5ce93dcad1397bd4813751dd | /3libs/ut/include/OXItemTipWnd.h | 3eae9a24beb42ca42f070016f07504446caf409b | [] | 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 | UTF-8 | C++ | false | false | 4,575 | h |
// Version: 9.3
#if !defined(_OXITEMTIPWND_H_)
#define _OXITEMTIPWND_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "OXDllExt.h"
// generic constant used to define that none of custom color was set
#define ID_OX_COLOR_NONE 0xffffffff
#define ID_OXITEMTIP_TIMER 221
#define ID_OXITEMTIP_TIMER_DELAY 100
// COXItemTipWnd.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// COXItemTipWnd window. Class to display item tips. Window functionality is
// similar to tool tip window. It is used by COXItemWnd class to display item
// tips. But it can be used directly by calling it's public functions.
//
// To use this class you have to:
//
// 1) call Create(CWnd* pParentWnd, HBRUSH hbrBackground=NULL) function.
// You can use hbrBackground argument to provide the background color you
// preffer
//
// 2) call Display(CRect& rect, CString sText, int nOffset,
// int nAlignment=DT_LEFT, CFont* m_pFont=NULL,
// COLORREF clrText=ID_OX_COLOR_NONE,
// COLORREF clrBackground=ID_OX_COLOR_NONE)
// function to display an item tip. You have to set the coordinates of
// item tip window using rect argument; text to be drawn is in sText;
// offset from left and right sides of item tip window to draw text;
// alignment of text: DT_LEFT, DT_CENTER or DT_RIGHT; font to draw text;
// color to draw text and color of background.
//
// 3) call Hide() to hide item tip window
//
//
class OX_CLASS_DECL COXItemTipWnd : public CWnd
{
// Construction
public:
// --- In :
// --- Out :
// --- Returns:
// --- Effect : Constructs the object
COXItemTipWnd();
// Data
protected:
// parent window
CWnd* m_pParentWnd;
// timer ID
UINT_PTR m_nTimerID;
//////////////////////////////////////////////
// data for inner use
// Attributes
public:
// Operations
public:
// --- In : pParentWnd - pointer to parent window
// hbrBackground - brush to be used to fill background
// --- Out :
// --- Returns: TRUE if item tip window was successfully created, or FALSE
// otherwise
// --- Effect : creates item tip window
BOOL Create(CWnd* pParentWnd, HBRUSH hbrBackground=NULL);
// --- In : rect - the size of item tip window
// sText - text to be drawn in item tip window
// nAlignment - allignment of text to draw, can be:
// DT_LEFT
// DT_CENTER
// DT_RIGHT
// pFont - font to draw text
// clrText - color to draw text
// clrBackground - color to fill item tip window background
// --- Out :
// --- Returns:
// --- Effect : displays item tip
virtual void Display(CRect& rect, CString sText, int nOffset,
int nAlignment=DT_LEFT, CFont* pFont=NULL,
COLORREF clrText=ID_OX_COLOR_NONE,
COLORREF clrBackground=ID_OX_COLOR_NONE);
// --- In : pMsg - pointer to MSG structure that can be sent to pWnd
// on hiding item tip window
// pWnd - pointer to window to recieve pMsg
// --- Out :
// --- Returns:
// --- Effect : hides item tip. Hiding can be caused by different reasons,
// e.g by user clicking on item tip window. In that case you'd
// be probably interested in sending WM_LBUTTONDOWN to parent
// window, that is accomplished by using pMSG and pWnd arguments.
virtual void Hide(MSG* pMsg=NULL, CWnd* pWnd=NULL);
// retrieves coordinates of the monitor to which the specified point
// (in screen coordinates) belongs
static CRect GetMonitorRectFromPoint(const CPoint& ptHitTest, BOOL bOnlyWorkArea);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COXItemTipWnd)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
public:
// --- In :
// --- Out :
// --- Returns:
// --- Effect : Destroys the object
virtual ~COXItemTipWnd();
// implementation
protected:
// helper function, determines if pWndChild is descendant of pWndParent
BOOL IsDescendant(CWnd* pWndParent, CWnd* pWndChild);
// Generated message map functions
protected:
//{{AFX_MSG(COXItemTipWnd)
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(_OXITEMTIPWND_H_)
| [
"[email protected]"
] | [
[
[
1,
153
]
]
] |
477ea2a2b1859bcf006260da59fce8b5216aa4cc | 59ce53af7ad5a1f9b12a69aadbfc7abc4c4bfc02 | /src/SkinResEditor/SkinResEditor.cpp | ee85b015b3641c0320b79b41b2b1e1fe51c83c14 | [] | no_license | fingomajom/skinengine | 444a89955046a6f2c7be49012ff501dc465f019e | 6bb26a46a7edac88b613ea9a124abeb8a1694868 | refs/heads/master | 2021-01-10T11:30:51.541442 | 2008-07-30T07:13:11 | 2008-07-30T07:13:11 | 47,892,418 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,966 | cpp | // SkinResEditor.cpp : main source file for SkinResEditor.exe
//
#include "stdafx.h"
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlctrlw.h>
#include "resource.h"
#include "aboutdlg.h"
#include "MainFrm.h"
extern HWND g_hWndFrame;
KSGUI::CSkinAppModule _Module;
KSGUI::SkinRichEditInit _RichEditInit;
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CMainFrame wndMain;
SkinWindowCreator::Instance().AddSkinCreator(
KSGUI::skinxmlhtmlctrl::GetSkinWndClassName(),
KSGUI::CSkinHtmlCtrl::SkinCreate_Static);
if(wndMain.CreateEx(NULL,
0,
ATL::CFrameWinTraits::GetWndStyle(0) | WS_MAXIMIZE ,
0) == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
g_hWndFrame = wndMain;
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
return nRet;
}
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
SkinHookMouse::instance().InitHookMouse();
int nRet = Run(lpstrCmdLine, nCmdShow);
SkinHookMouse::instance().UnitHookMouse();
_Module.Term();
::CoUninitialize();
return nRet;
}
| [
"[email protected]"
] | [
[
[
1,
79
]
]
] |
ab7183b34917fab362d174c1f8511672c9b22575 | f90b1358325d5a4cfbc25fa6cccea56cbc40410c | /src/GUI/proRataSearchDock.cpp | 906637920b09aa404cea3fcf7425e44bdaaf8a3f | [] | no_license | ipodyaco/prorata | bd52105499c3fad25781d91952def89a9079b864 | 1f17015d304f204bd5f72b92d711a02490527fe6 | refs/heads/master | 2021-01-10T09:48:25.454887 | 2010-05-11T19:19:40 | 2010-05-11T19:19:40 | 48,766,766 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 968 | cpp |
#include "proRataSearchDock.h"
ProRataSearchDock::ProRataSearchDock( QWidget* parent, Qt::WFlags fl )
: QDockWidget( parent, fl )
{
buildUI();
}
ProRataSearchDock::~ProRataSearchDock()
{
}
void ProRataSearchDock::buildUI()
{
QWidget *qwTopLevel = new QWidget(this);
findLayout = new QHBoxLayout;
findLayout->setMargin( 0 );
findLayout->setSpacing( 0 );
qlFindLabel = new QLabel;
qlFindLabel->setText( tr("Find:" ) );
findLayout->addWidget( qlFindLabel );
qleSearchString = new QLineEdit;
qleSearchString->setMinimumWidth( 40 );
findLayout->addWidget( qleSearchString );
qpbSearchButton = new QPushButton;
qpbSearchButton->setText( tr( "Search" ) );
findLayout->addWidget( qpbSearchButton );
qpbShowAll = new QPushButton;
qpbShowAll->setText( tr( "Show All" ) );
findLayout->addWidget( qpbShowAll );
findLayout->addStretch();
qwTopLevel->setLayout( findLayout );
setWidget( qwTopLevel );
}
| [
"chongle.pan@c58cc1ec-c975-bb1e-ac29-6983d7497d3a"
] | [
[
[
1,
43
]
]
] |
f6eaac43677e0b20103c457b4406b0e415e5e0d8 | 4d01363b089917facfef766868fb2b1a853605c7 | /src/SceneObjects/Entities/HumanPlayer.h | 6fb8248aa5e73d787e4e33ec3002d0e1bc03e7f9 | [] | no_license | FardMan69420/aimbot-57 | 2bc7075e2f24dc35b224fcfb5623083edcd0c52b | 3f2b86a1f86e5a6da0605461e7ad81be2a91c49c | refs/heads/master | 2022-03-20T07:18:53.690175 | 2009-07-21T22:45:12 | 2009-07-21T22:45:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 116 | h | #include "Player.h"
class HumanPlayer : public Player
{
private:
public:
HumanPlayer()
{
}
};
| [
"daven.hughes@92c3b6dc-493d-11de-82d9-516ade3e46db"
] | [
[
[
1,
14
]
]
] |
69fbdb91f9e51f918129939f7ed2f94fa49eae40 | 5fb9b06a4bf002fc851502717a020362b7d9d042 | /developertools/GumpEditor/diagram/DiagramEditor/DiagramEditor.h | 64242681b9ec6d5ff5a801494422e1b63d056836 | [] | no_license | bravesoftdz/iris-svn | 8f30b28773cf55ecf8951b982370854536d78870 | c03438fcf59d9c788f6cb66b6cb9cf7235fbcbd4 | refs/heads/master | 2021-12-05T18:32:54.525624 | 2006-08-21T13:10:54 | 2006-08-21T13:10:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,524 | h | #if !defined(AFX_DIAGRAMEDITOR_H__B8C35A07_CDC4_4D85_9FAE_2C9BE81EA911__INCLUDED_)
#define AFX_DIAGRAMEDITOR_H__B8C35A07_CDC4_4D85_9FAE_2C9BE81EA911__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DiagramEditor.h : header file
//
#include "DiagramEntity.h"
#include "DiagramEntityContainer.h"
#include "DiagramMenu.h"
#include <afxtempl.h>
// Current mouse mode
#define MODE_NONE 0
#define MODE_RUBBERBANDING 1
#define MODE_MOVING 2
#define MODE_RESIZING 3
#define MODE_DRAWING 4
#define MODE_BGRESIZING 5
// Restraint modes
#define RESTRAINT_NONE 0
#define RESTRAINT_VIRTUAL 1
#define RESTRAINT_MARGIN 2
#define KEY_NONE 0
#define KEY_ARROW 1 // Arrow keys
#define KEY_PGUPDOWN 4 // Pg up & pg down
#define KEY_DELETE 8 // Delete key
#define KEY_ESCAPE 16 // Escape key
#define KEY_INSERT 32 // Insert key
#define KEY_PLUSMINUS 64 // Plus- and minus key
#define KEY_CTRL 128 // Ctrl+A,Z,X,C,V, Enter
#define KEY_ALL 0xFFFFFFFF
/////////////////////////////////////////////////////////////////////////////
// CDiagramEditor window
class CDiagramEditor : public CWnd
{
friend class CDiagramMenu;
public:
// Construction/destruction/initialization
CDiagramEditor();
virtual ~CDiagramEditor();
virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, CDiagramEntityContainer* data = NULL );
void Clear();
void SetDiagramEntityContainer( CDiagramEntityContainer* objs );
CDiagramEntityContainer* GetDiagramEntityContainer() const;
// Visuals
virtual void Draw( CDC* dc, CRect rect ) const;
virtual void Print( CDC* dc, CRect rect, double zoom );
protected:
virtual void EraseBackground( CDC* dc, CRect rect ) const;
virtual void DrawBackground( CDC* dc, CRect rect, double zoom ) const;
virtual void DrawGrid( CDC* dc, CRect rect, double zoom ) const;
virtual void DrawMargins( CDC* dc, CRect rect, double zoom ) const;
virtual void DrawObjects( CDC* dc, double zoom ) const;
virtual void DrawSelectionMarkers( CDC* dc ) const;
public:
// Property Accessors
void SetVirtualSize( const CSize& size );
CSize GetVirtualSize() const;
void SetBackgroundColor( COLORREF col );
COLORREF GetBackgroundColor();
void SetNonClientColor( COLORREF col );
void ShowGrid( BOOL grid );
BOOL IsGridVisible() const;
void SetGridColor( COLORREF col );
COLORREF GetGridColor() const;
void SetGridPenStyle(int style );
int GetGridPenStyle() const;
void SetGridSize( CSize size );
CSize GetGridSize() const;
void SetSnapToGrid( BOOL snap );
BOOL GetSnapToGrid() const;
void SetResize( BOOL bgresize );
BOOL GetResize() const;
void SetResizeZone( BOOL bgresize );
int GetResizeZone() const;
void SetMargins( int left, int top, int right, int bottom );
void GetMargins( int& left, int& top, int& right, int& bottom ) const;
void SetMarginColor( COLORREF marginColor );
COLORREF GetMarginColor() const;
void ShowMargin( BOOL show );
BOOL IsMarginVisible() const;
BOOL GetRestraints() const;
void SetRestraints( BOOL restraint );
BOOL GetMultidraw() const;
void SetMultidraw( BOOL multidraw );
void SetZoom( double zoom );
double GetZoom() const;
void SetZoomFactor( double zoomfactor );
double GetZoomFactor() const;
void SetZoomMax( double zoommax );
double GetZoomMax() const;
void SetZoomMin( double zoommin );
double GetZoomMin() const;
CSize GetMarkerSize() const;
void SetMarkerSize( CSize markerSize );
UINT GetKeyboardInterface() const;
void SetKeyboardInterface( int keyInterface );
void SetPopupMenu( CDiagramMenu* popupmenu );
CDiagramMenu* GetPopupMenu() const;
BOOL IsModified() const;
void SetModified( BOOL dirty );
// Data access
void AddObject( CDiagramEntity* obj );
int GetObjectCount() const;
int GetSelectCount() const;
CDiagramEntity* GetObject( int index ) const;
BOOL IsDrawing() const;
CDiagramEntity* GetSelectedObject() const;
BOOL IsAnyObjectSelected() const;
virtual void StartDrawingObject( CDiagramEntity* obj );
// Group object operations
void New();
void SelectAll();
void UnselectAll();
void SelectObject(CDiagramEntity* obj, BOOL selected);
void DeleteAll();
void DeleteAllSelected();
void LeftAlignSelected();
void RightAlignSelected();
void TopAlignSelected();
void BottomAlignSelected();
void MakeSameSizeSelected();
// Copy/paste
void Cut();
void Copy();
void Paste();
void Undo();
// Single object operations
void Duplicate();
void Up();
void Down();
void Front();
void Bottom();
// order.GetSize() == m_objs.GetSize()
void Reorder( const CUIntArray &order );
// Background resizing
virtual int GetHitCode( CPoint point );
virtual CRect GetSelectionMarkerRect( UINT marker ) const;
virtual HCURSOR GetCursor( int hit ) const;
// Command enablers for Doc/View apps
void UpdateCut( CCmdUI* pCmdUI ) const;
void UpdateCopy( CCmdUI* pCmdUI ) const;
void UpdatePaste( CCmdUI* pCmdUI ) const;
void UpdateUndo( CCmdUI* pCmdUI ) const;
// Property handling
void ShowProperties();
void ShowCode();
// Saving and loading
virtual void Save( CStringArray& stra );
virtual BOOL FromString( const CString& str );
void Snapshot() { if (m_objs) m_objs->Snapshot(); }
void RemoveUnselectedPropertyDialogs(BOOL bAll = FALSE);
protected:
virtual void SaveObjects( CStringArray& stra );
virtual void SetInteractMode( int interactMode );
virtual int GetInteractMode() const;
virtual CDiagramEntity* GetDrawingObject();
virtual BOOL OnPreObjectCommand(UINT nID) { return FALSE; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDiagramEditor)
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CDiagramEditor)
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
virtual afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
virtual afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
virtual afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
virtual afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
virtual afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
virtual afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
virtual afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg UINT OnGetDlgCode();
virtual afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
afx_msg void OnObjectCommand( UINT nID );
afx_msg void OnEditCut();
afx_msg void OnEditCopy();
afx_msg void OnEditPaste();
DECLARE_MESSAGE_MAP()
private:
// Run-time states/data
double m_zoom; // Current zoom level
double m_zoomFactor; // Zoom factor for +/- keys
double m_zoomMax; // Max zoom level
double m_zoomMin; // Min zoom level
BOOL m_dirty; // TRUE if data is modified
int m_interactMode; // Current mouse-mode
int m_subMode; // Sub-mode for resizing (corner)
CRect m_selectionRect; // Rect to draw for rubberbanding
CPoint m_deltaPoint; // Offset to object when moving
BOOL m_drawing; // We are currently drawing
BOOL m_multiDraw; // If the drawing mode is continued
// after an object is added.
CDiagramEntity* m_multiSelObj; // Primary object when moving multiple
// Properties
COLORREF m_bkgndCol; // Background of paper area
COLORREF m_nonClientBkgndCol;// Background of non-paper area
int m_bgResizeZone; // Size, in pixels, of resize zone
BOOL m_bgResize; // TRUE if the paper can be resized
BOOL m_bgResizeSelected; // TRUE if we are resizing the background
BOOL m_snap; // TRUE if we should snap to grid
BOOL m_grid; // TRUE if the background grid should be displayed
int m_gridStyle; // Background style
CSize m_gridSize; // Size of a grid cell
COLORREF m_gridCol; // Color of the grid
BOOL m_margin; // TRUE if margins should be drawn
COLORREF m_marginColor; // Color of the margin
int m_leftMargin; // Left margin in pixels
int m_topMargin; // Top margin in pixels
int m_rightMargin; // Right margin in pixels
int m_bottomMargin; // Bottom margin in pixels
int m_restraint; // Restraint mode ( none, virtual or margin )
CSize m_markerSize; // Size of selection marker
UINT m_keyInterface; // Flags for the keys the editor will handle
// Data pointer
CDiagramEntityContainer* m_objs; // Pointer to data
//typedef CTypedPtrArray<CObArray,CDiagramEntity*> CSelObjArray ;
//CSelObjArray m_selObjs;
CDiagramMenu* m_popupMenu;
// Misc data
CDiagramEntity* m_drawObj; // Temporary pointer to object that should be drawn
CDiagramEntityContainer* m_internalData; // Internal data pointer - if external data is not submitted
// Construction/destruction/initialization
void SetInternalDiagramEntityContainer( CDiagramEntityContainer* objs );
protected:
// Scroll
void SetupScrollbars();
int HScroll( int scroll );
int VScroll( int scroll );
CPoint ScrollPoint( CPoint point );
// Coordinate conversions
void ScreenToVirtual( CRect& rect ) const;
void ScreenToVirtual( CPoint& point ) const;
void ScreenToVirtual( CSize& size ) const;
void VirtualToScreen( CRect& rect ) const;
void VirtualToScreen( CPoint& point ) const;
// Coordinate modifications
CSize GetContainingSize() const;
void InsideRestraints( double& x, double& y );
void AdjustForRestraints( double& left, double& top, double& right, double& bottom );
void AdjustForRestraints( double& xpos, double& ypos );
int SnapX( int coord ) const;
int SnapY( int coord ) const;
private:
// Misc internal functions
void SetInternalVirtualSize( const CSize& size );
void ShowPopup( CPoint point );
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIAGRAMEDITOR_H__B8C35A07_CDC4_4D85_9FAE_2C9BE81EA911__INCLUDED_)
| [
"sience@a725d9c3-d2eb-0310-b856-fa980ef11a19"
] | [
[
[
1,
334
]
]
] |
4636f466ed9a23888372dec7f70e5844c601dbd2 | b6d87736b619bd299d337637900c6025fe056a84 | /src/FlowSimulator.h | 82ae2c39a13b203a6ddd748a7c9c6bf62ace7a91 | [] | no_license | rogergranada/pipe-flow-simulator | 00d6ef7ab7d22a0c6e8512399e26b940a11bcbcf | 8b81b1ca6152aa8ac96a3a728896675e8aaea7de | refs/heads/master | 2021-01-17T12:10:39.727622 | 2011-04-11T16:19:30 | 2011-04-11T16:19:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,243 | h | #include "Fluid.h"
#include "Pipe.h"
#include <vector>
using namespace std;
enum FlowRegime{
// Reynolds number less than 2300
LaminarFlow,
// Reynolds number between 2300 and 4000
TransitionFlow,
// Reynolds number greater than 4000
TurbulentFlow
};
class FlowSimulator{
private:
//Flow rate [m3/s]
double flowRate;
//P - initial fluid pressure [Pa]
double initialPressure;
//The fluid circulating in the pipeline
Fluid fluid;
//The pipeline
vector<Pipe> pipes;
unsigned int getPipeIndex(double depth);
double getPipelineLength();
enum FlowRegime getFlowRegime(double reynoldsNumber);
double calculateReynoldsNumber(double fluidDensity, double fluidViscosity, double fluidVelocity, double pipeDiameter);
double calculateFrictionFactor(double roughnessHeight, double diameter, double reynoldsNumber);
double calculateFrictionFactorTurbulent(double roughnessHeight, double diameter, double reynoldsNumber);
public:
void addPipe(Pipe pipe);
void setFluid(Fluid fluid);
void setFlowRate(double flowRate);
void setInitialPressure(double initialPressure);
void computePressureGradient(double finalDepth, double segmentLength);
};
| [
"[email protected]"
] | [
[
[
1,
49
]
]
] |
63bf9987b57e594bc7f9c7a17caad0933e599eb4 | e02fa80eef98834bf8a042a09d7cb7fe6bf768ba | /MyGUIEngine/src/MyGUI_Window.cpp | 3547fc7eef5f196c3f9c7d01883e30a506eca981 | [] | no_license | MyGUI/mygui-historical | fcd3edede9f6cb694c544b402149abb68c538673 | 4886073fd4813de80c22eded0b2033a5ba7f425f | refs/heads/master | 2021-01-23T16:40:19.477150 | 2008-03-06T22:19:12 | 2008-03-06T22:19:12 | 22,805,225 | 2 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 9,742 | cpp | /*!
@file
@author Albert Semenov
@date 11/2007
@module
*/
#include "MyGUI_Window.h"
#include "MyGUI_Macros.h"
#include "MyGUI_Gui.h"
#include "MyGUI_ControllerManager.h"
#include "MyGUI_InputManager.h"
#include "MyGUI_WidgetManager.h"
#include "MyGUI_PointerManager.h"
#include "MyGUI_ControllerFadeAlpha.h"
#include "MyGUI_WidgetSkinInfo.h"
namespace MyGUI
{
const float WINDOW_ALPHA_MAX = ALPHA_MAX;
const float WINDOW_ALPHA_MIN = ALPHA_MIN;
const float WINDOW_ALPHA_ACTIVE = ALPHA_MAX;
const float WINDOW_ALPHA_FOCUS = 0.7f;
const float WINDOW_ALPHA_DEACTIVE = 0.3f;
const float WINDOW_SPEED_COEF = 3.0f;
const int WINDOW_SNAP_DISTANSE = 10;
Window::Window(const IntCoord& _coord, Align _align, const WidgetSkinInfoPtr _info, CroppedRectanglePtr _parent, const Ogre::String & _name) :
Widget(_coord, _align, _info, _parent, _name),
mWidgetCaption(null), mWidgetClient(null),
mMouseRootFocus(false), mKeyRootFocus(false),
mIsAutoAlpha(false),
mSnap(false)
{
// нам нужен фокус клавы
mNeedKeyFocus = true;
// дефолтные размеры
mMinmax.set(0, 0, 3000, 3000);
// парсим свойства
const MapString & param = _info->getParams();
MapString::const_iterator iter = param.find("Snap");
if (iter != param.end()) mSnap = utility::parseBool(iter->second);
iter = param.find("MainMove");
if (iter != param.end()) setUserString("Scale", "1 1 0 0");
for (VectorWidgetPtr::iterator iter=mWidgetChild.begin(); iter!=mWidgetChild.end(); ++iter) {
if ((*iter)->_getInternalString() == "Client") {
mWidgetClient = (*iter);
}
else if ((*iter)->_getInternalString() == "Caption") {
mWidgetCaption = (*iter);
mWidgetCaption->eventMouseButtonPressed = newDelegate(this, &Window::notifyMousePressed);
mWidgetCaption->eventMouseDrag = newDelegate(this, &Window::notifyMouseDrag);
}
else if ((*iter)->_getInternalString() == "Button") {
(*iter)->eventMouseButtonClick = newDelegate(this, &Window::notifyPressedButtonEvent);
}
else if ((*iter)->_getInternalString() == "Action") {
(*iter)->eventMouseButtonPressed = newDelegate(this, &Window::notifyMousePressed);
(*iter)->eventMouseDrag = newDelegate(this, &Window::notifyMouseDrag);
}
}
}
// переопределяем для присвоению клиенту
WidgetPtr Window::createWidgetT(const Ogre::String & _type, const Ogre::String & _skin, const IntCoord& _coord, Align _align, const Ogre::String & _name)
{
if (mWidgetClient != null) return mWidgetClient->createWidgetT(_type, _skin, _coord, _align, _name);
return Widget::createWidgetT(_type, _skin, _coord, _align, _name);
}
void Window::_onMouseChangeRootFocus(bool _focus)
{
mMouseRootFocus = _focus;
updateAlpha();
// !!! ОБЯЗАТЕЛЬНО вызывать в конце метода
Widget::_onMouseChangeRootFocus(_focus);
}
void Window::_onKeyChangeRootFocus(bool _focus)
{
mKeyRootFocus = _focus;
updateAlpha();
// !!! ОБЯЗАТЕЛЬНО вызывать в конце метода
Widget::_onKeyChangeRootFocus(_focus);
}
void Window::_onMouseDrag(int _left, int _top)
{
// на тот случай, если двигать окно, можно за любое место виджета
notifyMouseDrag(this, _left, _top);
// !!! ОБЯЗАТЕЛЬНО вызывать в конце метода
Widget::_onMouseDrag(_left, _top);
}
void Window::_onMouseButtonPressed(bool _left)
{
notifyMousePressed(this, _left);
// !!! ОБЯЗАТЕЛЬНО вызывать в конце метода
Widget::_onMouseButtonPressed(_left);
}
void Window::notifyMousePressed(MyGUI::WidgetPtr _sender, bool _left)
{
if (_left) {
mPreActionCoord = mCoord;
mCurrentActionScale = IntCoord::parse(_sender->getUserString("Scale"));
}
}
void Window::notifyPressedButtonEvent(MyGUI::WidgetPtr _sender)
{
eventWindowButtonPressed(this, _sender->getUserString("Event"));
}
void Window::notifyMouseDrag(MyGUI::WidgetPtr _sender, int _left, int _top)
{
const IntPoint & point = InputManager::getInstance().getLastLeftPressed();
IntCoord coord = mCurrentActionScale;
coord.left *= (_left - point.left);
coord.top *= (_top - point.top);
coord.width *= (_left - point.left);
coord.height *= (_top - point.top);
setPosition(mPreActionCoord + coord);
// посылаем событие о изменении позиции и размере
eventWindowChangeCoord(this);
}
void Window::updateAlpha()
{
if (false == mIsAutoAlpha) return;
float alpha;
if (mKeyRootFocus) alpha = WINDOW_ALPHA_ACTIVE;
else if (mMouseRootFocus) alpha = WINDOW_ALPHA_FOCUS;
else alpha = WINDOW_ALPHA_DEACTIVE;
//MYGUI_OUT(alpha);
ControllerManager::getInstance().addItem(this, new ControllerFadeAlpha(alpha, WINDOW_SPEED_COEF, ControllerFadeAlpha::ACTION_NONE, true));
}
void Window::setAutoAlpha(bool _auto)
{
mIsAutoAlpha = _auto;
if (false == _auto) setAlpha(ALPHA_MAX);
else {
if (mKeyRootFocus) setAlpha(WINDOW_ALPHA_ACTIVE);
else if (mMouseRootFocus) setAlpha(WINDOW_ALPHA_FOCUS);
else setAlpha(WINDOW_ALPHA_DEACTIVE);
}
}
void Window::setPosition(const IntPoint& _pos)
{
IntPoint pos = _pos;
// прилепляем к краям
if (mSnap) {
if (abs(pos.left) <= WINDOW_SNAP_DISTANSE) pos.left = 0;
if (abs(pos.top) <= WINDOW_SNAP_DISTANSE) pos.top = 0;
int width = (int)Gui::getInstance().getViewWidth();
int height = (int)Gui::getInstance().getViewHeight();
if ( abs(pos.left + mCoord.width - width) < WINDOW_SNAP_DISTANSE) pos.left = width - mCoord.width;
if ( abs(pos.top + mCoord.height - height) < WINDOW_SNAP_DISTANSE) pos.top = height - mCoord.height;
}
Widget::setPosition(pos);
}
void Window::setPosition(const IntCoord& _coord)
{
IntPoint pos = _coord.point();
IntSize size = _coord.size();
// прилепляем к краям
if (mSnap) {
if (abs(pos.left) <= WINDOW_SNAP_DISTANSE) pos.left = 0;
if (abs(pos.top) <= WINDOW_SNAP_DISTANSE) pos.top = 0;
int width = (int)Gui::getInstance().getViewWidth();
int height = (int)Gui::getInstance().getViewHeight();
if ( abs(pos.left + mCoord.width - width) < WINDOW_SNAP_DISTANSE) pos.left = width - mCoord.width;
if ( abs(pos.top + mCoord.height - height) < WINDOW_SNAP_DISTANSE) pos.top = height - mCoord.height;
if ( abs(mCoord.left + size.width - width) < WINDOW_SNAP_DISTANSE) size.width = width - mCoord.left;
if ( abs(mCoord.top + size.height - height) < WINDOW_SNAP_DISTANSE) size.height = height - mCoord.top;
}
if (size.width < mMinmax.left) {
int offset = mMinmax.left - size.width;
size.width = mMinmax.left;
if ((pos.left - mCoord.left) > offset) pos.left -= offset;
else pos.left = mCoord.left;
}
else if (size.width > mMinmax.right) {
int offset = mMinmax.right - size.width;
size.width = mMinmax.right;
if ((pos.left - mCoord.left) < offset) pos.left -= offset;
else pos.left = mCoord.left;
}
if (size.height < mMinmax.top) {
int offset = mMinmax.top - size.height;
size.height = mMinmax.top;
if ((pos.top - mCoord.top) > offset) pos.top -= offset;
else pos.top = mCoord.top;
}
else if (size.height > mMinmax.bottom) {
int offset = mMinmax.bottom - size.height;
size.height = mMinmax.bottom;
if ((pos.top - mCoord.top) < offset) pos.top -= offset;
else pos.top = mCoord.top;
}
IntCoord coord(pos, size);
if (coord == mCoord) return;
Widget::setPosition(coord);
}
void Window::setSize(const IntSize& _size)
{
IntSize size = _size;
// прилепляем к краям
if (mSnap) {
int width = (int)Gui::getInstance().getViewWidth();
int height = (int)Gui::getInstance().getViewHeight();
if ( abs(mCoord.left + size.width - width) < WINDOW_SNAP_DISTANSE) size.width = width - mCoord.left;
if ( abs(mCoord.top + size.height - height) < WINDOW_SNAP_DISTANSE) size.height = height - mCoord.top;
}
if (size.width < mMinmax.left) size.width = mMinmax.left;
else if (size.width > mMinmax.right) size.width = mMinmax.right;
if (size.height < mMinmax.top) size.height = mMinmax.top;
else if (size.height > mMinmax.bottom) size.height = mMinmax.bottom;
if ((size.width == mCoord.width) && (size.height == mCoord.height) ) return;
Widget::setSize(size);
}
// для мееедленного показа и скрытия
void Window::showSmooth(bool _reset)
{
if (_reset) {
setAlpha(ALPHA_MIN);
show();
}
ControllerManager::getInstance().addItem(
this, new ControllerFadeAlpha((mIsAutoAlpha && !mKeyRootFocus) ? WINDOW_ALPHA_DEACTIVE : WINDOW_ALPHA_MAX,
WINDOW_SPEED_COEF, ControllerFadeAlpha::ACTION_NONE, true));
}
void Window::hideSmooth()
{
ControllerManager::getInstance().addItem(
this, new ControllerFadeAlpha(WINDOW_ALPHA_MIN, WINDOW_SPEED_COEF, ControllerFadeAlpha::ACTION_HIDE, false));
}
void Window::destroySmooth()
{
ControllerManager::getInstance().addItem(
this, new ControllerFadeAlpha(WINDOW_ALPHA_MIN, WINDOW_SPEED_COEF, ControllerFadeAlpha::ACTION_DESTROY, false));
}
const IntCoord& Window::getClientRect()
{
if (null == mWidgetClient) return Widget::getClientRect();
return mWidgetClient->getClientRect();
}
VectorWidgetPtr Window::getChilds()
{
if (null == mWidgetClient) return Widget::getChilds();
return mWidgetClient->getChilds();
}
} // namespace MyGUI
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
9
],
[
11,
14
],
[
16,
26
],
[
28,
33
],
[
35,
36
],
[
38,
43
],
[
46,
55
],
[
57,
62
],
[
64,
93
],
[
95,
96
],
[
98,
99
],
[
101,
122
],
[
124,
131
],
[
133,
166
],
[
170,
170
],
[
173,
173
],
[
176,
184
],
[
188,
191
],
[
194,
194
],
[
197,
233
],
[
237,
237
],
[
240,
288
]
],
[
[
10,
10
],
[
15,
15
],
[
27,
27
],
[
34,
34
],
[
37,
37
],
[
44,
45
],
[
56,
56
],
[
63,
63
],
[
94,
94
],
[
97,
97
],
[
100,
100
],
[
123,
123
],
[
132,
132
],
[
167,
169
],
[
171,
172
],
[
174,
175
],
[
185,
187
],
[
192,
193
],
[
195,
196
],
[
234,
236
],
[
238,
239
]
]
] |
90205c2c773835c686a2e5f6c65190a87cfbe46e | 7b6292601467a32ab84e3f2c35801226dedb1490 | /Timer/TimerWnd.h | 9cf40d7c4c5c51e4cb7103725c4eda5bef0fe375 | [] | no_license | mareqq/mareq-timer | b4bc9134573fec6d554b7da51dc5d9350cc73581 | 180a60d7e1d8190f80b05177a0270cc0309e7822 | refs/heads/master | 2021-01-21T07:39:46.790716 | 2008-09-02T13:56:09 | 2008-09-02T13:56:09 | 32,898,637 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,124 | h | #pragma once
#include "TimerEvent.h"
#define WM_APP_TIMER WM_APP
#define WM_ICON_NOTIFY WM_APP + 1
#define PROFILE_SECTION _T("")
#define PROFILE_EVENTS_COUNT _T("EventsCount")
#define SMD_NONE -3
#define SMD_ABOUT -2
#define SMD_ADD -1
class CTimerWnd : public CWnd
{
DECLARE_DYNAMIC(CTimerWnd)
public:
CTimerWnd();
virtual ~CTimerWnd();
bool Create();
bool ShowBalloon(CString strMessage, int id);
void CustomizeMenu(CMenu &menu);
protected:
void LoadTimerEvents();
void SaveTimerEvents();
UINT_PTR ShowModalDialog(int id, CDialog &dlg);
afx_msg void OnAdd();
afx_msg void OnEdit(UINT nID);
afx_msg void OnDeleteAllOld();
afx_msg void OnAbout();
afx_msg void OnExit();
afx_msg LRESULT OnNotifyIcon(WPARAM wParam, LPARAM lParam);
afx_msg void OnTimer(UINT_PTR nIDEvent);
DECLARE_MESSAGE_MAP()
protected:
NOTIFYICONDATA m_NotifyIconData;
HICON m_hIcon;
CMap<int, int, CDialog *, CDialog *> m_Dialogs;
CTimerEvents m_TimerEvents;
COleDateTime m_LastTime;
int m_BalloonId;
};
| [
"mareqq@62a7fa73-be4e-0410-9e8d-e136552d7b79"
] | [
[
[
1,
54
]
]
] |
3331c0929bdec40a0ba9d0fe4d781b6903f59af4 | 91ac219c4cde8c08a6b23ac3d207c1b21124b627 | /common/mlc/ChannelCode.h | 6bcbca99b5ded8387bf77e57671091027efc42e1 | [] | no_license | DazDSP/hamdrm-dll | e41b78d5f5efb34f44eb3f0c366d7c1368acdbac | 287da5949fd927e1d3993706204fe4392c35b351 | refs/heads/master | 2023-04-03T16:21:12.206998 | 2008-01-05T19:48:59 | 2008-01-05T19:48:59 | 354,168,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,514 | h | /******************************************************************************\
* Technische Universitaet Darmstadt, Institut fuer Nachrichtentechnik
* Copyright (c) 2001
*
* Author(s):
* Volker Fischer
*
* Description:
*
*
******************************************************************************
*
* 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
#if !defined(CHANNEL_CODE_H__3B0BA660_CA63345347A0D31912__INCLUDED_)
#define CHANNEL_CODE_H__3B0BA660_CA63345347A0D31912__INCLUDED_
#include "../GlobalDefinitions.h"
#include "../tables/TableMLC.h"
#include "../Vector.h"
#include "../Parameter.h"
/* Classes ********************************************************************/
class CChannelCode
{
public:
CChannelCode();
virtual ~CChannelCode() {}
inline _BINARY Convolution(const _BYTE byNewStateShiftReg,
const int iGenPolyn) const
{
/* Mask bits with generator polynomial and get convolution result from
pre-calculated table (speed optimization). Since we have a AND
operation on the "byGeneratorMatrix", the index of the convolution
table cannot exceed the size of the table (although the value in
"byNewStateShiftReg" can be larger) */
return vecbiParity[byNewStateShiftReg & byGeneratorMatrix[iGenPolyn]];
}
CVector<int> GenPuncPatTable(CParameter::ECodScheme eNewCodingScheme,
CParameter::EChanType eNewChannelType,
int iN1, int iN2,
int iNewNumOutBitsPartA,
int iNewNumOutBitsPartB,
int iPunctPatPartA, int iPunctPatPartB,
int iLevel);
private:
_BINARY vecbiParity[1 << SIZEOF__BYTE];
};
#endif // !defined(CHANNEL_CODE_H__3B0BA660_CA63345347A0D31912__INCLUDED_)
| [
"[email protected]"
] | [
[
[
1,
70
]
]
] |
c513df43541a5d5bd5f96f0ed6d9685216b26076 | 29792c63c345f87474136c8df87beb771f0a20a8 | /server/netrpc.cpp | 24505a4df680874cc52215c035a7cdc9492de147 | [] | no_license | uvbs/jvcmp | 244ba6c2ab14ce0a757f3f6044b5982287b01fae | 57225e1c52085216a0a4a9c4e33ed324c1c92d39 | refs/heads/master | 2020-12-29T00:25:39.180996 | 2009-06-24T14:52:39 | 2009-06-24T14:52:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,114 | cpp | // File Author: kyeman && JackPowell
#include "netgame.h"
#include "rcon.h"
RakServerInterface *pRak=0;
extern CNetGame *pNetGame;
extern char *szAdminPass;
extern CRcon *pRcon;
#ifndef WIN32
# define stricmp strcasecmp
#endif
#define REJECT_REASON_BAD_VERSION 1
#define REJECT_REASON_BAD_NICKNAME 2
void FilterInvalidNickChars(PCHAR szString);
void ClientJoin(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
RakNet::BitStream bsReject;
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
CVehiclePool *pVehiclePool = pNetGame->GetVehiclePool();
CHAR szPlayerName[MAX_PLAYER_NAME];
BYTE bytePlayerID;
BYTE byteVersion;
BYTE byteNickLen;
BYTE byteRejectReason;
bsData.Read(byteVersion);
if(byteVersion != NETGAME_VERSION) {
byteRejectReason = REJECT_REASON_BAD_VERSION;
bsReject.Write(byteRejectReason);
pRak->RPC("ConnectionRejected",&bsReject,HIGH_PRIORITY,RELIABLE,0,sender,FALSE,FALSE);
return;
}
bsData.Read(byteNickLen);
bsData.Read(szPlayerName,byteNickLen);
szPlayerName[byteNickLen] = '\0';
FilterInvalidNickChars(szPlayerName);
byteNickLen = strlen(szPlayerName);
if(byteNickLen==0 || byteNickLen > 16 || pPlayerPool->IsNickInUse(szPlayerName)) {
byteRejectReason = REJECT_REASON_BAD_NICKNAME;
bsReject.Write(byteRejectReason);
pRak->RPC("ConnectionRejected",&bsReject,HIGH_PRIORITY,RELIABLE,0,sender,FALSE,FALSE);
return;
}
bytePlayerID = pRak->GetIndexFromPlayerID(sender);
// Add this client to the player pool.
pPlayerPool->New(bytePlayerID, szPlayerName);
// Send this client back an 'InitGame' RPC
RakNet::BitStream bsInitGame;
bsInitGame.Write((float)pNetGame->m_vecInitPlayerPos.X);
bsInitGame.Write((float)pNetGame->m_vecInitPlayerPos.Y);
bsInitGame.Write((float)pNetGame->m_vecInitPlayerPos.Z);
bsInitGame.Write((float)pNetGame->m_vecInitCameraPos.X);
bsInitGame.Write((float)pNetGame->m_vecInitCameraPos.Y);
bsInitGame.Write((float)pNetGame->m_vecInitCameraPos.Z);
bsInitGame.Write((float)pNetGame->m_vecInitCameraLook.X);
bsInitGame.Write((float)pNetGame->m_vecInitCameraLook.Y);
bsInitGame.Write((float)pNetGame->m_vecInitCameraLook.Z);
bsInitGame.Write((float)pNetGame->m_WorldBounds[0]);
bsInitGame.Write((float)pNetGame->m_WorldBounds[1]);
bsInitGame.Write((float)pNetGame->m_WorldBounds[2]);
bsInitGame.Write((float)pNetGame->m_WorldBounds[3]);
bsInitGame.Write(pNetGame->m_iSpawnsAvailable);
bsInitGame.Write(pNetGame->m_byteFriendlyFire);
bsInitGame.Write(pNetGame->m_byteShowOnRadar);
bsInitGame.Write(bytePlayerID);
pRak->RPC("InitGame",&bsInitGame,HIGH_PRIORITY,RELIABLE_ORDERED,0,sender,FALSE,FALSE);
// Send every player connected, updated to use 1 packet
BYTE x=0;
RakNet::BitStream pbsExistingClient;
pbsExistingClient.Write(pPlayerPool->GetTotalPlayers(bytePlayerID));
while(x<MAX_PLAYERS) {
if( (pPlayerPool->GetSlotState(x) == TRUE) && (x != bytePlayerID) ) {
pbsExistingClient.Write(x);
pbsExistingClient.Write(strlen(pPlayerPool->GetPlayerName(x)));
pbsExistingClient.Write(pPlayerPool->GetPlayerName(x),strlen(pPlayerPool->GetPlayerName(x)));
}
x++;
}
// Spawn all existing vehicles for player.
CVehicle *pVehicle;
x=0;
while(x!=MAX_VEHICLES) {
if(pVehiclePool->GetSlotState(x) == TRUE) {
pVehicle = pVehiclePool->GetAt(x);
if(pVehicle->IsActive()) pVehicle->SpawnForPlayer(bytePlayerID);
}
x++;
}
//Spawn players that are spawned
x=0;
while(x<MAX_PLAYERS) {
if( (pPlayerPool->GetSlotState(x) == TRUE) && (x != bytePlayerID) ) {
// Now also spawn the player for them if they're active.
CPlayer *pSpawnPlayer = pPlayerPool->GetAt(x);
if(pSpawnPlayer->IsActive()) {
pSpawnPlayer->SpawnForPlayer(bytePlayerID);
}
}
x++;
}
}
//----------------------------------------------------
// Sent by client with global chat text
void Chat(PCHAR Data, int iBitLength, PlayerID sender)
{
CHAR szText[256];
BYTE byteTextLen;
CPlayerPool *pPool = pNetGame->GetPlayerPool();
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
bsData.Read(byteTextLen);
bsData.Read(szText,byteTextLen);
szText[byteTextLen] = '\0';
if(!pPool->GetSlotState(pRak->GetIndexFromPlayerID(sender))) return;
pRcon->OutputChatMessage(pPool->GetPlayerName(pRak->GetIndexFromPlayerID(sender)),
szText);
// Now pass it off to all the other clients.
RakNet::BitStream bsSend;
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
bsSend.Write(bytePlayerID);
bsSend.Write(byteTextLen);
bsSend.Write(szText,byteTextLen);
pRak->RPC("Chat",&bsSend,HIGH_PRIORITY,RELIABLE,0,sender,TRUE,FALSE);
}
//----------------------------------------------------
// Sent by client who wishes to request a class from
// the gamelogic handler.
void RequestClass(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
BYTE byteRequestedClass;
BYTE byteRequestOutcome = 0;
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
bsData.Read(byteRequestedClass);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
if(pNetGame->GetGameLogic()->HandleSpawnClassRequest(bytePlayerID,byteRequestedClass))
{
byteRequestOutcome = 1;
}
RakNet::BitStream bsSpawnRequestReply;
CPlayer *pPlayer=pNetGame->GetPlayerPool()->GetAt(bytePlayerID);
PLAYER_SPAWN_INFO *SpawnInfo = pPlayer->GetSpawnInfo();
bsSpawnRequestReply.Write(byteRequestOutcome);
bsSpawnRequestReply.Write(SpawnInfo->byteTeam);
bsSpawnRequestReply.Write(SpawnInfo->byteSkin);
bsSpawnRequestReply.Write((float)SpawnInfo->vecPos.X);
bsSpawnRequestReply.Write((float)SpawnInfo->vecPos.Y);
bsSpawnRequestReply.Write((float)SpawnInfo->vecPos.Z);
bsSpawnRequestReply.Write((float)SpawnInfo->fRotation);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeapons[0]);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeaponsAmmo[0]);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeapons[1]);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeaponsAmmo[1]);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeapons[2]);
bsSpawnRequestReply.Write(SpawnInfo->iSpawnWeaponsAmmo[2]);
pRak->RPC("RequestClass",&bsSpawnRequestReply,HIGH_PRIORITY,RELIABLE,0,sender,FALSE,FALSE);
}
//----------------------------------------------------
// Sent by client when they're spawning/respawning.
void Spawn(PCHAR Data, int iBitLength, PlayerID sender)
{
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayer *pPlayer = pNetGame->GetPlayerPool()->GetAt(bytePlayerID);
pPlayer->Spawn();
}
//----------------------------------------------------
// Sent by client when they die.
void Death(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayer *pPlayer = pNetGame->GetPlayerPool()->GetAt(bytePlayerID);
BYTE byteDeathReason;
BYTE byteWhoWasResponsible;
bsData.Read(byteDeathReason);
bsData.Read(byteWhoWasResponsible);
if(pPlayer) {
pPlayer->HandleDeath(byteDeathReason,byteWhoWasResponsible);
}
}
//----------------------------------------------------
// Sent by client when they want to enter a
// vehicle gracefully.
void EnterVehicle(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayer *pPlayer = pNetGame->GetPlayerPool()->GetAt(bytePlayerID);
BYTE byteVehicleID;
BYTE bytePassenger;
bsData.Read(byteVehicleID);
bsData.Read(bytePassenger);
pPlayer->EnterVehicle(byteVehicleID,bytePassenger);
//logprintf("%u enters vehicle %u",bytePlayerID,byteVehicleID);
}
//----------------------------------------------------
// Sent by client when they want to exit a
// vehicle gracefully.
void ExitVehicle(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayer *pPlayer = pNetGame->GetPlayerPool()->GetAt(bytePlayerID);
BYTE byteVehicleID;
bsData.Read(byteVehicleID);
pPlayer->ExitVehicle(byteVehicleID);
//logprintf("%u exits vehicle %u",bytePlayerID,byteVehicleID);
}
//----------------------------------------------------
// Sent by client when they want score and ping information.
void UpdateScoreAndPing(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
RakNet::BitStream bsSend;
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
int write_counter=0;
PlayerID pID;
BYTE x=0;
while(x!=MAX_PLAYERS) {
if(pPlayerPool->GetSlotState(x) == TRUE) {
pID = pRak->GetPlayerIDFromIndex(x);
bsSend.Write((BYTE)x);
bsSend.Write((int)pPlayerPool->GetScore(x));
bsSend.Write((int)pRak->GetLastPing(pRak->GetPlayerIDFromIndex(x)));
if(pPlayerPool->IsAdmin(bytePlayerID)) {
bsSend.Write(pID.binaryAddress);
} else {
bsSend.Write((unsigned long)0UL);
}
write_counter++;
}
x++;
}
pRak->RPC("UpdateScPing",&bsSend,HIGH_PRIORITY,RELIABLE,0,sender,FALSE,FALSE);
}
//----------------------------------------------------
void Admin(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
char szPassTest[65];
int iPassLen;
bsData.Read(iPassLen);
if(iPassLen > 64) return;
bsData.Read(szPassTest,iPassLen);
szPassTest[iPassLen] = '\0';
if(!strcmp(szPassTest,szAdminPass)) {
pPlayerPool->SetAdmin(bytePlayerID);
}
}
//----------------------------------------------------
void KickPlayer(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
BYTE byteKickPlayer;
if(pPlayerPool->IsAdmin(bytePlayerID)) {
bsData.Read(byteKickPlayer);
pNetGame->KickPlayer(byteKickPlayer);
}
}
//----------------------------------------------------
void BanIPAddress(PCHAR Data, int iBitLength, PlayerID sender)
{
RakNet::BitStream bsData(Data,iBitLength/8,FALSE);
BYTE bytePlayerID = pRak->GetIndexFromPlayerID(sender);
if(!pNetGame->GetPlayerPool()->GetSlotState(bytePlayerID)) return;
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
char ban_ip[256];
int iBanIpLen;
if(pPlayerPool->IsAdmin(bytePlayerID)) {
bsData.Read(iBanIpLen);
bsData.Read(ban_ip,iBanIpLen);
ban_ip[iBanIpLen] = 0;
pNetGame->AddBan(ban_ip);
}
}
//----------------------------------------------------
void RegisterRPCs(RakServerInterface * pRakServer)
{
pRak = pRakServer;
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, ClientJoin);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Chat);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, RequestClass);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Spawn);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Death);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, EnterVehicle);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, ExitVehicle);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, UpdateScoreAndPing);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Admin);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, KickPlayer);
REGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, BanIPAddress);
}
//----------------------------------------------------
void UnRegisterRPCs(RakServerInterface * pRakServer)
{
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, ClientJoin);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Chat);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, RequestClass);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Spawn);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Death);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, EnterVehicle);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, ExitVehicle);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, UpdateScoreAndPing);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, Admin);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, KickPlayer);
UNREGISTER_AS_REMOTE_PROCEDURE_CALL(pRakServer, BanIPAddress);
pRak = 0;
}
//----------------------------------------------------
| [
"jacks.mini.net@43d76e2e-6035-11de-a55d-e76e375ae706"
] | [
[
[
1,
399
]
]
] |
cfa12f5775d1d2ee8e6887ddefb1e49db3cd5f37 | 5095bbe94f3af8dc3b14a331519cfee887f4c07e | /apsim/Plant/source/Phenology/CWSowingPhase.h | dc8832feccee83c351f2c876fbe0f737c714788d | [] | no_license | sativa/apsim_development | efc2b584459b43c89e841abf93830db8d523b07a | a90ffef3b4ed8a7d0cce1c169c65364be6e93797 | refs/heads/master | 2020-12-24T06:53:59.364336 | 2008-09-17T05:31:07 | 2008-09-17T05:31:07 | 64,154,433 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 470 | h | #ifndef CWSowingPhaseH
#define CWSowingPhaseH
#include "CWVernalPhase.h"
class CWSowingPhase : public CWVernalPhase
{
public:
CWSowingPhase(ScienceAPI& scienceAPI, plantInterface& p, const string& stage_name)
: CWVernalPhase (scienceAPI, p, stage_name){};
void calcPhaseDevelopment(int das,
float& dlt_tt_phenol, float& phase_devel);
private:
bool germinating();
};
#endif
| [
"hol353@8bb03f63-af10-0410-889a-a89e84ef1bc8"
] | [
[
[
1,
20
]
]
] |
651cf9fe7783ba967b6b45cd2c10ed2fcf7adeb9 | 77957df975b0b622fdbfede798b83c1d30ae117d | /practica2/Graphics/Textures/TextureManager.h | f3f94b2e6c8115bfb22e1143c9c3a9088b530c4e | [] | no_license | Juanmaramon/aplicacion-practica-basica | 92f80b0699c8450c3c32a6cdaff395bb257d3a95 | 9d7776dcc55c7de4cf03085c998d6c7461f4cae5 | refs/heads/master | 2016-08-12T19:49:55.787837 | 2011-07-10T15:34:01 | 2011-07-10T15:34:01 | 43,250,262 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 476 | h | //
#ifndef TEXTURE_MANAGER_H
#define TEXTURE_MANAGER_H
#include "../../Utility/ResourceManager.h"
#include "../../Utility/Singleton.h"
class cTextureManager : public cResourceManager,
public cSingleton<cTextureManager>
{
public:
friend class cSingleton<cTextureManager>;
protected:
cTextureManager() { ; } // Protected constructor
private:
virtual cResource * LoadResourceInternal( std::string lacNameID, const std::string &lacFile );
};
#endif | [
"[email protected]"
] | [
[
[
1,
19
]
]
] |
7e112edb9b511a084779fa30443921a2cf026517 | 6581dacb25182f7f5d7afb39975dc622914defc7 | /DaemonManager/DaemonManagerDlg.cpp | 1740c7783c85a3c9631694e6845491448ab0d135 | [] | 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 | 19,829 | cpp | // DaemonManagerDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DaemonManager.h"
#include "DaemonManagerDlg.h"
#include <MouseHook.h>
#include <string>
#include <vector>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDaemonManagerDlg dialog
//收缩模式
#define HM_NONE 0
#define HM_TOP 1
#define CM_ELAPSE 200 //检测鼠标是否离开窗口的时间间隔
#define HS_ELAPSE 30 //隐藏或显示过程每步的时间间隔
#define HS_STEPS 10 //隐藏或显示过程分成多少步
#define INTERVAL 20 //触发粘附时鼠标与屏幕边界的最小间隔,单位为象素
#define INFALTE 10 //触发收缩时鼠标与窗口边界的最小间隔,单位为象素
#define MINCX 100 //窗口最小宽度
#define MINCY 400 //窗口最小高度
#define SLIP_RATE 0.01
static UINT UWM_MOUSEMOVE = ::RegisterWindowMessage(UWM_MOUSEMOVE_MSG);
CDaemonManagerDlg::CDaemonManagerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDaemonManagerDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDaemonManagerDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_hIconHide=AfxGetApp()->LoadIcon(IDI_ICON_HIDE);
m_hIconFix=AfxGetApp()->LoadIcon(IDI_ICON_FIX);
m_isSizeChanged = FALSE;
m_isSetTimer = FALSE;
m_hsFinished = TRUE;
m_hiding = FALSE;
m_oldWndHeight = MINCY;
m_taskBarHeight = 30;
m_edgeHeight = 0;
m_edgeWidth =0;
m_hideMode = HM_TOP;
m_initialed=FALSE;
m_isFix=FALSE;
}
void CDaemonManagerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDaemonManagerDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDaemonManagerDlg, CDialog)
ON_REGISTERED_MESSAGE(UWM_MOUSEMOVE, OnMyMouseMove)
//{{AFX_MSG_MAP(CDaemonManagerDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_NCHITTEST()
ON_WM_TIMER()
ON_WM_SIZING()
ON_WM_CREATE()
ON_WM_MOVING()
ON_BN_CLICKED(IDC_BUTTON_FIX, OnButtonFix)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDaemonManagerDlg message handlers
void CDaemonManagerDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
CDialog::OnSysCommand(nID, lParam);
}
/****************************************************************************
* CHookDlg::OnMyMouseMove
* Inputs:
* WPARAM: unused
* LPARAM: (x,y) coordinates of mouse
* Result: LRESULT
* Logically void, 0, always
* Effect:
* Handles the mouse move event notification
****************************************************************************/
namespace
{
bool SaveBitmapToFile(HBITMAP hBitmap, string szfilename)
{
HDC hDC; // 设备描述表
int iBits; // 当前显示分辨率下每个像素所占字节数
WORD wBitCount; // 位图中每个像素所占字节数
DWORD dwPaletteSize = 0 ; // 定义调色板大小, 位图中像素字节大小 ,
// 位图文件大小 , 写入文件字节数
DWORD dwBmBitsSize ;
DWORD dwDIBSize, dwWritten ;
BITMAP Bitmap;
BITMAPFILEHEADER bmfHdr; //位图属性结构
BITMAPINFOHEADER bi; //位图文件头结构
LPBITMAPINFOHEADER lpbi; //位图信息头结构
HANDLE fh, hDib, hPal,hOldPal = NULL ; //指向位图信息头结构,定义文件,分配内存句柄,调色板句柄
//计算位图文件每个像素所占字节数
hDC = CreateDC( "DISPLAY" , NULL , NULL , NULL ) ;
iBits = GetDeviceCaps( hDC , BITSPIXEL ) * GetDeviceCaps( hDC , PLANES ) ;
DeleteDC( hDC ) ;
if ( iBits <= 1 )
{
wBitCount = 1;
}
else if ( iBits <= 4 )
{
wBitCount = 4;
}
else if ( iBits <= 8 )
{
wBitCount = 8;
}
else if ( iBits <= 24 )
{
wBitCount = 24;
}
else if ( iBits <= 32 )
{
wBitCount = 32;
}
//计算调色板大小
if ( wBitCount <= 8 )
{
dwPaletteSize = ( 1 << wBitCount ) * sizeof( RGBQUAD ) ;
}
//设置位图信息头结构
GetObject( hBitmap , sizeof( BITMAP ) , ( LPSTR ) & Bitmap ) ;
bi.biSize = sizeof( BITMAPINFOHEADER );
bi.biWidth = Bitmap.bmWidth;
bi.biHeight = Bitmap.bmHeight;
bi.biPlanes = 1;
bi.biBitCount = wBitCount;
bi.biCompression = BI_RGB;
bi.biSizeImage = 0;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0;
bi.biClrImportant = 0;
dwBmBitsSize = ( ( Bitmap.bmWidth * wBitCount + 31 ) / 32 ) * 4 * Bitmap.bmHeight ;
//为位图内容分配内存
hDib = GlobalAlloc( GHND ,dwBmBitsSize + dwPaletteSize + sizeof( BITMAPINFOHEADER ) ) ;
lpbi = ( LPBITMAPINFOHEADER )GlobalLock( hDib ) ;
*lpbi = bi;
// 处理调色板
hPal = GetStockObject( DEFAULT_PALETTE );
if ( hPal )
{
hDC = ::GetDC( NULL );
hOldPal = SelectPalette( hDC, (HPALETTE ) hPal , FALSE ) ;
RealizePalette( hDC ) ;
}
// 获取该调色板下新的像素值
GetDIBits( hDC, hBitmap, 0, ( UINT ) Bitmap.bmHeight,
( LPSTR )lpbi + sizeof( BITMAPINFOHEADER ) + dwPaletteSize,
( LPBITMAPINFO )lpbi, DIB_RGB_COLORS );
//恢复调色板
if ( hOldPal )
{
SelectPalette( hDC, ( HPALETTE )hOldPal, TRUE );
RealizePalette( hDC ) ;
::ReleaseDC( NULL, hDC ) ;
}
//创建位图文件
fh = CreateFile( szfilename.c_str() , GENERIC_WRITE,
0 , NULL , CREATE_ALWAYS ,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN , NULL ) ;
if ( fh == INVALID_HANDLE_VALUE )
{
return false;
}
// 设置位图文件头
bmfHdr.bfType = 0x4D42; // "BM"
dwDIBSize = sizeof( BITMAPFILEHEADER ) + sizeof( BITMAPINFOHEADER ) + dwPaletteSize + dwBmBitsSize;
bmfHdr.bfSize = dwDIBSize;
bmfHdr.bfReserved1 = 0;
bmfHdr.bfReserved2 = 0;
bmfHdr.bfOffBits = ( DWORD )sizeof( BITMAPFILEHEADER )
+ ( DWORD )sizeof( BITMAPINFOHEADER )
+ dwPaletteSize;
// 写入位图文件头
WriteFile( fh, ( LPSTR )&bmfHdr, sizeof
( BITMAPFILEHEADER ), &dwWritten, NULL);
// 写入位图文件其余内容
WriteFile( fh, ( LPSTR )lpbi, dwDIBSize,
&dwWritten , NULL );
//消除内存分配
GlobalUnlock( hDib );
GlobalFree( hDib );
CloseHandle( fh );
return true;
}
void CaptureRect(HDC hdcScreen, LPRECT prc)
{
HDC hdc = CreateCompatibleDC(hdcScreen);
HBITMAP hbmp = CreateCompatibleBitmap(hdcScreen,prc->right - prc->left,
prc->bottom - prc->top);
SelectObject(hdc,hbmp);
BitBlt(hdc,0,0,prc->right - prc->left,prc->bottom - prc->top,
hdcScreen,prc->left,prc->top,SRCCOPY);
//拷贝到剪贴板中
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP,hbmp);
CloseClipboard();
DeleteDC(hdc);
char tempFile[64];
sprintf(tempFile,"C:\\TMP\\%06u.bmp",GetTickCount());
SaveBitmapToFile(hbmp,string(tempFile));
::DeleteObject(hbmp);
vector<long> vecTest(300,0);
for (int i=0;i<vecTest.size();++i)
for (int k=0;k<vecTest.size();++k)
for (int j=0;j<vecTest.size();++j)
if(vecTest[j]!=vecTest[k])
break;
}
};
LRESULT CDaemonManagerDlg::OnMyMouseMove(WPARAM, LPARAM lParam)
{
CPoint point;
GetCursorPos(&point);
// CString str;
// str.Format("My Mouse (%d,%d)",point.x,point.y);
// GetDlgItem(IDC_CURSOR)->SetWindowText(str);
HDC hDeskDC = ::GetDC(NULL);
RECT rc;
//获取屏幕的大小
rc.left = point.x;
rc.top = point.y;
rc.right = rc.left + 100;
rc.bottom = rc.top + 100;
//CaptureRect(hDeskDC,&rc);
return 0;
} // CHookDlg::OnMyMouseMove
BOOL CDaemonManagerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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
// int cxIcon = GetSystemMetrics(SM_CXICON);
// int cyIcon = GetSystemMetrics(SM_CYICON);
int cxIcon = GetSystemMetrics( SM_CXFULLSCREEN );
int cyIcon = GetSystemMetrics( SM_CYFULLSCREEN );
CRect rect;
GetClientRect(&rect);
int x = (cxIcon-rect.Width() + 1) / 2;
int y = (cyIcon-rect.Height() + 1) / 2;
MoveWindow(x,0,rect.Width(),rect.Height(),TRUE);
CRgn rgn;
POINT points[4];
points[0].x=0;
points[0].y=0;
points[1].x=0+rect.Width();
points[1].y=0;
int slip=(int)(cxIcon*SLIP_RATE);
points[2].x=rect.Width()-slip;
points[2].y=rect.Height();
points[3].x=slip;
points[3].y=rect.Height();
rgn.CreatePolygonRgn(points,4,ALTERNATE);
SetWindowRgn(rgn,TRUE);
if(!m_initialed)
{
CPoint point;
point.x=x;
point.y=0;
m_btClose.SubclassDlgItem(IDOK,this);
m_btClose.LoadBitmaps(IDB_CLOSE_N,IDB_CLOSE_H,IDB_CLOSE_N,IDB_CLOSE_D);
m_btClose.Invalidate(true);
m_btClose.SizeToContent();
m_btFix.SubclassDlgItem(IDC_BUTTON_FIX,this);
m_btFix.LoadBitmaps(IDB_BITMAP_HIDE,IDB_BITMAP_HIDE,IDB_BITMAP_HIDE,IDB_BITMAP_HIDE);
m_btFix.Invalidate(true);
m_btFix.SizeToContent();
OnNcHitTest(point);
BOOL result = setMyHook(m_hWnd);
if(!result)
{ /* error */
DWORD err = ::GetLastError();
CString str;
str.Format(_T("%d"), err);
GetDlgItem(IDC_CURSOR)->SetWindowText(str);
} /* error */
else
{ /* set hook */
CString str;
str.Format(_T("Set Mouse Hook OK !"));
GetDlgItem(IDC_CURSOR)->SetWindowText(str);
} /* set hook */
}
return TRUE; // return TRUE unless you set the focus to a control
}
// 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 CDaemonManagerDlg::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 CDaemonManagerDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CDaemonManagerDlg::OnMoving(UINT fwSide, LPRECT pRect)
{
FixMoving(fwSide,pRect); //修正pRect
CDialog::OnMoving(fwSide, pRect);
}
void CDaemonManagerDlg::OnSizing(UINT fwSide, LPRECT pRect)
{
FixSizing(fwSide,pRect); //修正pRect
CDialog::OnSizing(fwSide, pRect);
}
UINT CDaemonManagerDlg::OnNcHitTest(CPoint point)
{
// TODO: Add your message handler code here and/or call default
CString str;
str.Format("Mouse (%d,%d)",point.x,point.y);
GetDlgItem(IDC_CURSOR)->SetWindowText(str);
if(m_hideMode != HM_NONE && !m_isSetTimer)
{
int firOpenPlus=0;
if(!m_initialed)
{
firOpenPlus=1000;
}
//鼠标进入时,如果是从收缩状态到显示状态则开启Timer
SetTimer(1,CM_ELAPSE+firOpenPlus,NULL);
m_isSetTimer = TRUE;
m_hsFinished = FALSE;
m_hiding = FALSE;
SetTimer(2,HS_ELAPSE,NULL); //开启显示过程
}
m_initialed=TRUE;
return CDialog::OnNcHitTest(point);
}
void CDaemonManagerDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == 1 )
{
POINT curPos;
GetCursorPos(&curPos);
CString str;
str.Format("Timer On(%d,%d)",curPos.x,curPos.y);
GetDlgItem(IDC_TIMER)->SetWindowText(str);
CRect tRect;
//获取此时窗口大小
GetWindowRect(tRect);
//膨胀tRect,以达到鼠标离开窗口边沿一定距离才触发事件
tRect.InflateRect(INFALTE,INFALTE);
if(!tRect.PtInRect(curPos)) //如果鼠标离开了这个区域
{
KillTimer(1); //关闭检测鼠标Timer
m_isSetTimer = FALSE;
GetDlgItem(IDC_TIMER)->SetWindowText("Timer Off");
m_hsFinished = FALSE;
m_hiding = TRUE;
SetTimer(2,HS_ELAPSE,NULL); //开启收缩过程
}
}
if(nIDEvent == 2)
{
if(m_hsFinished) //如果收缩或显示过程完毕则关闭Timer
KillTimer(2);
else
m_hiding ? DoHide() : DoShow();
}
CDialog::OnTimer(nIDEvent);
}
void CDaemonManagerDlg::DoHide()
{
if(m_isFix)
return;
if(m_hideMode == HM_NONE)
return;
CRect tRect;
GetWindowRect(tRect);
INT height = tRect.Height();
INT width = tRect.Width();
INT steps = 0;
switch(m_hideMode)
{
case HM_TOP:
steps = height/HS_STEPS;
tRect.bottom -= steps;
if(tRect.bottom <= m_edgeWidth)
{ //你可以把下面一句替换上面的 ...+=|-=steps 达到取消抽屉效果
//更好的办法是添加个BOOL值来控制,其他case同样.
tRect.bottom = m_edgeWidth;
m_hsFinished = TRUE; //完成隐藏过程
}
tRect.top = tRect.bottom - height;
break;
default:
break;
}
SetWindowPos(&wndTopMost,tRect);
}
void CDaemonManagerDlg::DoShow()
{
if(m_hideMode == HM_NONE)
return;
CRect tRect;
GetWindowRect(tRect);
INT height = tRect.Height();
INT width = tRect.Width();
INT steps = 0;
switch(m_hideMode)
{
case HM_TOP:
steps = height/HS_STEPS;
tRect.top += steps;
if(tRect.top >= -m_edgeHeight)
{ //你可以把下面一句替换上面的 ...+=|-=steps 达到取消抽屉效果
//更好的办法是添加个BOOL值来控制,其他case同样.
tRect.top = -m_edgeHeight;
m_hsFinished = TRUE; //完成显示过程
}
tRect.bottom = tRect.top + height;
break;
default:
break;
}
SetWindowPos(&wndTopMost,tRect);
}
BOOL CDaemonManagerDlg::SetWindowPos(const CWnd* pWndInsertAfter, LPCRECT pCRect, UINT nFlags)
{
return CDialog::SetWindowPos(pWndInsertAfter,pCRect->left, pCRect->top,
pCRect->right - pCRect->left, pCRect->bottom - pCRect->top, nFlags);
}
void CDaemonManagerDlg::FixMoving(UINT fwSide, LPRECT pRect)
{
POINT curPos;
GetCursorPos(&curPos);
INT screenHeight = GetSystemMetrics(SM_CYSCREEN);
INT screenWidth = GetSystemMetrics(SM_CXSCREEN);
INT height = pRect->bottom - pRect->top;
INT width = pRect->right - pRect->left;
if (curPos.y <= INTERVAL)
{ //粘附在上边
pRect->bottom = height - m_edgeHeight;
pRect->top = -m_edgeHeight;
m_hideMode = HM_TOP;
}
else
{ //不粘附
if(m_isSizeChanged)
{ //如果收缩到两边,则拖出来后会变回原来大小
//在"拖动不显示窗口内容下"只有光栅变回原来大小
pRect->bottom = pRect->top + m_oldWndHeight;
m_isSizeChanged = FALSE;
}
if(m_isSetTimer)
{ //如果Timer开启了,则关闭之
if(KillTimer(1) == 1)
m_isSetTimer = FALSE;
}
m_hideMode = HM_NONE;
GetDlgItem(IDC_TIMER)->SetWindowText("Timer off");
}
}
void CDaemonManagerDlg::FixSizing(UINT fwSide, LPRECT pRect)
{
CRect curRect(pRect);
if(curRect.Width() < MINCX || curRect.Height() < MINCY)
{ //小于指定的最小宽度或高度
switch(fwSide)
{
case WMSZ_BOTTOM:
pRect->bottom = pRect->top + MINCY;
break;
case WMSZ_BOTTOMLEFT:
if(curRect.Width() <= MINCX)
pRect->left = pRect->right - MINCX;
if(curRect.Height() <= MINCY)
pRect->bottom = pRect->top + MINCY;
break;
case WMSZ_BOTTOMRIGHT:
if(curRect.Width() < MINCX)
pRect->right = pRect->left + MINCX;
if(curRect.Height() < MINCY)
pRect->bottom = pRect->top + MINCY;
break;
case WMSZ_LEFT:
pRect->left = pRect->right - MINCX;
break;
case WMSZ_RIGHT:
pRect->right = pRect->left + MINCX;
break;
case WMSZ_TOP:
pRect->top = pRect->bottom - MINCY;
break;
case WMSZ_TOPLEFT:
if(curRect.Width() <= MINCX)
pRect->left = pRect->right - MINCX;
if(curRect.Height() <= MINCY)
pRect->top = pRect->bottom - MINCY;
break;
case WMSZ_TOPRIGHT:
if(curRect.Width() < MINCX)
pRect->right = pRect->left + MINCX;
if(curRect.Height() < MINCY)
pRect->top = pRect->bottom - MINCY;
break;
}
}
}
int CDaemonManagerDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//获得任务栏高度
CWnd* p;
p = this->FindWindow("Shell_TrayWnd",NULL);
if(p != NULL)
{
CRect tRect;
p->GetWindowRect(tRect);
m_taskBarHeight = tRect.Height();
}
//修改风格使得他不在任务栏显示
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
//去掉关闭按键(如果想画3个按键的话)
//ModifyStyle(WS_SYSMENU,NULL);
//获得边缘高度和宽度
m_edgeHeight = GetSystemMetrics(SM_CYEDGE);
m_edgeWidth = GetSystemMetrics(SM_CXFRAME);
//可以在这里读取上次关闭后保存的大小
return 0;
}
void CDaemonManagerDlg::OnButtonFix()
{
// TODO: Add your control notification handler code here
m_isFix=!m_isFix;
if(m_isFix)
{
m_btFix.LoadBitmaps(IDB_BITMAP_FIX,IDB_BITMAP_FIX,IDB_BITMAP_FIX,IDB_BITMAP_FIX);
}
else
{
m_btFix.LoadBitmaps(IDB_BITMAP_HIDE,IDB_BITMAP_HIDE,IDB_BITMAP_HIDE,IDB_BITMAP_HIDE);
}
m_btFix.RedrawWindow();
}
void CDaemonManagerDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnMouseMove(nFlags, point);
}
| [
"damoguyan8844@3a4e9f68-f5c2-36dc-e45a-441593085838"
] | [
[
[
1,
790
]
]
] |
f9d4c1bb1b19425f6d63f7adaa70f7819e8a0004 | 39040af0ff84935d083209731dd7343f93fa2874 | /demo/static/uhyperlink.h | f3a0f0730fb6b5a7f9d268bf694219139f335555 | [
"Apache-2.0"
] | permissive | alanzw/ulib-win | 02f8b7bcd8220b6a057fd3b33e733500294f9b56 | b67f644ed11c849e3c93b909f90d443df7be4e4c | refs/heads/master | 2020-04-06T05:26:54.849486 | 2011-07-23T05:47:17 | 2011-07-23T05:47:17 | 34,505,292 | 5 | 3 | null | null | null | null | ISO-8859-15 | C++ | false | false | 6,795 | h | /*
* =====================================================================================
*
* Filename: uhyperlink.h
*
* Description:
*
* Version: 1.0
* Created: 2010-9-28 19:06:37
* Revision: none
* Compiler: gcc
*
* Author: huys (hys), [email protected]
* Company: hu
*
* =====================================================================================
*/
#ifndef U_HYPERLINK_H
#define U_HYPERLINK_H
#include "ustatic.h"
#include "umsg.h"
#include "ubrush.h"
#include "udc.h"
#include "ushell.h"
class UHyperLink : public UStatic
{
enum {
ID_TIMER_DELAY = 111
};
public:
UHyperLink(HWND hParent, UINT nID, HINSTANCE hInst=GetModuleHandle(NULL))
: UStatic(hParent, nID, hInst)
{
m_dwStyles &= ~SS_SIMPLE;
m_dwStyles |= SS_NOTIFY;
_brBackgroud.createSolidBrush(::GetSysColor(COLOR_3DFACE));
m_crLink = huys::blue;
m_crVisited = huys::purple;
m_crHover = huys::red;
m_bOverControl = FALSE; // Cursor not yet over control
m_bVisited = FALSE; // Hasn't been visited yet.
m_bAdjustToFit = FALSE;
m_sUrl = "http://blog.csdn.net/fox000002";
}
BOOL create()
{
return UStatic::create() && this->subclassProc() && setTimer(ID_TIMER_DELAY, 100);
}
virtual BOOL onMouseMove(WPARAM wParam, LPARAM lParam)
{
if (!m_bOverControl) // Cursor has just moved over control
{
m_bOverControl = TRUE;
//if (m_nUnderline == ulHover)
// SetFont(&m_UnderlineFont);
invalidate();
setTimer(ID_TIMER_DELAY, 100);
}
return TRUE;
}
virtual BOOL onCtrlColor(WPARAM wParam, LPARAM lParam)
{
HDC hdc = (HDC)wParam;
USmartDC dc(hdc);
if (m_bOverControl)
dc.setTextColor(m_crHover);
else if (m_bVisited)
dc.setTextColor(m_crVisited);
else
dc.setTextColor(m_crLink);
dc.setBKMode(TRANSPARENT);
return (BOOL)(HBRUSH)GetStockObject(NULL_BRUSH);
}
/*
virtual BOOL onEraseBkgnd(HDC hdc)
{
USmartDC udc(hdc);
huys::URectL rect;
this->getClientRect(rect);
udc.fillRect(rect, _brBackgroud);
return TRUE;
}
*/
/* virtual */ BOOL onTimer(WPARAM wParam, LPARAM lParam)
{
if (wParam == ID_TIMER_DELAY)
{
huys::UPointL p(GetMessagePos());
::ScreenToClient(m_hSelf, p);
huys::URectL rect;
this->getClientRect(rect);
if (!rect.PtrInRect(p))
{
m_bOverControl = FALSE;
killTimer(ID_TIMER_DELAY);
//if (m_nUnderline != ulAlways)
// SetFont(&m_StdFont);
rect.offsetY(0, 10);
::InvalidateRect(m_hSelf, rect, TRUE);
}
//CStatic::OnTimer(nIDEvent);
return TRUE;
}
return FALSE;
}
/* virtual */ BOOL onNotifyReflect(WPARAM wParam, LPARAM lParam)
{
UINT code = ((LPNMHDR)lParam)->code;;
if (STN_CLICKED == code)
{
return this->onClicked();
}
return UStatic::onNotifyReflect(wParam, lParam);
}
/* virtual */ BOOL onLButtonDown(WPARAM wParam, LPARAM lParam)
{
//return this->onClicked();
this->goURL(m_sUrl);
return FALSE;
}
public:
void setBackground(huys::Color clr)
{
if (!_brBackgroud.isNull())
{
_brBackgroud.destroy();
}
_brBackgroud.createSolidBrush(clr);
}
void setColors(huys::Color crLink, huys::Color crVisited,
huys::Color crHover = -1)
{
m_crLink = crLink;
m_crVisited = crVisited;
m_crHover = crHover;
}
private:
huys::Color m_crLink; // Hyperlink colours
huys::Color m_crVisited;
huys::Color m_crHover; // Hover colour
BOOL m_bOverControl; // cursor over control?
BOOL m_bVisited; // Has it been visited?
UBrush _brBackgroud;
BOOL m_bAdjustToFit; // Adjust window size to fit text?
LPCTSTR m_sUrl;
private:
BOOL onClicked()
{
showMsg("clicked!");
return TRUE;
}
void goURL(const char * url)
{
UShell::open(url);
}
///////////////////////////////////////////////////////////////////////////////
// PositionWindow
// Move and resize the window so that the window is the same size
// as the hyperlink text. This stops the hyperlink cursor being active
// when it is not directly over the text. If the text is left justified
// then the window is merely shrunk, but if it is centred or right
// justified then the window will have to be moved as well.
//
// Suggested by Pål K. Tønder
//
void positionWindow()
{
if (!::IsWindow(m_hSelf) || !m_bAdjustToFit)
return;
// Get the current window position
huys::URectL WndRect, ClientRect;
this->getWindowRect(WndRect);
this->getClientRect(ClientRect);
//this->clientToScreen(m_hSelf, ClientRect);
HWND hParent = ::GetParent(m_hSelf);
if (hParent)
{
this->screenToDialog(hParent, WndRect);
this->clientToDialog(hParent, ClientRect);
}
// Get the size of the window text
TCHAR strWndText[512];
this->getWindowText(strWndText, 512);
/*
UPrivate dc(m_hSelf);
HANDLE hOldFont = dc.selectObj(m_UnderlineFont);
huys::USizeL Extent;
pDC->GetTextExtent(strWndText);
dc.selectObj(hOldFont);
ReleaseDC(pDC);
// Adjust for window borders
Extent.cx += WndRect.Width() - ClientRect.Width();
Extent.cy += WndRect.Height() - ClientRect.Height();
// Get the text justification via the window style
DWORD dwStyle = GetStyle();
// Recalc the window size and position based on the text justification
if (dwStyle & SS_CENTERIMAGE)
WndRect.DeflateRect(0, (WndRect.Height() - Extent.cy)/2);
else
WndRect.bottom = WndRect.top + Extent.cy;
if (dwStyle & SS_CENTER)
WndRect.DeflateRect((WndRect.Width() - Extent.cx)/2, 0);
else if (dwStyle & SS_RIGHT)
WndRect.left = WndRect.right - Extent.cx;
else // SS_LEFT = 0, so we can't test for it explicitly
WndRect.right = WndRect.left + Extent.cx;
// Move the window
SetWindowPos(NULL,
WndRect.left, WndRect.top,
WndRect.Width(), WndRect.Height(),
SWP_NOZORDER);
*/
}
};
#endif // U_HYPERLINK_H
| [
"fox000002@48c0247c-a797-11de-8c46-7bd654735883"
] | [
[
[
1,
265
]
]
] |
f7f5d5136bfa2508649edd4552d65da43823dfd6 | 38926bfe477f933a307f51376dd3c356e7893ffc | /Source/GameDLL/HUD/HUDInterfaceEffects.cpp | b46f44d8794a76a21a29b196eccf905a548524cb | [] | no_license | richmondx/dead6 | b0e9dd94a0ebb297c0c6e9c4f24c6482ef4d5161 | 955f76f35d94ed5f991871407f3d3ad83f06a530 | refs/heads/master | 2021-12-05T14:32:01.782047 | 2008-01-01T13:13:39 | 2008-01-01T13:13:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 49,592 | cpp | #include "StdAfx.h"
#include "HUD.h"
#include "HUDRadar.h"
#include "HUDSilhouettes.h"
#include "GameFlashAnimation.h"
#include "IRenderer.h"
#include "../Actor.h"
#include "WeaponSystem.h"
#include "Weapon.h"
#include "Claymore.h"
#include "../GameRules.h"
#include <IMaterialEffects.h>
#include "Game.h"
#include "GameCVars.h"
#include "IMusicSystem.h"
#include "INetwork.h"
#include "HUDVehicleInterface.h"
#include "Player.h"
#include "PlayerInput.h"
#include "IMovieSystem.h"
#include "HUDScopes.h"
#include "HUDCrosshair.h"
#include "OffHand.h"
#include "GameActions.h"
void CHUD::QuickMenuSnapToMode(ENanoMode mode)
{
switch(mode)
{
case NANOMODE_SPEED:
m_fAutosnapCursorRelativeX = 0.0f;
m_fAutosnapCursorRelativeY = -30.0f;
break;
case NANOMODE_STRENGTH:
m_fAutosnapCursorRelativeX = 30.0f;
m_fAutosnapCursorRelativeY = 0.0f;
break;
case NANOMODE_DEFENSE:
m_fAutosnapCursorRelativeX = -30.0f;
m_fAutosnapCursorRelativeY = 0.0f;
break;
case NANOMODE_CLOAK:
m_fAutosnapCursorRelativeX = 20.0f;
m_fAutosnapCursorRelativeY = 30.0f;
break;
default:
break;
}
}
void CHUD::AutoSnap()
{
const float fRadius = 25.0f;
static Vec2 s_vCursor = Vec2(0,0);
if(fabsf(m_fAutosnapCursorControllerX)>0.1 || fabsf(m_fAutosnapCursorControllerY)>0.1)
{
s_vCursor.x = m_fAutosnapCursorControllerX * 30.0f;
s_vCursor.y = m_fAutosnapCursorControllerY * 30.0f;
}
else
{
s_vCursor.x = m_fAutosnapCursorRelativeX;
s_vCursor.y = m_fAutosnapCursorRelativeY;
}
if(m_bOnCircle && s_vCursor.GetLength() < fRadius*0.5f)
{
m_fAutosnapCursorRelativeX = 0;
m_fAutosnapCursorRelativeY = 0;
m_bOnCircle = false;
}
if(s_vCursor.GetLength() > fRadius)
{
s_vCursor.NormalizeSafe();
m_fAutosnapCursorRelativeX = s_vCursor.x*fRadius;
m_fAutosnapCursorRelativeY = s_vCursor.y*fRadius;
m_bOnCircle = true;
}
const char* autosnapItem = "Center";
if(m_bOnCircle)
{
Vec2 vCursor = s_vCursor;
vCursor.NormalizeSafe();
float fAngle;
if(vCursor.y < 0)
{
fAngle = RAD2DEG(acos_tpl(vCursor.x));
}
else
{
fAngle = RAD2DEG(gf_PI2-acos_tpl(vCursor.x));
}
char szAngle[32];
sprintf(szAngle,"%f",-fAngle+90.0f);
/*
ColorB col(255,255,255,255);
int iW=m_pRenderer->GetWidth();
int iH=m_pRenderer->GetHeight();
m_pRenderer->Set2DMode(true,iW,iH);
m_pRenderer->GetIRenderAuxGeom()->DrawLine(Vec3(iW/2,iH/2,0),col,Vec3(iW/2+vCursor.x*100,iH/2+vCursor.y*100,0),col,5);
m_pRenderer->Set2DMode(false,0,0);
*/
m_animQuickMenu.CheckedSetVariable("Root.QuickMenu.Circle.Indicator._rotation",szAngle);
if(fAngle >= 342 || fAngle < 52)
{
autosnapItem = "Strength";
}
else if(fAngle >= 52 && fAngle < 128)
{
autosnapItem = "Speed";
}
else if(fAngle >= 128 && fAngle < 205)
{
autosnapItem = "Defense";
}
else if(fAngle >= 205 && fAngle < 260)
{
autosnapItem = "Weapon";
}
else if(fAngle >= 260 && fAngle < 342)
{
autosnapItem = "Cloak";
}
}
m_animQuickMenu.CheckedInvoke("Root.QuickMenu.setAutosnapItem", autosnapItem);
}
void CHUD::UpdateMissionObjectiveIcon(EntityId objective, int friendly, FlashOnScreenIcon iconType, bool forceNoOffset, Vec3 rotationTarget)
{
IEntity *pObjectiveEntity = GetISystem()->GetIEntitySystem()->GetEntity(objective);
if(!pObjectiveEntity) return;
AABB box;
pObjectiveEntity->GetWorldBounds(box);
Vec3 vWorldPos = Vec3(0,0,0);
SEntitySlotInfo info;
int slotCount = pObjectiveEntity->GetSlotCount();
for(int i=0; i<slotCount; ++i)
{
if (pObjectiveEntity->GetSlotInfo(i, info))
{
if (info.pCharacter)
{
int16 id = info.pCharacter->GetISkeletonPose()->GetJointIDByName("objectiveicon");
if (id >= 0)
{
//vPos = pCharacter->GetISkeleton()->GetHelperPos(helper);
vWorldPos = info.pCharacter->GetISkeletonPose()->GetAbsJointByID(id).t;
if (!vWorldPos.IsZero())
{
vWorldPos = pObjectiveEntity->GetSlotWorldTM(i).TransformPoint(vWorldPos);
break;
}
}
}
}
}
if(vWorldPos == Vec3(0,0,0))
vWorldPos = pObjectiveEntity->GetWorldPos();
if(!forceNoOffset)
vWorldPos.z += 2.0f;
Vec3 vEntityScreenSpace;
m_pRenderer->ProjectToScreen( vWorldPos.x, vWorldPos.y, vWorldPos.z, &vEntityScreenSpace.x, &vEntityScreenSpace.y, &vEntityScreenSpace.z);
Vec3 vEntityTargetSpace;
bool useTarget = false;
if(!rotationTarget.IsZero())
{
m_pRenderer->ProjectToScreen( rotationTarget.x, rotationTarget.y, rotationTarget.z, &vEntityTargetSpace.x, &vEntityTargetSpace.y, &vEntityTargetSpace.z);
useTarget = true;
}
CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetClientActor());
bool bBack = false;
if (IMovementController *pMV = pActor->GetMovementController())
{
SMovementState state;
pMV->GetMovementState(state);
Vec3 vLook = state.eyeDirection;
Vec3 vDir = vWorldPos - pActor->GetEntity()->GetWorldPos();
float fDot = vLook.Dot(vDir);
if(fDot<0.0f)
bBack = true;
}
bool bLeft(false), bRight(false), bTop(false), bBottom(false);
if(vEntityScreenSpace.z > 1.0f && bBack)
{
Vec2 vCenter(50.0f, 50.0f);
Vec2 vTarget(-vEntityScreenSpace.x, -vEntityScreenSpace.y);
Vec2 vScreenDir = vTarget - vCenter;
vScreenDir = vCenter + (100.0f * vScreenDir.NormalizeSafe());
vEntityScreenSpace.y = vScreenDir.y;
vEntityScreenSpace.x = vScreenDir.x;
useTarget = false;
}
if(vEntityScreenSpace.x < 2.0f)
{
bLeft = true;
vEntityScreenSpace.x = 2.0f;
useTarget = false;
}
if(vEntityScreenSpace.x > 98.0f)
{
bRight = true;
vEntityScreenSpace.x = 98.0f;
useTarget = false;
}
if(vEntityScreenSpace.y < 2.01f)
{
bTop = true;
vEntityScreenSpace.y = 2.0f;
useTarget = false;
}
if(vEntityScreenSpace.y > 97.99f)
{
bBottom = true;
vEntityScreenSpace.y = 98.0f;
useTarget = false;
}
float fScaleX = 0.0f;
float fScaleY = 0.0f;
float fHalfUselessSize = 0.0f;
GetProjectionScale(&m_animMissionObjective,&fScaleX,&fScaleY,&fHalfUselessSize);
if(bLeft && bTop)
{
iconType = eOS_TopLeft;
}
else if(bLeft && bBottom)
{
iconType = eOS_BottomLeft;
}
else if(bRight && bTop)
{
iconType = eOS_TopRight;
}
else if(bRight && bBottom)
{
iconType = eOS_BottomRight;
}
else if(bLeft)
{
iconType = eOS_Left;
}
else if(bRight)
{
iconType = eOS_Right;
}
else if(bTop)
{
iconType = eOS_Top;
}
else if(bBottom)
{
iconType = eOS_Bottom;
}
float rotation = 0.0f;
if(useTarget)
{
float diffX = (vEntityScreenSpace.x*fScaleX+fHalfUselessSize+16.0f) - (vEntityTargetSpace.x*fScaleX+fHalfUselessSize+16.0f);
float diffY = (vEntityScreenSpace.y*fScaleY) - (vEntityTargetSpace.y*fScaleY);
Vec2 dir(diffX, diffY);
dir.NormalizeSafe();
float fAngle;
if(dir.y < 0)
{
fAngle = RAD2DEG(acos_tpl(dir.x));
}
else
{
fAngle = RAD2DEG(gf_PI2-acos_tpl(dir.x));
}
rotation = fAngle - 90.0f;
}
int iMinDist = g_pGameCVars->hud_onScreenNearDistance;
int iMaxDist = g_pGameCVars->hud_onScreenFarDistance;
float fMinSize = g_pGameCVars->hud_onScreenNearSize;
float fMaxSize = g_pGameCVars->hud_onScreenFarSize;
CActor *pPlayerActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
float fDist = (vWorldPos-pPlayerActor->GetEntity()->GetWorldPos()).len();
float fSize = 1.0;
if(fDist<=iMinDist)
{
fSize = fMinSize;
}
else if(fDist>=iMaxDist)
{
fSize = fMaxSize;
}
else if(iMaxDist>iMinDist)
{
float fA = ((float)iMaxDist - fDist);
float fB = (float)(iMaxDist - iMinDist);
float fC = (fMinSize - fMaxSize);
fSize = ((fA / fB) * fC) + fMaxSize;
}
float centerX = 50.0;
float centerY = 50.0;
m_missionObjectiveNumEntries += FillUpMOArray(&m_missionObjectiveValues, objective, vEntityScreenSpace.x*fScaleX+fHalfUselessSize+16.0f, vEntityScreenSpace.y*fScaleY, iconType, friendly, (int)fDist, fSize*fSize, -rotation);
bool nearCenter = (pow(centerX-vEntityScreenSpace.x+1.5f,2.0f)+pow(centerY-vEntityScreenSpace.y+2.5f,2.0f))<16.0f;
if(nearCenter && (gEnv->bMultiplayer || m_pHUDScopes->IsBinocularsShown()))
{
m_objectiveNearCenter = objective;
}
}
void CHUD::UpdateAllMissionObjectives()
{
if(m_missionObjectiveValues.size() && (gEnv->bMultiplayer || m_pHUDScopes->IsBinocularsShown()))
{
m_animMissionObjective.SetVisible(true);
m_animMissionObjective.GetFlashPlayer()->SetVariableArray(FVAT_Double, "m_allValues", 0, &m_missionObjectiveValues[0], m_missionObjectiveNumEntries);
m_animMissionObjective.Invoke("updateMissionObjectives");
const char* description = "";
if(m_pHUDRadar)
description = m_pHUDRadar->GetObjectiveDescription(m_objectiveNearCenter);
SFlashVarValue args[2] = {(int)m_objectiveNearCenter, description};
m_animMissionObjective.Invoke("setNearCenter",args, 2);
m_objectiveNearCenter = 0;
}
else if(m_animMissionObjective.GetVisible())
{
m_animMissionObjective.SetVisible(false);
}
m_missionObjectiveNumEntries = 0;
m_missionObjectiveValues.clear();
}
int CHUD::FillUpMOArray(std::vector<double> *doubleArray, double a, double b, double c, double d, double e, double f, double g, double h)
{
doubleArray->push_back(a);
doubleArray->push_back(b);
doubleArray->push_back(c);
doubleArray->push_back(d);
doubleArray->push_back(e);
doubleArray->push_back(f);
doubleArray->push_back(g);
doubleArray->push_back(h);
return 8;
}
void CHUD::GrenadeDetector(CPlayer* pPlayerActor)
{
if(!m_entityGrenadeDectectorId)
return;
if(g_pGameCVars->g_difficultyLevel > 3)
return;
if(!m_animGrenadeDetector.IsLoaded())
m_animGrenadeDetector.Reload();
IEntity *pEntityGrenadeDetector = GetISystem()->GetIEntitySystem()->GetEntity(m_entityGrenadeDectectorId);
if(NULL == pEntityGrenadeDetector)
m_entityGrenadeDectectorId = 0;
else
{
AABB box;
pEntityGrenadeDetector->GetWorldBounds(box);
Vec3 vWorldPos = box.GetCenter();
Vec3 vEntityScreenSpace;
m_pRenderer->ProjectToScreen( vWorldPos.x, vWorldPos.y, vWorldPos.z, &vEntityScreenSpace.x, &vEntityScreenSpace.y, &vEntityScreenSpace.z);
if(vEntityScreenSpace.z > 1.0f)
{
m_animGrenadeDetector.Invoke("hideGrenadeDetector");
m_bGrenadeBehind = true;
}
else if(m_bGrenadeBehind)
{
m_animGrenadeDetector.Invoke("showGrenadeDetector");
m_bGrenadeBehind = false;
}
if(vEntityScreenSpace.x < 3.0f)
{
vEntityScreenSpace.x = 3.0f;
m_animGrenadeDetector.Invoke("morphLeft");
m_bGrenadeLeftOrRight = true;
}
else if(vEntityScreenSpace.x > 97.0f)
{
vEntityScreenSpace.x = 97.0f;
m_animGrenadeDetector.Invoke("morphRight");
m_bGrenadeLeftOrRight = true;
}
else if(m_bGrenadeLeftOrRight)
{
m_animGrenadeDetector.Invoke("morphNone");
m_bGrenadeLeftOrRight = false;
}
float fScaleX = 0.0f;
float fScaleY = 0.0f;
float fHalfUselessSize = 0.0f;
GetProjectionScale(&m_animGrenadeDetector,&fScaleX,&fScaleY,&fHalfUselessSize);
float fMovieHeight = (float) m_animGrenadeDetector.GetFlashPlayer()->GetHeight();
float fRendererHeight = (float) m_pRenderer->GetHeight();
// Note: 18 is the size of the box (coming from Flash)
float fBoxSizeX = 18.0f * fMovieHeight / fRendererHeight;
float fBoxSizeY = 18.0f * fMovieHeight / fRendererHeight;
char strX[32];
char strY[32];
sprintf(strX,"%f",vEntityScreenSpace.x*fScaleX-fBoxSizeX+fHalfUselessSize);
sprintf(strY,"%f",vEntityScreenSpace.y*fScaleY-fBoxSizeY);
m_animGrenadeDetector.SetVariable("Root.GrenadeDetect._x",strX);
m_animGrenadeDetector.SetVariable("Root.GrenadeDetect._y",strY);
char strDistance[32];
sprintf(strDistance,"%.2fM",(vWorldPos-pPlayerActor->GetEntity()->GetWorldPos()).len());
m_animGrenadeDetector.Invoke("setDistance", strDistance);
string grenadeName("@");
grenadeName.append(pEntityGrenadeDetector->GetClass()->GetName());
m_animGrenadeDetector.Invoke("setGrenadeType", grenadeName.c_str());
}
}
void CHUD::IndicateDamage(EntityId weaponId, Vec3 direction, bool onVehicle)
{
Vec3 vlookingDirection = FORWARD_DIRECTION;
CGameFlashAnimation* pAnim = NULL;
CActor *pPlayerActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
if(!pPlayerActor)
return;
if(IEntity *pEntity = gEnv->pEntitySystem->GetEntity(weaponId))
{
if(pEntity->GetClass() == CItem::sGaussRifleClass)
{
m_animRadarCompassStealth.Invoke("GaussHit");
m_animPlayerStats.Invoke("GaussHit");
}
}
IMovementController *pMovementController = NULL;
float fFront = 0.0f;
float fRight = 0.0f;
if(!onVehicle)
{
if(!g_pGameCVars->hud_chDamageIndicator)
return;
pMovementController = pPlayerActor->GetMovementController();
pAnim = m_pHUDCrosshair->GetFlashAnim();
}
else if(IVehicle *pVehicle = pPlayerActor->GetLinkedVehicle())
{
pMovementController = pVehicle->GetMovementController();
pAnim = &(m_pHUDVehicleInterface->m_animStats);
}
if(pMovementController && pAnim)
{
SMovementState sMovementState;
pMovementController->GetMovementState(sMovementState);
vlookingDirection = sMovementState.eyeDirection;
}
else
return;
if(!onVehicle)
{
//we use a static/world damage indicator and add the view rotation to the indicator animation now
fFront = -(Vec3(0,-1,0).Dot(direction));
fRight = -(Vec3(-1, 0, 0).Dot(direction));
}
else
{
Vec3 vRightDir = vlookingDirection.Cross(Vec3(0,0,1));
fFront = -vlookingDirection.Dot(direction);
fRight = -vRightDir.Dot(direction);
}
if(fabsf(fFront) > 0.35f)
{
if(fFront > 0)
pAnim->Invoke("setDamageDirection", 1);
else
pAnim->Invoke("setDamageDirection", 3);
}
if(fabsf(fRight) > 0.35f)
{
if(fRight > 0)
pAnim->Invoke("setDamageDirection", 2);
else
pAnim->Invoke("setDamageDirection", 4);
}
if(fFront == 0.0f && fRight == 0.0f)
{
pAnim->Invoke("setDamageDirection", 1);
pAnim->Invoke("setDamageDirection", 2);
pAnim->Invoke("setDamageDirection", 3);
pAnim->Invoke("setDamageDirection", 4);
}
m_fDamageIndicatorTimer = gEnv->pTimer->GetFrameStartTime().GetSeconds();
}
void CHUD::IndicateHit(bool enemyIndicator,IEntity *pEntity)
{
CPlayer *pPlayer = static_cast<CPlayer *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
if(!pPlayer)
return;
if(!pPlayer->GetLinkedVehicle())
m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
else
{
IVehicleSeat *pSeat = pPlayer->GetLinkedVehicle()->GetSeatForPassenger(pPlayer->GetEntityId());
if(pSeat && !pSeat->IsDriver())
m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
else
{
m_pHUDVehicleInterface->m_animMainWindow.Invoke("indicateHit", enemyIndicator);
if(pEntity && !gEnv->bMultiplayer)
{
float r = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 16) & 0xFF)) / 255.0f;
float g = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 8) & 0xFF)) / 255.0f;
float b = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 0) & 0xFF)) / 255.0f;
// It should be useless to test if pEntity is an enemy (it's already done by caller func)
IActor *pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEntity->GetId());
if(pActor)
m_pHUDSilhouettes->SetSilhouette(pActor,r,g,b,1.0f,5.0f,true);
else if(IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEntity->GetId()))
m_pHUDSilhouettes->SetSilhouette(pVehicle,r,g,b,1.0f,5.0f);
}
}
}
}
void CHUD::Targetting(EntityId pTargetEntity, bool bStatic)
{
if(IsAirStrikeAvailable() && GetScopes()->IsBinocularsShown())
{
float fCos = fabsf(cosf(gEnv->pTimer->GetAsyncCurTime()));
std::vector<EntityId>::const_iterator it = m_possibleAirStrikeTargets.begin();
for(; it != m_possibleAirStrikeTargets.end(); ++it)
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(*it);
if(pEntity)
{
m_pHUDSilhouettes->SetSilhouette(pEntity, 1.0f-0.6f*fCos, 1.0f-0.4f*fCos, 1.0f-0.20f*fCos, 0.5f, -1.0f);
}
}
}
else
{
IEntity *pEntityTargetAutoaim = gEnv->pEntitySystem->GetEntity(m_entityTargetAutoaimId);
if(NULL == pEntityTargetAutoaim)
{
m_entityTargetAutoaimId = 0;
}
else
{
m_pHUDSilhouettes->SetSilhouette(pEntityTargetAutoaim, 0.8f, 0.8f, 1.0f, 0.5f, -1.0f);
}
}
// Tac lock
if(GetCurrentWeapon() && m_bTacLock)
{
Vec3 vAimPos = (static_cast<CWeapon *>(GetCurrentWeapon()))->GetAimLocation();
Vec3 vTargetPos = (static_cast<CWeapon *>(GetCurrentWeapon()))->GetTargetLocation();
Vec3 vAimScreenSpace;
m_pRenderer->ProjectToScreen(vAimPos.x,vAimPos.y,vAimPos.z,&vAimScreenSpace.x,&vAimScreenSpace.y,&vAimScreenSpace.z);
Vec3 vTargetScreenSpace;
m_pRenderer->ProjectToScreen(vTargetPos.x,vTargetPos.y,vTargetPos.z,&vTargetScreenSpace.x,&vTargetScreenSpace.y,&vTargetScreenSpace.z);
float fScaleX = 0.0f;
float fScaleY = 0.0f;
float fHalfUselessSize = 0.0f;
GetProjectionScale(&m_animTacLock,&fScaleX,&fScaleY,&fHalfUselessSize);
m_animTacLock.SetVariable("AimSpot._x",SFlashVarValue(vAimScreenSpace.x*fScaleX+fHalfUselessSize));
m_animTacLock.SetVariable("AimSpot._y",SFlashVarValue(vAimScreenSpace.y*fScaleY));
m_animTacLock.SetVariable("TargetSpot._x",SFlashVarValue(vTargetScreenSpace.x*fScaleX+fHalfUselessSize));
m_animTacLock.SetVariable("TargetSpot._y",SFlashVarValue(vTargetScreenSpace.y*fScaleY));
}
//OnScreenMissionObjective
float fX(0.0f), fY(0.0f);
CActor *pActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
int team = 0;
CGameRules *pGameRules = (CGameRules*)(gEnv->pGame->GetIGameFramework()->GetIGameRulesSystem()->GetCurrentGameRules());
if(pActor && pGameRules)
team = pGameRules->GetTeam(pActor->GetEntityId());
if(m_iPlayerOwnedVehicle)
{
IEntity *pEntity = GetISystem()->GetIEntitySystem()->GetEntity(m_iPlayerOwnedVehicle);
if(!pEntity)
{
m_iPlayerOwnedVehicle = 0;
}
else
{
IVehicle *pCurrentVehicle = pActor->GetLinkedVehicle();
if(!(pCurrentVehicle && pCurrentVehicle->GetEntityId() == m_iPlayerOwnedVehicle))
UpdateMissionObjectiveIcon(m_iPlayerOwnedVehicle,1,eOS_Purchase);
}
}
if(!gEnv->bMultiplayer && GetScopes()->IsBinocularsShown() && g_pGameCVars->g_difficultyLevel < 3)
{
//draw single player mission objectives
std::map<EntityId, CHUDRadar::RadarObjective>::const_iterator it = m_pHUDRadar->m_missionObjectives.begin();
std::map<EntityId, CHUDRadar::RadarObjective>::const_iterator end = m_pHUDRadar->m_missionObjectives.end();
for(; it != end; ++it)
{
UpdateMissionObjectiveIcon(it->first, 0, eOS_SPObjective);
}
}
/* if(m_pHUDRadar->m_selectedTeamMates.size())
{
std::vector<EntityId>::iterator it = m_pHUDRadar->m_selectedTeamMates.begin();
for(; it != m_pHUDRadar->m_selectedTeamMates.end(); ++it)
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(*it);
if(pEntity)
UpdateMissionObjectiveIcon(*it,1,eOS_TeamMate);
}
}*/
if(pActor && pGameRules)
{
SetTACWeapon(false);
const std::vector<CGameRules::SMinimapEntity> synchEntities = pGameRules->GetMinimapEntities();
for(int m = 0; m < synchEntities.size(); ++m)
{
bool vehicle = false;
CGameRules::SMinimapEntity mEntity = synchEntities[m];
FlashRadarType type = m_pHUDRadar->GetSynchedEntityType(mEntity.type);
IEntity *pEntity = NULL;
if(type == ENuclearWeapon)
{
if(IItem *pWeapon = gEnv->pGame->GetIGameFramework()->GetIItemSystem()->GetItem(mEntity.entityId))
{
pEntity = gEnv->pEntitySystem->GetEntity(mEntity.entityId);
if(EntityId ownerId=pWeapon->GetOwnerId())
{
pEntity = gEnv->pEntitySystem->GetEntity(ownerId);
if (ownerId==g_pGame->GetIGameFramework()->GetClientActorId())
{
SetTACWeapon(true);
pEntity=0;
}
}
}
else
{
pEntity = gEnv->pEntitySystem->GetEntity(mEntity.entityId);
if (IVehicle *pVehicle=g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(mEntity.entityId))
{
vehicle=true;
if (pVehicle->GetDriver()==g_pGame->GetIGameFramework()->GetClientActor())
{
SetTACWeapon(true);
pEntity=0;
}
}
}
}
if(!pEntity) continue;
float fX(0.0f), fY(0.0f);
int friendly = m_pHUDRadar->FriendOrFoe(gEnv->bMultiplayer, team, pEntity, pGameRules);
if(vehicle)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_TACTank);
else
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_TACWeapon);
bool yetdrawn = false;
if(vehicle)
{
IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEntity->GetId());
if(pVehicle)
{
IActor *pDriverActor = pVehicle->GetDriver();
if(pDriverActor)
{
IEntity *pDriver = pDriverActor->GetEntity();
if(pDriver)
{
SFlashVarValue arg[2] = {(int)pEntity->GetId(),pDriver->GetName()};
m_animMissionObjective.Invoke("setPlayerName", arg, 2);
yetdrawn = true;
}
}
else
{
SFlashVarValue arg[2] = {(int)pEntity->GetId(),"@ui_osmo_NODRIVER"};
m_animMissionObjective.Invoke("setPlayerName", arg, 2);
yetdrawn = true;
}
}
}
if(!yetdrawn)
{
SFlashVarValue arg[2] = {(int)pEntity->GetId(),pEntity->GetName()};
m_animMissionObjective.Invoke("setPlayerName", arg, 2);
}
}
}
if(pActor)
{
std::vector<EntityId>::iterator it = m_pHUDRadar->GetObjectives()->begin();
for(; it != m_pHUDRadar->GetObjectives()->end(); ++it)
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(*it);
if(pEntity)
{
int friendly = m_pHUDRadar->FriendOrFoe(gEnv->bMultiplayer, team, pEntity, pGameRules);
FlashRadarType type = m_pHUDRadar->ChooseType(pEntity);
if(friendly==1 && IsUnderAttack(pEntity))
{
friendly = 3;
AddOnScreenMissionObjective(pEntity, friendly);
}
else if(HasTACWeapon() && (type == EHeadquarter || type == EHeadquarter2) && friendly == 2)
{
// Show TAC Target icon
AddOnScreenMissionObjective(pEntity, friendly);
}
else if(m_bShowAllOnScreenObjectives || m_iOnScreenObjective==(*it))
{
AddOnScreenMissionObjective(pEntity, friendly);
}
}
}
}
// icons for friendly claymores and mines
if(gEnv->bMultiplayer && pActor && pGameRules)
{
int playerTeam = pGameRules->GetTeam(pActor->GetEntityId());
std::list<EntityId>::iterator next;
std::list<EntityId>::iterator it = m_explosiveList.begin();
for(; it != m_explosiveList.end(); it=next)
{
next = it; ++next;
int mineTeam = pGameRules->GetTeam(*it);
if(mineTeam != 0 && mineTeam == playerTeam)
{
// quick check for proximity
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(*it);
if(pEntity)
{
Vec3 dir = pEntity->GetWorldPos() - pActor->GetEntity()->GetWorldPos();
if(dir.GetLengthSquared() <= 100.0f)
{
Vec3 targetPoint(0,0,0);
FlashOnScreenIcon icon = eOS_Bottom;
CProjectile *pProjectile = g_pGame->GetWeaponSystem()->GetProjectile(*it);
if(pProjectile && pProjectile->GetEntity())
{
IEntityClass* pClass = pProjectile->GetEntity()->GetClass();
if(pClass == m_pClaymore)
{
icon = eOS_Claymore;
CClaymore *pClaymore = static_cast<CClaymore *>(pProjectile);
if(pClaymore)
{
targetPoint = pEntity->GetWorldPos() + pClaymore->GetTriggerDirection();
}
}
else if(pClass == m_pAVMine)
{
icon = eOS_Mine;
}
UpdateMissionObjectiveIcon(*it, 1, icon, true, targetPoint);
}
}
}
}
}
}
UpdateAllMissionObjectives();
}
bool CHUD::IsUnderAttack(IEntity *pEntity)
{
if(!pEntity)
return false;
IScriptTable *pScriptTable = g_pGame->GetGameRules()->GetEntity()->GetScriptTable();
if (!pScriptTable)
return false;
bool underAttack=false;
HSCRIPTFUNCTION scriptFuncHelper = NULL;
if(pScriptTable->GetValue("IsUncapturing", scriptFuncHelper) && scriptFuncHelper)
{
Script::CallReturn(gEnv->pScriptSystem, scriptFuncHelper, pScriptTable, ScriptHandle(pEntity->GetId()), underAttack);
gEnv->pScriptSystem->ReleaseFunc(scriptFuncHelper);
scriptFuncHelper = NULL;
}
return underAttack;
}
void CHUD::AddOnScreenMissionObjective(IEntity *pEntity, int friendly)
{
FlashRadarType type = m_pHUDRadar->ChooseType(pEntity);
if(type == EHeadquarter)
if(HasTACWeapon() && friendly==2)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_HQTarget);
else
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_HQKorean);
else if(type == EHeadquarter2)
if(HasTACWeapon() && friendly==2)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_HQTarget);
else
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_HQUS);
else if(type == EFactoryTank)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_FactoryTank);
else if(type == EFactoryAir)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_FactoryAir);
else if(type == EFactorySea)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_FactoryNaval);
else if(type == EFactoryVehicle)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_FactoryVehicle);
else if(type == EFactoryPrototype)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_FactoryPrototypes);
else if(type == EAlienEnergySource)
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_AlienEnergyPoint);
else
{
//now spawn points
std::vector<EntityId> locations;
CGameRules *pGameRules = (CGameRules*)(gEnv->pGame->GetIGameFramework()->GetIGameRulesSystem()->GetCurrentGameRules());
pGameRules->GetSpawnGroups(locations);
for(int i = 0; i < locations.size(); ++i)
{
IEntity *pSpawnEntity = gEnv->pEntitySystem->GetEntity(locations[i]);
if(!pSpawnEntity) continue;
else if(pSpawnEntity == pEntity)
{
UpdateMissionObjectiveIcon(pEntity->GetId(),friendly,eOS_Spawnpoint);
break;
}
}
}
}
void CHUD::ShowKillAreaWarning(bool active, int timer)
{
if(active && timer && !m_animKillAreaWarning.IsLoaded())
{
m_animDeathMessage.Unload();
m_animKillAreaWarning.Reload();
m_animKillAreaWarning.Invoke("showWarning");
}
else if(m_animKillAreaWarning.IsLoaded() && (!active || !timer))
{
m_animKillAreaWarning.Unload();
return;
}
//set timer
if (m_animKillAreaWarning.IsLoaded())
{
m_animKillAreaWarning.Invoke("setCountdown", timer);
}
else if(timer <= 0 && active)
{
if(IActor *pActor = gEnv->pGame->GetIGameFramework()->GetClientActor())
{
IMaterialEffects* pMaterialEffects = gEnv->pGame->GetIGameFramework()->GetIMaterialEffects();
SMFXRunTimeEffectParams params;
params.pos = pActor->GetEntity()->GetWorldPos();
params.soundSemantic = eSoundSemantic_HUD;
TMFXEffectId id = pMaterialEffects->GetEffectIdByName("player_fx", "player_boundry_damage");
pMaterialEffects->ExecuteEffect(id, params);
}
m_animDeathMessage.Reload();
m_animDeathMessage.Invoke("showKillEvent");
}
}
void CHUD::ShowDeathFX(int type)
{
if(m_godMode || !g_pGame->GetIGameFramework()->IsGameStarted())
return;
IMaterialEffects* pMaterialEffects = gEnv->pGame->GetIGameFramework()->GetIMaterialEffects();
if (m_deathFxId != InvalidEffectId)
{
pMaterialEffects->StopEffect(m_deathFxId);
m_deathFxId = InvalidEffectId;
}
if (type<=0)
return;
IActor *pActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
if(pActor->GetHealth() <= 0)
return;
SMFXRunTimeEffectParams params;
params.pos = pActor->GetEntity()->GetWorldPos();
params.soundSemantic = eSoundSemantic_HUD;
static const char* deathType[] =
{
"playerdeath_generic",
"playerdeath_headshot",
"playerdeath_melee",
"playerdeath_freeze"
};
static const int maxTypes = sizeof(deathType) / sizeof(deathType[0]);
type = type < 1 ? 1 : ( type <= maxTypes ? type : maxTypes ); // sets values outside [0, maxTypes) to 0
m_deathFxId = pMaterialEffects->GetEffectIdByName("player_fx", deathType[type-1]);
if (m_deathFxId != InvalidEffectId)
pMaterialEffects->ExecuteEffect(m_deathFxId, params);
if(IMusicSystem *pMusic = gEnv->pSystem->GetIMusicSystem())
pMusic->SetMood("low_health");
}
void CHUD::UpdateVoiceChat()
{
if(!gEnv->bMultiplayer)
return;
IVoiceContext *pVoiceContext = gEnv->pGame->GetIGameFramework()->GetNetContext()->GetVoiceContext();
if(!pVoiceContext || !pVoiceContext->IsEnabled())
return;
IActor *pLocalActor = g_pGame->GetIGameFramework()->GetClientActor();
if(!pLocalActor)
return;
INetChannel *pNetChannel = gEnv->pGame->GetIGameFramework()->GetClientChannel();
if(!pNetChannel)
return;
bool someoneTalking = false;
EntityId localPlayerId = pLocalActor->GetEntityId();
//CGameRules::TPlayers players;
//g_pGame->GetGameRules()->GetPlayers(players); - GameRules has 0 players on client
//for(CGameRules::TPlayers::iterator it = players.begin(), itEnd = players.end(); it != itEnd; ++it)
IActorIteratorPtr it = g_pGame->GetIGameFramework()->GetIActorSystem()->CreateActorIterator();
while (IActor* pActor = it->Next())
{
if (!pActor->IsPlayer())
continue;
CGameRules* pGR = g_pGame->GetGameRules();
//IEntity *pEntity = gEnv->pEntitySystem->GetEntity(*it);
IEntity *pEntity = pActor->GetEntity();
if(pEntity)
{
if(pEntity->GetId() == localPlayerId)
{
if(g_pGame->GetIGameFramework()->IsVoiceRecordingEnabled())
{
m_animVoiceChat.Invoke("addVoice", pEntity->GetName());
someoneTalking = true;
}
}
else if(pGR && (pGR->GetTeamCount() == 1 || (pGR->GetTeam(pEntity->GetId()) == pGR->GetTeam(localPlayerId))))
{
if(pNetChannel->TimeSinceVoiceReceipt(pEntity->GetId()).GetSeconds() < 0.2f)
{
m_animVoiceChat.Invoke("addVoice", pEntity->GetName());
someoneTalking = true;
}
}
}
}
if(someoneTalking)
{
m_animVoiceChat.SetVisible(true);
m_animVoiceChat.Invoke("updateVoiceChat");
}
else
{
m_animVoiceChat.SetVisible(false);
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::UpdateCrosshairVisibility()
{
// marcok: don't touch this, please
if (g_pGameCVars->goc_enable)
{
m_pHUDCrosshair->GetFlashAnim()->Invoke("setVisible", 1);
return;
}
bool wasVisible = false;
if(!m_pHUDCrosshair->GetFlashAnim()->IsLoaded())
return;
if(m_pHUDCrosshair->GetFlashAnim()->GetFlashPlayer()->GetVisible())
{
wasVisible = true;
m_pHUDCrosshair->GetFlashAnim()->GetFlashPlayer()->SetVisible(false);
}
bool forceVehicleCrosshair = m_pHUDVehicleInterface->GetVehicle() && m_pHUDVehicleInterface->ForceCrosshair();
if(!m_iCursorVisibilityCounter && !m_bAutosnap && !m_bHideCrosshair && (!m_bThirdPerson || forceVehicleCrosshair) && !m_pHUDScopes->IsBinocularsShown())
{
// Do not show crosshair while in vehicle
if((!m_pHUDVehicleInterface->GetVehicle() && !m_pHUDVehicleInterface->IsParachute()) || forceVehicleCrosshair)
{
m_pHUDCrosshair->GetFlashAnim()->GetFlashPlayer()->SetVisible(true);
}
}
if(wasVisible != m_pHUDCrosshair->GetFlashAnim()->GetFlashPlayer()->GetVisible())
{
//turn off damage circle
m_pHUDCrosshair->GetFlashAnim()->Invoke("clearDamageDirection");
m_pHUDCrosshair->GetFlashAnim()->GetFlashPlayer()->Advance(0.1f);
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::UpdateCrosshair(IItem *pItem)
{
m_pHUDCrosshair->SelectCrosshair(pItem);
}
//-----------------------------------------------------------------------------------------------------
void CHUD::OnToggleThirdPerson(IActor *pActor,bool bThirdPerson)
{
if (!pActor->IsClient())
return;
m_bThirdPerson = bThirdPerson;
if(m_pHUDVehicleInterface && m_pHUDVehicleInterface->GetHUDType()!=CHUDVehicleInterface::EHUD_NONE)
m_pHUDVehicleInterface->UpdateVehicleHUDDisplay();
m_pHUDScopes->OnToggleThirdPerson(bThirdPerson);
UpdateCrosshairVisibility();
}
//-----------------------------------------------------------------------------------------------------
void CHUD::ShowTargettingAI(EntityId id)
{
if(gEnv->bMultiplayer)
return;
if(!g_pGameCVars->hud_chDamageIndicator)
return;
if(g_pGameCVars->g_difficultyLevel > 2)
return;
EntityId actorID = id;
if(IVehicle *pVehicle = g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(id))
{
if(pVehicle->GetDriver())
actorID = pVehicle->GetDriver()->GetEntityId();
}
if(IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(actorID))
{
if(pActor != g_pGame->GetIGameFramework()->GetClientActor())
{
m_pHUDSilhouettes->SetSilhouette(pActor,0.89411f,0.10588f,0.10588f,1,2);
m_pHUDRadar->AddEntityTemporarily(actorID);
}
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::FadeCinematicBars(int targetVal)
{
m_animCinematicBar.Reload();
m_animCinematicBar.SetVisible(true);
m_animCinematicBar.Invoke("setBarPos", targetVal<<1); // *2, because in flash its percentage of half size!
m_cineState = eHCS_Fading;
}
//-----------------------------------------------------------------------------------------------------
void CHUD::UpdateCinematicAnim(float frameTime)
{
if (m_cineState == eHCS_None)
return;
if(m_animCinematicBar.IsLoaded())
{
IFlashPlayer* pFP = m_animCinematicBar.GetFlashPlayer();
pFP->Advance(frameTime);
pFP->Render();
if (pFP->GetVisible() == false)
{
m_cineState = eHCS_None;
m_animCinematicBar.Unload();
}
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::UpdateSubtitlesAnim(float frameTime)
{
UpdateSubtitlesManualRender(frameTime);
}
//-----------------------------------------------------------------------------------------------------
bool CHUD::OnBeginCutScene(IAnimSequence* pSeq, bool bResetFX)
{
if (pSeq == 0)
return false;
if(m_pModalHUD == &m_animPDA)
{
ShowPDA(false);
}
else if(m_pModalHUD == &m_animWeaponAccessories)
{
ShowWeaponAccessories(false);
}
if(m_bNightVisionActive)
OnAction(g_pGame->Actions().hud_night_vision, 1, 1.0f); //turn off
int flags = pSeq->GetFlags();
if (IAnimSequence::IS_16TO9 & flags)
{
FadeCinematicBars(g_pGameCVars->hud_panoramicHeight);
}
if (IAnimSequence::NO_PLAYER & flags)
g_pGameActions->FilterCutsceneNoPlayer()->Enable(true);
else
g_pGameActions->FilterCutscene()->Enable(true);
g_pGameActions->FilterInVehicleSuitMenu()->Enable(true);
if(IAnimSequence::NO_HUD & flags)
{
m_cineHideHUD = true;
}
CActor *pPlayerActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
if (pPlayerActor)
{
if (CPlayer* pPlayer = static_cast<CPlayer*> (pPlayerActor))
{
if(m_pHUDScopes->m_animBinoculars.IsLoaded())
{
if(m_pHUDScopes->IsBinocularsShown())
pPlayer->SelectLastItem(false);
m_pHUDScopes->ShowBinoculars(false,false,true);
}
pPlayer->StopLoopingSounds();
if(IAnimSequence::NO_PLAYER & flags)
{
if (SPlayerStats* pActorStats = static_cast<SPlayerStats*> (pPlayer->GetActorStats()))
pActorStats->spectatorMode = CActor::eASM_Cutscene; // moved up to avoid conflict with the MP spectator modes
pPlayer->Draw(false);
if (pPlayer->GetPlayerInput())
pPlayer->GetPlayerInput()->Reset();
if(IItem* pItem = pPlayer->GetCurrentItem())
{
if(IWeapon *pWeapon = pItem->GetIWeapon())
{
if(pWeapon->IsZoomed() || pWeapon->IsZooming())
pWeapon->ExitZoom();
}
}
if(COffHand* pOffHand = static_cast<COffHand*>(pPlayer->GetItemByClass(CItem::sOffHandClass)))
pOffHand->OnBeginCutScene();
pPlayer->HolsterItem(true);
}
}
}
m_fCutsceneSkipTimer = g_pGameCVars->g_cutsceneSkipDelay;
m_bCutscenePlaying = true;
m_bCutsceneAbortPressed = false;
#ifdef USER_alexl
CryLogAlways("[CX]: BEGIN Frame=%d 0x%p Name=%s Cutscene=%d NoPlayer=%d NoHUD=%d NoAbort=%d",
gEnv->pRenderer->GetFrameID(false), pSeq, pSeq->GetName(), flags & IAnimSequence::CUT_SCENE, flags & IAnimSequence::NO_PLAYER, flags & IAnimSequence::NO_HUD, flags & IAnimSequence::NO_ABORT);
#endif
return true;
}
//-----------------------------------------------------------------------------------------------------
bool CHUD::OnEndCutScene(IAnimSequence* pSeq)
{
if (pSeq == 0)
return false;
m_pHUDCrosshair->Reset();
m_bCutscenePlaying = false;
if (m_bStopCutsceneNextUpdate)
{
m_bStopCutsceneNextUpdate = false; // just in case, the cutscene wasn't stopped in CHUD::OnPostUpdate, but due to some other stuff (like Serialize/Flowgraph)
}
g_pGameActions->FilterCutscene()->Enable(false);
g_pGameActions->FilterCutsceneNoPlayer()->Enable(false);
g_pGameActions->FilterInVehicleSuitMenu()->Enable(false);
int flags = pSeq->GetFlags();
if (IAnimSequence::IS_16TO9 & flags)
{
FadeCinematicBars(0);
}
if(IAnimSequence::NO_HUD & flags)
m_cineHideHUD = false;
if(IAnimSequence::NO_PLAYER & flags)
{
if (CActor *pPlayerActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor()))
{
if (CPlayer* pPlayer = static_cast<CPlayer*> (pPlayerActor))
{
if (SPlayerStats* pActorStats = static_cast<SPlayerStats*> (pPlayer->GetActorStats()))
pActorStats->spectatorMode = CActor::eASM_None;
pPlayer->Draw(true);
if(COffHand* pOffHand = static_cast<COffHand*>(pPlayer->GetItemByClass(CItem::sOffHandClass)))
pOffHand->OnEndCutScene();
// restore health and nanosuit, because time has passed during cutscene
// and player was not-enabled
// -> simulate health-regen
pPlayer->SetHealth(pPlayer->GetMaxHealth());
if (pPlayer->GetNanoSuit())
{
pPlayer->GetNanoSuit()->ResetEnergy();
}
pPlayer->HolsterItem(false);
}
}
}
#ifdef USER_alexl
CryLogAlways("[CX]: END Frame=%d 0x%p Name=%s Cutscene=%d NoPlayer=%d NoHUD=%d NoAbort=%d",
gEnv->pRenderer->GetFrameID(false), pSeq, pSeq->GetName(), flags & IAnimSequence::CUT_SCENE, flags & IAnimSequence::NO_PLAYER, flags & IAnimSequence::NO_HUD, flags & IAnimSequence::NO_ABORT);
#endif
return true;
}
//-----------------------------------------------------------------------------------------------------
bool CHUD::OnCameraChange(const SCameraParams& cameraParams)
{
return true;
}
//-----------------------------------------------------------------------------------------------------
void CHUD::OnPlayCutSceneSound(IAnimSequence* pSeq, ISound* pSound)
{
if (m_hudSubTitleMode == eHSM_CutSceneOnly)
{
if (pSound && pSound->GetFlags() & FLAG_SOUND_VOICE)
ShowSubtitle(pSound, true);
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::SetSubtitleMode(HUDSubtitleMode mode)
{
m_hudSubTitleMode = mode;
ISubtitleManager* pSubtitleManager = g_pGame->GetIGameFramework()->GetISubtitleManager();
if (pSubtitleManager == 0)
return;
if (m_hudSubTitleMode == eHSM_Off || m_hudSubTitleMode == eHSM_CutSceneOnly)
{
pSubtitleManager->SetEnabled(false);
pSubtitleManager->SetHandler(0);
if (m_hudSubTitleMode == eHSM_Off)
{
m_subtitleEntries.clear();
m_bSubtitlesNeedUpdate = true;
}
}
else // mode == eHSM_All
{
pSubtitleManager->SetEnabled(true);
pSubtitleManager->SetHandler(this);
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::ShowProgress(int progress, bool init /* = false */, int posX /* = 0 */, int posY /* = 0 */, const char *text, bool topText, bool lockingBar)
{
CGameFlashAnimation *pAnim = &m_animProgress;
if(m_bProgressLocking)
pAnim = &m_animProgressLocking;
if(init)
{
if(lockingBar)
{
if(m_animProgress.IsLoaded())
m_animProgress.Unload();
}
else
{
if(m_animProgressLocking.IsLoaded())
m_animProgressLocking.Unload();
}
m_bProgressLocking = lockingBar;
if(!pAnim->IsLoaded())
{
if(lockingBar)
m_animProgressLocking.Load("Libs/UI/HUD_TAC_Locking.gfx", eFD_Center, eFAF_Visible);
else
m_animProgress.Load("Libs/UI/HUD_ProgressBar.gfx", eFD_Center, eFAF_Default);
m_iProgressBar = 0;
}
pAnim->Invoke("showProgressBar", true);
const wchar_t* localizedText = (text)?LocalizeWithParams(text, true):L"";
SFlashVarValue args[2] = {localizedText, topText ? 1 : 2};
pAnim->Invoke("setText", args, 2);
SFlashVarValue pos[2] = {posX*1024/800, posY*768/512};
pAnim->Invoke("setPosition", pos, 2);
m_iProgressBarX = posX;
m_iProgressBarY = posY;
m_sProgressBarText = string(text);
m_bProgressBarTextPos = topText;
}
else if(progress < 0 && pAnim->IsLoaded())
{
pAnim->Invoke("showProgressBar", false); // for sound callback
pAnim->Unload();
m_iProgressBar = 0;
}
if(pAnim->IsLoaded() && (m_iProgressBar != progress || init))
{
pAnim->Invoke("setProgressBar", progress);
m_iProgressBar = progress;
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::FakeDeath(bool revive)
{
return; //feature disabled
CPlayer *pPlayer = static_cast<CPlayer*>(g_pGame->GetIGameFramework()->GetClientActor());
if(pPlayer->IsGod() || gEnv->bMultiplayer)
return;
if(pPlayer->GetLinkedEntity()) //not safe
{
m_fPlayerRespawnTimer = 0.0f;
pPlayer->SetHealth(0);
pPlayer->CreateScriptEvent("kill",0);
return;
}
if(revive)
{
float now = gEnv->pTimer->GetFrameStartTime().GetSeconds();
float diff = now - m_fPlayerRespawnTimer;
if(pPlayer->GetHealth() <= 0)
{
m_fPlayerRespawnTimer = 0.0f;
return;
}
if(diff > -3.0f && (now - m_fLastPlayerRespawnEffect > 0.5f))
{
IMaterialEffects* pMaterialEffects = gEnv->pGame->GetIGameFramework()->GetIMaterialEffects();
SMFXRunTimeEffectParams params;
params.pos = pPlayer->GetEntity()->GetWorldPos();
params.soundSemantic = eSoundSemantic_HUD;
TMFXEffectId id = pMaterialEffects->GetEffectIdByName("player_fx", "player_damage_armormode");
pMaterialEffects->ExecuteEffect(id, params);
m_fLastPlayerRespawnEffect = now;
}
else if(diff > 0.0)
{
if(m_bRespawningFromFakeDeath)
{
pPlayer->StandUp();
pPlayer->Revive(false);
RebootHUD();
pPlayer->HolsterItem(false);
if (g_pGameCVars->g_godMode == 3)
{
g_pGame->GetGameRules()->PlayerPosForRespawn(pPlayer, false);
}
m_fPlayerRespawnTimer = 0.0f;
//if (IUnknownProxy * pProxy = pPlayer->GetEntity()->GetAI()->GetProxy())
// pProxy->EnableUpdate(true); //seems not to work
pPlayer->CreateScriptEvent("cloaking", 0);
if (pPlayer->GetEntity()->GetAI())
gEnv->pAISystem->SendSignal(SIGNALFILTER_SENDER,1, "OnNanoSuitUnCloak",pPlayer->GetEntity()->GetAI());
m_bRespawningFromFakeDeath = false;
DisplayOverlayFlashMessage(" ");
}
else
{
m_fPlayerRespawnTimer = 0.0f;
pPlayer->SetHealth(0);
pPlayer->CreateScriptEvent("kill",0);
}
}
else
{
char text[256];
char seconds[10];
sprintf(seconds,"%i",(int)(fabsf(diff)));
if(m_bRespawningFromFakeDeath)
sprintf(text,"@ui_respawn_counter");
else
sprintf(text,"@ui_revive_counter");
DisplayFlashMessage(text, 2, ColorF(1.0f,0.0f,0.0f), true, seconds);
}
}
else if(!m_fPlayerRespawnTimer)
{
if(pPlayer && (/*g_pGameCVars->g_playerRespawns > 0*/ g_pGameCVars->g_difficultyLevel < 2 || g_pGameCVars->g_godMode == 3))
{
//g_pGameCVars->g_playerRespawns--; //unlimited for now
//if (g_pGameCVars->g_playerRespawns < 0)
// g_pGameCVars->g_playerRespawns = 0;
pPlayer->HolsterItem(true);
pPlayer->Fall(Vec3(0,0,0), true);
pPlayer->SetDeathTimer();
//if (IUnknownProxy * pProxy = pPlayer->GetEntity()->GetAI()->GetProxy())
// pProxy->EnableUpdate(false); //seems not to work - cloak instead
pPlayer->CreateScriptEvent("cloaking", 1);
if (pPlayer->GetEntity()->GetAI())
gEnv->pAISystem->SendSignal(SIGNALFILTER_SENDER,1, "OnNanoSuitCloak",pPlayer->GetEntity()->GetAI());
ShowDeathFX(0);
GetRadar()->Reset();
BreakHUD(2);
m_fPlayerRespawnTimer = gEnv->pTimer->GetFrameStartTime().GetSeconds() + 10.0f;
m_fLastPlayerRespawnEffect = 0.0f;
}
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::ShowDataUpload(bool active)
{
if(active)
{
if(!m_animDataUpload.IsLoaded())
{
m_animDataUpload.Load("Libs/UI/HUD_Recording.gfx", eFD_Right);
m_animDataUpload.Invoke("showUplink", true);
}
}
else
{
if(m_animDataUpload.IsLoaded())
m_animDataUpload.Unload();
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::ShowWeaponsOnGround()
{
if(!m_pHUDScopes->IsBinocularsShown())
return;
if(gEnv->bMultiplayer)
return;
if(g_pGameCVars->g_difficultyLevel > 2)
return;
IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
if(!pClientActor)
return;
Vec3 clientPos = pClientActor->GetEntity()->GetWorldPos();
CCamera camera=GetISystem()->GetViewCamera();
IPhysicalEntity *pSkipEnt=pClientActor?pClientActor->GetEntity()->GetPhysics():0;
//go through all weapons without owner in your proximity and highlight them
const std::vector<EntityId> *pItems = m_pHUDRadar->GetNearbyItems();
if(pItems && pItems->size() > 0)
{
std::vector<EntityId>::const_iterator it = pItems->begin();
std::vector<EntityId>::const_iterator end = pItems->end();
for(; it != end; ++it)
{
EntityId id = *it;
IItem *pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(id);
if(pItem && pItem->GetIWeapon() /*&& !pItem->GetOwnerId()*/ && !pItem->GetEntity()->GetParent() && !pItem->GetEntity()->IsHidden())
{
float distance = (pItem->GetEntity()->GetWorldPos() - clientPos).len();
if(distance < 10.0f)
{
IPhysicalEntity *pPE = pItem->GetEntity()->GetPhysics();
if(pPE)
{
pe_status_dynamics dyn;
pPE->GetStatus(&dyn);
Vec3 dir=(dyn.centerOfMass-camera.GetPosition())*1.15f;
//raycast object
ray_hit hit;
if (gEnv->pPhysicalWorld->RayWorldIntersection(camera.GetPosition(), dir, ent_all, (13&rwi_pierceability_mask), &hit, 1, &pSkipEnt, pSkipEnt?1:0))
{
if (!hit.bTerrain && hit.pCollider==pPE)
{
//display
// UpdateMissionObjectiveIcon(id, 1, eOS_Bottom, true);
m_pHUDSilhouettes->SetSilhouette(pItem,0,0,1,1,-1);
}
}
}
}
}
}
}
}
//-----------------------------------------------------------------------------------------------------
void CHUD::FireModeSwitch(bool grenades /* = false */)
{
if(m_quietMode)
return;
if(!grenades)
m_animPlayerStats.Invoke("switchFireMode");
else
m_animPlayerStats.Invoke("switchGrenades");
}
//-----------------------------------------------------------------------------------------------------
void CHUD::DrawGroundCircle(Vec3 pos, float radius, float thickness /* = 1.0f */, float anglePerSection /* = 5.0f */, ColorB col, bool aligned /* = true */, float offset /* = 0.1f */, bool useSecondColor, ColorB colB)
{
Vec3 p0,p1;
p0.x = pos.x + radius*sin(0.0f);
p0.y = pos.y + radius*cos(0.0f);
p0.z = pos.z;
if(aligned)
{
float terrainHeight = gEnv->p3DEngine->GetTerrainZ((int)p0.x, (int)p0.y);
p0.z = terrainHeight + 0.25f;
}
float step = anglePerSection/180*gf_PI;
bool switchColor = true;
for (float angle = 0; angle < 360.0f/180*gf_PI+step; angle += step)
{
p1.x = pos.x + radius*sin(angle);
p1.y = pos.y + radius*cos(angle);
if(aligned)
{
float terrainHeight = gEnv->p3DEngine->GetTerrainZ((int)p1.x, (int)p1.y);
p1.z = terrainHeight + offset;
if(p1.z - p0.z > 0.15f)
p1.z = (3.0f* p0.z + p1.z) * 0.25f;
}
else
p1.z = pos.z + offset;
if(angle == 0)
p0 = p1;
if(useSecondColor)
{
switchColor = !switchColor;
if(switchColor)
gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(p0,colB,p1,col,thickness);
else
gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(p0,col,p1,colB,thickness);
}
else
gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(p0,col,p1,col,thickness);
p0 = p1;
}
}
| [
"[email protected]",
"kkirst@c5e09591-5635-0410-80e3-0b71df3ecc31"
] | [
[
[
1,
2
],
[
5,
7
],
[
9,
9
],
[
11,
22
],
[
25,
90
],
[
92,
94
],
[
96,
97
],
[
109,
109
],
[
111,
111
],
[
113,
115
],
[
117,
119
],
[
121,
123
],
[
125,
127
],
[
129,
136
],
[
138,
143
],
[
173,
175
],
[
183,
206
],
[
208,
212
],
[
214,
218
],
[
220,
224
],
[
226,
230
],
[
232,
233
],
[
238,
271
],
[
279,
279
],
[
291,
315
],
[
326,
334
],
[
341,
341
],
[
343,
351
],
[
353,
360
],
[
363,
415
],
[
420,
421
],
[
423,
438
],
[
442,
458
],
[
460,
527
],
[
529,
541
],
[
559,
561
],
[
563,
565
],
[
567,
571
],
[
575,
578
],
[
581,
585
],
[
587,
590
],
[
592,
592
],
[
595,
601
],
[
606,
630
],
[
634,
639
],
[
642,
643
],
[
645,
673
],
[
675,
705
],
[
707,
753
],
[
755,
765
],
[
767,
773
],
[
821,
915
],
[
917,
928
],
[
930,
948
],
[
950,
998
],
[
1001,
1012
],
[
1014,
1039
],
[
1041,
1045
],
[
1048,
1050
],
[
1053,
1053
],
[
1055,
1055
],
[
1059,
1060
],
[
1062,
1065
],
[
1080,
1102
],
[
1106,
1112
],
[
1114,
1118
],
[
1120,
1120
],
[
1122,
1122
],
[
1125,
1173
],
[
1176,
1176
],
[
1185,
1191
],
[
1199,
1203
],
[
1207,
1207
],
[
1209,
1209
],
[
1220,
1225
],
[
1238,
1240
],
[
1251,
1260
],
[
1271,
1289
],
[
1302,
1305
],
[
1311,
1358
],
[
1360,
1360
],
[
1365,
1366
],
[
1388,
1388
],
[
1391,
1392
],
[
1394,
1394
],
[
1407,
1408
],
[
1414,
1415
],
[
1418,
1419
],
[
1422,
1425
],
[
1434,
1437
],
[
1444,
1449
],
[
1451,
1473
],
[
1475,
1496
],
[
1498,
1498
],
[
1502,
1528
],
[
1530,
1541
],
[
1543,
1543
],
[
1610,
1610
],
[
1663,
1663
]
],
[
[
3,
4
],
[
8,
8
],
[
10,
10
],
[
23,
24
],
[
91,
91
],
[
95,
95
],
[
98,
108
],
[
110,
110
],
[
112,
112
],
[
116,
116
],
[
120,
120
],
[
124,
124
],
[
128,
128
],
[
137,
137
],
[
144,
172
],
[
176,
182
],
[
207,
207
],
[
213,
213
],
[
219,
219
],
[
225,
225
],
[
231,
231
],
[
234,
237
],
[
272,
278
],
[
280,
290
],
[
316,
325
],
[
335,
340
],
[
342,
342
],
[
352,
352
],
[
361,
362
],
[
416,
419
],
[
422,
422
],
[
439,
441
],
[
459,
459
],
[
528,
528
],
[
542,
558
],
[
562,
562
],
[
566,
566
],
[
572,
574
],
[
579,
580
],
[
586,
586
],
[
591,
591
],
[
593,
594
],
[
602,
605
],
[
631,
633
],
[
640,
641
],
[
644,
644
],
[
674,
674
],
[
706,
706
],
[
754,
754
],
[
766,
766
],
[
774,
820
],
[
916,
916
],
[
929,
929
],
[
949,
949
],
[
999,
1000
],
[
1013,
1013
],
[
1040,
1040
],
[
1046,
1047
],
[
1051,
1052
],
[
1054,
1054
],
[
1056,
1058
],
[
1061,
1061
],
[
1066,
1079
],
[
1103,
1105
],
[
1113,
1113
],
[
1119,
1119
],
[
1121,
1121
],
[
1123,
1124
],
[
1174,
1175
],
[
1177,
1184
],
[
1192,
1198
],
[
1204,
1206
],
[
1208,
1208
],
[
1210,
1219
],
[
1226,
1237
],
[
1241,
1250
],
[
1261,
1270
],
[
1290,
1301
],
[
1306,
1310
],
[
1359,
1359
],
[
1361,
1364
],
[
1367,
1387
],
[
1389,
1390
],
[
1393,
1393
],
[
1395,
1406
],
[
1409,
1413
],
[
1416,
1417
],
[
1420,
1421
],
[
1426,
1433
],
[
1438,
1443
],
[
1450,
1450
],
[
1474,
1474
],
[
1497,
1497
],
[
1499,
1501
],
[
1529,
1529
],
[
1542,
1542
],
[
1544,
1609
],
[
1611,
1662
]
]
] |
9d0a15c23ef2a5edb06401d0befe02c64b9e4ffe | d7320c9c1f155e2499afa066d159bfa6aa94b432 | /ghostgproxy/replay.h | b45754977f1fd216ea8ee8c8d2bd199b73b0d00b | [] | no_license | HOST-PYLOS/ghostnordicleague | c44c804cb1b912584db3dc4bb811f29f3761a458 | 9cb262d8005dda0150b75d34b95961d664b1b100 | refs/heads/master | 2016-09-05T10:06:54.279724 | 2011-02-23T08:02:50 | 2011-02-23T08:02:50 | 32,241,503 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,071 | h | /*
Copyright [2008] [Trevor Hogan]
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.
CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
*/
#ifndef REPLAY_H
#define REPLAY_H
#include "gameslot.h"
//
// CReplay
//
class CIncomingAction;
class CReplay : public CPacked
{
public:
enum BlockID {
REPLAY_LEAVEGAME = 0x17,
REPLAY_FIRSTSTARTBLOCK = 0x1A,
REPLAY_SECONDSTARTBLOCK = 0x1B,
REPLAY_THIRDSTARTBLOCK = 0x1C,
REPLAY_TIMESLOT2 = 0x1E, // corresponds to W3GS_INCOMING_ACTION2
REPLAY_TIMESLOT = 0x1F, // corresponds to W3GS_INCOMING_ACTION
REPLAY_CHATMESSAGE = 0x20,
REPLAY_CHECKSUM = 0x22, // corresponds to W3GS_OUTGOING_KEEPALIVE
REPLAY_DESYNC = 0x23
};
private:
unsigned char m_HostPID;
string m_HostName;
string m_GameName;
string m_StatString;
uint32_t m_PlayerCount;
uint32_t m_MapGameType;
vector<PIDPlayer> m_Players;
vector<CGameSlot> m_Slots;
uint32_t m_RandomSeed;
unsigned char m_SelectMode; // also known as the "layout style" elsewhere in this project
unsigned char m_StartSpotCount;
queue<BYTEARRAY> m_LoadingBlocks;
queue<BYTEARRAY> m_Blocks;
queue<uint32_t> m_CheckSums;
string m_CompiledBlocks;
public:
CReplay( );
virtual ~CReplay( );
unsigned char GetHostPID( ) { return m_HostPID; }
string GetHostName( ) { return m_HostName; }
string GetGameName( ) { return m_GameName; }
string GetStatString( ) { return m_StatString; }
uint32_t GetPlayerCount( ) { return m_PlayerCount; }
uint32_t GetMapGameType( ) { return m_MapGameType; }
vector<PIDPlayer> GetPlayers( ) { return m_Players; }
vector<CGameSlot> GetSlots( ) { return m_Slots; }
uint32_t GetRandomSeed( ) { return m_RandomSeed; }
unsigned char GetSelectMode( ) { return m_SelectMode; }
unsigned char GetStartSpotCount( ) { return m_StartSpotCount; }
queue<BYTEARRAY> *GetLoadingBlocks( ) { return &m_LoadingBlocks; }
queue<BYTEARRAY> *GetBlocks( ) { return &m_Blocks; }
queue<uint32_t> *GetCheckSums( ) { return &m_CheckSums; }
void AddPlayer( unsigned char nPID, string nName ) { m_Players.push_back( PIDPlayer( nPID, nName ) ); }
void SetSlots( vector<CGameSlot> nSlots ) { m_Slots = nSlots; }
void SetRandomSeed( uint32_t nRandomSeed ) { m_RandomSeed = nRandomSeed; }
void SetSelectMode( unsigned char nSelectMode ) { m_SelectMode = nSelectMode; }
void SetStartSpotCount( unsigned char nStartSpotCount ) { m_StartSpotCount = nStartSpotCount; }
void SetMapGameType( uint32_t nMapGameType ) { m_MapGameType = nMapGameType; }
void SetHostPID( unsigned char nHostPID ) { m_HostPID = nHostPID; }
void SetHostName( string nHostName ) { m_HostName = nHostName; }
void SetStatString( string nStatString ) { m_StatString = nStatString; }
void SetGameName( string nGameName ) { m_GameName = nGameName; }
void AddLeaveGame( uint32_t reason, unsigned char PID, uint32_t result );
void AddLeaveGameDuringLoading( uint32_t reason, unsigned char PID, uint32_t result );
void AddTimeSlot2( queue<CIncomingAction *> actions );
void AddTimeSlot( uint16_t timeIncrement, queue<CIncomingAction *> actions );
void AddChatMessage( unsigned char PID, unsigned char flags, uint32_t chatMode, string message );
void AddLoadingBlock( BYTEARRAY &loadingBlock );
void BuildReplay( string gameName, string statString, uint32_t war3Version, uint16_t buildNumber );
void BuildReplay( );
void ParseReplay( bool parseBlocks );
};
#endif
| [
"fredrik.sigillet@4a4c9648-eef2-11de-9456-cf00f3bddd4e"
] | [
[
[
1,
106
]
]
] |
dc32086604c32f90d89abd39497ae44c3faaf1ad | 65fe6f7017f90fa55acf45773470f8f039724748 | /antbuster/include/ca/caPoint2d.h | c6cfaa68f1d2c153ce9083a00a13eb4fee2d00ed | [] | no_license | ashivers/antbusterhge | bd37276c29d1bb5b3da8d0058d2a3e8421dfa3ab | 575a21c56fa6c8633913b7e2df729767ac8a7850 | refs/heads/master | 2021-01-20T22:40:19.612909 | 2007-10-03T10:56:44 | 2007-10-03T10:56:44 | 40,769,210 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,475 | h | #ifndef __POINT_2_H_
#define __POINT_2_H_
#include <cmath>
namespace cAni
{
template< typename T >
struct _Point2
{
T x, y;
_Point2():x(0), y(0)
{
}
_Point2(const _Point2 &p):x(p.x), y(p.y)
{
}
_Point2(const T &_x, const T &_y):x(_x), y(_y)
{
}
_Point2& operator *= (const T &s)
{
x *= s;
y *= s;
return *this;
}
_Point2 operator * (const T &s) const
{
_Point2 o = *this;
o *= s;
return o;
}
_Point2& operator += (const _Point2& a)
{
x += a.x;
y += a.y;
return *this;
}
_Point2 operator + (const _Point2& b) const
{
_Point2 o = *this;
return o += b;
}
_Point2& operator -= (const _Point2& a)
{
x -= a.x;
y -= a.y;
return *this;
}
_Point2 operator - (const _Point2& b) const
{
_Point2 o = *this;
return o -= b;
}
_Point2 operator - () const
{
return _Point2(-x, -y);
}
_Point2 operator / (const T &t) const
{
return _Point2(x/t, y/t);
}
T DotProduct() const
{
return x * x + y * y;
}
T operator * (const _Point2 &a) const
{
return x * a.x + y * a.y;
}
friend const _Point2 CrossProduct(const _Point2 &a, const _Point2 &b)
{
return _Point2(a.x * b.y - b.x * a.y, a.x * b.y - b.x * a.y);
}
template< typename T2 >
operator _Point2<T2> () const
{
_Point2<T2> t;
t.x = static_cast<T2>(x);
t.y = static_cast<T2>(y);
return t;
}
T Length() const
{
return x + y;
}
_Point2& Normalize()
{
return *this = *this / Length();
}
_Point2& Normalize(float len)
{
return *this = *this * (len / Length());
}
bool operator == (const _Point2 &a) const
{
return x == a.x && y == a.y;
}
bool operator != (const _Point2 &a) const
{
return ! (*this == a);
}
};
template<>
inline float _Point2<float>::Length() const
{
return sqrtf(DotProduct());
}
template<>
inline double _Point2<double>::Length() const
{
return sqrt(DotProduct());
}
typedef _Point2< float > Point2f;
typedef _Point2< int > Point2i;
typedef _Point2< short > Point2s;
} // namespace cAni
#endif // __POINT_2_H_ | [
"zikaizhang@b4c9a983-0535-0410-ac72-75bbccfdc641"
] | [
[
[
1,
121
]
]
] |
3871df68e952066f44e1b45ee0407972182d78ec | ed9ecdcba4932c1adacac9218c83e19f71695658 | /CJEngine/trunk/CJEngine/IScene.cpp | 0854384eecbe7dc5b76804b6ac6279445a96b60f | [] | no_license | karansapra/futurattack | 59cc71d2cc6564a066a8e2f18e2edfc140f7c4ab | 81e46a33ec58b258161f0dd71757a499263aaa62 | refs/heads/master | 2021-01-10T08:47:01.902600 | 2010-09-20T20:25:04 | 2010-09-20T20:25:04 | 45,804,375 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 190 | cpp | /*
* IScene.cpp
*
* Created on: 28 oct. 2009
* Author: Clement
*/
#include "IScene.h"
namespace CJEngine {
IScene::IScene() {
}
IScene::~IScene() {
}
}
| [
"clems71@52ecbd26-af3e-11de-a2ab-0da4ed5138bb"
] | [
[
[
1,
20
]
]
] |
e6e32f86ea3770783a02ba2f788b7d3e6360d40f | c5ecda551cefa7aaa54b787850b55a2d8fd12387 | /src/UILayer/CtrlEx/TabItem_Cake.cpp | 1e953e3b95be7b85555224349e74f7fe5a7e3cf9 | [] | no_license | firespeed79/easymule | b2520bfc44977c4e0643064bbc7211c0ce30cf66 | 3f890fa7ed2526c782cfcfabb5aac08c1e70e033 | refs/heads/master | 2021-05-28T20:52:15.983758 | 2007-12-05T09:41:56 | 2007-12-05T09:41:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 879 | cpp | #include "StdAfx.h"
#include ".\tabitem_cake.h"
#include "Util.h"
#include "FaceManager.h"
CTabItem_Cake::CTabItem_Cake(void)
{
SetAttribute(ATTR_FIXLEN);
}
CTabItem_Cake::~CTabItem_Cake(void)
{
}
void CTabItem_Cake::Paint(CDC* pDC)
{
CRect rtCake;
rtCake = GetRect();
if (GetActive())
CFaceManager::GetInstance()->DrawImage(II_DETAILTAB_A, pDC->GetSafeHdc(), rtCake);
else
{
if (IsHover())
CFaceManager::GetInstance()->DrawImage(II_DETAILTAB_H, pDC->GetSafeHdc(), rtCake);
else
CFaceManager::GetInstance()->DrawImage(II_DETAILTAB_N, pDC->GetSafeHdc(), rtCake);
}
CRect rtIcon;
enum{ICONSIZE = 32};
rtIcon = rtCake;
rtIcon.DeflateRect((rtCake.Width() - ICONSIZE)/2, (rtCake.Height() - ICONSIZE)/2);
rtIcon.OffsetRect(1, 0);
if (m_bHasIcon)
m_imgIcon.Draw(pDC->GetSafeHdc(), rtIcon.left, rtIcon.top);
}
| [
"LanceFong@4a627187-453b-0410-a94d-992500ef832d"
] | [
[
[
1,
40
]
]
] |
d8c6954b130e549fdf4b0785f481c7648ab913b4 | df5277b77ad258cc5d3da348b5986294b055a2be | /GameEngineV0.35/Source/IController.cpp | 17bffaae94893cd652d07328f4d4d06f9e03fac0 | [] | no_license | beentaken/cs260-last2 | 147eaeb1ab15d03c57ad7fdc5db2d4e0824c0c22 | 61b2f84d565cc94a0283cc14c40fb52189ec1ba5 | refs/heads/master | 2021-03-20T16:27:10.552333 | 2010-04-26T00:47:13 | 2010-04-26T00:47:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | cpp |
// IController.cpp : "Brains" or "Logic component" for entities. Updated by logic every loop.
#include "Precompiled.h"
#include "IController.h"
#include "GameStateManager.h"
namespace Framework
{
Controller::~Controller()
{
GSM->RemoveController( this );
}
void Controller::Initialize( void )
{
GSM->AddController( this );
OnInitialize();
}
void Controller::Update(float dt)
{
LogicalUpdate(dt);
DestroyCheck();
}
void Controller::Serialize(ISerializer& stream)
{}
void Controller::DestroyCheck()
{
//^! destroy things if the get too far from the player or the center or something
}
}
| [
"westleyargentum@af704e40-745a-32bd-e5ce-d8b418a3b9ef",
"ProstheticMind43@af704e40-745a-32bd-e5ce-d8b418a3b9ef",
"rziugy@af704e40-745a-32bd-e5ce-d8b418a3b9ef"
] | [
[
[
1,
5
],
[
7,
11
],
[
13,
14
],
[
22,
36
]
],
[
[
6,
6
],
[
12,
12
]
],
[
[
15,
21
]
]
] |
25d04994276ff0b21ae2c9f63272154b8b02a229 | 1736474d707f5c6c3622f1cd370ce31ac8217c12 | /PseudoUnitTest/TestMath.hpp | 4c1ad77b03f392e738071d97cc61f37eeec786b5 | [] | no_license | arlm/pseudo | 6d7450696672b167dd1aceec6446b8ce137591c0 | 27153e50003faff31a3212452b1aec88831d8103 | refs/heads/master | 2022-11-05T23:38:08.214807 | 2011-02-18T23:18:36 | 2011-02-18T23:18:36 | 275,132,368 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,985 | hpp | #include <Pseudo\Math.hpp>
#include <Pseudo\ValueType.hpp>
BEGIN_TEST_CLASS(TestMath)
BEGIN_TEST_METHODS
TEST_METHOD(TestMax)
TEST_METHOD(TestMin)
TEST_METHOD(TestAbs)
TEST_METHOD(TestSqrt)
TEST_METHOD(TestAlign)
TEST_METHOD(TestSwap)
END_TEST_METHODS
void TestMax()
{
TEST_ASSERT(Math::Max(0, 1) == 1, L"1 > 0");
TEST_ASSERT(Math::Max(1, 0) == 1, L"1 > 0");
TEST_ASSERT(Math::Max(0.0, 1.0) == 1.0, L"1.0 > 0.0");
TEST_ASSERT(Math::Max(1.0, 0.0) == 1.0, L"1.0 > 0.0");
}
void TestMin()
{
TEST_ASSERT(Math::Min(0, 1) == 0, L"0 < 1");
TEST_ASSERT(Math::Min(1, 0) == 0, L"0 < 1");
TEST_ASSERT(Math::Min(0.0, 1.0) == 0.0, L"0.0 < 1.0");
TEST_ASSERT(Math::Min(1.0, 0.0) == 0.0, L"0.0 < 1.0");
}
void TestAbs()
{
TEST_ASSERT(Math::Abs(1) == 1, L"|1| == 1");
TEST_ASSERT(Math::Abs(-1) == 1, L"|-1| == 1");
TEST_ASSERT(Math::Abs(1.0) == 1.0, L"|1.0| == 1.0");
TEST_ASSERT(Math::Abs(-1.0) == 1.0, L"|-1.0| == 1.0");
TEST_ASSERT(Math::Abs((IntPtr)0x10000000) == 0x10000000, L"|0x10000000| == 0x10000000");
}
void TestSqrt()
{
TEST_ASSERT(Math::Sqrt(4.0) == 2.0, L"Sqrt(4.0) == 2.0");
}
void TestAlign()
{
TEST_ASSERT(Math::Align<Int>(0, sizeof(Long)) == 0, L"Aligning 0 on sizeof(Long) boundary should be 0");
TEST_ASSERT(Math::Align<Int>(3, sizeof(Double)) == 8, L"Aligning 3 on sizeof(Double) boundary should be 8");
TEST_ASSERT(Math::Align<Int>(7, sizeof(Int)) == 8, L"Aligning 7 on sizeof(Int) boundary should be 8");
TEST_ASSERT(Math::Align<UInt>(78, sizeof(UInt)) == 80, L"Aligning 78 on sizeof(UInt) boundary should be 80");
TEST_ASSERT(Math::Align<UInt>(16, sizeof(UInt)) == 16, L"Aligning 16 on sizeof(UInt) boundary should be 16");
}
void TestSwap()
{
Int i1 = 1;
Int i2 = 100;
Math::Swap(i1, i2);
TEST_ASSERT(i1 == 100 && i2 == 1, L"Expected i1 == 100 and i2 == 1 after swap");
}
END_TEST_CLASS
| [
"[email protected]"
] | [
[
[
1,
64
]
]
] |
125bce06a2c8673e037606b488a14e83020967bf | ad9f0e8b1b5ffae0685027b897032272a4b55acd | /chickamauga engine/chickamauga engine/mapSuperClass.h | 2ac908017775fd11f765a6750b2529ab08ba3c4b | [] | no_license | robertmcconnell2007/chickamauga | 33c36f61f9a467f0cca56c0ea9914ab57da98556 | 1883d055482973ba421e303661ce0acd529ca886 | refs/heads/master | 2021-01-23T00:14:57.431579 | 2010-08-31T19:36:15 | 2010-08-31T19:36:15 | 32,115,025 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,709 | h | #pragma once
#include <fstream>
#include <string>
using namespace std;
#include "SDL.h"
#include "GraphicsLoader.h"
struct node_edge;
class armyClass;
class unitClass;
enum terrainTypes
{
clear = 0,
forest = 1,
rough = 2,
roughForest = 3,
river = 4
};
struct map_node
{
node_edge *nodeEdges[6];
int movement;
int col, row;
int type; //0-4
int numOfUnits;
bool selected;
bool enemy;
bool town; //8
bool control; //16
bool controlBlue; //32
int reinforce;
bool reinforceBlue;
bool reinforceGrey;
bool exit;
void newNode(int x, int y)
{
col = x;
row = y;
type = 0;
movement = -1;
numOfUnits = 0;
enemy = false;
selected = false;
town = false;
control = false;
controlBlue = false;
reinforce = 0;
reinforceBlue = false;
reinforceGrey = false;
exit = false;
for(int j = 0; j < 6; ++j)
{
nodeEdges[j] = NULL;
}
}
};
//controlblue control town type type type
//32 16 8 4 2 1
//32 16 8 4 2 1
struct node_edge
{
map_node * upperNode;
map_node * lowerNode;
bool passable; //32
bool road_edge; //16
bool ford_edge; //8
bool trail_edge; //4
bool creek_edge; //2
bool bridge_edge; //1
void newNode()
{
passable = true;
road_edge = false;
ford_edge = false;
trail_edge = false;
creek_edge = false;
bridge_edge = false;
}
};
class mapSuperClass
{
private:
string mapName;
bool mapEdit;
map_node ** mapPointer;
SDL_Surface * nodeTypes;
SDL_Surface * roadsTrails;
SDL_Surface * creeksBridgesFords;
SDL_Surface * statusTiles;
SDL_Surface * townNstratPoint;
SDL_Rect hexSize;
//array of units
void createBlankMap(int width, int height); //for the specific use of this class
void loadData();
public:
void clearMovement();
bool showEnemyControl;
int width;
int height;
map_node** getMap() { return mapPointer; }
mapSuperClass(const char* nameOfInputFile); //fixed map generation
bool mapSuperClassIni(const char* nameOfInputFile); //fixed map generation
void hilightHex(int nodeX, int nodeY); //highlights the selected hex, if a unit is present, will show the available movement and enemy control area
void drawMap(int screenShiftx, int screenShifty, SDL_Surface * screen);
mapSuperClass(int sizeX, int sizeY); //random map generation
void exportMap();
bool mapSuperClassIni(int sizeX, int sizeY);
void setNodeType(int type, int nodeX, int nodeY);
bool setConnecterType(int type, int node1X, int node1Y, int node2X, int node2Y);
void setEnemy(int x, int y);
void clearEnemy();
void deleteMap();
void cleanReinforce();
void cleanMap();
void cleanStacks();
~mapSuperClass();
};
| [
"IxAtreusAzai@40b09f04-00bc-11df-b8ab-b3eb4b1fa784",
"ignatusfordon@40b09f04-00bc-11df-b8ab-b3eb4b1fa784",
"seancox1990@40b09f04-00bc-11df-b8ab-b3eb4b1fa784"
] | [
[
[
1,
31
],
[
36,
39
],
[
41,
47
],
[
52,
88
],
[
90,
102
],
[
104,
118
]
],
[
[
32,
35
],
[
40,
40
],
[
48,
51
],
[
119,
123
]
],
[
[
89,
89
],
[
103,
103
]
]
] |
950543a9d29d406d4a0de84260a80ef2c62a681b | 81128e8bcf44c1db5790433785e83bbd70b8d9c2 | /Testbed/Tests/MyContactListener.cpp | 559303916b1eca4d538eb8b809feedd378997a64 | [
"Zlib"
] | permissive | vanminhle246/Box2D_v2.2.1 | 8a16ef72688c6b03466c7887e501e92f264ed923 | 6f06dda1e2c9c7277ce26eb7aa6340863d1f3bbb | refs/heads/master | 2016-09-05T18:41:00.133321 | 2011-11-28T07:47:32 | 2011-11-28T07:47:32 | 2,817,435 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,491 | cpp | #include "MyContactListener.h"
#include <Box2D\Dynamics\Contacts\b2Contact.h>
#include "BallUserData.h"
void handleContact(BallUserData* b1, BallUserData* b2)
{
int temp = b1->m_numContacts;
b1->m_numContacts = b2->m_numContacts;
b2->m_numContacts = temp;
}
MyContactListener::MyContactListener(void)
{
}
MyContactListener::~MyContactListener(void)
{
}
void MyContactListener::BeginContact(b2Contact* contact)
{
/**
void* bodyUserData = contact->GetFixtureA()->GetBody()->GetUserData();
if (bodyUserData)
static_cast<BallUserData*>(bodyUserData)->startContact();
bodyUserData = contact->GetFixtureB()->GetBody()->GetUserData();
if (bodyUserData)
static_cast<BallUserData*>(bodyUserData)->startContact();
/**/
/**/
void* bodyAUserData = contact->GetFixtureA()->GetBody()->GetUserData();
void* bodyBUserData = contact->GetFixtureB()->GetBody()->GetUserData();
if (bodyAUserData && bodyBUserData)
handleContact(static_cast<BallUserData*>(bodyAUserData), static_cast<BallUserData*>(bodyBUserData));
/**/
}
void MyContactListener::EndContact(b2Contact* contact)
{
//check if fixture A was a ball
void* bodyUserData = contact->GetFixtureA()->GetBody()->GetUserData();
if (bodyUserData)
static_cast<BallUserData*>(bodyUserData)->endContact();
//check if fixture B was a ball
bodyUserData = contact->GetFixtureB()->GetBody()->GetUserData();
if (bodyUserData)
static_cast<BallUserData*>(bodyUserData)->endContact();
}
| [
"[email protected]"
] | [
[
[
1,
47
]
]
] |
df1cd67a6aed169bac0c2437f708188d8e88f2fc | fcf03ead74f6dc103ec3b07ffe3bce81c820660d | /Base/FileServer/Attributes/Attributes.cpp | f3ab61e8876a8658c67a48fd3bf89d02c2a184ec | [] | no_license | huellif/symbian-example | 72097c9aec6d45d555a79a30d576dddc04a65a16 | 56f6c5e67a3d37961408fc51188d46d49bddcfdc | refs/heads/master | 2016-09-06T12:49:32.021854 | 2010-10-14T06:31:20 | 2010-10-14T06:31:20 | 38,062,421 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,396 | cpp | // Attributes.cpp
//
// Copyright (C) Symbian Software Ltd 2000-2005. All rights reserved.
// This code creates several files and directories inside
// the private directory on drive C:
// i.e. the directory "C:\private\0FFFFF03."
//
// Note that no special capabilities are needed provided all file
// operations are directed at files that lie within
// the private directory. This is the case with this example.
//
// Before the program terminates,
// all files and directories created will be deleted.
#include <f32file.h>
#include "CommonFramework.h"
LOCAL_D RFs fsSession;
// example functions
void DoDirectoryAttribsL();
void PrintDirectoryLists();
void DeleteAll();
// utility functions
void FormatEntry(TDes& aBuffer, const TEntry& aEntry);
void FormatAtt(TDes& aBuffer, const TUint aValue);
void MakeSmallFile(const TDesC& aFileName);
void WaitForKey()
{
_LIT(KMessage,"Press any key to continue\n");
console->Printf(KMessage);
console->Getch();
}
LOCAL_C void doExampleL()
{
// connect to file server
User::LeaveIfError(fsSession.Connect());
// create the private directory
// on drive C:
// i.e. "C:\private\0FFFFF03\"
// Note that the number 0FFFFF03 is the
// process security id taken from the 2nd UID
// specified in the mmp file.
fsSession.CreatePrivatePath(EDriveC);
// Set the session path to
// this private directory on drive C:
fsSession.SetSessionToPrivate(EDriveC);
DoDirectoryAttribsL();
WaitForKey();
PrintDirectoryLists();
WaitForKey();
DeleteAll();
// close session with file server
fsSession.Close();
}
void DoDirectoryAttribsL()
{
// Define text to be used for display at the console.
_LIT(KAttsMsg,"\nAttributes and entry details\n");
_LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B");
_LIT(KDateMsg,"Using Entry():\nModification time of %S is %S\n");
_LIT(KSizeMsg,"Size = %d bytes\n");
_LIT(KBuffer,"%S");
_LIT(KEntryMsg,"Using Modified():\nModification time of %S is %S\n");
_LIT(KAttMsg,"Using Att():\n%S");
// Define subdirectory name and the file name to be used.
_LIT(KSubDirName,"f32examp\\");
_LIT(KFileName,"tmpfile.txt");
// Create a file.
// Display its entry details, its modification time
// and its attributes.
// Then change some attributes and print them again.
console->Printf(KAttsMsg);
// When referring to a directory rather than a file,
// a backslash must be appended to the path.
TFileName thePath;
fsSession.PrivatePath(thePath);
thePath.Append(KSubDirName);
// Make the directory
TInt err=fsSession.MkDir(thePath);
if (err!=KErrAlreadyExists) // Don't leave if it already exists
User::LeaveIfError(err);
// Create a file in "private\0ffffff03\f32examp\ "
thePath.Append(KFileName);
MakeSmallFile(thePath);
// Get entry details for file and print them
TEntry entry;
User::LeaveIfError(fsSession.Entry(thePath,entry));
TBuf<30> dateString;
entry.iModified.FormatL(dateString,KDateString);
// Modification date and time = time of file's creation
console->Printf(KDateMsg,&entry.iName,&dateString);
// Print size of file
console->Printf(KSizeMsg,entry.iSize);
TBuf<80> buffer;
FormatEntry(buffer,entry); // Archive attribute should be set
console->Printf(KBuffer,&buffer);
buffer.Zero();
// get the entry details using Att() and Modified()
TTime time;
User::LeaveIfError(fsSession.Modified(thePath,time));
time.FormatL(dateString,KDateString);
// Modification date and time = time of file's creation
console->Printf(KEntryMsg,&entry.iName,&dateString);
TUint value;
User::LeaveIfError(fsSession.Att(thePath,value));
FormatAtt(buffer,value); // get and print file attributes
console->Printf(KAttMsg,&buffer);
buffer.Zero();
// Change entry details using SetEntry() to clear archive
User::LeaveIfError(fsSession.SetEntry(thePath,time,
NULL,KEntryAttArchive));
}
void PrintDirectoryLists()
{
// Define text to be used for display at the console.
_LIT(KListMsg,"\nDirectory listings\n");
_LIT(KListMsg2,"\nDirectories and files:\n");
_LIT(KDirList,"%S\n");
_LIT(KDirs,"\nDirectories:\n");
_LIT(KFilesSizes,"\nFiles and sizes:\n");
_LIT(KBytes," %d bytes\n");
_LIT(KNewLine,"\n");
// Define subdirectory names and the file names to be used here.
_LIT(KDir1,"f32examp\\tmpdir1\\");
_LIT(KDir2,"f32examp\\tmpdir2\\");
_LIT(KFile2,"f32examp\\tmpfile2.txt");
_LIT(KDirName,"f32examp\\*");
// Create some directories and files
// in private"\f32examp\."
// List them using GetDir(), then list files and
// directories in separate lists.
console->Printf(KListMsg);
TFileName thePrivatePath;
fsSession.PrivatePath(thePrivatePath);
TFileName thePath;
TInt err;
// Create private\0fffff03\f32examp\tmpdir1
thePath = thePrivatePath;
thePath.Append(KDir1);
err=fsSession.MkDir(thePath);
if (err!=KErrAlreadyExists)
User::LeaveIfError(err); // Don't leave if it already exists
// Create "private\0fffff03\f32examp\tmpdir2"
thePath = thePrivatePath;
thePath.Append(KDir2);
err=fsSession.MkDir(thePath);
if (err!=KErrAlreadyExists)
User::LeaveIfError(err); // Don't leave if it already exists
// Create "private\0ffffff03\f32examp\tmpfile2.txt"
thePath = thePrivatePath;
thePath.Append(KFile2);
MakeSmallFile(thePath);
// Now list all files and directories in "\f32examp\"
//
// in alphabetical order.
thePath = thePrivatePath;
thePath.Append(KDirName);
CDir* dirList;
//err = fsSession.GetDir(thePath,KEntryAttMaskSupported,ESortByName,dirList);
User::LeaveIfError(fsSession.GetDir(thePath,KEntryAttMaskSupported,ESortByName,dirList));
console->Printf(KListMsg2);
TInt i;
for (i=0;i<dirList->Count();i++)
console->Printf(KDirList,&(*dirList)[i].iName);
delete dirList;
// List the files and directories in \f32examp\ separately
CDir* fileList;
User::LeaveIfError(fsSession.GetDir(thePath,KEntryAttNormal,ESortByName,fileList,dirList));
console->Printf(KDirs);
for (i=0;i<dirList->Count();i++)
console->Printf(KDirList,&(*dirList)[i].iName);
console->Printf(KFilesSizes);
for (i=0;i<fileList->Count();i++)
{
console->Printf(KDirList,&(*fileList)[i].iName);
console->Printf(KBytes,(*fileList)[i].iSize);
}
console->Printf(KNewLine);
delete dirList;
delete fileList;
}
void DeleteAll()
// Delete all the files and directories which have been created
{
// Define descriptor constants using the _LIT macro
_LIT(KDeleteMsg,"\nDeleteAll()\n");
_LIT(KFile2,"f32examp\\tmpfile2.txt");
_LIT(KDir1,"f32examp\\tmpdir1\\");
_LIT(KDir2,"f32examp\\tmpdir2\\");
_LIT(KFile1,"f32examp\\tmpfile.txt");
_LIT(KTopDir,"f32examp\\");
console->Printf(KDeleteMsg);
TFileName thePrivatePath;
fsSession.PrivatePath(thePrivatePath);
TFileName thePath;
thePath = thePrivatePath;
thePath.Append(KFile2);
User::LeaveIfError(fsSession.Delete(thePath));
thePath = thePrivatePath;
thePath.Append(KDir1);
User::LeaveIfError(fsSession.RmDir(thePath));
thePath = thePrivatePath;
thePath.Append(KDir2);
User::LeaveIfError(fsSession.RmDir(thePath));
thePath = thePrivatePath;
thePath.Append(KFile1);
User::LeaveIfError(fsSession.Delete(thePath));
thePath = thePrivatePath;
thePath.Append(KTopDir);
User::LeaveIfError(fsSession.RmDir(thePath));
}
void MakeSmallFile(const TDesC& aFileName)
{
_LIT8(KFileData,"Some data");
RFile file;
User::LeaveIfError(file.Replace(fsSession,aFileName,EFileWrite));
User::LeaveIfError(file.Write(KFileData));
User::LeaveIfError(file.Flush()); // Commit data
file.Close(); // close file having finished with it
}
void FormatEntry(TDes& aBuffer, const TEntry& aEntry)
{
_LIT(KEntryDetails,"Entry details: ");
_LIT(KReadOnly," Read-only");
_LIT(KHidden," Hidden");
_LIT(KSystem," System");
_LIT(KDirectory," Directory");
_LIT(KArchive," Archive");
_LIT(KNewLIne,"\n");
aBuffer.Append(KEntryDetails);
if(aEntry.IsReadOnly())
aBuffer.Append(KReadOnly);
if(aEntry.IsHidden())
aBuffer.Append(KHidden);
if(aEntry.IsSystem())
aBuffer.Append(KSystem);
if(aEntry.IsDir())
aBuffer.Append(KDirectory);
if(aEntry.IsArchive())
aBuffer.Append(KArchive);
aBuffer.Append(KNewLIne);
}
void FormatAtt(TDes& aBuffer, const TUint aValue)
{
_LIT(KAttsMsg,"Attributes set are:");
_LIT(KNormal," Normal");
_LIT(KReadOnly," Read-only");
_LIT(KHidden," Hidden");
_LIT(KSystem," System");
_LIT(KVolume," Volume");
_LIT(KDir," Directory");
_LIT(KArchive," Archive");
_LIT(KNewLine,"\n");
aBuffer.Append(KAttsMsg);
if (aValue & KEntryAttNormal)
{
aBuffer.Append(KNormal);
return;
}
if (aValue & KEntryAttReadOnly)
aBuffer.Append(KReadOnly);
if (aValue & KEntryAttHidden)
aBuffer.Append(KHidden);
if (aValue & KEntryAttSystem)
aBuffer.Append(KSystem);
if (aValue & KEntryAttVolume)
aBuffer.Append(KVolume);
if (aValue & KEntryAttDir)
aBuffer.Append(KDir);
if (aValue & KEntryAttArchive)
aBuffer.Append(KArchive);
aBuffer.Append(KNewLine);
}
| [
"liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca"
] | [
[
[
1,
321
]
]
] |
e5e9233491d6c9340e6f91c2f84b88ef92a643cd | 0d5c8865066a588602d621f3ea1657f9abb14768 | /aaac.cxx | ea150676c28ec07d2dfe21a4dee6ec9aead61298 | [] | no_license | peerct/Conquest-DICOM-Server | 301e6460c87b8a8d5d95f0057af95e8357dd4e7c | 909978a7c8e5838ec8eb61d333e3a3fdd637ef60 | refs/heads/master | 2021-01-18T05:03:42.221986 | 2009-06-15T14:00:15 | 2009-06-15T14:00:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,347 | cxx | /*
MvH 19980327: Removed evaluation of Count without initialization in ReadDynamic
mvh 20001106: Use memcpy instead of ByteCopy
ljz 20030122: Fixed initialization of AAssociateAC
mvh 20050108: Fixed for linux compile
mvh 20080203: Added experimental ConfigPadAEWithZeros
ljz 20080313: Removed some warnings
*/
/****************************************************************************
Copyright (C) 1995, University of California, Davis
THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE UNIVERSITY
OF CALIFORNIA DOES NOT MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
THE SOFTWARE IS WITH THE USER.
Copyright of the software and supporting documentation is
owned by the University of California, and free access
is hereby granted as a license to use this software, copy this
software and prepare derivative works based upon this software.
However, any distribution of this software source code or
supporting documentation or derivative works (source code and
supporting documentation) must include this copyright notice.
****************************************************************************/
/***************************************************************************
*
* University of California, Davis
* UCDMC DICOM Network Transport Libraries
* Version 0.1 Beta
*
* Technical Contact: [email protected]
*
***************************************************************************/
# include "dicom.hpp"
# include <stdlib.h>
#ifndef min
#define min(a, b) ((a)<(b)?(a):(b))
#endif
/************************************************************************
*
* Presentation Context Accept
*
************************************************************************/
PresentationContextAccept :: PresentationContextAccept()
{
ItemType = 0x21;
Reserved1 = 0;
PresentationContextID = uniq8();
Reserved2 = 0;
Result = 2;
Reserved4 = 0;
}
PresentationContextAccept :: PresentationContextAccept(
//AbstractSyntax &Abs,
TransferSyntax &Tran)
{
//AbsSyntax = Abs;
TrnSyntax = Tran;
ItemType = 0x21;
Reserved1 = 0;
PresentationContextID = uniq8();
Reserved2 = 0;
Result = 2;
Reserved4 = 0;
}
PresentationContextAccept :: ~PresentationContextAccept()
{
//
}
/*
void PresentationContextAccept :: SetAbstractSyntax(AbstractSyntax &Abs)
{
AbsSyntax = Abs;
}
*/
void PresentationContextAccept :: SetTransferSyntax(TransferSyntax &Tran)
{
TrnSyntax = Tran;
}
BOOL PresentationContextAccept :: Write ( Buffer &Link )
{
Link.Write((BYTE *) &ItemType, sizeof(BYTE));
Link.Write((BYTE *) &Reserved1, sizeof(BYTE));
Link << Length; //Link.Write((BYTE *) &Length, sizeof(UINT16));
Link.Write((BYTE *) &PresentationContextID, sizeof(BYTE));
Link.Write((BYTE *) &Reserved2, sizeof(BYTE));
Link.Write((BYTE *) &Result, sizeof(BYTE));
Link.Write((BYTE *) &Reserved4, sizeof(BYTE));
// fprintf(stderr, "Writing Presentation Contex Accept: %d bytes\n", Length);
// AbsSyntax.Write(Link);
TrnSyntax.Write(Link);
// fprintf(stderr, "ABS: %d TRN: %d\n", AbsSyntax.Size(), TrnSyntax.Size());
Link.Flush();
return ( TRUE );
}
BOOL PresentationContextAccept :: Read (Buffer &Link)
{
Link.Read((BYTE *) &ItemType, sizeof(BYTE));
return ( this->ReadDynamic(Link) );
}
BOOL PresentationContextAccept :: ReadDynamic (Buffer &Link)
{
// INT32 Count;
TransferSyntax Tran;
Link.Read((BYTE *) &Reserved1, sizeof(BYTE));
Link >> Length; //Link.Read((BYTE *) &Length, sizeof(UINT16));
Link.Read((BYTE *) &PresentationContextID, sizeof(BYTE));
Link.Read((BYTE *) &Reserved2, sizeof(BYTE));
Link.Read((BYTE *) &Result, sizeof(BYTE));
Link.Read((BYTE *) &Reserved4, sizeof(BYTE));
// Count = Length - sizeof(BYTE) - sizeof(BYTE) - sizeof(BYTE) - sizeof(BYTE);
// AbsSyntax.Read(Link);
// Count = Count - AbsSyntax.Size();
TrnSyntax.Read(Link);
// Count = Count - TrnSyntax.Size();
// if ( !Count)
return ( TRUE );
// return ( FALSE );
}
UINT32 PresentationContextAccept :: Size()
{
Length = sizeof(BYTE) + sizeof(BYTE) + sizeof(BYTE) + sizeof(BYTE);
// Length += AbsSyntax.Size();
Length += TrnSyntax.Size();
return ( Length + sizeof(BYTE) + sizeof(BYTE) + sizeof(UINT16));
}
/************************************************************************
*
* AAssociateAC Packet
*
************************************************************************/
AAssociateAC :: AAssociateAC()
{
ItemType = 0x02;
Reserved1 = 0;
ProtocolVersion = 0x0001;
Reserved2 = 0;
SpaceMem(CalledApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
CalledApTitle[16] = 0;
SpaceMem(CallingApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
CallingApTitle[16] = 0;
ZeroMem(Reserved3, 32);
}
AAssociateAC :: AAssociateAC(BYTE *CallingAp, BYTE *CalledAp)
{
ItemType = 0x02;
Reserved1 = 0;
ProtocolVersion = 0x0001;
Reserved2 = 0;
SpaceMem(CalledApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
CalledApTitle[16] = 0;
SpaceMem(CallingApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
CallingApTitle[16] = 0;
ZeroMem(Reserved3, 32);
memcpy(CallingApTitle, CallingAp, min(strlen((char *)CallingAp), 16u));
memcpy(CalledApTitle, CalledAp, min(strlen((char *)CalledAp), 16u));
}
AAssociateAC :: ~AAssociateAC()
{
// nothing, everything should self-destruct nicely
}
void AAssociateAC :: SetCalledApTitle(BYTE *CalledAp)
{
SpaceMem(CalledApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
memcpy(CalledApTitle, CalledAp, min(strlen((char *)CalledAp), 16u));
}
void AAssociateAC :: SetCallingApTitle(BYTE *CallingAp)
{
SpaceMem(CallingApTitle, 16);
if (ConfigPadAEWithZeros) memset(CalledApTitle, 0, 16);
memcpy(CallingApTitle, CallingAp, min(strlen((char *)CallingAp), 16u));
}
void AAssociateAC :: SetApplicationContext(ApplicationContext &AppC)
{
AppContext = AppC;
}
void AAssociateAC :: AddPresentationContextAccept(PresentationContextAccept &PresContextAccept)
{
PresContextAccepts.Add(PresContextAccept);
}
void AAssociateAC :: SetUserInformation(UserInformation &User)
{
UserInfo = User;
}
BOOL AAssociateAC :: Write(Buffer &Link)
{
UINT Index;
// fprintf(stderr, "AAssociateAC :: Write ()\n");fflush(stderr);
Size();
Link << ItemType; //Link.Write((BYTE *) &ItemType, sizeof(BYTE));
Link.Write((BYTE *) &Reserved1, sizeof(BYTE));
Link << Length; //Link.Write((BYTE *) &Length, sizeof(UINT32));
Link << ProtocolVersion; //Link.Write((BYTE *) &ProtocolVersion, sizeof(UINT16));
Link << Reserved2; //Link.Write((BYTE *) &Reserved2, sizeof(UINT16));
Link.Write((BYTE *) CalledApTitle, 16);
Link.Write((BYTE *) CallingApTitle, 16);
Link.Write((BYTE *) Reserved3, 32);
Link.Flush();
// fprintf(stderr, "AAssociateAC (writting App/Pre Contexts)\n");
AppContext.Write(Link);
Index = 0;
while(Index < PresContextAccepts.GetSize())
{
PresContextAccepts[Index].Write(Link);
++Index;
}
// fprintf(stderr, "AAssociateAC ( writting User info)\n");
UserInfo.Write(Link);
return ( TRUE );
}
BOOL AAssociateAC :: Read(Buffer &Link)
{
Link.Read((BYTE *) &ItemType, sizeof(BYTE));
return(this->ReadDynamic(Link));
}
BOOL AAssociateAC :: ReadDynamic(Buffer &Link)
{
INT Count;
BYTE TempByte;
PresentationContextAccept PresContextAccept;
Link.Read((BYTE *) &Reserved1, sizeof(BYTE));
Link >> Length; //Link.Read((BYTE *) &Length, sizeof(UINT32));
Link >> ProtocolVersion; //Link.Read((BYTE *) &ProtocolVersion, sizeof(UINT16));
Link >> Reserved2; //Link.Read((BYTE *) &Reserved2, sizeof(UINT16));
Link.Read((BYTE *) CalledApTitle, 16);
Link.Read((BYTE *) CallingApTitle, 16);
Link.Read((BYTE *) Reserved3, 32);
CalledApTitle[16] = '\0';
CallingApTitle[16] = '\0';
Count = Length - sizeof(UINT16) - sizeof(UINT16) - 16 - 16 - 32;
while(Count > 0)
{
Link.Read((BYTE *) &TempByte, sizeof(BYTE));
switch(TempByte)
{
case 0x50: // user information
UserInfo.ReadDynamic(Link);
Count = Count - UserInfo.Size();
break;
case 0x21:
PresContextAccept.ReadDynamic(Link);
Count = Count - PresContextAccept.Size();
PresContextAccepts.Add(PresContextAccept);
break;
case 0x10:
AppContext.ReadDynamic(Link);
Count = Count - AppContext.Size();
break;
default:
Link.Kill(Count-1);
Count = -1;
}
}
if(!Count)
return ( TRUE );
return ( FALSE);
}
UINT32 AAssociateAC :: Size()
{
UINT Index;
Length = sizeof(UINT16) + sizeof(UINT16) + 16 + 16 + 32;
Length += AppContext.Size();
Index = 0;
Index = 0;
while(Index < PresContextAccepts.GetSize())
{
Length += PresContextAccepts[Index].Size();
++Index;
}
Length += UserInfo.Size();
return ( Length + sizeof(BYTE) + sizeof(BYTE) + sizeof(UINT32) );
}
| [
"[email protected]"
] | [
[
[
1,
316
]
]
] |
d61a731e450b96c20db81a3a1068ef40bfb18303 | 80716d408715377e88de1fc736c9204b87a12376 | /OnSipCore/OnSipThread.h | 258d70cda3d35d4049321d34d9df4dc68585d3fb | [] | 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 | 1,140 | h | #ifndef ONSIP_THREAD_H
#define ONSIP_THREAD_H
#include "onsipxmpp.h"
#include "threads.h"
#include "onsip.h"
// Thread wrapper around OnSipXMPP.
// Runs OnSipXmpp within a thread to keep
// the Xmpp communication and state machines going.
class OnSipThread : public MyThread
{
private:
auto_ptr<OnSipXmpp> m_xmpp;
LoginInfo m_loginInfo;
CriticalSection m_cs;
protected:
// Main thread method
virtual DWORD Run();
// Virtual from within thread to create an instance
// of the OnSipXmpp. Can be taken over to
// create difference instance or provide an initialized
// instance.
virtual OnSipXmpp *CreateOnSipXMPP();
public:
// Creates thread and OnSipXmpp using LoginInfo,
// but created in suspended state.
// Call start to get things going.
OnSipThread(LoginInfo& loginInfo);
void Start();
// THREAD-SAFE
//
// Request to dial the specified number.
// Returns the unique call-id to track the call.
// Returns 0 if error.
long MakeCall(const tstring& number);
// THREAD-SAFE
//
// Request to drop the specified call
void DropCall(long callId);
};
#endif
| [
"Owner@.(none)",
"[email protected]"
] | [
[
[
1,
42
],
[
49,
51
]
],
[
[
43,
48
]
]
] |
f6c861f52733da8b7dcecf0111c8dbaf7e0698b9 | 71ffdff29137de6bda23f02c9e22a45fe94e7910 | /KillaCoptuz3000/src/CGame.h | dbbaa74d01d06d948256a02c1259caae3fc550e2 | [] | no_license | anhoppe/killakoptuz3000 | f2b6ecca308c1d6ebee9f43a1632a2051f321272 | fbf2e77d16c11abdadf45a88e1c747fa86517c59 | refs/heads/master | 2021-01-02T22:19:10.695739 | 2009-03-15T21:22:31 | 2009-03-15T21:22:31 | 35,839,301 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,705 | h | // ***************************************************************
// CGame version: 1.0 · date: 06/04/2007
// -------------------------------------------------------------
//
// -------------------------------------------------------------
// Copyright (C) 2007 - All Rights Reserved
// ***************************************************************
//
// ***************************************************************
#include "CLevel.h"
#include "Objects/CPlayer.h"
#include "Menu/CMenu.h"
enum EGameState
{
e_menu = 0,
e_level = 1
};
class CGame
{
public:
/** Standard constructor */
CGame();
/** Standard destructor */
~CGame();
static CGame& getInstance();
//////////////////////////////////////////////////////////////////////////
// Methods
//////////////////////////////////////////////////////////////////////////
void gameControl();
void setGameState(EGameState t_gameState);
private:
//////////////////////////////////////////////////////////////////////////
// Functions
//////////////////////////////////////////////////////////////////////////
/** Load the next level*/
void loadNextLevel();
/** Loads the player*/
void loadPlayer();
//////////////////////////////////////////////////////////////////////////
// Members
//////////////////////////////////////////////////////////////////////////
public:
CMenu m_menu;
/** State of the game */
EGameState m_gameState;
std::string m_menuName;
private:
/** Current level*/
CLevel m_level;
/** Current pointer*/
CPlayer m_player;
}; | [
"anhoppe@9386d06f-8230-0410-af72-8d16ca8b68df",
"fabianheinemann@9386d06f-8230-0410-af72-8d16ca8b68df"
] | [
[
[
1,
48
],
[
52,
70
]
],
[
[
49,
51
]
]
] |
68ba623ba0035e184098272afd13bd5c36a46efd | 0c016c407bd4c7812d205c8d15b5777923b7e75e | /source/gui/gui_button.h | de4c9016edad8a7d7c05ecb28e40d59deef38af6 | [] | no_license | withLogic/bash-the-castle | 6236ef542f2661f588380b5e39048078e8e06745 | b369fbe5ae667de9afa001787c2fcb5fc55f8061 | refs/heads/master | 2022-03-29T10:39:29.585308 | 2010-03-04T18:09:40 | 2010-03-04T18:09:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,141 | h | #ifndef _GUI_BUTTON_H_
#define _GUI_BUTTON_H_
#include "gui_object.h"
//simple button class
class gui_button : public gui_object
{
public:
void* user_data;
gui_button(castle_game* _cg,int x,int y,char* t,long tc,void* _ud = 0) :
user_data(_ud)
{
thegame = _cg;
s_x = x;
s_y = y;
pad_x = 30;
pad_y = 12;
text_color = tc;
fnts = _cg->fnts;
guibuffer = _cg->screen;
obj_state = B_OUT;
obj_type = GUI_BUTTON;
if (t) strcpy(text_l1,t);
}
~gui_button()
{
};
void draw()
{
gui_object::draw();
if (*text_l1)
{
if (center_text) {
int text_len = fnts->get_length_px(text_l1);
int cx = 0;
text_len>0 ? cx = (int)((s_w-(text_len))/2): cx=1;
fnts->text(guibuffer,text_l1,cx+s_x,s_y+pad_y,limit_text);
}else{
fnts->text(guibuffer,text_l1,s_x+pad_x,s_y+pad_y,limit_text);
}
}
};
};
#endif
| [
"[email protected]@c7d25896-185f-11df-84a7-3128a651e3da"
] | [
[
[
1,
61
]
]
] |
37ad00786d3ff8a2584d29420e121676dd64a7a9 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /Engine/sdk/inc/ltrenderstyle.h | efa0beb8b78e734b7c091b16611b033c051ee96a | [] | 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 | 24,465 | h | // ltrenderstyle.h
// Defines a render style. The renderer supports setting render styles for render
// objects.
#ifndef __LTRENDERSTYLE_H__
#define __LTRENDERSTYLE_H__
#define MAX_NUM_TEXTURES_PER_PASS 4
// RENDER STATE TYPES
/*!
Enumerates the z-buffering modes for model piece to which the render style
is applied.
\see RenderPassOp structure
*/
enum ERenStyle_ZBufferMode {
/*!
Read/write z-buffering enabled.
*/
RENDERSTYLE_ZRW,
/*!
Read-only z-buffering enabled.
*/
RENDERSTYLE_ZRO,
/*!
Z-buffering disabled.
*/
RENDERSTYLE_NOZ,
//This must come last
RENDERSTYLE_ZBUFFERMODE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_ZBUFFERMODE_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Enumerates the modes for alpha testing on model piece to which the render style is
applied. An alpha test compares the vertex alpha value of each pixel in the model
piece to the alpha value of the texture's pixel (texel). If the test is true, then
the pixel is rendered. If the test is false, the pixel does not render.
\see RenderPassOp structure
*/
enum ERenStyle_TestMode {
/*!
No test is conducted. All pixels are drawn.
*/
RENDERSTYLE_NOALPHATEST,
/*!
If the alpha value of the pixel is less than the alpha value of the texel,
the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_LESS,
/*!
If the alpha value of the pixel is less than or equal to the alpha value
of the texel, the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_LESSEQUAL,
/*!
If the alpha value of the pixel is greater than the alpha value of the texel,
the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_GREATER,
/*!
If the alpha value of the pixel is greater than or equal to the alpha value
of the texel, the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_GREATEREQUAL,
/*!
If the alpha value of the pixel is equal to the alpha value of the texel,
the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_EQUAL,
/*!
If the alpha value of the pixel is not equal to the alpha value of the texel,
the pixel is drawn.
*/
RENDERSTYLE_ALPHATEST_NOTEQUAL,
//This must come last
RENDERSTYLE_TESTMODE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_TESTMODE_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Enumerates the fill modes for the model piece to which the render style is applied.
\see RenderPassOp structure
*/
enum ERenStyle_FillMode {
/*!
Only a wire frame is drawn for the model piece.
*/
RENDERSTYLE_WIRE,
/*!
The model piece is filled with the appropriate color and texture.
*/
RENDERSTYLE_FILL,
//This must come last
RENDERSTYLE_FILLMODE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_FILLMODE_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Enumerates the cull modes for the model piece to which the render style is applied.
\see RenderPassOp structure
*/
enum ERenStyle_CullMode {
/*!
No culling is done. The model piece is rendered regardless of winding order.
*/
RENDERSTYLE_CULL_NONE,
/*!
Model pieces with counter-clockwise winding orders relative to the camera
are not rendered.
*/
RENDERSTYLE_CULL_CCW,
/*!
Model pieces with clockwise winding orders relative to the camera are
not rendered.
*/
RENDERSTYLE_CULL_CW,
//This must come last
RENDERSTYLE_CULLMODE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_CULLMODE_TYPE_FORCE_32BIT = 0x7fffffff
};
// TEXTURE STAGE TYPES
/*!
Enumerates the texture-to-color behaviors for model pieces to which the render
style is applied. This state is only useful for textured model pieces.
\see TextureStageOps structure
*/
enum ERenStyle_ColorOp {
/*!
The color of the texture is ignored and only the color of the model piece
is drawn.
*/
RENDERSTYLE_COLOROP_DISABLE,
/*!
Select the Color Arg1.
*/
RENDERSTYLE_COLOROP_SELECTARG1,
/*!
Select the Color Arg2.
*/
RENDERSTYLE_COLOROP_SELECTARG2,
/*!
Each of the pixel colors of the model piece is multiplied with the pixel
color of the texture.
*/
RENDERSTYLE_COLOROP_MODULATE,
/*!
Multiply the two arguments, then multiply by two.
*/
RENDERSTYLE_COLOROP_MODULATE2X,
/*!
Use the current alpha to modulate the two args (Arg1 * Alpha + Arg2 * (1-Alpha))
*/
RENDERSTYLE_COLOROP_MODULATEALPHA,
/*!
Use the tfactor alpha to modulate the two args (Arg1 * Alpha + Arg2 * (1-Alpha))
*/
RENDERSTYLE_COLOROP_MODULATETFACTOR,
/*!
Each of the pixel colors of the model piece is added to the pixel color of
the texture. This value is not supported on the PlayStation 2 platform.
*/
RENDERSTYLE_COLOROP_ADD,
/*!
DotProduct3 the two args.
*/
RENDERSTYLE_COLOROP_DOTPRODUCT3,
/*!
Bump Environment Map.
*/
RENDERSTYLE_COLOROP_BUMPENVMAP,
/*!
Bump Environment Map with lumination.
*/
RENDERSTYLE_COLOROP_BUMPENVMAPLUM,
/*!
Color1 + Color2 - 0.5
*/
RENDERSTYLE_COLOROP_ADDSIGNED,
/*!
(Color1 + Color2 - 0.5) * 2
*/
RENDERSTYLE_COLOROP_ADDSIGNED2X,
/*!
Color1 - Color2
*/
RENDERSTYLE_COLOROP_SUBTRACT,
/*!
Color1 + Alpha1 * Color2
*/
RENDERSTYLE_COLOROP_ADDMODALPHA,
/*!
Color1 + (1 - Alpha1) * Color2
*/
RENDERSTYLE_COLOROP_ADDMODINVALPHA,
//This must come last
RENDERSTYLE_COLOROP_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_COLOROP_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Color Argument types.
*/
enum ERenStyle_ColorArg {
/*!
Result of previous stage.
*/
RENDERSTYLE_COLORARG_CURRENT,
/*!
Diffuse component.
*/
RENDERSTYLE_COLORARG_DIFFUSE,
/*!
Texture component.
*/
RENDERSTYLE_COLORARG_TEXTURE,
/*!
Use TFactor color.
*/
RENDERSTYLE_COLORARG_TFACTOR,
//This must come last
RENDERSTYLE_COLORARG_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_COLORARG_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Alpha Argument types.
*/
enum ERenStyle_AlphaOp {
/*!
Disable this operand (output is zero).
*/
RENDERSTYLE_ALPHAOP_DISABLE,
/*!
Select Alpha Arg1.
*/
RENDERSTYLE_ALPHAOP_SELECTARG1,
/*!
Select Alpha Arg2.
*/
RENDERSTYLE_ALPHAOP_SELECTARG2,
/*!
Out = AlphaArg1 * AlphaArg2
*/
RENDERSTYLE_ALPHAOP_MODULATE,
/*!
Use current alpha to modulate. Out = AlphaArg1 * Alpha + AlphaArg2 * (1 - Alpha)
*/
RENDERSTYLE_ALPHAOP_MODULATEALPHA,
/*!
Use TFactor alpha to modulate. Out = AlphaArg1 * Alpha + AlphaArg2 * (1 - Alpha)
*/
RENDERSTYLE_ALPHAOP_MODULATETFACTOR,
/*!
Out = AlphaArg1 + AlphaArg2
*/
RENDERSTYLE_ALPHAOP_ADD,
/*!
Out = AlphaArg1 + AlphaArg2 - 0.5
*/
RENDERSTYLE_ALPHAOP_ADDSIGNED,
/*!
Out = (AlphaArg1 + AlphaArg2 - 0.5) * 2
*/
RENDERSTYLE_ALPHAOP_ADDSIGNED2X,
/*!
Out = AlphaArg1 - AlphaArg2
*/
RENDERSTYLE_ALPHAOP_SUBTRACT,
//This must come last
RENDERSTYLE_ALPHAOP_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_ALPHAOP_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Alpha Arguments
*/
enum ERenStyle_AlphaArg {
/*!
Use alpha from previous stage.
*/
RENDERSTYLE_ALPHAARG_CURRENT,
/*!
Use the diffuse alpha.
*/
RENDERSTYLE_ALPHAARG_DIFFUSE,
/*!
Use the texture alpha.
*/
RENDERSTYLE_ALPHAARG_TEXTURE,
/*!
Use the TFactor alpha.
*/
RENDERSTYLE_ALPHAARG_TFACTOR,
//This must come last
RENDERSTYLE_ALPHAARG_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_ALPHAARG_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Source for UV co-ords.
*/
enum ERenStyle_UV_Source {
/*!
ModelData UV Set 1.
*/
RENDERSTYLE_UVFROM_MODELDATA_UVSET1,
/*!
ModelData UV Set 2.
*/
RENDERSTYLE_UVFROM_MODELDATA_UVSET2,
/*!
ModelData UV Set 3.
*/
RENDERSTYLE_UVFROM_MODELDATA_UVSET3,
/*!
ModelData UV Set 4.
*/
RENDERSTYLE_UVFROM_MODELDATA_UVSET4,
/*!
The camera space normal.
*/
RENDERSTYLE_UVFROM_CAMERASPACENORMAL,
/*!
The camera space position.
*/
RENDERSTYLE_UVFROM_CAMERASPACEPOSITION,
/*!
The camera space reflection vector.
*/
RENDERSTYLE_UVFROM_CAMERASPACEREFLTVECT,
/*!
The world space normal vector.
*/
RENDERSTYLE_UVFROM_WORLDSPACENORMAL,
/*!
The world space position.
*/
RENDERSTYLE_UVFROM_WORLDSPACEPOSITION,
/*!
The world space reflection vector.
*/
RENDERSTYLE_UVFROM_WORLDSPACEREFLTVECT ,
//This must come last
RENDERSTYLE_UVSOURCE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_UVSOURCE_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Set which texture to use.
*/
enum ERenStyle_TextureParam {
/*!
No Texture.
*/
RENDERSTYLE_NOTEXTURE,
/*!
Use the first texture in the list.
*/
RENDERSTYLE_USE_TEXTURE1,
/*!
Use the second texture in the list.
*/
RENDERSTYLE_USE_TEXTURE2,
/*!
Use the third texture in the list.
*/
RENDERSTYLE_USE_TEXTURE3,
/*!
Use the fourth texture in the list.
*/
RENDERSTYLE_USE_TEXTURE4,
//This must come last
RENDERSTYLE_TEXTUREPARAM_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_TEXTUREPARAM_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Selects the UV address mode.
*/
enum ERenStyle_UV_Address {
/*!
Wrap (Repeat) UV address.
*/
RENDERSTYLE_UVADDR_WRAP,
/*!
Clamp to edge of texture.
*/
RENDERSTYLE_UVADDR_CLAMP,
/*!
Mirror on wrap.
*/
RENDERSTYLE_UVADDR_MIRROR,
/*!
Mirror once on wrap.
*/
RENDERSTYLE_UVADDR_MIRRORONCE,
//This must come last
RENDERSTYLE_UVADDRESS_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_UVADDRESS_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
Texture filter mode.
*/
enum ERenStyle_TexFilter {
/*!
BiLinear filter (TexFilter: Point, MipFilter: None).
*/
RENDERSTYLE_TEXFILTER_POINT,
/*!
BiLinear filter (TexFilter: Linear, MipFilter: Point).
*/
RENDERSTYLE_TEXFILTER_BILINEAR,
/*!
BiLinear filter (TexFilter: Linear, MipFilter: Linear).
*/
RENDERSTYLE_TEXFILTER_TRILINEAR,
/*!
BiLinear filter (TexFilter: Anisotropic, MipFilter: Linear).
*/
RENDERSTYLE_TEXFILTER_ANISOTROPIC,
/*!
BiLinear filter (TexFilter: Point, MipFilter: Point).
*/
RENDERSTYLE_TEXFILTER_POINT_PTMIP,
//This must come last
RENDERSTYLE_TEXFILTER_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_TEXFILTER_TYPE_FORCE_32BIT = 0x7fffffff
};
// RENDER PASS TYPES
/*!
Enumerates the alpha blend modes with which the model piece is drawn. The blend mode
defines how the source color (Cs), source alpha value (As), destination color (Cd),
and destination alpha value (Ad) interact. PlayStation 2 (which does not support
full collor modulate) supports the \b RENDERSTYLE_BLEND_ADD,
\b RENDERSTYLE_BLEND_MOD_SRCALPHA, and \b RENDERSTYLE_NOBLEND values.
\see RenderPassOp structure
*/
enum ERenStyle_BlendMode {
/*!
No blending is done. The source color is drawn with no modification.
This is the default value.
*/
RENDERSTYLE_NOBLEND, // Cs
/*!
The source color is added to the destination color (Cs + Cd).
*/
RENDERSTYLE_BLEND_ADD,
/*!
Cs * (1 - Cd) + Cd
*/
RENDERSTYLE_BLEND_SATURATE,
/*!
Cs * As + Cd * (1 - As)
*/
RENDERSTYLE_BLEND_MOD_SRCALPHA,
/*!
Cs * Cs + Cd * (1 - Cs)
*/
RENDERSTYLE_BLEND_MOD_SRCCOLOR,
/*!
Cs * Cd + Cd * (1 - Cd)
*/
RENDERSTYLE_BLEND_MOD_DSTCOLOR,
/*!
Cs * Cs + Cd * Cd
*/
RENDERSTYLE_BLEND_MUL_SRCCOL_DSTCOL,
/*!
Cs * Cs + Cd
*/
RENDERSTYLE_BLEND_MUL_SRCCOL_ONE,
/*!
CS * As
*/
RENDERSTYLE_BLEND_MUL_SRCALPHA_ZERO,
/*!
Cs * As + Cd
*/
RENDERSTYLE_BLEND_MUL_SRCALPHA_ONE,
/*!
Cs * Cd
*/
RENDERSTYLE_BLEND_MUL_DSTCOL_ZERO,
//This must come last
RENDERSTYLE_BLENDMODE_TYPE_COUNT,
/*!
Force this enumerated type to use 32 bit value.
*/
RENDERSTYLE_BLENDMODE_TYPE_FORCE_32BIT = 0x7fffffff
};
/*!
FourFloatVector
*/
struct FourFloatVector { // Four float vector...
FourFloatVector() { }
FourFloatVector(float nx, float ny, float nz, float nw) { x = nx; y = ny; z = nz; w = nw; };
float x,y,z,w;
};
/*!
FourFloatColor
*/
struct FourFloatColor { // Four float color...
FourFloatColor() { }
FourFloatColor(float nr, float ng, float nb, float na) { r = nr; g = ng; b = nb; a = na; }
float r,g,b,a;
};
/*!
Contains the set of operations that the render pass applies to the texture of
a model piece.
\see RenderPassOp structure
*/
struct TextureStageOps {
/*!
The \b ERenStyle_TextureParam value for this \TextureStageOps.
*/
ERenStyle_TextureParam TextureParam;
/*!
The \b ERenStyle_ColorOp value for this \TextureStageOps.
*/
ERenStyle_ColorOp ColorOp;
/*!
The \b ERenStyle_ColorArg value for this \TextureStageOps.
*/
ERenStyle_ColorArg ColorArg1,ColorArg2;
/*!
The \b ERenStyle_AlphaOp value for this \TextureStageOps.
*/
ERenStyle_AlphaOp AlphaOp;
/*!
The \b ERenStyle_AlphaArg value for this \TextureStageOps.
*/
ERenStyle_AlphaArg AlphaArg1,AlphaArg2;
/*!
The \b ERenStyle_UV_Source value for this \TextureStageOps.
*/
ERenStyle_UV_Source UVSource;
/*!
The \b ERenStyle_UV_Address value for this \TextureStageOps.
*/
ERenStyle_UV_Address UAddress;
/*!
The \b ERenStyle_UV_Address value for this \TextureStageOps.
*/
ERenStyle_UV_Address VAddress;
/*!
The \b ERenStyle_TexFilter value for this \TextureStageOps.
*/
ERenStyle_TexFilter TexFilter;
/*!
Enable matrix transform on UV Co-ords.
*/
bool UVTransform_Enable;
/*!
The matrix transform.
*/
float UVTransform_Matrix[16];
/*!
Enable projection of uv co-ords (divide by last UV element).
*/
bool ProjectTexCoord;
/*!
The number of texture coordinates that will be output by the texture transform matrix
*/
uint32 TexCoordCount;
};
/*!
Contains the set of operations that are applied to the model piece for a given
render pass. Each Render Style has one or more render passes.
\see AddRenderPass(), SetRenderPass(), GetRenderPass() = 0;
*/
struct RenderPassOp
{
/*!
An array of \b TextureStageOps for this \b RenderPassOp.
*/
TextureStageOps TextureStages[4];
/*!
The \b ERenStyle_BlendMode value for this \b RenderPassOp.
*/
ERenStyle_BlendMode BlendMode;
/*!
The \b ERenStyle_ZBufferMode value for this \b RenderPassOp.
*/
ERenStyle_ZBufferMode ZBufferMode;
/*!
The \b ERenStyle_CullMode value for this \b RenderPassOp.
*/
ERenStyle_CullMode CullMode;
/*!
ARGB value that can be used in the texture stages.
*/
uint32 TextureFactor;
/*!
Alpha Ref values (for alphatesting)...
*/
uint32 AlphaRef;
/*!
Enable dynamic lighting...
*/
bool DynamicLight;
/*!
The Z comparison function that will be used for this render pass
*/
ERenStyle_TestMode ZBufferTestMode;
/*!
The \b ERenStyle_TestMode value for this \b RenderPassOp.
*/
ERenStyle_TestMode AlphaTestMode;
/*!
The \b ERenStyle_FillMode value for this \b RenderPassOp.
*/
ERenStyle_FillMode FillMode;
/*!
Enable BumpEnvMap
*/
bool bUseBumpEnvMap; // BumpEnvMap Params...
/*!
Set the BumpEnvMap Stage...
*/
uint32 BumpEnvMapStage;
/*!
BumpEnvMap scale.
*/
float fBumpEnvMap_Scale;
/*!
BumpEnvMap offset.
*/
float fBumpEnvMap_Offset;
};
/*!
Light Material values (attenuation values for dynamic lighting).
*/
struct LightingMaterial { // Lighting Materials...
/*!
Ambient attenuation.
*/
FourFloatColor Ambient;
/*!
Diffuse attenuation.
*/
FourFloatColor Diffuse;
/*!
Emissive attenuation.
*/
FourFloatColor Emissive;
/*!
Specular attenuation.
*/
FourFloatColor Specular;
/*!
Specular Power.
*/
float SpecularPower;
};
/*!
*/
struct RSD3DOptions { // Platform options: Direct3D...
};
/*!
Contains render pass options for Direct3d platforms.
\see SetRenderPass_D3DOptions(), GetRenderPass_D3DOptions()
*/
struct RSD3DRenderPass {
/*!
A Boolean value indicating whether or not to use a vertex shader.
*/
bool bUseVertexShader;
bool bExpandForSkinning;
int32 ConstVector_ConstReg1; // Should be -1 if not used (same goes for all const regs)...
FourFloatVector ConstVector_Param1;
int32 ConstVector_ConstReg2;
FourFloatVector ConstVector_Param2;
int32 ConstVector_ConstReg3;
FourFloatVector ConstVector_Param3;
int32 WorldViewTransform_ConstReg;
uint32 WorldViewTransform_Count;
int32 ProjTransform_ConstReg;
int32 WorldViewProjTransform_ConstReg;
int32 ViewProjTransform_ConstReg;
int32 CamPos_MSpc_ConstReg;
uint32 Light_Count;
int32 LightPosition_MSpc_ConstReg;
int32 LightPosition_CSpc_ConstReg;
int32 LightColor_ConstReg;
int32 LightAtt_ConstReg;
int32 Material_AmbDifEm_ConstReg;
int32 Material_Specular_ConstReg;
int32 AmbientLight_ConstReg;
int32 PrevWorldViewTrans_ConstReg;
uint32 PrevWorldViewTrans_Count;
int32 Last_ConstReg;
bool bDeclaration_Stream_Position[4]; // Declaration flags...
bool bDeclaration_Stream_Normal[4];
bool bDeclaration_Stream_UVSets[4];
bool bDeclaration_Stream_BasisVectors[4];
int32 Declaration_Stream_UVCount[4]; };
/*!
Manages settings for a render style.
*/
class CRenderStyle {
public:
CRenderStyle() { m_iRefCnt = 0; m_pFilename = NULL ; }
virtual ~CRenderStyle() { if(m_pFilename) delete [] m_pFilename ; }
// Lighting Material...
/*!
\param LightMaterial The address of the \b LightingMaterial structure for this render style.
\return A Boolean value indicating whether or not the function is successful.
Sets the lighting material for this render style.
*/
virtual bool SetLightingMaterial(LightingMaterial& LightMaterial) = 0;
/*!
\param pLightMaterial [Return parameter] A pointer to the \LightingMaterial structure set for this
render style.
\return A Boolean value indicating whether or not the function is successful.
Retrieves the lighting material set for this render style.
*/
virtual bool GetLightingMaterial(LightingMaterial* pLightMaterial) = 0;
// RenderPasses...
/*!
\param Renderpass The address of the \b RenderPassOp structure to add to this
render style.
\return A Boolean value indicating whether or not the function is successful.
Adds a \b RenderPassOp structure to this render style. A \b CRenderStyle instance
may have any number of \b RenderPassOp structures applied to it. The
\b CRenderStyle instance keeps a 0-based list of these structures.
\see CRenderStyle::RemoveRenderPass()
*/
virtual bool AddRenderPass(RenderPassOp& Renderpass) = 0;
/*!
\param iPass An index into the \b CRenderStyle instance's list of \b RenderPassOp
structures.
\return A Boolean value indicating whether or not the function is successful.
Removes a \b RenderPassOp structure from this render style.
\see CRenderStyle::AddRenderPass()
*/
virtual bool RemoveRenderPass(uint32 iPass) = 0;
/*!
\param iPass An index into the \b CRenderStyle instance's list of \b RenderPassOp
structures.
\param RenderPass The address of the \b RenderPassOp structure.
\return A Boolean value indicating whether or not the function is successful.
Sets a \RenderPassOp structure for this render style.
\see CRenderStyle::GetRenderPass()
*/
virtual bool SetRenderPass(uint32 iPass,RenderPassOp& RenderPass) = 0;
/*!
\param iPass An index into the \b CRenderStyle instance's list of \b RenderPassOp
structures.
\param pRenderPass [Return parameter] A pointer to the \b RenderPassOp structure.
Retrieves one of the \b RenderPassOp structures set for this render style.
\see CRenderStyle::SetRenderPass()
*/
virtual bool GetRenderPass(uint32 iPass,RenderPassOp* pRenderPass) = 0;
/*!
\return A uint32 value identifying how many \b RenderPassOp structures apply to this
render style.
Returns the count of \b RenderPassOp structures applied to this render style.
*/
virtual uint32 GetRenderPassCount() = 0;
// Platform Options: Direct3D...
/*!
\param Options The address of the \b RSD3DOptions structure to apply to this
render style.
\return A Boolean value indicating whether or not the function is successful.
Sets Direct3D options for this render style.
\see CRenderStyle::GetDirect3D_Options()
*/
virtual bool SetDirect3D_Options(RSD3DOptions& Options) { return false; }
/*!
\param pOptions [Return parameter] A pointer to the \b RSD3DOptions structure
set for this render style.
\return A Boolean value indicating whether or not the function is successful.
Retrieves the Direct3D options set for this render style.
\see CRenderStyle::SetDirect3D_Options()
*/
virtual bool GetDirect3D_Options(RSD3DOptions* pOptions) { pOptions = NULL; return false; }
/*!
\param iPass An index into the \b CRenderStyle instance's list of \b RSD3DRenderPassOp
structures.
\param pD3DRenderPass The address of the \b RSD3DRenderPass structure to apply
to this render style.
\return A Boolean value indicating whether or not the function is successful.
Sets a \b RSD3DRenderPass structure to this render style.
\see CRenderStyle::GetRenderPass_D3DOptions()
*/
virtual bool SetRenderPass_D3DOptions(uint32 iPass,RSD3DRenderPass* pD3DRenderPass) { return false; }
/*!
\param iPass An index into the \b CRenderStyle instance's list of \b RSD3DRenderPassOp
structures.
\param pD3DRenderPass [Return parameter] A pointer to one of the \b RSD3DRenderPass
structures applied to this render style.
\return A Boolean value indicating whether or not the function is successful.
Retrieves one of the \b RSD3DRenderPass structures applied to this render style.
\see CRenderStyle::GetRenderPass_D3DOptions()
*/
virtual bool GetRenderPass_D3DOptions(uint32 iPass,RSD3DRenderPass* pD3DRenderPass) { pD3DRenderPass = NULL; return false; }
// Helper Functions...
/*!
\param pFileStream The LTB render style file.
\return A Boolean value indicating whether or not the function is successful.
Loads a compiled LTB render style file.
*/
virtual bool Load_LTBData(ILTStream* pFileStream) = 0; // Stream in the ltb file...
const char * GetFilename() const { return m_pFilename; }
/*!
\return A Boolean value indicating whether or not the function is successful.
*/
virtual bool Compile() = 0; // May need to be compiled if it has been changed (will automattically be done if used - but you may choose to do it at a particular time since it may take some time).
/*!
Set to default.
*/
virtual void SetDefaults() = 0;
/*!
\param pSrcRenderStyle
\return A Boolean value indicating whether or not the function is successful.
*/
virtual bool CopyRenderStyle(CRenderStyle* pSrcRenderStyle) = 0; // Copy the render style data from a source RS and put it in this one...
/*!
Check for support on the current platform.
*/
virtual bool IsSupportedOnDevice() = 0; // Does the current device support this render style...
/*!
\return ref count.
Get the reference count.
*/
virtual uint32 GetRefCount() { return m_iRefCnt; }
// Note: Use these functions with care. DecRefCount will not free a render style (use the render style interface to do that)...
virtual uint32 IncRefCount() { ++m_iRefCnt; return m_iRefCnt; }
virtual uint32 DecRefCount() { assert(m_iRefCnt > 0); --m_iRefCnt; return m_iRefCnt; }
void SetFilename( const char *new_name ) { delete [] m_pFilename ; LT_MEM_TRACK_ALLOC(m_pFilename = new char [ strlen( new_name ) + 1], LT_MEM_TYPE_RENDERER); strcpy( m_pFilename, new_name ); }
protected:
// Used to figure out if/when we can get rid of this guy...
uint32 m_iRefCnt;
private:
char* m_pFilename ;
};
#endif
| [
"[email protected]"
] | [
[
[
1,
971
]
]
] |
189fea87e24127c78231acca1ab3d1d2560d6f3c | 7b4c786d4258ce4421b1e7bcca9011d4eeb50083 | /_代码统计专用文件夹/《算法设计与分析基础》/第一章 绪论/20090312_习题1.1.9.a_减法版欧几里德算法.cpp | 104e1c331efb1c06b28d24f46c5c5ad3a96858e6 | [] | no_license | lzq123218/guoyishi-works | dbfa42a3e2d3bd4a984a5681e4335814657551ef | 4e78c8f2e902589c3f06387374024225f52e5a92 | refs/heads/master | 2021-12-04T11:11:32.639076 | 2011-05-30T14:12:43 | 2011-05-30T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 421 | cpp | #include <iostream>
using namespace std;
int getvalue(int m, int n)
{
if (m < n)
return m;
while (m >= n) {
m -= n;
}
return m;
}
int gcd(int m, int n)
{
int t;
while (n != 0) {
t = getvalue(m, n);
m = n;
n = t;
}
return m;
}
int main()
{
cout << "Enter a value:" << endl;
int m, n;
cin >> m >> n;
cout << "GCD = " << gcd(m, n) << endl;
return 0;
} | [
"baicaibang@70501136-4834-11de-8855-c187e5f49513"
] | [
[
[
1,
40
]
]
] |
0c6b2bf0c583f3e7943f8cab13b3f5469c6d6ac7 | 36fea6c98ecabcd5e932f2b7854b3282cdb571ee | /plugins/stringEditor/debug/qrc_qtpropertybrowser.cpp | 45fd0ecb38b139718bb918ef62fa438f29287a15 | [] | no_license | doomfrawen/visualcommand | 976adaae69303d8b4ffc228106a1db9504e4a4e4 | f7bc1d590444ff6811f84232f5c6480449228e19 | refs/heads/master | 2016-09-06T17:40:57.775379 | 2009-07-28T22:48:23 | 2009-07-28T22:48:23 | 32,345,504 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,469 | cpp | /****************************************************************************
** Resource object code
**
** Created: Fri Jun 19 11:30:43 2009
** by: The Resource Compiler for Qt version 4.5.1
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <QtCore/qglobal.h>
static const unsigned char qt_resource_data[] = {
// E:/VisualCommand/VisualCommand/src/images/cursor-vsplit.png
0x0,0x0,0x0,0xa1,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x46,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0xc0,0xd,
0x14,0xa0,0xf4,0xc,0x8,0xc5,0x14,0x6,0xa1,0x39,0x43,0x1b,0xc0,0xb4,0x6a,0x68,
0x2,0x98,0xe6,0x9a,0x5,0xe1,0x33,0x8,0x80,0x8,0xa6,0x55,0xab,0x66,0xad,0x5a,
0x5,0x52,0x5,0x2,0xd,0x70,0x1a,0x1d,0x60,0x91,0x7,0xeb,0x47,0x98,0x7,0x33,
0x1f,0x66,0x1f,0xcc,0x7e,0x98,0x7b,0xe0,0xee,0x3,0x1,0x0,0x56,0x7,0x14,0x5,
0x94,0xb6,0xb7,0x4f,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-sizeh.png
0x0,0x0,0x0,0x91,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x36,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0xa0,0x14,
0x68,0x30,0x30,0x70,0x81,0xe8,0x25,0xc,0xc,0x6c,0xd,0xc,0xc,0x4c,0x53,0x18,
0x18,0x58,0x17,0x0,0xc5,0x42,0x80,0x74,0x6,0x3,0x3,0x67,0x28,0x10,0x44,0x20,
0x68,0x98,0x38,0x4c,0x1d,0x4c,0x1f,0xdc,0x1c,0xf2,0x0,0x0,0xd3,0x23,0xa,0x2f,
0x9a,0xc3,0x39,0x37,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-forbidden.png
0x0,0x0,0x0,0xc7,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x6c,0x49,0x44,0x41,0x54,0x78,0x5e,0x75,0xce,0xb1,0xd,
0x43,0x31,0x8,0x4,0x50,0xbb,0x20,0x1b,0x84,0x79,0x9c,0xd,0x5c,0xe4,0xa7,0x60,
0x83,0xcf,0x34,0x2e,0x9c,0x4c,0x60,0x22,0xc1,0x94,0xf1,0x45,0xa2,0x8a,0x42,0xf3,
0xa,0xd0,0x1d,0xe5,0xff,0x5c,0x8f,0x6,0xaa,0xc4,0x1d,0x52,0x84,0x41,0xf6,0x87,
0x63,0x21,0x4f,0xd2,0xbe,0x55,0x2b,0x32,0xf6,0xd9,0xe9,0x8d,0xe7,0xd6,0xb5,0x5f,
0xd6,0xd6,0x64,0x12,0x5c,0x6c,0xf5,0x2b,0xf9,0xd,0x5a,0xd5,0x3,0x7a,0x91,0x17,
0x3c,0x1b,0xbf,0x27,0x72,0x3a,0xc5,0xc8,0xdc,0xec,0xc9,0xde,0xfc,0x23,0xff,0xfa,
0x99,0xf,0x85,0x37,0x24,0x14,0xff,0x2f,0x73,0xcf,0x0,0x0,0x0,0x0,0x49,0x45,
0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-sizev.png
0x0,0x0,0x0,0x8d,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x32,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0xc0,0x0,
0x4c,0x2b,0x20,0x34,0x57,0x14,0x84,0xd6,0xc,0x6b,0x0,0xd3,0x4b,0x43,0x17,0x80,
0xe9,0xa9,0xa1,0x9,0x10,0x89,0x0,0x8,0x45,0x6d,0x1a,0x66,0x3e,0xcc,0x3e,0x98,
0xfd,0x30,0xf7,0xc0,0xdc,0x87,0x2,0x0,0x34,0xf9,0xd,0x53,0x76,0x91,0x98,0xee,
0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-whatsthis.png
0x0,0x0,0x0,0xbf,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x20,0x0,0x0,0x0,0x20,0x2,0x3,0x0,0x0,0x0,0xe,0x14,0x92,0x67,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x64,0x49,0x44,0x41,0x54,0x18,0x57,0x63,0x68,0x60,0x80,
0x82,0x5,0xc,0xc,0xa1,0x21,0x20,0xc6,0xc,0x6,0xc6,0x55,0x2b,0x41,0x8c,0x69,
0xc,0x6c,0x53,0xb3,0x1c,0x80,0x8c,0xa9,0xd,0x52,0x13,0x20,0x8c,0x4,0x18,0x23,
0x2,0xc6,0x8,0x83,0x31,0x42,0x5b,0x1d,0xc1,0xba,0xa6,0x86,0x26,0xb0,0x2d,0x1,
0x33,0xa2,0x56,0x48,0x4d,0x0,0x9b,0x13,0xc1,0x0,0x61,0xcc,0x98,0x6,0x65,0x2c,
0x80,0x31,0x1a,0x54,0x1b,0x44,0x3,0xc0,0xd6,0xab,0x36,0x40,0x44,0x18,0x38,0x13,
0xe0,0xc,0xa8,0x14,0x53,0x3,0xc3,0x80,0x1,0x0,0x24,0xf4,0x1f,0xdd,0x57,0x8f,
0x2f,0x71,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-busy.png
0x0,0x0,0x0,0xc9,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x20,0x0,0x0,0x0,0x20,0x2,0x3,0x0,0x0,0x0,0xe,0x14,0x92,0x67,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x6e,0x49,0x44,0x41,0x54,0x78,0x5e,0xad,0xcd,0xb1,0xd,
0x85,0x30,0x10,0x3,0x50,0xa7,0xb9,0xd,0x7e,0x1,0xd3,0xdc,0x8,0x29,0x7e,0x36,
0x88,0x90,0x8e,0x69,0xd2,0xd2,0x7,0xa4,0x64,0x4a,0xb0,0x8e,0xdb,0x0,0x57,0x4f,
0x2e,0x6c,0x28,0xde,0xe4,0x40,0xd,0x58,0x60,0xd7,0x40,0xb,0x74,0xfc,0x4a,0x21,
0x6,0xd6,0x39,0x88,0xa9,0x6c,0x88,0x26,0xb3,0x13,0xe7,0xdf,0x61,0x1d,0xb2,0x71,
0xb5,0x1a,0xd2,0xc1,0x89,0x6c,0xc0,0xc6,0x51,0x5d,0x15,0xb,0x98,0x7,0x7e,0x23,
0x2d,0xcd,0xe6,0x90,0xab,0x13,0x49,0xe5,0x20,0x0,0xee,0x38,0xf8,0xc5,0xf8,0x7b,
0x34,0xdf,0xe7,0x6,0xac,0xb8,0x1e,0xf1,0xed,0x75,0x34,0x8c,0x0,0x0,0x0,0x0,
0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-wait.png
0x0,0x0,0x0,0xac,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x51,0x49,0x44,0x41,0x54,0x8,0x99,0x63,0x60,0x40,0x7,
0x52,0xab,0x56,0xad,0x4,0xd3,0xa1,0xa1,0x99,0xc8,0x7c,0xb6,0xd0,0xd0,0x14,0x14,
0x3a,0x72,0x26,0x84,0xe,0x4b,0x85,0xd0,0x53,0xa7,0x2e,0x1,0xd1,0x8c,0x4b,0xc3,
0x26,0x80,0xd,0xca,0x9c,0xe5,0x0,0x31,0x30,0x13,0x62,0x70,0x66,0x94,0x3,0x44,
0x7e,0xda,0x4,0x88,0xfa,0xd0,0x25,0x10,0xf3,0xa6,0xa2,0x9a,0x3,0x33,0x37,0x2d,
0x2d,0x5,0x9f,0x7b,0x50,0x1,0x0,0xa7,0xcc,0x1d,0xf4,0xaf,0x59,0xb,0x18,0x0,
0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-ibeam.png
0x0,0x0,0x0,0x7c,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x21,0x49,0x44,0x41,0x54,0x8,0x99,0x63,0x60,0xc0,0x0,
0x22,0x8c,0xe,0x60,0x9a,0x91,0x5,0x2a,0x10,0x40,0x1b,0x9a,0x33,0x8c,0x34,0xf5,
0x30,0xf7,0xc0,0xdc,0x87,0x2,0x0,0x5e,0x9d,0x6,0x14,0x54,0xdc,0x17,0x3,0x0,
0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-hand.png
0x0,0x0,0x0,0x9f,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x44,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0x60,0x10,
0x61,0x80,0x80,0x4c,0x28,0x3d,0x8d,0x58,0x7a,0x1,0x94,0x8e,0x6a,0x80,0xd0,0x91,
0x19,0x20,0x4a,0x63,0x5a,0x64,0x1a,0x98,0xb,0xa5,0xa7,0x4e,0xd,0xd,0x3,0xd1,
0xaa,0xa1,0x10,0x9a,0x13,0x8d,0x66,0xa,0xd,0x8d,0x40,0xa6,0x19,0xa6,0x86,0x26,
0xa0,0xd0,0xab,0x56,0x2d,0xc0,0x4a,0xa3,0x0,0x0,0x37,0xd6,0x1a,0x55,0x25,0x9d,
0xd9,0x18,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-openhand.png
0x0,0x0,0x0,0xa0,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x4,0x0,0x0,0x0,0xb5,0xfa,0x37,0xea,
0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x89,0x0,0x0,0xb,0x89,
0x1,0x37,0xc9,0xcb,0xad,0x0,0x0,0x0,0x52,0x49,0x44,0x41,0x54,0x28,0xcf,0x85,
0xd0,0xe1,0xe,0x0,0x10,0x8,0x85,0xd1,0xef,0xfd,0x5f,0xfa,0xfa,0x81,0x74,0x57,
0x96,0x26,0x9b,0xe,0x1a,0x44,0xe,0x84,0xea,0x4e,0x14,0x90,0x74,0xeb,0x6,0x5e,
0x61,0xaf,0x27,0xcf,0x60,0x4f,0x23,0x39,0x23,0xe5,0x56,0x2a,0x88,0x7e,0xae,0xf5,
0x11,0xc0,0xdf,0x57,0x61,0x60,0x27,0xca,0x2d,0x24,0xf2,0x5,0x7f,0x32,0x0,0x64,
0x5f,0x3d,0x80,0x4a,0xec,0xab,0x3b,0xd2,0x80,0x3e,0x16,0x78,0x30,0x74,0x9a,0xaf,
0x1e,0xaa,0x62,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-sizeall.png
0x0,0x0,0x0,0xae,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x53,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0xc0,0x0,
0x5c,0xb,0x20,0xb4,0x66,0x6,0x84,0x5e,0x1a,0x5,0xa6,0x98,0xa6,0x86,0x35,0x80,
0xe9,0xd0,0x50,0x30,0xad,0xc1,0xe8,0xa0,0x1,0xa2,0x97,0x30,0x3a,0x48,0x81,0x84,
0xa7,0x30,0x3a,0x88,0x1,0x25,0xb8,0x42,0x18,0x1d,0x44,0x81,0x26,0x70,0x86,0x2,
0x41,0x2,0x82,0x86,0x89,0xc3,0xd4,0xc1,0xf4,0xc1,0xcd,0x81,0x99,0xb,0xb3,0x7,
0x66,0x2f,0xdc,0x1d,0x30,0x77,0x61,0x5,0x0,0xdb,0x74,0x15,0xc3,0xaa,0xe7,0x4e,
0x58,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-sizef.png
0x0,0x0,0x0,0xa1,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x46,0x49,0x44,0x41,0x54,0x8,0xd7,0x63,0x60,0x20,0x4,
0x56,0xad,0x6a,0x0,0xd3,0x53,0x43,0xa1,0x74,0x18,0x44,0x7c,0x6a,0x4,0x94,0xe,
0x80,0xd2,0x21,0x10,0x7a,0x9a,0x28,0x84,0x9e,0xc1,0xea,0x0,0xa6,0x17,0x30,0x6,
0x30,0x41,0x74,0x86,0x70,0x42,0x68,0x51,0x55,0x8,0xcd,0xa,0x35,0x91,0x11,0x4a,
0x73,0x42,0x69,0xd5,0x50,0x54,0x1b,0x61,0x2e,0xc0,0x7,0x0,0x24,0x2c,0x12,0x3d,
0xcf,0x2,0x9,0x27,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-sizeb.png
0x0,0x0,0x0,0xa1,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x46,0x49,0x44,0x41,0x54,0x8,0x99,0x63,0x60,0x20,0xc,
0x56,0xad,0x6a,0x0,0xd3,0x53,0x43,0x21,0xb4,0x2a,0x94,0xe6,0x84,0xd2,0x8c,0x50,
0x9a,0x15,0x4a,0x8b,0xaa,0x42,0xe8,0x10,0x4e,0x10,0xbd,0x80,0x31,0x80,0x9,0x44,
0xcf,0x60,0x75,0x0,0x8b,0x4e,0x13,0x85,0x98,0x3a,0x35,0x4,0x4a,0x7,0x40,0xe9,
0x8,0x28,0x1d,0xc6,0x80,0x62,0x1b,0xcc,0x76,0xfc,0x0,0x0,0x20,0x6c,0x12,0x3d,
0x8,0xc,0xcf,0x6a,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-hsplit.png
0x0,0x0,0x0,0x9b,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x40,0x49,0x44,0x41,0x54,0x8,0x99,0x63,0x60,0x80,0x3,
0x2e,0x2e,0x8,0xad,0xca,0xda,0x40,0xa,0xcd,0xa1,0xca,0xda,0x4,0xa2,0xd5,0x54,
0x59,0x3b,0x41,0x2,0xd3,0x80,0x74,0x2,0x3,0x3,0x53,0x18,0x90,0x8e,0x60,0x60,
0xe0,0xc,0xd,0x65,0xd,0xd,0x43,0xf0,0x61,0xf2,0x70,0xf5,0x30,0xfd,0xa4,0xda,
0xb,0x77,0x2f,0x18,0x0,0x0,0xac,0x50,0x13,0xb6,0xd7,0xdc,0xaa,0xe9,0x0,0x0,
0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-cross.png
0x0,0x0,0x0,0x82,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x27,0x49,0x44,0x41,0x54,0x8,0x99,0x63,0x60,0xc0,0xd,
0x1c,0x20,0x14,0xe3,0x4,0xb2,0xe8,0xd0,0x10,0xd6,0x50,0xa0,0x9,0x8c,0xab,0x56,
0x70,0xad,0x9a,0x80,0xe0,0x93,0x6d,0x1e,0xdc,0x3d,0x58,0x1,0x0,0x4b,0xf4,0xd,
0x8c,0xd6,0x20,0x22,0xab,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,
0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-closedhand.png
0x0,0x0,0x0,0x93,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x4,0x0,0x0,0x0,0xb5,0xfa,0x37,0xea,
0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x89,0x0,0x0,0xb,0x89,
0x1,0x37,0xc9,0xcb,0xad,0x0,0x0,0x0,0x45,0x49,0x44,0x41,0x54,0x28,0xcf,0xad,
0xd1,0xcb,0xa,0x0,0x20,0x8,0x44,0xd1,0xf9,0xff,0x9f,0xbe,0x2d,0x24,0x70,0x7a,
0x53,0x19,0xba,0xe9,0x80,0xa2,0x42,0xeb,0xa7,0x7f,0x40,0x8,0xaf,0x6,0x4,0x80,
0xd7,0x40,0x6,0x72,0x28,0x32,0xb7,0x60,0x84,0x94,0x27,0x98,0x83,0xd1,0xe7,0x1,
0xd8,0xc,0xd9,0x80,0x9e,0xd4,0x4d,0xd8,0xce,0x5e,0xc1,0xe5,0xb1,0xa,0x94,0xc,
0x50,0xbe,0xf5,0x9f,0x96,0xe7,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,
0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-arrow.png
0x0,0x0,0x0,0xab,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,
0x0,0x8e,0xf4,0xc3,0xec,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x50,0x49,0x44,0x41,0x54,0x78,0x5e,0x3d,0xce,0xb1,0xd,
0x80,0x30,0xc,0x5,0xd1,0xa4,0x80,0x1d,0xd8,0xe6,0xf,0x41,0x22,0x39,0xb5,0xb3,
0x4f,0x68,0xd8,0x81,0x2d,0x89,0x9c,0x83,0x6b,0x5e,0x63,0x4b,0x3f,0xfd,0x6d,0xb8,
0xb,0x7,0x3a,0x1a,0x56,0x2d,0xcb,0x40,0x47,0xc3,0xaa,0x65,0x19,0xe8,0xcb,0xf6,
0x84,0xd5,0xce,0xb0,0x71,0xdf,0x6f,0x85,0x17,0xaa,0xc7,0x5f,0x4e,0xd3,0xe8,0x70,
0xc4,0x6f,0x59,0xd6,0x84,0x5e,0x5d,0x49,0x11,0xba,0xf,0x75,0x5a,0x95,0x0,0x0,
0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
// E:/VisualCommand/VisualCommand/src/images/cursor-uparrow.png
0x0,0x0,0x0,0x84,
0x89,
0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
0x0,0x0,0x19,0x0,0x0,0x0,0x19,0x2,0x3,0x0,0x0,0x0,0xb9,0x87,0x6d,0xf0,
0x0,0x0,0x0,0x9,0x50,0x4c,0x54,0x45,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,
0xff,0x7e,0xef,0x8f,0x4f,0x0,0x0,0x0,0x1,0x74,0x52,0x4e,0x53,0x0,0x40,0xe6,
0xd8,0x66,0x0,0x0,0x0,0x29,0x49,0x44,0x41,0x54,0x8,0x5b,0x63,0x60,0xc0,0x0,
0x4c,0x2b,0x20,0x34,0x57,0x14,0x84,0xd6,0xc,0x6b,0x0,0xd3,0x4b,0x43,0x17,0x80,
0xe9,0xa9,0xa1,0x9,0x10,0x89,0x0,0x86,0x81,0xa1,0x17,0x30,0x60,0x2,0x0,0xad,
0xe7,0xa,0x42,0x37,0xd2,0x7e,0x32,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,
0x42,0x60,0x82,
};
static const unsigned char qt_resource_name[] = {
// trolltech
0x0,0x9,
0x6,0x33,0x5c,0xb8,
0x0,0x74,
0x0,0x72,0x0,0x6f,0x0,0x6c,0x0,0x6c,0x0,0x74,0x0,0x65,0x0,0x63,0x0,0x68,
// qtpropertybrowser
0x0,0x11,
0x4,0xad,0x0,0x62,
0x0,0x71,
0x0,0x74,0x0,0x70,0x0,0x72,0x0,0x6f,0x0,0x70,0x0,0x65,0x0,0x72,0x0,0x74,0x0,0x79,0x0,0x62,0x0,0x72,0x0,0x6f,0x0,0x77,0x0,0x73,0x0,0x65,0x0,0x72,
// images
0x0,0x6,
0x7,0x3,0x7d,0xc3,
0x0,0x69,
0x0,0x6d,0x0,0x61,0x0,0x67,0x0,0x65,0x0,0x73,
// cursor-vsplit.png
0x0,0x11,
0xe,0x5,0xc5,0x27,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x76,0x0,0x73,0x0,0x70,0x0,0x6c,0x0,0x69,0x0,0x74,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-sizeh.png
0x0,0x10,
0x4,0x6b,0x71,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x73,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x68,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-forbidden.png
0x0,0x14,
0x2,0x39,0xe9,0x87,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x66,0x0,0x6f,0x0,0x72,0x0,0x62,0x0,0x69,0x0,0x64,0x0,0x64,0x0,0x65,0x0,0x6e,0x0,0x2e,
0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-sizev.png
0x0,0x10,
0x4,0x19,0x71,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x73,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x76,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-whatsthis.png
0x0,0x14,
0x6,0xbe,0x82,0x47,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x77,0x0,0x68,0x0,0x61,0x0,0x74,0x0,0x73,0x0,0x74,0x0,0x68,0x0,0x69,0x0,0x73,0x0,0x2e,
0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-busy.png
0x0,0xf,
0xf,0xe9,0x5b,0x47,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x62,0x0,0x75,0x0,0x73,0x0,0x79,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-wait.png
0x0,0xf,
0x7,0x4a,0x55,0xc7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x77,0x0,0x61,0x0,0x69,0x0,0x74,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-ibeam.png
0x0,0x10,
0xf,0xb0,0x9a,0x27,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x69,0x0,0x62,0x0,0x65,0x0,0x61,0x0,0x6d,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-hand.png
0x0,0xf,
0x7,0xa,0x5b,0xa7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x68,0x0,0x61,0x0,0x6e,0x0,0x64,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-openhand.png
0x0,0x13,
0x7,0xab,0x44,0xa7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x6f,0x0,0x70,0x0,0x65,0x0,0x6e,0x0,0x68,0x0,0x61,0x0,0x6e,0x0,0x64,0x0,0x2e,0x0,0x70,
0x0,0x6e,0x0,0x67,
// cursor-sizeall.png
0x0,0x12,
0x8,0x9,0x1f,0x87,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x73,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x61,0x0,0x6c,0x0,0x6c,0x0,0x2e,0x0,0x70,0x0,0x6e,
0x0,0x67,
// cursor-sizef.png
0x0,0x10,
0x4,0x69,0x71,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x73,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x66,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-sizeb.png
0x0,0x10,
0x4,0x65,0x71,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x73,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x62,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-hsplit.png
0x0,0x11,
0xe,0xb,0x85,0x27,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x68,0x0,0x73,0x0,0x70,0x0,0x6c,0x0,0x69,0x0,0x74,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-cross.png
0x0,0x10,
0x2,0x76,0x90,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x63,0x0,0x72,0x0,0x6f,0x0,0x73,0x0,0x73,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-closedhand.png
0x0,0x15,
0x8,0xe,0x3a,0x47,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x63,0x0,0x6c,0x0,0x6f,0x0,0x73,0x0,0x65,0x0,0x64,0x0,0x68,0x0,0x61,0x0,0x6e,0x0,0x64,
0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-arrow.png
0x0,0x10,
0xd,0xba,0x94,0x7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x61,0x0,0x72,0x0,0x72,0x0,0x6f,0x0,0x77,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
// cursor-uparrow.png
0x0,0x12,
0x9,0x44,0xef,0xc7,
0x0,0x63,
0x0,0x75,0x0,0x72,0x0,0x73,0x0,0x6f,0x0,0x72,0x0,0x2d,0x0,0x75,0x0,0x70,0x0,0x61,0x0,0x72,0x0,0x72,0x0,0x6f,0x0,0x77,0x0,0x2e,0x0,0x70,0x0,0x6e,
0x0,0x67,
};
static const unsigned char qt_resource_struct[] = {
// :
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
// :/trolltech
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2,
// :/trolltech/qtpropertybrowser
0x0,0x0,0x0,0x18,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x3,
// :/trolltech/qtpropertybrowser/images
0x0,0x0,0x0,0x40,0x0,0x2,0x0,0x0,0x0,0x12,0x0,0x0,0x0,0x4,
// :/trolltech/qtpropertybrowser/images/cursor-forbidden.png
0x0,0x0,0x0,0xa0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x3a,
// :/trolltech/qtpropertybrowser/images/cursor-cross.png
0x0,0x0,0x2,0x7e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x9,0x38,
// :/trolltech/qtpropertybrowser/images/cursor-sizev.png
0x0,0x0,0x0,0xce,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x5,
// :/trolltech/qtpropertybrowser/images/cursor-sizeb.png
0x0,0x0,0x2,0x30,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x7,0xf4,
// :/trolltech/qtpropertybrowser/images/cursor-sizef.png
0x0,0x0,0x2,0xa,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x7,0x4f,
// :/trolltech/qtpropertybrowser/images/cursor-sizeh.png
0x0,0x0,0x0,0x7a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xa5,
// :/trolltech/qtpropertybrowser/images/cursor-whatsthis.png
0x0,0x0,0x0,0xf4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x96,
// :/trolltech/qtpropertybrowser/images/cursor-hand.png
0x0,0x0,0x1,0x90,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x5,0x56,
// :/trolltech/qtpropertybrowser/images/cursor-wait.png
0x0,0x0,0x1,0x46,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x4,0x26,
// :/trolltech/qtpropertybrowser/images/cursor-openhand.png
0x0,0x0,0x1,0xb4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x5,0xf9,
// :/trolltech/qtpropertybrowser/images/cursor-sizeall.png
0x0,0x0,0x1,0xe0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x6,0x9d,
// :/trolltech/qtpropertybrowser/images/cursor-closedhand.png
0x0,0x0,0x2,0xa4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x9,0xbe,
// :/trolltech/qtpropertybrowser/images/cursor-uparrow.png
0x0,0x0,0x2,0xfa,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xb,0x4,
// :/trolltech/qtpropertybrowser/images/cursor-arrow.png
0x0,0x0,0x2,0xd4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xa,0x55,
// :/trolltech/qtpropertybrowser/images/cursor-vsplit.png
0x0,0x0,0x0,0x52,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
// :/trolltech/qtpropertybrowser/images/cursor-hsplit.png
0x0,0x0,0x2,0x56,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x8,0x99,
// :/trolltech/qtpropertybrowser/images/cursor-ibeam.png
0x0,0x0,0x1,0x6a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x4,0xd6,
// :/trolltech/qtpropertybrowser/images/cursor-busy.png
0x0,0x0,0x1,0x22,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x3,0x59,
};
QT_BEGIN_NAMESPACE
extern bool qRegisterResourceData
(int, const unsigned char *, const unsigned char *, const unsigned char *);
extern bool qUnregisterResourceData
(int, const unsigned char *, const unsigned char *, const unsigned char *);
QT_END_NAMESPACE
int QT_MANGLE_NAMESPACE(qInitResources_qtpropertybrowser)()
{
QT_PREPEND_NAMESPACE(qRegisterResourceData)
(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_qtpropertybrowser))
int QT_MANGLE_NAMESPACE(qCleanupResources_qtpropertybrowser)()
{
QT_PREPEND_NAMESPACE(qUnregisterResourceData)
(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources_qtpropertybrowser))
| [
"flouger@13a168e0-7ae3-11de-a146-1f7e517e55b8"
] | [
[
[
1,
453
]
]
] |
9eadaf955a7f25a8f140f6f6b1a1fd9aa2de6716 | c1a2953285f2a6ac7d903059b7ea6480a7e2228e | /deitel/ch24/Fig24_13/Book.cpp | 447c84198f30dd738b54fb9d0cd90999a4936da2 | [] | no_license | tecmilenio/computacion2 | 728ac47299c1a4066b6140cebc9668bf1121053a | a1387e0f7f11c767574fcba608d94e5d61b7f36c | refs/heads/master | 2016-09-06T19:17:29.842053 | 2008-09-28T04:27:56 | 2008-09-28T04:27:56 | 50,540 | 4 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,173 | cpp | // Fig. 24.12: Book.cpp
// Member function definitions for class Book.
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include "Author.h"
#include "Book.h"
#include "boost/shared_ptr.hpp"
#include "boost/weak_ptr.hpp"
Book::Book( const string &bookTitle ) : title( bookTitle )
{
}
Book::~Book()
{
cout << "Destroying Book: " << title << endl;
} // end of destructor
// print the name of this Book's Author
void Book::printAuthorName()
{
// if weakAuthorPtr.lock() returns a non-empty shared_ptr
if ( boost::shared_ptr< Author > authorPtr = weakAuthorPtr.lock() )
{
// show the reference count increase and print the Author's name
cout << "Reference count for Author " << authorPtr->name
<< " is " << authorPtr.use_count() << "." << endl;
cout << "The book " << title << " was written by "
<< authorPtr->name << "\n" << endl;
} // end if
else // weakAuthorPtr points to NULL
cout << "This Book has no Author." << endl;
} // end of printAuthorName
/**************************************************************************
* (C) Copyright 1992-2008 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
**************************************************************************/ | [
"[email protected]"
] | [
[
[
1,
53
]
]
] |
489a8dfa19c625faaadeeb133404f7aebc9d9b6a | 975e3cacad2b513dff73ddd5ce3d449ad40c293b | /babel-2014-minett_a/trunk/portaudio/Convert.h | 5851b6c07d34b09ea238ba803875d2208ac33a30 | [] | no_license | alex-min/babelroxor | 08a2babfbd1cf51dcfcba589d9acc7afcebee6e3 | 53cbdedd7d4b68943fe99d74dbb5443b799cca05 | refs/heads/master | 2021-01-10T14:24:12.257931 | 2011-12-13T10:57:30 | 2011-12-13T10:57:30 | 46,981,346 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 814 | h |
#ifndef UTILS_CONVERT_H_
#define UTILS_CONVERT_H_
#include <sstream>
#include <math.h>
#include "Config.h"
#ifndef M_PI
#define M_PI 3.14
#endif
namespace Utils
{
namespace Convert
{
inline double LINK_OPTION_UTILS DegToRad(double deg) {return (deg*M_PI)/180.0;}
inline double LINK_OPTION_UTILS RadToDeg(double rad) {return (rad*180.0)/M_PI;}
template <typename T>
bool StringTo(const std::string &s, T &dest)
{
std::istringstream iss(s);
return (iss >> dest != 0);
}
template <typename T>
std::string ToString(const T &data)
{
std::ostringstream oss;
oss << data;
return oss.str();
}
}
}
#endif
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
9
],
[
14,
38
]
],
[
[
10,
13
]
]
] |
a30b46062c9265e4ae97d09edecd08178cab6df9 | 35231241243cb13bd3187983d224e827bb693df3 | /branches/umptesting/MPReader/mp_sql.cpp | 775a7f869247a91b8425cf1344552269c306d438 | [] | no_license | casaretto/cgpsmapper | b597aa2775cc112bf98732b182a9bc798c3dd967 | 76d90513514188ef82f4d869fc23781d6253f0ba | refs/heads/master | 2021-05-15T01:42:47.532459 | 2011-06-25T23:16:34 | 2011-06-25T23:16:34 | 1,943,334 | 2 | 2 | null | 2019-06-11T00:26:40 | 2011-06-23T18:31:36 | C++ | UTF-8 | C++ | false | false | 1,162 | cpp | #include "mp_sql.h"
SQLFrame::SQLFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxGridSizer* gSizer4;
gSizer4 = new wxGridSizer( 1, 1, 0, 0 );
m_htmlSQL = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
gSizer4->Add( m_htmlSQL, 0, wxEXPAND, 5 );
this->SetSizer( gSizer4 );
this->Layout();
}
SQLFrame::~SQLFrame()
{
}
ProgressFrame::ProgressFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_Progress = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
bSizer4->Add( m_Progress, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizer4 );
this->Layout();
this->Centre( wxBOTH );
}
ProgressFrame::~ProgressFrame()
{
} | [
"marrud@ad713ecf-6e55-4363-b790-59b81426eeec"
] | [
[
[
1,
39
]
]
] |
b69edf2540f2d53010bfa0323cd6622fef7b76aa | af96c6474835be2cc34ef21b0c2a45e950bb9148 | /media/libdrm/mobile2/src/util/xml/XMLElementImpl.cpp | 5453902eba64132778745be492c69bff8f2b9055 | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | zsol/android_frameworks_base | 86abe37fcd4136923cab2d6677e558826f087cf9 | 8d18426076382edaaea68392a0298d2c32cfa52e | refs/heads/donut | 2021-07-04T17:24:05.847586 | 2010-01-13T19:24:55 | 2010-01-13T19:24:55 | 469,422 | 14 | 12 | NOASSERTION | 2020-10-01T18:05:31 | 2010-01-12T21:20:20 | Java | UTF-8 | C++ | false | false | 3,028 | cpp | /*
* Copyright (C) 2007 The Android Open Source Project
*
* 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.
*/
#include <util/xml/XMLElementImpl.h>
#include <util/domcore/TextImpl.h>
/** see XMLElementImpl.h */
XMLElementImpl::XMLElementImpl(const DOMString *tag)
{
if (tag)
{
mTagName = *tag;
}
}
/** see XMLElementImpl.h */
XMLElementImpl::~XMLElementImpl()
{
}
/** see XMLElementImpl.h */
const DOMString* XMLElementImpl::getTagName() const
{
return &mTagName;
}
/** see XMLElementImpl.h */
void XMLElementImpl::setAttribute(const DOMString* name, const DOMString* value)
throw (DOMException)
{
if (name && value)
{
mAttributeMap[*name] = *value;
}
}
/** see XMLElementImpl.h */
void XMLElementImpl::removeAttribute(const DOMString* name) throw (DOMException)
{
if (name)
{
mAttributeMap.erase(*name);
}
}
/** see XMLElementImpl.h */
const DOMString* XMLElementImpl::getAttribute(const DOMString* name) const
{
if (name)
{
DOMStringMap::const_iterator pos = mAttributeMap.find(*name);
if (pos != mAttributeMap.end())
{
return &(pos->second);
}
}
return NULL;
}
/** see XMLElementImpl.h */
bool XMLElementImpl::hasAttributes() const
{
return !mAttributeMap.empty();
}
/** see XMLElementImpl.h */
const DOMStringMap* XMLElementImpl::getAttributeMap() const
{
return &mAttributeMap;
}
/** see XMLElementImpl.h */
const NodeImpl* XMLElementImpl::findSoloChildNode(const char* tag) const
{
if (NULL == tag)
{
return NULL;
}
string token;
NodeListImpl *nodeList = NULL;
const NodeImpl *childNode = NULL;
token.assign(tag);
nodeList = getElementsByTagName(&token);
if (nodeList->getLength() > 0)
{
childNode = nodeList->item(0);
}
return childNode;
}
/** see XMLElementImpl.h */
const string* XMLElementImpl::getSoloText(const char* tag) const
{
const NodeImpl *textNode = this->findSoloChildNode(tag);
if (textNode)
{
textNode = textNode->getFirstChild();
if (textNode)
{
return static_cast<const TextImpl*>(textNode)->getData();
}
}
return NULL;
}
/** see XMLElementImpl.h */
const XMLElementImpl* XMLElementImpl::getSoloElement(const char* tag) const
{
const NodeImpl *node = findSoloChildNode(tag);
if (node)
{
return static_cast<const XMLElementImpl*>(node);
}
return NULL;
}
| [
"[email protected]"
] | [
[
[
1,
136
]
]
] |
6c2c60f785b840b9c26beecab7656d4e88c5e304 | fac8de123987842827a68da1b580f1361926ab67 | /inc/physics/Common/Visualize/Shape/hkDisplayCylinder.h | 073f41f6aca46a0296d2429ba410004886a0f5df | [] | no_license | blockspacer/transporter-game | 23496e1651b3c19f6727712a5652f8e49c45c076 | 083ae2ee48fcab2c7d8a68670a71be4d09954428 | refs/heads/master | 2021-05-31T04:06:07.101459 | 2009-02-19T20:59:59 | 2009-02-19T20:59:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,058 | 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-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_VISUALIZE_SHAPE_CYLINDER_H
#define HK_VISUALIZE_SHAPE_CYLINDER_H
#include <Common/Visualize/Shape/hkDisplayGeometry.h>
class hkDisplayCylinder : public hkDisplayGeometry
{
public:
hkDisplayCylinder( const hkVector4& top, const hkVector4& bottom, hkReal radius, int numSides = 9, int numHeightSegments = 1 );
virtual void buildGeometry();
virtual void getWireframeGeometry(hkArray<hkVector4>& lines);
const hkVector4& getTop() { return m_top; }
const hkVector4& getBottom() { return m_bottom; }
hkReal getRadius() { return m_radius; }
inline int getNumHeightSamples() { return m_numHeightSegments; }
inline int getNumSides() { return m_numSides; }
protected:
hkVector4 m_top;
hkVector4 m_bottom;
hkReal m_radius;
int m_numSides;
int m_numHeightSegments;
};
#endif // HK_VISUALIZE_SHAPE_CYLINDER_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529)
*
* Confidential Information of Havok. (C) Copyright 1999-2008
* 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
*
*/
| [
"uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4"
] | [
[
[
1,
58
]
]
] |
cee6463560f82682df805fe156635911745ff9f6 | eed0d2db074961e9fa1ff2c58281de679bf734c7 | /thread_manager.cpp | cfc3026cf6fe69136946963a9fe0581e0d87d902 | [] | no_license | thandav/micron | 35eefa22b3e9d698a092b98898510d6a393e2424 | 349ef537d16970c93569c8de478e1f2addee3d94 | refs/heads/master | 2016-09-11T09:13:22.733858 | 2011-09-11T17:37:39 | 2011-09-11T17:37:39 | 1,777,980 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,758 | cpp | #include "thread_manager.h"
#include <sstream>
#include <string>
#include "queue_manager.h"
ThreadManager* ThreadManager::pInstance = NULL;
void* run(void* ptr)
{
QueueManager& pQM = QueueManager::instance();
ostringstream buf;
//buf << "Thread started. THREAD_ID=" << pthread_self() << endl;
cout << buf.str();
ThreadManager* pTM = static_cast<ThreadManager*>(ptr);
for (;;)
{
Message* message = NULL;
pthread_mutex_lock(&pTM->mutex);
if (pTM->m_pJobQueue.empty())
{
//cout << "Going into WAIT state. THREAD_ID=" << pthread_self() << endl;
pthread_cond_wait(&pTM->cond, &pTM->mutex);
}
else
{
message = pTM->m_pJobQueue.front();
pTM->m_pJobQueue.pop();
//cout << "Message recvd from JobQueue: " << " THREAD_ID=" << pthread_self() << endl;
pQM.putInQueue(string(message->getQueueName()), message);
}
pthread_mutex_unlock(&pTM->mutex);
}
}
ThreadManager& ThreadManager::instance()
{
if (pInstance == NULL)
{
pInstance = new ThreadManager();
}
return *pInstance;
}
ThreadManager::ThreadManager()
{
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cond, NULL);
pthread_t newThread;
for (int i = 0; i < 4; i++)
{
pthread_create(&newThread, NULL, run, this);
}
}
ThreadManager::~ThreadManager()
{
//dtor
}
void ThreadManager::addJobToQueue(Message* msg)
{
pthread_mutex_lock(&mutex);
m_pJobQueue.push(msg);
if (m_pJobQueue.size() > 0)
{
//cout << "SIGNALLING! JOB_COUNT=" << m_pJobQueue.size() << endl;
pthread_cond_signal(&cond);
}
pthread_mutex_unlock(&mutex);
}
| [
"[email protected]"
] | [
[
[
1,
73
]
]
] |
f044a35c752d1fc2dace7f1610afd71890c62a47 | 41c264ec05b297caa2a6e05e4476ce0576a8d7a9 | /CTransform/pdiff/LPyramid.cpp | a795eeddf98df2b02b04be34b1b7d1611cbeaa25 | [] | no_license | seawei/openholdem | cf19a90911903d7f4d07f956756bd7e521609af3 | ba408c835b71dc1a9d674eee32958b69090fb86c | refs/heads/master | 2020-12-25T05:40:09.628277 | 2009-01-25T01:17:10 | 2009-01-25T01:17:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,438 | cpp | /*
Laplacian Pyramid
Copyright (C) 2006 Yangli Hector Yee
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
#include "LPyramid.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
LPyramid::LPyramid(float *image, int width, int height) :
Width(width),
Height(height)
{
// Make the Laplacian pyramid by successively
// copying the earlier levels and blurring them
for (int i=0; i<MAX_PYR_LEVELS; i++) {
if (i == 0) {
Levels[i] = Copy(image);
} else {
Levels[i] = new float[Width * Height];
Convolve(Levels[i], Levels[i - 1]);
}
}
}
LPyramid::~LPyramid()
{
for (int i=0; i<MAX_PYR_LEVELS; i++) {
if (Levels[i]) delete Levels[i];
}
}
float *LPyramid::Copy(float *img)
{
int max = Width * Height;
float *out = new float[max];
for (int i = 0; i < max; i++) out[i] = img[i];
return out;
}
void LPyramid::Convolve(float *a, float *b)
// convolves image b with the filter kernel and stores it in a
{
int y,x,i,j,nx,ny;
const float Kernel[] = {0.05f, 0.25f, 0.4f, 0.25f, 0.05f};
for (y=0; y<Height; y++) {
for (x=0; x<Width; x++) {
int index = y * Width + x;
a[index] = 0.0f;
for (i=-2; i<=2; i++) {
for (j=-2; j<=2; j++) {
nx=x+i;
ny=y+j;
if (nx<0) nx=-nx;
if (ny<0) ny=-ny;
if (nx>=Width) nx=2*Width-nx-1;
if (ny>=Height) ny=2*Height-ny-1;
a[index] += Kernel[i+2] * Kernel[j+2] * b[ny * Width + nx];
}
}
}
}
}
float LPyramid::Get_Value(int x, int y, int level)
{
int index = x + y * Width;
int l = level;
if (l > MAX_PYR_LEVELS) l = MAX_PYR_LEVELS;
return Levels[level][index];
}
| [
"[email protected]"
] | [
[
[
1,
89
]
]
] |
bc21e5904adc0a5f28d1293bb5a8d1a01d1d45d6 | 9a48be80edc7692df4918c0222a1640545384dbb | /Libraries/Boost1.40/libs/math/performance/test_ibeta.cpp | c3f984b2fba7dcd4e2f8e50db085065d19b46cfc | [
"BSL-1.0"
] | permissive | fcrick/RepSnapper | 05e4fb1157f634acad575fffa2029f7f655b7940 | a5809843f37b7162f19765e852b968648b33b694 | refs/heads/master | 2021-01-17T21:42:29.537504 | 2010-06-07T05:38:05 | 2010-06-07T05:38:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,980 | cpp | // Copyright John Maddock 2007.
// Use, modification and distribution are 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)
#include "required_defines.hpp"
#include "performance_measure.hpp"
#include <boost/math/special_functions/beta.hpp>
#include <boost/array.hpp>
#define T double
#include "../test/ibeta_data.ipp"
#include "../test/ibeta_int_data.ipp"
#include "../test/ibeta_large_data.ipp"
#include "../test/ibeta_small_data.ipp"
template <std::size_t N>
double ibeta_evaluate2(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += boost::math::ibeta(data[i][0], data[i][1], data[i][2]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta")
{
double result = ibeta_evaluate2(ibeta_data);
result += ibeta_evaluate2(ibeta_int_data);
result += ibeta_evaluate2(ibeta_large_data);
result += ibeta_evaluate2(ibeta_small_data);
consume_result(result);
set_call_count(
(sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
template <std::size_t N>
double ibeta_inv_evaluate2(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv")
{
double result = ibeta_inv_evaluate2(ibeta_data);
result += ibeta_inv_evaluate2(ibeta_int_data);
result += ibeta_inv_evaluate2(ibeta_large_data);
result += ibeta_inv_evaluate2(ibeta_small_data);
consume_result(result);
set_call_count(
(sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
template <std::size_t N>
double ibeta_invab_evaluate2(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
{
//std::cout << "ibeta_inva(" << data[i][1] << "," << data[i][2] << "," << data[i][5] << ");" << std::endl;
result += boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]);
//std::cout << "ibeta_invb(" << data[i][0] << "," << data[i][2] << "," << data[i][5] << ");" << std::endl;
result += boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]);
//std::cout << "ibetac_inva(" << data[i][1] << "," << data[i][2] << "," << data[i][6] << ");" << std::endl;
result += boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]);
//std::cout << "ibetac_invb(" << data[i][0] << "," << data[i][2] << "," << data[i][6] << ");" << std::endl;
result += boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]);
}
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta_invab")
{
double result = ibeta_invab_evaluate2(ibeta_data);
result += ibeta_invab_evaluate2(ibeta_int_data);
result += ibeta_invab_evaluate2(ibeta_large_data);
result += ibeta_invab_evaluate2(ibeta_small_data);
consume_result(result);
set_call_count(
4 * (sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
#ifdef TEST_CEPHES
extern "C" {
double incbet(double a, double b, double x);
double incbi(double a, double b, double y);
}
template <std::size_t N>
double ibeta_evaluate_cephes(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += incbet(data[i][0], data[i][1], data[i][2]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-cephes")
{
double result = ibeta_evaluate_cephes(ibeta_data);
result += ibeta_evaluate_cephes(ibeta_int_data);
result += ibeta_evaluate_cephes(ibeta_large_data);
result += ibeta_evaluate_cephes(ibeta_small_data);
consume_result(result);
set_call_count(
(sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
template <std::size_t N>
double ibeta_inv_evaluate_cephes(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += incbi(data[i][0], data[i][1], data[i][5]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv-cephes")
{
double result = ibeta_inv_evaluate_cephes(ibeta_data);
result += ibeta_inv_evaluate_cephes(ibeta_int_data);
result += ibeta_inv_evaluate_cephes(ibeta_large_data);
result += ibeta_inv_evaluate_cephes(ibeta_small_data);
consume_result(result);
set_call_count(
(sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
#endif
#ifdef TEST_GSL
//
// This test segfaults inside GSL....
//
#include <gsl/gsl_sf.h>
template <std::size_t N>
double ibeta_evaluate_gsl(const boost::array<boost::array<T, 7>, N>& data)
{
double result = 0;
for(unsigned i = 0; i < N; ++i)
result += gsl_sf_beta_inc(data[i][0], data[i][1], data[i][2]);
return result;
}
BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-gsl")
{
double result = ibeta_evaluate_gsl(ibeta_data);
result += ibeta_evaluate_gsl(ibeta_int_data);
result += ibeta_evaluate_gsl(ibeta_large_data);
result += ibeta_evaluate_gsl(ibeta_small_data);
consume_result(result);
set_call_count(
(sizeof(ibeta_data)
+ sizeof(ibeta_int_data)
+ sizeof(ibeta_large_data)
+ sizeof(ibeta_small_data)) / sizeof(ibeta_data[0]));
}
#endif
| [
"metrix@Blended.(none)"
] | [
[
[
1,
191
]
]
] |
acb05977e9497387a81fafe01a7095d72c155605 | 0b66a94448cb545504692eafa3a32f435cdf92fa | /tags/cms/cbear.berlios.de/windows/thread.hpp | 09117809b1cf99e02a5a15f169b86c5eabf16b73 | [
"MIT"
] | permissive | BackupTheBerlios/cbear-svn | e6629dfa5175776fbc41510e2f46ff4ff4280f08 | 0109296039b505d71dc215a0b256f73b1a60b3af | refs/heads/master | 2021-03-12T22:51:43.491728 | 2007-09-28T01:13:48 | 2007-09-28T01:13:48 | 40,608,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,299 | hpp | #ifndef CBEAR_BERLIOS_DE_WINDOWS_THREAD_HPP_INCLUDED
#define CBEAR_BERLIOS_DE_WINDOWS_THREAD_HPP_INCLUDED
#include <cbear.berlios.de/windows/base.hpp>
#include <cbear.berlios.de/windows/security_attributes.hpp>
#include <cbear.berlios.de/windows/exception.hpp>
#include <cbear.berlios.de/windows/optional_ref.hpp>
namespace cbear_berlios_de
{
namespace windows
{
class thread
{
public:
thread():
H()
{
}
~thread()
{
this->close();
}
void close()
{
if(!this->H)
{
return;
}
{
exception::scope_last_error S;
::WaitForSingleObject(this->H, INFINITE);
}
{
exception::scope_last_error S;
::CloseHandle(this->H);
}
this->H = internal_t();
}
template<class T>
dword_t create(
const security_attributes &Attributes,
size_t StackSize,
T &P,
dword_t Flags)
{
this->close();
exception::scope_last_error S;
dword_t Id;
this->H = ::CreateThread(
Attributes.get(), StackSize, traits<T>::func, &P, Flags, &Id);
return Id;
}
private:
typedef ::HANDLE internal_t;
internal_t H;
template<class T>
class traits
{
public:
static DWORD WINAPI func(LPVOID lpParameter)
{
(*reinterpret_cast<T *>(lpParameter))();
return 0;
}
};
};
}
}
#endif
| [
"sergey_shandar@e6e9985e-9100-0410-869a-e199dc1b6838"
] | [
[
[
1,
79
]
]
] |
f7cc0bdfc2cea7ce66ec0bacb80f77e8d4109163 | 5f0b8d4a0817a46a9ae18a057a62c2442c0eb17e | /Include/event/ChangeListener.h | 130dfe64f3dcfb970c17057351e2a41f7e3a25e6 | [
"BSD-3-Clause"
] | permissive | gui-works/ui | 3327cfef7b9bbb596f2202b81f3fc9a32d5cbe2b | 023faf07ff7f11aa7d35c7849b669d18f8911cc6 | refs/heads/master | 2020-07-18T00:46:37.172575 | 2009-11-18T22:05:25 | 2009-11-18T22:05:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,924 | h | /*
* Copyright (c) 2003-2006, Bram Stein
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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.
*/
#ifndef CHANGELISTENER_H
#define CHANGELISTENER_H
#include "../Pointers.h"
#include "./EventListener.h"
namespace ui
{
namespace event
{
/**
* Listens for ChangeEvents.
*/
class ChangeListener : public EventListener
{
public:
virtual ~ChangeListener() {};
virtual void stateChanged(const ChangeEvent &e) = 0;
};
}
}
#endif | [
"bs@bram.(none)"
] | [
[
[
1,
51
]
]
] |
88e3e1195d8da9ddfb4462f1498979e5c5be1c2d | d425cf21f2066a0cce2d6e804bf3efbf6dd00c00 | /Tactical/XML_AttachmentSlots.cpp | 63ed4db9996b14d1f81bb4de09b3ca0d6cabb75c | [] | no_license | infernuslord/ja2 | d5ac783931044e9b9311fc61629eb671f376d064 | 91f88d470e48e60ebfdb584c23cc9814f620ccee | refs/heads/master | 2021-01-02T23:07:58.941216 | 2011-10-18T09:22:53 | 2011-10-18T09:22:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,069 | cpp | #ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
#include "sgp.h"
#include "overhead.h"
#include "weapons.h"
#include "Debug Control.h"
#include "expat.h"
#include "XML.h"
#endif
UINT16 LAST_SLOT_INDEX = 0;
struct
{
PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
AttachmentSlotStruct curAttachmentSlot;
AttachmentSlotStruct * curArray;
UINT32 maxArraySize;
UINT32 currentDepth;
UINT32 maxReadDepth;
}
typedef attachmentslotParseData;
static void XMLCALL
attachmentslotStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
{
attachmentslotParseData * pData = (attachmentslotParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
{
if(strcmp(name, "ATTACHMENTSLOTLIST") == 0 && pData->curElement == ELEMENT_NONE)
{
pData->curElement = ELEMENT_LIST;
memset(pData->curArray,0,sizeof(AttachmentSlotStruct)*pData->maxArraySize);
pData->maxReadDepth++; //we are not skipping this element
}
else if(strcmp(name, "ATTACHMENTSLOT") == 0 && pData->curElement == ELEMENT_LIST)
{
pData->curElement = ELEMENT;
memset(&pData->curAttachmentSlot,0,sizeof(AttachmentSlotStruct));
pData->maxReadDepth++; //we are not skipping this element
}
else if(pData->curElement == ELEMENT &&
(strcmp(name, "uiSlotIndex") == 0 ||
strcmp(name, "szSlotName") == 0 ||
strcmp(name, "nasAttachmentClass") == 0 ||
strcmp(name, "nasLayoutClass") == 0 ||
strcmp(name, "usDescPanelPosX") == 0 ||
strcmp(name, "usDescPanelPosY") == 0 ||
strcmp(name, "fMultiShot") == 0 ||
strcmp(name, "fBigSlot") == 0 ))
{
pData->curElement = ELEMENT_PROPERTY;
pData->maxReadDepth++; //we are not skipping this element
}
pData->szCharData[0] = '\0';
}
pData->currentDepth++;
}
static void XMLCALL
attachmentslotCharacterDataHandle(void *userData, const XML_Char *str, int len)
{
attachmentslotParseData * pData = (attachmentslotParseData *)userData;
if( (pData->currentDepth <= pData->maxReadDepth) &&
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
){
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
}
}
static void XMLCALL
attachmentslotEndElementHandle(void *userData, const XML_Char *name)
{
attachmentslotParseData * pData = (attachmentslotParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
{
if(strcmp(name, "ATTACHMENTSLOTLIST") == 0)
{
pData->curElement = ELEMENT_NONE;
}
else if(strcmp(name, "ATTACHMENTSLOT") == 0)
{
pData->curElement = ELEMENT_LIST;
if(pData->curAttachmentSlot.uiSlotIndex < pData->maxArraySize)
{
pData->curArray[pData->curAttachmentSlot.uiSlotIndex] = pData->curAttachmentSlot; //write the attachmentinfo into the table
//Save the highest known index up till now.
if(LAST_SLOT_INDEX < pData->curAttachmentSlot.uiSlotIndex){
LAST_SLOT_INDEX = (UINT16) pData->curAttachmentSlot.uiSlotIndex;
}
}
}
else if(strcmp(name, "uiSlotIndex") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.uiSlotIndex = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "szSlotName") == 0)
{
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curAttachmentSlot.szSlotName, sizeof(pData->curAttachmentSlot.szSlotName)/sizeof(pData->curAttachmentSlot.szSlotName[0]) );
pData->curAttachmentSlot.szSlotName[sizeof(pData->curAttachmentSlot.szSlotName)/sizeof(pData->curAttachmentSlot.szSlotName[0]) - 1] = '\0';
}
else if(strcmp(name, "nasAttachmentClass") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.nasAttachmentClass = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "nasLayoutClass") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.nasLayoutClass = (UINT128) atol(pData->szCharData);
}
else if(strcmp(name, "usDescPanelPosX") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.usDescPanelPosX = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "usDescPanelPosY") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.usDescPanelPosY = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "fMultiShot") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.fMultiShot = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "fBigSlot") == 0)
{
pData->curElement = ELEMENT;
pData->curAttachmentSlot.fBigSlot = (BOOLEAN) atol(pData->szCharData);
}
pData->maxReadDepth--;
}
pData->currentDepth--;
}
BOOLEAN ReadInAttachmentSlotsStats(STR fileName)
{
HWFILE hFile;
UINT32 uiBytesRead;
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
attachmentslotParseData pData;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AttachmentSlots.xml" );
// Open attachmentinfo file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
//Read in block
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
{
MemFree(lpcBuffer);
return( FALSE );
}
lpcBuffer[uiFSize] = 0; //add a null terminator
FileClose( hFile );
XML_SetElementHandler(parser, attachmentslotStartElementHandle, attachmentslotEndElementHandle);
XML_SetCharacterDataHandler(parser, attachmentslotCharacterDataHandle);
// This should fix the crash in a Release Version with VS 2008
//memset(&pData,0,sizeof(pData));
pData.curElement = ELEMENT_NONE;
pData.szCharData[0] = 0;
pData.currentDepth = 0;
pData.maxReadDepth = 0;
pData.curArray = AttachmentSlots;
pData.maxArraySize = MAXITEMS;
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
sprintf(errorBuf, "XML Parser Error in AttachmentSlots.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
LiveMessage(errorBuf);
MemFree(lpcBuffer);
return FALSE;
}
MemFree(lpcBuffer);
XML_ParserFree(parser);
return( TRUE );
}
BOOLEAN WriteAttachmentSlotsStats()
{
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writeattachmentslotstats");
HWFILE hFile;
//Debug code; make sure that what we got from the file is the same as what's there
// Open a new file
hFile = FileOpen( "TABLEDATA\\AttachmentSlots out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
UINT32 cnt;
FilePrintf(hFile,"<ATTACHMENTSLOTLIST>\r\n");
for(cnt = 0;cnt < MAXITEMS;cnt++)
{
FilePrintf(hFile,"\t<ATTACHMENTSLOT>\r\n");
FilePrintf(hFile,"\t\t<uiSlotIndex>%d</uiSlotIndex>\r\n", AttachmentSlots[cnt].uiSlotIndex );
FilePrintf(hFile,"\t\t<szSlotName>%d</szSlotName>\r\n", AttachmentSlots[cnt].szSlotName );
FilePrintf(hFile,"\t\t<nasAttachmentClass>%d</nasAttachmentClass>\r\n", AttachmentSlots[cnt].nasAttachmentClass );
FilePrintf(hFile,"\t\t<nasLayoutClass>%d</nasLayoutClass>\r\n", AttachmentSlots[cnt].nasLayoutClass );
FilePrintf(hFile,"\t\t<usDescPanelPosX>%d</usDescPanelPosX>\r\n", AttachmentSlots[cnt].usDescPanelPosX );
FilePrintf(hFile,"\t\t<usDescPanelPosY>%d</usDescPanelPosY>\r\n", AttachmentSlots[cnt].usDescPanelPosY );
FilePrintf(hFile,"\t\t<fMultiShot>%d</fMultiShot>\r\n", AttachmentSlots[cnt].fMultiShot );
FilePrintf(hFile,"\t\t<fBigSlot>%d</fBigSlot>\r\n", AttachmentSlots[cnt].fBigSlot );
FilePrintf(hFile,"\t</ATTACHMENTSLOT>\r\n");
}
FilePrintf(hFile,"</ATTACHMENTSLOTLIST>\r\n");
}
FileClose( hFile );
return( TRUE );
}
| [
"jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1"
] | [
[
[
1,
264
]
]
] |
93c6d98c91cd901fe23101da5ea9311ac1e325d0 | 6dac9369d44799e368d866638433fbd17873dcf7 | /src/branches/26042005/graphics/opengl/OGLStaticVB.h | d8f114ebb9be0d9a9dd6057af2a8b7a55831be09 | [] | no_license | christhomas/fusionengine | 286b33f2c6a7df785398ffbe7eea1c367e512b8d | 95422685027bb19986ba64c612049faa5899690e | refs/heads/master | 2020-04-05T22:52:07.491706 | 2006-10-24T11:21:28 | 2006-10-24T11:21:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,623 | h | #ifndef _OGLSTATICVB_H_
#define _OGLSTATICVB_H_
#include "OGLDynamicVB.h"
/** @ingroup OGL_VertexBuffer_Group
* @brief Derived OGLDynamicVB class for Statically assigned mesh data
*
* NOTE: This class is not implemented.
*/
class OGLStaticVB:public OGLDynamicVB{
protected:
/** @var float *m_texcoord
* @brief The pointer to the meshes texture coordinate data
*/
float *m_texcoord;
/** @var ITexture *m_texture
* @brief The texture which to map onto this mesh data
*/
ITexture *m_texture;
public:
OGLStaticVB ();
virtual ~OGLStaticVB ();
virtual bool Initialise (int nv, int ni, int nc_p, int nc_t);
virtual void ReleaseAll (void);
virtual void SetComponents (int p, int t);
virtual void SetName (char *n);
virtual void SetPosition (float *p);
virtual void SetNormal (float *n);
virtual void SetTexcoord (float *t);
virtual void SetIndex (int *i);
virtual void SetTexture (ITexture *t);
virtual void SetColour (Colour4f *c);
virtual void SetColour (float r, float g, float b, float a);
virtual void SetMaterial (Material *m);
virtual char * GetName (void);
virtual float * GetPosition (void);
virtual float * GetNormal (void);
virtual float * GetTexcoord (int layer=0);
virtual int * GetIndex (void);
virtual ITexture * GetTexture (int layer=0);
virtual Colour4f * GetColour (void);
virtual Material * GetMaterial (void);
virtual int GetNumIndex (void); // Returns the number of indices
virtual void Render (void);
};
#endif // #ifndef _OGLSTATICVB_H_
| [
"chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7"
] | [
[
[
1,
55
]
]
] |
9bcb032b8e5849a3fe2e4fd7376828366f943997 | e037588d8d78cf181001a16176224e437dce3f30 | /src/flatland/UnicodeText.tpp | 5c66b5a1feab4861e914531bc0b98824e5f9b178 | [] | no_license | dichodaemon/flatland | 3b1b34f0b048842c8b49a7806ec765c24a18be2a | c086753af10689e53375d4b32b7ca3bec2f04f19 | refs/heads/master | 2016-09-06T13:05:40.499964 | 2010-03-20T08:02:50 | 2010-03-20T08:02:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,326 | tpp |
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF32ToANSI( IN begin, IN end, OUT output, char replacement, const std::locale & Locale )
{
#ifdef __MINGW32__
// MinGW has a almost no support for UnicodeText stuff
// As a consequence, the MinGW version of this function can only use the default locale
// and ignores the one passed as parameter
while ( begin < end ) {
char char = 0;
if ( wctomb( &Char, static_cast<wchar_t>( *begin++ ) ) >= 0 ) {
*output++ = char;
} else if ( replacement ) {
*output++ = replacement;
}
}
#else
// Get the facet of the locale which deals with character conversion
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >( Locale );
// Use the facet to convert each character of the input string
while ( begin < end ) {
*output++ = Facet.narrow( static_cast<wchar_t>( *begin++ ), replacement );
}
#endif
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::ANSIToUTF32( IN begin, IN end, OUT output, const std::locale & Locale )
{
#ifdef __MINGW32__
// MinGW has a almost no support for UnicodeText stuff
// As a consequence, the MinGW version of this function can only use the default locale
// and ignores the one passed as parameter
while ( begin < end ) {
wchar_t char = 0;
mbtowc( &Char, &*begin, 1 );
begin++;
*output++ = static_cast<uint32_t>( char );
}
#else
// Get the facet of the locale which deals with character conversion
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >( Locale );
// Use the facet to convert each character of the input string
while ( begin < end ) {
*output++ = static_cast<uint32_t>( Facet.widen( *begin++ ) );
}
#endif
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF8ToUTF16( IN begin, IN end, OUT output, uint16_t replacement )
{
while ( begin < end ) {
uint32_t c = 0;
int TrailingBytes = UTF8TrailingBytes[static_cast<int>( *begin )];
if ( begin + TrailingBytes < end ) {
// First decode the UTF-8 character
switch ( TrailingBytes ) {
case 5 :
c += *begin++;
c <<= 6;
case 4 :
c += *begin++;
c <<= 6;
case 3 :
c += *begin++;
c <<= 6;
case 2 :
c += *begin++;
c <<= 6;
case 1 :
c += *begin++;
c <<= 6;
case 0 :
c += *begin++;
}
c -= UTF8Offsets[TrailingBytes];
// Then encode it in UTF-16
if ( c < 0xFFFF ) {
// character can be converted directly to 16 bits, just need to check it's in the valid range
if ( ( c >= 0xD800 ) && ( c <= 0xDFFF ) ) {
// Invalid character (this range is reserved)
if ( replacement ) {
*output++ = replacement;
}
} else {
// Valid character directly convertible to 16 bits
*output++ = static_cast<uint16_t>( c );
}
} else if ( c > 0x0010FFFF ) {
// Invalid character (greater than the maximum UnicodeText value)
if ( replacement ) {
*output++ = replacement;
}
} else {
// character will be converted to 2 UTF-16 elements
c -= 0x0010000;
*output++ = static_cast<uint16_t>( ( c >> 10 ) + 0xD800 );
*output++ = static_cast<uint16_t>( ( c & 0x3FFUL ) + 0xDC00 );
}
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF8ToUTF32( IN begin, IN end, OUT output, uint32_t replacement )
{
while ( begin < end ) {
uint32_t c = 0;
int TrailingBytes = UTF8TrailingBytes[static_cast<int>( *begin )];
if ( begin + TrailingBytes < end ) {
// First decode the UTF-8 character
switch ( TrailingBytes ) {
case 5 :
c += *begin++;
c <<= 6;
case 4 :
c += *begin++;
c <<= 6;
case 3 :
c += *begin++;
c <<= 6;
case 2 :
c += *begin++;
c <<= 6;
case 1 :
c += *begin++;
c <<= 6;
case 0 :
c += *begin++;
}
c -= UTF8Offsets[TrailingBytes];
// Then write it if valid
if ( ( c < 0xD800 ) || ( c > 0xDFFF ) ) {
// Valid UTF-32 character
*output++ = c;
} else {
// Invalid UTF-32 character
if ( replacement ) {
*output++ = replacement;
}
}
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF16ToUTF8( IN begin, IN end, OUT output, uint8_t replacement )
{
while ( begin < end ) {
uint32_t c = *begin++;
// If it's a surrogate pair, first convert to a single UTF-32 character
if ( ( c >= 0xD800 ) && ( c <= 0xDBFF ) ) {
if ( begin < end ) {
// The second element is valid : convert the two elements to a UTF-32 character
uint32_t d = *begin++;
if ( ( d >= 0xDC00 ) && ( d <= 0xDFFF ) ) {
c = static_cast<uint32_t>( ( ( c - 0xD800 ) << 10 ) + ( d - 0xDC00 ) + 0x0010000 );
}
} else {
// Invalid second element
if ( replacement ) {
*output++ = replacement;
}
}
}
// Then convert to UTF-8
if ( c > 0x0010FFFF ) {
// Invalid character (greater than the maximum UnicodeText value)
if ( replacement ) {
*output++ = replacement;
}
} else {
// Valid character
// Get number of bytes to write
int bytesToWrite = 1;
if ( c < 0x80 ) {
bytesToWrite = 1;
} else if ( c < 0x800 ) {
bytesToWrite = 2;
} else if ( c < 0x10000 ) {
bytesToWrite = 3;
} else if ( c <= 0x0010FFFF ) {
bytesToWrite = 4;
}
// Extract bytes to write
uint8_t bytes[4];
switch ( bytesToWrite ) {
case 4 :
bytes[3] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 3 :
bytes[2] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 2 :
bytes[1] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 1 :
bytes[0] = static_cast<uint8_t> ( c | UTF8FirstBytes[bytesToWrite] );
}
// Add them to the output
const uint8_t * currentByte = bytes;
switch ( bytesToWrite ) {
case 4 :
*output++ = *currentByte++;
case 3 :
*output++ = *currentByte++;
case 2 :
*output++ = *currentByte++;
case 1 :
*output++ = *currentByte++;
}
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF16ToUTF32( IN begin, IN end, OUT output, uint32_t replacement )
{
while ( begin < end ) {
uint16_t c = *begin++;
if ( ( c >= 0xD800 ) && ( c <= 0xDBFF ) ) {
// We have a surrogate pair, ie. a character composed of two elements
if ( begin < end ) {
uint16_t d = *begin++;
if ( ( d >= 0xDC00 ) && ( d <= 0xDFFF ) ) {
// The second element is valid : convert the two elements to a UTF-32 character
*output++ = static_cast<uint32_t>( ( ( c - 0xD800 ) << 10 ) + ( d - 0xDC00 ) + 0x0010000 );
} else {
// Invalid second element
if ( replacement ) {
*output++ = replacement;
}
}
}
} else if ( ( c >= 0xDC00 ) && ( c <= 0xDFFF ) ) {
// Invalid character
if ( replacement ) {
*output++ = replacement;
}
} else {
// Valid character directly convertible to UTF-32
*output++ = static_cast<uint32_t>( c );
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF32ToUTF8( IN begin, IN end, OUT output, uint8_t replacement )
{
while ( begin < end ) {
uint32_t c = *begin++;
if ( c > 0x0010FFFF ) {
// Invalid character (greater than the maximum UnicodeText value)
if ( replacement ) {
*output++ = replacement;
}
} else {
// Valid character
// Get number of bytes to write
int bytesToWrite = 1;
if ( c < 0x80 ) {
bytesToWrite = 1;
} else if ( c < 0x800 ) {
bytesToWrite = 2;
} else if ( c < 0x10000 ) {
bytesToWrite = 3;
} else if ( c <= 0x0010FFFF ) {
bytesToWrite = 4;
}
// Extract bytes to write
uint8_t bytes[4];
switch ( bytesToWrite ) {
case 4 :
bytes[3] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 3 :
bytes[2] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 2 :
bytes[1] = static_cast<uint8_t>( ( c | 0x80 ) & 0xBF );
c >>= 6;
case 1 :
bytes[0] = static_cast<uint8_t> ( c | UTF8FirstBytes[bytesToWrite] );
}
// Add them to the output
const uint8_t * currentByte = bytes;
switch ( bytesToWrite ) {
case 4 :
*output++ = *currentByte++;
case 3 :
*output++ = *currentByte++;
case 2 :
*output++ = *currentByte++;
case 1 :
*output++ = *currentByte++;
}
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN, typename OUT >
inline OUT UnicodeText::UTF32ToUTF16( IN begin, IN end, OUT output, uint16_t replacement )
{
while ( begin < end ) {
uint32_t c = *begin++;
if ( c < 0xFFFF ) {
// character can be converted directly to 16 bits, just need to check it's in the valid range
if ( ( c >= 0xD800 ) && ( c <= 0xDFFF ) ) {
// Invalid character (this range is reserved)
if ( replacement ) {
*output++ = replacement;
}
} else {
// Valid character directly convertible to 16 bits
*output++ = static_cast<uint16_t>( c );
}
} else if ( c > 0x0010FFFF ) {
// Invalid character (greater than the maximum UnicodeText value)
if ( replacement ) {
*output++ = replacement;
}
} else {
// character will be converted to 2 UTF-16 elements
c -= 0x0010000;
*output++ = static_cast<uint16_t>( ( c >> 10 ) + 0xD800 );
*output++ = static_cast<uint16_t>( ( c & 0x3FFUL ) + 0xDC00 );
}
}
return output;
}
//------------------------------------------------------------------------------
template < typename IN >
inline std::size_t UnicodeText::GetUTF8Length( IN begin, IN end )
{
std::size_t length = 0;
while ( begin < end ) {
int byteCount = UTF8TrailingBytes[static_cast<int>( *begin )];
if ( begin + byteCount < end ) {
++length;
}
begin += byteCount + 1;
}
return length;
}
template < typename IN >
inline std::size_t UnicodeText::GetUTF16Length( IN begin, IN end )
{
std::size_t length = 0;
while ( begin < end ) {
if ( ( *begin >= 0xD800 ) && ( *begin <= 0xDBFF ) ) {
++begin;
if ( ( begin < end ) && ( ( *begin >= 0xDC00 ) && ( *begin <= 0xDFFF ) ) ) {
++length;
}
} else {
++length;
}
++begin;
}
return length;
}
template < typename IN >
inline std::size_t UnicodeText::GetUTF32Length( IN begin, IN end )
{
return end - begin;
}
| [
"[email protected]"
] | [
[
[
1,
448
]
]
] |
8cf411e6ae6ab5e2d27a27c98d7d00c634dc7870 | 6027fd920827293ab00346989eef9a3d0e4690ad | /src/epsilon/event/win32/event.cpp | a7482fcab4b6089ea01a748c45cbb470e4a79c12 | [] | no_license | andyfriesen/epsilon | 6f67ec0ee5e832c19580da0376730a2022c9c237 | 073011e1c549ae3d1f591365abe2357612ce1f0b | refs/heads/master | 2016-09-06T07:30:15.809710 | 2009-11-10T02:45:30 | 2009-11-10T02:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 955 | cpp |
#include "epsilon.h"
#include "epsilon/wm/win32/internal.h"
EPS_EXPORT(eps_bool) eps_event_peekEvent(eps_Window* window, eps_Event* event) {
eps_wm_pollMessages(window, false);
if (window->events.empty()) {
return false;
} else {
*event = window->events.back();
return true;
}
}
EPS_EXPORT(eps_bool) eps_event_getEvent(eps_Window* window, eps_Event* event) {
eps_wm_pollMessages(window, false);
if (eps_event_peekEvent(window, event)) {
window->events.pop_back();
return true;
} else {
return false;
}
}
EPS_EXPORT(eps_bool) eps_event_waitEvent(eps_Window* window, eps_Event* event) {
while (window->events.empty()) {
eps_wm_pollMessages(window, true);
}
return eps_event_getEvent(window, event);
}
EPS_EXPORT(void) eps_event_sendEvent(eps_Window* window, eps_Event* event) {
window->events.push_back(*event);
}
| [
"andy@malaria.(none)"
] | [
[
[
1,
34
]
]
] |
26b0d1f7f540c1c78e2f42b816b9b66c6a1a4332 | abafdd61ea123f3e90deb02fe5709951b453eec6 | /fuzzy/patl/impl/core_prefix.hpp | 923b329d97df170d048bcecf5f861e4f925b2121 | [
"BSD-3-Clause"
] | permissive | geoiq/geojoin-ruby | 8a6a07938fe3d629de74aac50e61eb8af15ab027 | 247a80538c4fc68c365e71f9014b66d3c38526c1 | refs/heads/master | 2016-09-06T15:22:47.436634 | 2010-08-11T13:00:24 | 2010-08-11T13:00:24 | 13,863,658 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,471 | hpp | #ifndef PATL_IMPL_CORE_PREFIX_GENERIC_HPP
#define PATL_IMPL_CORE_PREFIX_GENERIC_HPP
#include "prefix.hpp"
namespace uxn
{
namespace patl
{
namespace impl
{
template <typename Container, typename Node>
class core_prefix_generic
: public prefix_generic<core_prefix_generic<Container, Node>, Container, Node>
{
typedef prefix_generic<core_prefix_generic<Container, Node>, Container, Node> super;
protected:
typedef typename super::node_type node_type;
public:
typedef typename super::cont_type cont_type;
core_prefix_generic(const cont_type *cont, const node_type *q)
: super(cont, q)
{
}
const node_type *get_parent(const node_type *nod) const
{
return nod->get_parent();
}
node_type *get_parent(node_type *nod) const
{
return nod->get_parent();
}
const node_type *get_xlink(const node_type *nod, word_t id) const
{
return nod->get_xlink(id);
}
node_type *get_xlink(node_type *nod, word_t id) const
{
return nod->get_xlink(id);
}
void set_parentid(node_type *nod, node_type *parent, word_t id) const
{
return nod->set_parentid(parent, id);
}
void set_xlinktag(node_type *nod, word_t id, const node_type *link, word_t tag) const
{
return nod->set_xlinktag(id, link, tag);
}
};
} // namespace impl
} // namespace patl
} // namespace uxn
#endif
| [
"sderle@goldman.(none)"
] | [
[
[
1,
63
]
]
] |
c69f9793e6d37fc3a5f5ed02d17da3c14e8c6868 | 85d9531c984cd9ffc0c9fe8058eb1210855a2d01 | /QxOrm/include/QxFunction/QxFunction_3.h | d95726c7e02e4e349aa5a379403b04f709e8a6ce | [] | no_license | padenot/PlanningMaker | ac6ece1f60345f857eaee359a11ee6230bf62226 | d8aaca0d8cdfb97266091a3ac78f104f8d13374b | refs/heads/master | 2020-06-04T12:23:15.762584 | 2011-02-23T21:36:57 | 2011-02-23T21:36:57 | 1,125,341 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,839 | h | /****************************************************************************
**
** http://www.qxorm.com/
** http://sourceforge.net/projects/qxorm/
** Original file by Lionel Marty
**
** This file is part of the QxOrm library
**
** 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.
**
** GNU Lesser General Public License Usage
** This file must be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file 'license.lgpl.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you have questions regarding the use of this file, please contact :
** [email protected]
**
****************************************************************************/
#ifndef _QX_FUNCTION_3_H_
#define _QX_FUNCTION_3_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <QxFunction/IxFunction.h>
#include <QxFunction/QxParameters.h>
namespace qx {
template <class Owner, typename R, typename P1, typename P2, typename P3>
class QxFunction_3 : public IxFunction
{
public:
typedef boost::function<R (Owner *, P1, P2, P3)> type_fct;
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
QX_FUNCTION_CLASS_MEMBER_FCT(QxFunction_3);
virtual qx_bool isValidParams(const QString & params) const { Q_UNUSED(params); return true; }
virtual qx_bool isValidParams(const type_any_params & params) const { Q_UNUSED(params); return true; }
private:
template <class T, bool bReturnValue /* = false */>
struct QxInvokerFct
{
static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_3 * pThis)
{
QX_FUNCTION_INVOKE_START_WITH_OWNER();
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
try { pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3); }
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
}
};
template <class T>
struct QxInvokerFct<T, true>
{
static inline qx_bool invoke(void * pOwner, const T & params, boost::any * ret, const QxFunction_3 * pThis)
{
QX_FUNCTION_INVOKE_START_WITH_OWNER();
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
try { R retTmp = pThis->m_fct(static_cast<Owner *>(pOwner), p1, p2, p3); if (ret) { (* ret) = boost::any(retTmp); } }
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
}
};
};
template <typename R, typename P1, typename P2, typename P3>
class QxFunction_3<void, R, P1, P2, P3> : public IxFunction
{
public:
typedef boost::function<R (P1, P2, P3)> type_fct;
typedef typename qx::trait::remove_attr<P1, false>::type type_P1;
typedef typename qx::trait::remove_attr<P2, false>::type type_P2;
typedef typename qx::trait::remove_attr<P3, false>::type type_P3;
QX_FUNCTION_CLASS_FCT(QxFunction_3);
virtual qx_bool isValidParams(const QString & params) const { Q_UNUSED(params); return true; }
virtual qx_bool isValidParams(const type_any_params & params) const { Q_UNUSED(params); return true; }
private:
template <class T, bool bReturnValue /* = false */>
struct QxInvokerFct
{
static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_3 * pThis)
{
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
try { pThis->m_fct(p1, p2, p3); }
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
}
};
template <class T>
struct QxInvokerFct<T, true>
{
static inline qx_bool invoke(const T & params, boost::any * ret, const QxFunction_3 * pThis)
{
QX_FUNCTION_INVOKE_START_WITHOUT_OWNER();
QX_FUNCTION_FETCH_PARAM(type_P1, p1, get_param_1);
QX_FUNCTION_FETCH_PARAM(type_P2, p2, get_param_2);
QX_FUNCTION_FETCH_PARAM(type_P3, p3, get_param_3);
try { R retTmp = pThis->m_fct(p1, p2, p3); if (ret) { (* ret) = boost::any(retTmp); } }
QX_FUNCTION_CATCH_AND_RETURN_INVOKE();
}
};
};
namespace function {
template <class Owner, typename R, typename P1, typename P2, typename P3>
IxFunction_ptr bind_fct_3(const typename QxFunction_3<Owner, R, P1, P2, P3>::type_fct & fct)
{
typedef boost::is_same<Owner, void> qx_verify_owner_tmp;
BOOST_STATIC_ASSERT(qx_verify_owner_tmp::value);
IxFunction_ptr ptr; ptr.reset(new QxFunction_3<void, R, P1, P2, P3>(fct));
return ptr;
}
template <class Owner, typename R, typename P1, typename P2, typename P3>
IxFunction_ptr bind_member_fct_3(const typename QxFunction_3<Owner, R, P1, P2, P3>::type_fct & fct)
{
typedef boost::is_same<Owner, void> qx_verify_owner_tmp;
BOOST_STATIC_ASSERT(! qx_verify_owner_tmp::value);
IxFunction_ptr ptr; ptr.reset(new QxFunction_3<Owner, R, P1, P2, P3>(fct));
return ptr;
}
} // namespace function
} // namespace qx
#endif // _QX_FUNCTION_3_H_
| [
"[email protected]"
] | [
[
[
1,
155
]
]
] |
2441c45ef7bdd2bd2ffe8519f09fa2357831dba2 | 9152cb31fbe4e82c22092bb3071b2ec8c6ae86ab | /demos/rtc/RTCSAMPLE/rtcsample.cpp | 61717b791c6f930823f4fac10fe42471149e08e2 | [] | no_license | zzjs2001702/sfsipua-svn | ca3051b53549066494f6264e8f3bf300b8090d17 | e8768338340254aa287bf37cf620e2c68e4ff844 | refs/heads/master | 2022-01-09T20:02:20.777586 | 2006-03-29T13:24:02 | 2006-03-29T13:24:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,639 | cpp | // rtcsample.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
/////////////////////////////////////////////
//
// WinMain
//
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HRESULT hr;
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(hPrevInstance);
DEBUG_PRINT(("STARTED"));
// Initialize COM
hr = CoInitialize(NULL);
if (FAILED(hr))
{
// CoInitialize failed
DEBUG_PRINT(("CoInitialize failed %x", hr));
return 0;
}
// Initialize windows common controls
InitCommonControls();
// Load the rich edit library
HMODULE hRichEdit = NULL;
hRichEdit = LoadLibrary(L"riched20.dll");
if (hRichEdit == NULL)
{
// LoadLibrary failed
DEBUG_PRINT(("LoadLibrary failed %x",
HRESULT_FROM_WIN32(GetLastError()) ));
return 0;
}
// Register the window classes
CRTCWin::RegisterClass();
CRTCIMSession::RegisterClass();
CRTCAVSession::RegisterClass();
CRTCSearch::RegisterClass();
CRTCWatcher::RegisterClass();
CRTCGroup::RegisterClass();
// Create the main window
HWND hWnd;
hWnd = CreateWindowExW(
0,
APP_CLASS,
APP_TITLE,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
CW_USEDEFAULT, CW_USEDEFAULT,
APP_WIDTH, APP_HEIGHT,
NULL,
NULL,
hInstance,
NULL);
if ( !hWnd )
{
// CreateWindowExW failed
DEBUG_PRINT(("CreateWindowExW failed %x",
HRESULT_FROM_WIN32(GetLastError()) ));
return 0;
}
// Make the main window visible
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
// Message loop
BOOL bRet;
MSG msg;
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
// GetMessage failed
DEBUG_PRINT(("GetMessage failed %x",
HRESULT_FROM_WIN32(GetLastError()) ));
return 0;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// Free the rich edit library
FreeLibrary(hRichEdit);
// Shutdown COM
CoUninitialize();
DEBUG_PRINT(("STOPPED"));
return (int) msg.wParam;
}
| [
"yippeesoft@5dda88da-d10c-0410-ac74-cc18da35fedd"
] | [
[
[
1,
112
]
]
] |
a1919857e5e45813e9f8261cc8c2a1a064af2f8a | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/com/xml4com.cpp | 12c64d56a69d49cd391b7da4201c79c1882c904a | [] | no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,571 | cpp | /*
* Copyright 1999-2001,2004 The Apache Software Foundation.
*
* 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.
*/
/*
* $Id: xml4com.cpp 191054 2005-06-17 02:56:35Z jberry $
*/
// xml4com.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To merge the proxy/stub code into the object DLL, add the file
// dlldatax.c to the project. Make sure precompiled headers
// are turned off for this file, and add _MERGE_PROXYSTUB to the
// defines for the project.
//
// If you are not running WinNT4.0 or Win95 with DCOM, then you
// need to remove the following define from dlldatax.c
// #define _WIN32_WINNT 0x0400
//
// Further, if you are running MIDL without /Oicf switch, you also
// need to remove the following define from dlldatax.c.
// #define USE_STUBLESS_PROXY
//
// Modify the custom build rule for xml4com.idl by adding the following
// files to the Outputs.
// xml4com_p.c
// dlldata.c
// To build a separate proxy/stub DLL,
// run nmake -f xml4comps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include <xercesc/util/PlatformUtils.hpp>
#include "xml4com.h"
#include <xercesc/dom/DOMException.hpp>
//
//
// These were extracted from an identifier definition file
// generated by compiling MSXML.IDL using the MIDL compiler
// (and removing CLSID_DOMDocument, CLSID_XMLHttpRequest, et al)
//
const IID IID_IXMLDOMImplementation = {0x2933BF8F,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMNode = {0x2933BF80,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMDocumentFragment = {0x3efaa413,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
const IID IID_IXMLDOMDocument = {0x2933BF81,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMNodeList = {0x2933BF82,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMNamedNodeMap = {0x2933BF83,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMCharacterData = {0x2933BF84,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMAttribute = {0x2933BF85,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMElement = {0x2933BF86,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMText = {0x2933BF87,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMComment = {0x2933BF88,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMProcessingInstruction = {0x2933BF89,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMCDATASection = {0x2933BF8A,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMDocumentType = {0x2933BF8B,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMNotation = {0x2933BF8C,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMEntity = {0x2933BF8D,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMEntityReference = {0x2933BF8E,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
const IID IID_IXMLDOMParseError = {0x3efaa426,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
const IID IID_IXTLRuntime = {0x3efaa425,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
const IID DIID_XMLDOMDocumentEvents = {0x3efaa427,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
const IID IID_IXMLHttpRequest = {0xED8C108D,0x4349,0x11D2,{0x91,0xA4,0x00,0xC0,0x4F,0x79,0x69,0xE8}};
const IID IID_IXMLDSOControl = {0x310afa62,0x0575,0x11d2,{0x9c,0xa9,0x00,0x60,0xb0,0xec,0x3d,0x39}};
const IID IID_IXMLElementCollection = {0x65725580,0x9B5D,0x11d0,{0x9B,0xFE,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
const IID IID_IXMLDocument = {0xF52E2B61,0x18A1,0x11d1,{0xB1,0x05,0x00,0x80,0x5F,0x49,0x91,0x6B}};
const IID IID_IXMLDocument2 = {0x2B8DE2FE,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}};
const IID IID_IXMLElement = {0x3F7F31AC,0xE15F,0x11d0,{0x9C,0x25,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
const IID IID_IXMLElement2 = {0x2B8DE2FF,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}};
const IID IID_IXMLAttribute = {0xD4D4A0FC,0x3B73,0x11d1,{0xB2,0xB4,0x00,0xC0,0x4F,0xB9,0x25,0x96}};
const IID IID_IXMLError = {0x948C5AD3,0xC58D,0x11d0,{0x9C,0x0B,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
//
// This file is generated from the type library compilation
// of xml4com.idl
//
#include "xml4com_i.c"
#include "XMLDOMDocument.h"
#include "XMLHTTPRequest.h"
#ifdef _MERGE_PROXYSTUB
extern "C" HINSTANCE hProxyDll;
#endif
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_DOMDocument, CXMLDOMDocument)
OBJECT_ENTRY(CLSID_XMLHTTPRequest, CXMLHttpRequest)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
lpReserved;
#ifdef _MERGE_PROXYSTUB
if (!PrxDllMain(hInstance, dwReason, lpReserved))
return FALSE;
#endif
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_Xerces);
DisableThreadLibraryCalls(hInstance);
XMLPlatformUtils::Initialize();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
XMLPlatformUtils::Terminate();
_Module.Term();
}
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
#ifdef _MERGE_PROXYSTUB
if (PrxDllCanUnloadNow() != S_OK)
return S_FALSE;
#endif
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
#ifdef _MERGE_PROXYSTUB
if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
return S_OK;
#endif
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
#ifdef _MERGE_PROXYSTUB
HRESULT hRes = PrxDllRegisterServer();
if (FAILED(hRes))
return hRes;
#endif
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
#ifdef _MERGE_PROXYSTUB
PrxDllUnregisterServer();
#endif
return _Module.UnregisterServer(TRUE);
}
static LPOLESTR Msgs[] =
{
OLESTR("UNDEFINED DOM ERROR"),
OLESTR("INDEX_SIZE_ERR"), // INDEX_SIZE_ERR = 1
OLESTR("DOMSTRING_SIZE_ERR"), // DOMSTRING_SIZE_ERR = 2
OLESTR("HIERARCHY_REQUEST_ERR"), // HIERARCHY_REQUEST_ERR = 3
OLESTR("WRONG_DOCUMENT_ERR"), // WRONG_DOCUMENT_ERR = 4
OLESTR("INVALID_CHARACTER_ERR"), // INVALID_CHARACTER_ERR = 5
OLESTR("NO_DATA_ALLOWED_ERR"), // NO_DATA_ALLOWED_ERR = 6
OLESTR("NO_MODIFICATION_ALLOWED_ERR"), // NO_MODIFICATION_ALLOWED_ERR = 7
OLESTR("NOT_FOUND_ERR"), // NOT_FOUND_ERR = 8
OLESTR("NOT_SUPPORTED_ERR"), // NOT_SUPPORTED_ERR = 9
OLESTR("INUSE_ATTRIBUTE_ERR"), // INUSE_ATTRIBUTE_ERR = 10
OLESTR("INVALID_STATE_ERR"), // INVALID_STATE_ERR = 11
OLESTR("SYNTAX_ERR "), // SYNTAX_ERR = 12
OLESTR("INVALID_MODIFICATION_ERR"), // INVALID_MODIFICATION_ERR = 13
OLESTR("NAMESPACE_ERR"), // NAMESPACE_ERR = 14
OLESTR("INVALID_ACCESS_ERR") // INVALID_ACCESS_ERR = 15
OLESTR("VALIDATION_ERR") // VALIDATION_ERR = 16
};
//
//
// makes an HRESULT with a code based on the DOM error code
//
HRESULT MakeHRESULT(DOMException& ex)
{
ICreateErrorInfo* pCErr = NULL;
HRESULT sc = CreateErrorInfo(&pCErr);
if(SUCCEEDED(sc)) {
const XMLCh* msg = ex.msg;
if(msg == NULL)
{
if(ex.code >= DOMException::INDEX_SIZE_ERR &&
ex.code <= DOMException::VALIDATION_ERR)
{
sc = pCErr->SetDescription(Msgs[ex.code]);
}
else
{
sc = pCErr->SetDescription(Msgs[0]);
}
}
else
{
sc = pCErr->SetDescription(SysAllocString(ex.msg));
}
IErrorInfo* pErr = NULL;
sc = pCErr->QueryInterface(IID_IErrorInfo,(void**) &pErr);
if(SUCCEEDED(sc))
{
sc = SetErrorInfo(0,pErr);
pErr->Release();
}
pCErr->Release();
}
return 0x80040600 + ex.code;
}
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] | [
[
[
1,
301
]
]
] |
4433758a5ede57761a4259c38d527ea5052b5f08 | a0bc9908be9d42d58af7a1a8f8398c2f7dcfa561 | /SlonEngine/extensions/PythonBindings/graphics/src/PyGraphicsManager.cpp | 13c4a3ac7ee2aa71ba967a2be4ab38a655e0e096 | [] | no_license | BackupTheBerlios/slon | e0ca1137a84e8415798b5323bc7fd8f71fe1a9c6 | dc10b00c8499b5b3966492e3d2260fa658fee2f3 | refs/heads/master | 2016-08-05T09:45:23.467442 | 2011-10-28T16:19:31 | 2011-10-28T16:19:31 | 39,895,039 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | cpp | #include "stdafx.h"
#include "Engine.h"
#include "PyGraphicsManager.h"
#include "Graphics/GraphicsManager.h"
#include <boost/python.hpp>
using namespace boost::python;
using namespace slon::graphics;
// wrappers
void setVideoMode( unsigned width,
unsigned height,
unsigned bpp,
bool fullscreen = false,
bool vSync = false,
int multisample = 0 )
{
currentGraphicsManager().setVideoMode(width, height, bpp, fullscreen, vSync, multisample);
currentGraphicsManager().initRenderer( FFPRendererDesc() );
}
void closeWindow()
{
slon::Engine::Free();
}
void exportGraphicsManager()
{
def("setVideoMode", setVideoMode);
def("closeWindow", closeWindow);
} | [
"devnull@localhost"
] | [
[
[
1,
31
]
]
] |
956d12ee7565e127bf8fb1b150b5751857c0b132 | d1ce8db98d580f0f17f868ed408edf6d92f9208f | /QT/QtOgre/source/SettingsDialog.cpp | 080df5874280fab97f32bdc8c7c61121d0baa48a | [] | no_license | babochingu/andrew-phd | eed82e7bbd3e2b5b5403c1493e3d36b112b1b007 | ba94c3961d9dfef041c974e7ed2d9da4eb7d4dd3 | refs/heads/master | 2016-09-06T07:18:39.627522 | 2010-10-04T23:54:06 | 2010-10-04T23:54:06 | 33,762,959 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 962 | cpp | #include "SettingsDialog.h"
namespace QtOgre
{
SettingsDialog::SettingsDialog(QSettings* settings, QWidget *parent)
:QDialog(parent)
,mSettings(settings)
{
setupUi(this);
}
void SettingsDialog::addSettingsWidget(const QString& title, AbstractSettingsWidget* settingsWidget)
{
settingsWidget->setSettings(mSettings);
settingsWidget->readFromSettings();
mTabWidget->addTab(settingsWidget, title);
//NOTE: We need to make sure the settings are copied from the dialogs widgets into the settings
//object before the main application tries to retrieve them. The main app does this on the
//accepted() signal, but because signal order is not guarenteed we cannot use this for copying the
//settings as well. Looking st the Qt source shows that the finished signal is emitted first,
//though the documentation doesn't state this.
connect(this, SIGNAL(finished(int)), settingsWidget, SLOT(dialogFinished(int)));
}
} | [
"evertech.andrew@2dccfce6-0550-11df-956f-01f849d29158"
] | [
[
[
1,
25
]
]
] |
47d4dfb2aec3c10d7e92e1dd801e3f0d8606a6ba | ff5c060273aeafed9f0e5aa7018f371b8b11cdfd | /Codigo/C/PEditor.cpp | 012b7a2b81e9a9df029e95d0647879e68c28a6c0 | [] | no_license | BackupTheBerlios/genaro | bb14efcdb54394e12e56159313151930d8f26d6b | 03e618a4f259cfb991929ee48004b601486d610f | refs/heads/master | 2020-04-20T19:37:21.138816 | 2008-03-25T16:15:16 | 2008-03-25T16:15:16 | 40,075,683 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 759 | cpp | //---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("PEditor.res");
USEFORM("Editor.cpp", Form1);
USEUNIT("TiposAbstractos.cpp");
USE("PEditor.todo", ToDo);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
| [
"gatchan"
] | [
[
[
1,
24
]
]
] |
82f8ccd17c48977c3d9ddea0d72a1bc41564af0e | 1e976ee65d326c2d9ed11c3235a9f4e2693557cf | /CtrlColorsMediaSliderAdapter.h | 31815f48e2bb54be64469c9d266009e7303434d2 | [] | 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 | 1,395 | 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 "ICtrlColors.h"
class CMediaSlider;
class CtrlColorsMediaSliderAdapter:public ICtrlColors
{
public:
CtrlColorsMediaSliderAdapter();
virtual ~CtrlColorsMediaSliderAdapter() {}
void ConfigAdapter(CMediaSlider* pMediaSlider);
virtual void SetColor(UINT idx, COLORREF value);
virtual COLORREF GetColor(UINT idx);
virtual LPCTSTR GetColorName(UINT idx);
private:
CMediaSlider* m_pMediaSlider;
};
| [
"outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678"
] | [
[
[
1,
43
]
]
] |
eb481c4bc3c811826fe377121a4763d6f3c1bc8f | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/internal/VecAttributesImpl.cpp | 421153a8851b0024e40bf368a251d425551fae51 | [] | no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,083 | cpp | /*
* Copyright 1999-2001,2004 The Apache Software Foundation.
*
* 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.
*/
/*
* $Id: VecAttributesImpl.cpp 191054 2005-06-17 02:56:35Z jberry $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/util/Janitor.hpp>
#include <xercesc/internal/VecAttributesImpl.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
VecAttributesImpl::VecAttributesImpl() :
fAdopt(false)
, fCount(0)
, fVector(0)
, fScanner(0)
{
}
VecAttributesImpl::~VecAttributesImpl()
{
//
// Note that some compilers can't deal with the fact that the pointer
// is to a const object, so we have to cast off the const'ness here!
//
if (fAdopt)
delete (RefVectorOf<XMLAttr>*)fVector;
}
// ---------------------------------------------------------------------------
// Implementation of the attribute list interface
// ---------------------------------------------------------------------------
unsigned int VecAttributesImpl::getLength() const
{
return fCount;
}
const XMLCh* VecAttributesImpl::getURI(const unsigned int index) const
{
// since this func really needs to be const, like the rest, not sure how we
// make it const and re-use the fURIBuffer member variable. we're currently
// creating a buffer each time you need a URI. there has to be a better
// way to do this...
//XMLBuffer tempBuf;
if (index >= fCount) {
return 0;
}
//fValidator->getURIText(fVector->elementAt(index)->getURIId(), tempBuf) ;
//return tempBuf.getRawBuffer() ;
return fScanner->getURIText(fVector->elementAt(index)->getURIId());
}
const XMLCh* VecAttributesImpl::getLocalName(const unsigned int index) const
{
if (index >= fCount) {
return 0;
}
return fVector->elementAt(index)->getName();
}
const XMLCh* VecAttributesImpl::getQName(const unsigned int index) const
{
if (index >= fCount) {
return 0;
}
return fVector->elementAt(index)->getQName();
}
const XMLCh* VecAttributesImpl::getType(const unsigned int index) const
{
if (index >= fCount) {
return 0;
}
return XMLAttDef::getAttTypeString(fVector->elementAt(index)->getType(), fVector->getMemoryManager());
}
const XMLCh* VecAttributesImpl::getValue(const unsigned int index) const
{
if (index >= fCount) {
return 0;
}
return fVector->elementAt(index)->getValue();
}
int VecAttributesImpl::getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const
{
//
// Search the vector for the attribute with the given name and return
// its type.
//
XMLBuffer uriBuffer(1023, fVector->getMemoryManager()) ;
for (unsigned int index = 0; index < fCount; index++)
{
const XMLAttr* curElem = fVector->elementAt(index);
fScanner->getURIText(curElem->getURIId(), uriBuffer) ;
if ( (XMLString::equals(curElem->getName(), localPart)) &&
(XMLString::equals(uriBuffer.getRawBuffer(), uri)) )
return index ;
}
return -1;
}
int VecAttributesImpl::getIndex(const XMLCh* const qName ) const
{
//
// Search the vector for the attribute with the given name and return
// its type.
//
for (unsigned int index = 0; index < fCount; index++)
{
const XMLAttr* curElem = fVector->elementAt(index);
if (XMLString::equals(curElem->getQName(), qName))
return index ;
}
return -1;
}
const XMLCh* VecAttributesImpl::getType(const XMLCh* const uri, const XMLCh* const localPart ) const
{
int retVal = getIndex(uri, localPart);
return ((retVal < 0) ? 0 : getType(retVal));
}
const XMLCh* VecAttributesImpl::getType(const XMLCh* const qName) const
{
int retVal = getIndex(qName);
return ((retVal < 0) ? 0 : getType(retVal));
}
const XMLCh* VecAttributesImpl::getValue(const XMLCh* const uri, const XMLCh* const localPart ) const
{
int retVal = getIndex(uri, localPart);
return ((retVal < 0) ? 0 : getValue(retVal));
}
const XMLCh* VecAttributesImpl::getValue(const XMLCh* const qName) const
{
int retVal = getIndex(qName);
return ((retVal < 0) ? 0 : getValue(retVal));
}
// ---------------------------------------------------------------------------
// Setter methods
// ---------------------------------------------------------------------------
void VecAttributesImpl::setVector(const RefVectorOf<XMLAttr>* const srcVec
, const unsigned int count
, const XMLScanner * const scanner
, const bool adopt)
{
//
// Delete the previous vector (if any) if we are adopting. Note that some
// compilers can't deal with the fact that the pointer is to a const
// object, so we have to cast off the const'ness here!
//
if (fAdopt)
delete (RefVectorOf<XMLAttr>*)fVector;
fAdopt = adopt;
fCount = count;
fVector = srcVec;
fScanner = scanner ;
}
XERCES_CPP_NAMESPACE_END
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] | [
[
[
1,
193
]
]
] |
25df94e09656932eca03163ee79d80521ea92b35 | 4d5ee0b6f7be0c3841c050ed1dda88ec128ae7b4 | /src/nvmesh/subdiv/LimitSurface.h | 18bcd0fd500239245cb36ac954d399a16f5416ca | [] | no_license | saggita/nvidia-mesh-tools | 9df27d41b65b9742a9d45dc67af5f6835709f0c2 | a9b7fdd808e6719be88520e14bc60d58ea57e0bd | refs/heads/master | 2020-12-24T21:37:11.053752 | 2010-09-03T01:39:02 | 2010-09-03T01:39:02 | 56,893,300 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,226 | h | // Copyright NVIDIA Corporation 2008 -- Ignacio Castano <[email protected]>
#ifndef NV_MESH_LIMITSURFACE_H
#define NV_MESH_LIMITSURFACE_H
#include <nvmath/Vector.h>
#include <nvmesh/halfedge/HalfEdgeMesh.h>
//#include <nvmesh/subdiv/Stencil.h>
namespace nv
{
namespace CatmullClark
{
void projectToLimitSurface(HalfEdgeMesh * mesh);
Vector3 limitPosition(const HalfEdgeMesh::Vertex * vertex);
Vector3 limitNormal(const HalfEdgeMesh::Vertex * vertex);
Vector3 limitTangent(const HalfEdgeMesh::Edge * edge);
//Stencil * limitPositionStencil(const HalfEdgeMesh::Vertex * vertex);
//Stencil * limitTangentStencil(const HalfEdgeMesh::Vertex * edge);
} // CatmullClark namespace
namespace Loop
{
void projectToLimitSurface(HalfEdgeMesh * mesh);
Vector3 limitPosition(const HalfEdgeMesh::Vertex * vertex);
Vector3 limitNormal(const HalfEdgeMesh::Vertex * vertex);
Vector3 limitTangent(const HalfEdgeMesh::Edge * edge);
//Stencil * limitPositionStencil(const HalfEdgeMesh::Vertex * vertex);
//Stencil * limitTangentStencil(const HalfEdgeMesh::Vertex * edge);
} // Loop namespace
} // nv namespace
#endif // NV_MESH_LIMITSURFACE_H
| [
"castano@0f2971b0-9fc2-11dd-b4aa-53559073bf4c"
] | [
[
[
1,
42
]
]
] |
9bea6d39070e1cdbfa9b0c09320b292bdc49e121 | fe7a7f1385a7dd8104e6ccc105f9bb3141c63c68 | /chat.cpp | 9debb1f03575b5474e0baa71253af58155999806 | [] | no_license | divinity76/ancient-divinity-ots | d29efe620cea3fe8d61ffd66480cf20c8f77af13 | 0c7b5bfd5b9277c97d28de598f781dbb198f473d | refs/heads/master | 2020-05-16T21:01:29.130756 | 2010-10-11T22:58:07 | 2010-10-11T22:58:07 | 29,501,722 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,858 | cpp | //////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#include "otpch.h"
#include "chat.h"
#include "player.h"
PrivateChatChannel::PrivateChatChannel(uint16_t channelId, std::string channelName) :
ChatChannel(channelId, channelName)
{
m_owner = 0;
}
bool PrivateChatChannel::isInvited(const Player* player)
{
if(!player)
return false;
if(player->getGUID() == getOwner())
return true;
InvitedMap::iterator it = m_invites.find(player->getGUID());
if(it != m_invites.end())
return true;
return false;
}
bool PrivateChatChannel::addInvited(Player* player)
{
InvitedMap::iterator it = m_invites.find(player->getGUID());
if(it != m_invites.end())
return false;
m_invites[player->getGUID()] = player;
return true;
}
bool PrivateChatChannel::removeInvited(Player* player)
{
InvitedMap::iterator it = m_invites.find(player->getGUID());
if(it == m_invites.end())
return false;
m_invites.erase(it);
return true;
}
void PrivateChatChannel::invitePlayer(Player* player, Player* invitePlayer)
{
if(player != invitePlayer && addInvited(invitePlayer)){
std::string msg;
msg = player->getName();
msg += " invites you to ";
msg += (player->getSex() == PLAYERSEX_FEMALE ? "her" : "his");
msg += " private chat channel.";
invitePlayer->sendTextMessage(MSG_INFO_DESCR, msg.c_str());
msg = invitePlayer->getName();
msg += " has been invited.";
player->sendTextMessage(MSG_INFO_DESCR, msg.c_str());
}
}
void PrivateChatChannel::excludePlayer(Player* player, Player* excludePlayer)
{
if(player != excludePlayer && removeInvited(excludePlayer)){
removeUser(excludePlayer);
std::string msg;
msg = excludePlayer->getName();
msg += " has been excluded.";
player->sendTextMessage(MSG_INFO_DESCR, msg.c_str());
excludePlayer->sendClosePrivate(getId());
}
}
void PrivateChatChannel::closeChannel()
{
UsersMap::iterator cit;
for(cit = m_users.begin(); cit != m_users.end(); ++cit){
cit->second->sendClosePrivate(getId());
}
}
ChatChannel::ChatChannel(uint16_t channelId, std::string channelName)
{
m_id = channelId;
m_name = channelName;
}
bool ChatChannel::addUser(Player* player)
{
UsersMap::iterator it = m_users.find(player->getID());
if(it != m_users.end())
return false;
if(getId() == 0x03 && !player->hasFlag(PlayerFlag_CanAnswerRuleViolations)){ //Rule Violations channel
return false;
}
m_users[player->getID()] = player;
return true;
}
bool ChatChannel::removeUser(Player* player)
{
UsersMap::iterator it = m_users.find(player->getID());
if(it == m_users.end())
return false;
m_users.erase(it);
return true;
}
bool ChatChannel::talk(Player* fromPlayer, SpeakClasses type, const std::string& text, uint32_t time /*= 0*/)
{
bool success = false;
UsersMap::iterator it;
for(it = m_users.begin(); it != m_users.end(); ++it){
it->second->sendToChannel(fromPlayer, type, text, getId(), time);
success = true;
}
return success;
}
Chat::Chat()
{
// Create the default channels
ChatChannel *newChannel;
newChannel = new ChatChannel(0x03, "Rule Violations");
if(newChannel)
m_normalChannels[0x03] = newChannel;
newChannel = new ChatChannel(0x04, "Game-Chat");
if(newChannel)
m_normalChannels[0x04] = newChannel;
newChannel = new ChatChannel(0x05, "Trade");
if(newChannel)
m_normalChannels[0x05] = newChannel;
newChannel = new ChatChannel(0x06, "RL-Chat");
if(newChannel)
m_normalChannels[0x06] = newChannel;
newChannel = new ChatChannel(0x08, "Help");
if(newChannel)
m_normalChannels[0x08] = newChannel;
newChannel = new PrivateChatChannel(0xFFFF, "Private Chat Channel");
if(newChannel)
dummyPrivate = newChannel;
}
Chat::~Chat()
{
delete dummyPrivate;
for(NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it){
delete it->second;
}
m_normalChannels.clear();
for(GuildChannelMap::iterator it = m_guildChannels.begin(); it != m_guildChannels.end(); ++it){
delete it->second;
}
m_guildChannels.clear();
for(PrivateChannelMap::iterator it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){
delete it->second;
}
m_privateChannels.clear();
}
ChatChannel* Chat::createChannel(Player* player, uint16_t channelId)
{
if(getChannel(player, channelId))
return NULL;
if(channelId == 0x00){
ChatChannel *newChannel = new ChatChannel(channelId, player->getGuildName());
if(!newChannel)
return NULL;
m_guildChannels[player->getGuildId()] = newChannel;
return newChannel;
}
else if(channelId == 0xFFFF){
//only 1 private channel for each player
if(getPrivateChannel(player)){
return NULL;
}
//find a free private channel slot
for(uint16_t i = 100; i < 10000; ++i){
if(m_privateChannels.find(i) == m_privateChannels.end()){
PrivateChatChannel* newChannel = new PrivateChatChannel(i, player->getName() + "'s Channel");
if(!newChannel)
return NULL;
newChannel->setOwner(player->getGUID());
m_privateChannels[i] = newChannel;
return newChannel;
}
}
}
return NULL;
}
bool Chat::deleteChannel(Player* player, uint16_t channelId)
{
if(channelId == 0x00){
GuildChannelMap::iterator it = m_guildChannels.find(player->getGuildId());
if(it == m_guildChannels.end())
return false;
delete it->second;
m_guildChannels.erase(it);
return true;
}
else{
PrivateChannelMap::iterator it = m_privateChannels.find(channelId);
if(it == m_privateChannels.end())
return false;
it->second->closeChannel();
delete it->second;
m_privateChannels.erase(it);
return true;
}
return false;
}
bool Chat::addUserToChannel(Player* player, uint16_t channelId)
{
ChatChannel *channel = getChannel(player, channelId);
if(!channel)
return false;
if(channel->addUser(player))
return true;
else
return false;
}
bool Chat::removeUserFromChannel(Player* player, uint16_t channelId)
{
ChatChannel *channel = getChannel(player, channelId);
if(!channel)
return false;
if(channel->removeUser(player)){
if(channel->getOwner() == player->getGUID())
deleteChannel(player, channelId);
return true;
}
else
return false;
}
void Chat::removeUserFromAllChannels(Player* player)
{
ChannelList list = getChannelList(player);
while(list.size()){
ChatChannel *channel = list.front();
list.pop_front();
channel->removeUser(player);
if(channel->getOwner() == player->getGUID())
deleteChannel(player, channel->getId());
}
}
bool Chat::talkToChannel(Player* player, SpeakClasses type, const std::string& text, uint16_t channelId)
{
ChatChannel *channel = getChannel(player, channelId);
if(!channel)
return false;
switch(channelId){
case 0x08:
{
//0x08 is the channelId of Help channel
if(type == SPEAK_CHANNEL_Y && player->hasFlag(PlayerFlag_TalkOrangeHelpChannel)){
type = SPEAK_CHANNEL_O;
}
break;
}
default:
{
break;
}
}
if(channel->talk(player, type, text)){
return true;
}
return false;
}
std::string Chat::getChannelName(Player* player, uint16_t channelId)
{
ChatChannel *channel = getChannel(player, channelId);
if(channel)
return channel->getName();
else
return "";
}
ChannelList Chat::getChannelList(Player* player)
{
ChannelList list;
NormalChannelMap::iterator itn;
PrivateChannelMap::iterator it;
bool gotPrivate = false;
// If has guild
if(player->getGuildId() && player->getGuildName().length()){
ChatChannel *channel = getChannel(player, 0x00);
if(channel)
list.push_back(channel);
else if((channel = createChannel(player, 0x00)))
list.push_back(channel);
}
for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){
if(itn->first == 0x03 && !player->hasFlag(PlayerFlag_CanAnswerRuleViolations)){ //Rule violations channel
continue;
}
ChatChannel *channel = itn->second;
list.push_back(channel);
}
for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){
PrivateChatChannel* channel = it->second;
if(channel){
if(channel->isInvited(player))
list.push_back(channel);
if(channel->getOwner() == player->getGUID())
gotPrivate = true;
}
}
if(!gotPrivate)
list.push_front(dummyPrivate);
return list;
}
ChatChannel* Chat::getChannel(Player* player, uint16_t channelId)
{
if(channelId == 0x00){
GuildChannelMap::iterator git = m_guildChannels.find(player->getGuildId());
if(git != m_guildChannels.end()){
return git->second;
}
return NULL;
}
NormalChannelMap::iterator nit = m_normalChannels.find(channelId);
if(nit != m_normalChannels.end()){
if(channelId == 0x03 && !player->hasFlag(PlayerFlag_CanAnswerRuleViolations)){ //Rule violations channel
return NULL;
}
return nit->second;
}
PrivateChannelMap::iterator pit = m_privateChannels.find(channelId);
if(pit != m_privateChannels.end()){
return pit->second;
}
return NULL;
}
ChatChannel* Chat::getChannelById(uint16_t channelId)
{
NormalChannelMap::iterator it = m_normalChannels.find(channelId);
if(it != m_normalChannels.end()){
return it->second;
}
return NULL;
}
PrivateChatChannel* Chat::getPrivateChannel(Player* player)
{
for(PrivateChannelMap::iterator it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){
if(PrivateChatChannel* channel = it->second){
if(channel->getOwner() == player->getGUID()){
return channel;
}
}
}
return NULL;
}
| [
"[email protected]@6be3b30e-f956-11de-ba51-6b4196a2b81e"
] | [
[
[
1,
432
]
]
] |
5dc925be462a483fa351f2e38af7391d5ca6e9cf | fc7dbcb3bcdb16010e9b1aad4ecba41709089304 | /EdkCompatibilityPkg/Sample/Tools/Source/UefiVfrCompile/VfrUtilityLib.h | 70301241c6e836365a460d55beb409237fe8eb18 | [] | no_license | Itomyl/loongson-uefi | 5eb0ece5875406b00dbd265d28245208d6bbc99a | 70b7d5495e2b451899e2ba2ef677384de075d984 | refs/heads/master | 2021-05-28T04:38:29.989074 | 2010-05-31T02:47:26 | 2010-05-31T02:47:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,882 | h | /*++
Copyright (c) 2004 - 2010, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
VfrUtilityLib.h
Abstract:
--*/
#ifndef _VFRUTILITYLIB_H_
#define _VFRUTILITYLIB_H_
#include "Tiano.h"
#include "string.h"
#include "EfiTypes.h"
#include "EfiVfr.h"
#include "VfrError.h"
#define MAX_NAME_LEN 64
#define DEFAULT_ALIGN 1
#define DEFAULT_PACK_ALIGN 0xFFFFFFFF
#define DEFAULT_NAME_TABLE_ITEMS 1024
#define EFI_BITS_SHIFT_PER_UINT32 0x5
#define EFI_BITS_PER_UINT32 (1 << EFI_BITS_SHIFT_PER_UINT32)
#define BUFFER_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete (Buf); } } while (0);
class CVfrBinaryOutput {
public:
virtual VOID WriteLine (IN FILE *, IN UINT32, IN INT8 *, IN INT8 *, IN UINT32);
virtual VOID WriteEnd (IN FILE *, IN UINT32, IN INT8 *, IN INT8 *, IN UINT32);
};
UINT32
_STR2U32 (
IN INT8 *Str
);
struct SConfigInfo {
UINT16 mOffset;
UINT16 mWidth;
UINT8 *mValue;
SConfigInfo *mNext;
SConfigInfo (IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
~SConfigInfo (VOID);
};
struct SConfigItem {
INT8 *mId;
INT8 *mInfo;
SConfigInfo *mInfoStrList;
SConfigItem *mNext;
public:
SConfigItem (IN INT8 *, IN INT8 *);
SConfigItem (IN INT8 *, IN INT8 *, IN UINT8, IN UINT16, IN UINT16, IN EFI_IFR_TYPE_VALUE);
virtual ~SConfigItem ();
};
class CVfrBufferConfig {
private:
SConfigItem *mItemListHead;
SConfigItem *mItemListTail;
SConfigItem *mItemListPos;
public:
CVfrBufferConfig (VOID);
virtual ~CVfrBufferConfig (VOID);
virtual UINT8 Register (IN INT8 *, IN INT8 *Info = NULL);
virtual VOID Open (VOID);
virtual BOOLEAN Eof(VOID);
virtual UINT8 Select (IN INT8 *, IN INT8 *Info = NULL);
virtual UINT8 Write (IN CONST CHAR8, IN INT8 *, IN INT8 *, IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
#if 0
virtual UINT8 Read (OUT INT8 **, OUT INT8 **, OUT INT8 **, OUT INT8 **, OUT INT8 **);
#endif
virtual VOID Close (VOID);
virtual VOID OutputCFile (IN FILE *, IN INT8 *);
};
extern CVfrBufferConfig gCVfrBufferConfig;
#define ALIGN_STUFF(Size, Align) ((Align) - (Size) % (Align))
#define INVALID_ARRAY_INDEX 0xFFFFFFFF
struct SVfrDataType;
struct SVfrDataField {
INT8 mFieldName[MAX_NAME_LEN];
SVfrDataType *mFieldType;
UINT32 mOffset;
UINT32 mArrayNum;
SVfrDataField *mNext;
};
struct SVfrDataType {
INT8 mTypeName[MAX_NAME_LEN];
UINT8 mType;
UINT32 mAlign;
UINT32 mTotalSize;
SVfrDataField *mMembers;
SVfrDataType *mNext;
};
class CVfrVarDataTypeDB {
private:
SVfrDataType *mDataTypeList;
UINT32 mPackAlign;
SVfrDataType *mNewDataType;
SVfrDataType *mCurrDataType;
SVfrDataField *mCurrDataField;
VOID InternalTypesListInit (VOID);
VOID RegisterNewType (IN SVfrDataType *);
EFI_VFR_RETURN_CODE ExtractStructTypeName (IN INT8 *&, OUT INT8 *);
EFI_VFR_RETURN_CODE ExtractFieldNameAndArrary (IN INT8 *&, OUT INT8 *, OUT UINT32 &);
EFI_VFR_RETURN_CODE GetTypeField (IN INT8 *, IN SVfrDataType *, IN SVfrDataField *&);
EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &);
UINT8 GetFieldWidth (IN SVfrDataField *);
UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32);
public:
CVfrVarDataTypeDB (VOID);
~CVfrVarDataTypeDB (VOID);
EFI_VFR_RETURN_CODE Pack (IN UINT32);
VOID UnPack (VOID);
VOID DeclareDataTypeBegin (VOID);
EFI_VFR_RETURN_CODE SetNewTypeName (IN INT8 *);
EFI_VFR_RETURN_CODE DataTypeAddField (IN INT8 *, IN INT8 *, IN UINT32);
VOID DeclareDataTypeEnd (VOID);
EFI_VFR_RETURN_CODE GetDataType (IN INT8 *, OUT SVfrDataType **);
EFI_VFR_RETURN_CODE GetDataTypeSize (IN INT8 *, OUT UINT32 *);
EFI_VFR_RETURN_CODE GetDataFieldInfo (IN INT8 *, OUT UINT16 &, OUT UINT8 &, OUT UINT32 &);
EFI_VFR_RETURN_CODE GetUserDefinedTypeNameList (OUT INT8 ***, OUT UINT32 *);
BOOLEAN IsTypeNameDefined (IN INT8 *);
#ifdef CVFR_VARDATATYPEDB_DEBUG
VOID ParserDB ();
#endif
};
typedef enum {
EFI_VFR_VARSTORE_INVALID,
EFI_VFR_VARSTORE_BUFFER,
EFI_VFR_VARSTORE_EFI,
EFI_VFR_VARSTORE_NAME
} EFI_VFR_VARSTORE_TYPE;
struct SVfrVarStorageNode {
EFI_GUID mGuid;
INT8 *mVarStoreName;
EFI_VARSTORE_ID mVarStoreId;
struct SVfrVarStorageNode *mNext;
EFI_VFR_VARSTORE_TYPE mVarStoreType;
union {
// EFI Variable
struct {
EFI_STRING_ID mEfiVarName;
UINT32 mEfiVarSize;
} mEfiVar;
// Buffer Storage
SVfrDataType *mDataType;
// NameValue Storage
struct {
EFI_STRING_ID *mNameTable;
UINT32 mTableSize;
} mNameSpace;
} mStorageInfo;
public:
SVfrVarStorageNode (IN EFI_GUID *, IN INT8 *, IN EFI_VARSTORE_ID, IN EFI_STRING_ID, IN UINT32);
SVfrVarStorageNode (IN EFI_GUID *, IN INT8 *, IN EFI_VARSTORE_ID, IN SVfrDataType *);
SVfrVarStorageNode (IN INT8 *, IN EFI_VARSTORE_ID);
~SVfrVarStorageNode (VOID);
};
struct EFI_VARSTORE_INFO {
EFI_VARSTORE_ID mVarStoreId;
union {
EFI_STRING_ID mVarName;
UINT16 mVarOffset;
} mInfo;
UINT8 mVarType;
UINT32 mVarTotalSize;
EFI_VARSTORE_INFO (VOID);
EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &);
BOOLEAN operator == (IN EFI_VARSTORE_INFO *);
};
#define EFI_VARSTORE_ID_MAX 0xFFFF
#define EFI_FREE_VARSTORE_ID_BITMAP_SIZE ((EFI_VARSTORE_ID_MAX + 1) / EFI_BITS_PER_UINT32)
class CVfrDataStorage {
private:
UINT32 mFreeVarStoreIdBitMap[EFI_FREE_VARSTORE_ID_BITMAP_SIZE];
struct SVfrVarStorageNode *mBufferVarStoreList;
struct SVfrVarStorageNode *mEfiVarStoreList;
struct SVfrVarStorageNode *mNameVarStoreList;
struct SVfrVarStorageNode *mCurrVarStorageNode;
struct SVfrVarStorageNode *mNewVarStorageNode;
private:
EFI_VARSTORE_ID GetFreeVarStoreId (VOID);
BOOLEAN ChekVarStoreIdFree (IN EFI_VARSTORE_ID);
VOID MarkVarStoreIdUsed (IN EFI_VARSTORE_ID);
VOID MarkVarStoreIdUnused (IN EFI_VARSTORE_ID);
public:
CVfrDataStorage ();
~CVfrDataStorage ();
EFI_VFR_RETURN_CODE DeclareNameVarStoreBegin (INT8 *);
EFI_VFR_RETURN_CODE NameTableAddItem (EFI_STRING_ID);
EFI_VFR_RETURN_CODE DeclareNameVarStoreEnd (EFI_GUID *);
EFI_VFR_RETURN_CODE DeclareEfiVarStore (IN INT8 *, IN EFI_GUID *, IN EFI_STRING_ID, IN UINT32);
EFI_VFR_RETURN_CODE DeclareBufferVarStore (IN INT8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN INT8 *, IN EFI_VARSTORE_ID);
EFI_VFR_RETURN_CODE GetVarStoreId (IN INT8 *, OUT EFI_VARSTORE_ID *);
EFI_VFR_RETURN_CODE GetVarStoreType (IN INT8 *, OUT EFI_VFR_VARSTORE_TYPE &);
EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT INT8 **);
EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN INT8 *, OUT INT8 **);
EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *);
EFI_VFR_RETURN_CODE GetNameVarStoreInfo (IN EFI_VARSTORE_INFO *, IN UINT32);
EFI_VFR_RETURN_CODE BufferVarStoreRequestElementAdd (IN INT8 *, IN EFI_VARSTORE_INFO &);
};
#define EFI_QUESTION_ID_MAX 0xFFFF
#define EFI_FREE_QUESTION_ID_BITMAP_SIZE ((EFI_QUESTION_ID_MAX + 1) / EFI_BITS_PER_UINT32)
#define EFI_QUESTION_ID_INVALID 0x0
#define DATE_YEAR_BITMASK 0x0000FFFF
#define DATE_MONTH_BITMASK 0x00FF0000
#define DATE_DAY_BITMASK 0xFF000000
#define TIME_HOUR_BITMASK 0x000000FF
#define TIME_MINUTE_BITMASK 0x0000FF00
#define TIME_SECOND_BITMASK 0x00FF0000
struct SVfrQuestionNode {
INT8 *mName;
INT8 *mVarIdStr;
EFI_QUESTION_ID mQuestionId;
UINT32 mBitMask;
SVfrQuestionNode *mNext;
SVfrQuestionNode (IN INT8 *, IN INT8 *, IN UINT32 BitMask = 0);
~SVfrQuestionNode ();
};
class CVfrQuestionDB {
private:
SVfrQuestionNode *mQuestionList;
UINT32 mFreeQIdBitMap[EFI_FREE_QUESTION_ID_BITMAP_SIZE];
private:
EFI_QUESTION_ID GetFreeQuestionId (VOID);
BOOLEAN ChekQuestionIdFree (IN EFI_QUESTION_ID);
VOID MarkQuestionIdUsed (IN EFI_QUESTION_ID);
VOID MarkQuestionIdUnused (IN EFI_QUESTION_ID);
public:
CVfrQuestionDB ();
~CVfrQuestionDB();
EFI_VFR_RETURN_CODE RegisterQuestion (IN INT8 *, IN INT8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterOldDateQuestion (IN INT8 *, IN INT8 *, IN INT8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterNewDateQuestion (IN INT8 *, IN INT8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterOldTimeQuestion (IN INT8 *, IN INT8 *, IN INT8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterNewTimeQuestion (IN INT8 *, IN INT8 *, IN OUT EFI_QUESTION_ID &);
EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID);
VOID GetQuestionId (IN INT8 *, IN INT8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &);
EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID);
EFI_VFR_RETURN_CODE FindQuestion (IN INT8 *);
};
struct SVfrDefaultStoreNode {
EFI_IFR_DEFAULTSTORE *mObjBinAddr;
INT8 *mRefName;
EFI_STRING_ID mDefaultStoreNameId;
UINT16 mDefaultId;
SVfrDefaultStoreNode *mNext;
SVfrDefaultStoreNode (IN EFI_IFR_DEFAULTSTORE *, IN INT8 *, IN EFI_STRING_ID, IN UINT16);
~SVfrDefaultStoreNode();
};
class CVfrDefaultStore {
private:
SVfrDefaultStoreNode *mDefaultStoreList;
public:
CVfrDefaultStore ();
~CVfrDefaultStore ();
EFI_VFR_RETURN_CODE RegisterDefaultStore (IN CHAR8 *, IN INT8 *, IN EFI_STRING_ID, IN UINT16);
EFI_VFR_RETURN_CODE ReRegisterDefaultStoreById (IN UINT16, IN INT8 *, IN EFI_STRING_ID);
BOOLEAN DefaultIdRegistered (IN UINT16);
EFI_VFR_RETURN_CODE GetDefaultId (IN INT8 *, OUT UINT16 *);
EFI_VFR_RETURN_CODE BufferVarStoreAltConfigAdd (IN EFI_VARSTORE_ID, IN EFI_VARSTORE_INFO &, IN INT8 *, IN UINT8, IN EFI_IFR_TYPE_VALUE);
};
#define EFI_RULE_ID_START 0x01
#define EFI_RULE_ID_INVALID 0x00
struct SVfrRuleNode {
UINT8 mRuleId;
INT8 *mRuleName;
SVfrRuleNode *mNext;
SVfrRuleNode(IN INT8 *, IN UINT8);
~SVfrRuleNode();
};
class CVfrRulesDB {
private:
SVfrRuleNode *mRuleList;
UINT8 mFreeRuleId;
public:
CVfrRulesDB ();
~CVfrRulesDB();
VOID RegisterRule (IN INT8 *);
UINT8 GetRuleId (IN INT8 *);
};
#define MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))
#define MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
#endif
| [
"[email protected]"
] | [
[
[
1,
360
]
]
] |
c9015376937af199bb0eefb83614b1a6355dfdee | b8ac0bb1d1731d074b7a3cbebccc283529b750d4 | /Code/controllers/Tcleaner/utils/GarbageRecognition.cpp | 7a9f51400d10941d4bff6291e79b698652b2dd9f | [] | 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 | 8,818 | cpp | #include <utils/GarbageRecognition.h>
#include <highgui.h>
#include <stdio.h>
#include <string>
#include <time.h>
#include <utils/Contours.h>
#include <utils/Histogram.h>
#include <utils/Garbage.h>
#include <utils/MyAngle.h>
#include <utils/MinimalBoundingRectangle.h>
// image preprocessing values
#define THRESHOLD_VALUE 240
#define MORPH_KERNEL_SIZE 2
#define MORPH_DILATE_ITER 0
#define MORPH_ERODE_ITER 0
#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 200
#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 1 //seconds
namespace utils {
robotapi::ICamera * cam;
std::list<utils::Garbage*> garbages;
time_t lastRequest;
GarbageRecognition::GarbageRecognition(WorldInfo * wi){
this->wi = wi;
this->model = cvLoadImage("./colilla-sinBlanco.png",1);
}
void GarbageRecognition::setCamera(robotapi::ICamera &camera)
{
cam = &camera;
lastRequest = time(NULL);
this->pooled = false;
}
bool GarbageRecognition::thereIsGarbage()
{
if ( ! this->pooled ){
this->getGarbageList();
}
return !garbages.empty();
}
std::list<Garbage*> GarbageRecognition::getGarbageList()
{
if ( ! this->pooled ){
this->pooled = true;
IplImage * src = loadImage();
this->garbageList(src,this->model);
cvReleaseImage(&src);
}
return garbages;
}
utils::Garbage * GarbageRecognition::getClosestGarbage(std::list<utils::Garbage*> gs){
if ( gs.empty() )
return NULL;
std::list<utils::Garbage *>::iterator it;
it=gs.begin();
return *it;
}
std::list<utils::Garbage*> GarbageRecognition::garbageList(IplImage * src, IplImage * model){
std::list<utils::Garbage*>::iterator it;
for ( it=garbages.begin() ; it != garbages.end() ; it++ )
delete *it;
garbages.clear();
//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++;
//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( pf && raf && baf && hmf ){
//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);
// printf("%d , %d - %d , %d\n",boundingRect.x,boundingRect.y,boundingRect.width,boundingRect.height);
garbages.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 garbages;
}
double GarbageRecognition::angleTo(utils::Garbage * g)
{
if ( g == NULL )
return PI;
int centerX = g->boundingBox()->getTopX() + g->boundingBox()->getWidth()/2;
int centerY = g->boundingBox()->getTopY() + g->boundingBox()->getHeight()/2;
int transformedX = centerX - this->wi->getCameraImageWidth()/2;
int transformedY = this->wi->getCameraImageHeight() - centerY;
double hfov = this->wi->getCameraFOVH();
if ( transformedY == 0 ){
return transformedX < 0 ? (-hfov/2) : (hfov/2);
}
// Negative if its in the left side of the screen, positive otherwise
return atan((double)transformedX/(double)transformedY) * hfov / PI;
}
double GarbageRecognition::distanceTo(utils::Garbage * g)
{
if ( g == NULL )
return 10000;
int centerX = g->boundingBox()->getTopX() + g->boundingBox()->getWidth()/2;
int centerY = g->boundingBox()->getTopY() + g->boundingBox()->getHeight()/2;
int transformedX = centerX - this->wi->getCameraImageWidth()/2;
int transformedY = this->wi->getCameraImageHeight() - centerY;
double minDist = this->getMinimumDistance();
double maxDist = this->getMaximumDistance();
double vAngleToGarbage = this->wi->getCameraFOVV()*transformedY/this->wi->getCameraImageHeight();
double distanceToGarbage = this->getDistance(vAngleToGarbage);
/*
printf("Minimum Distance : %g - Maximum Distance : %g\n",minDist,maxDist);
printf("Garbage Y: %d - Camera Height : %d - Vertical FOV : %g\n",transformedY,this->wi->getCameraImageHeight(),this->wi->getCameraFOVV());
printf("Vertical angle to: %g - Distance to : %g\n",vAngleToGarbage,distanceToGarbage);
*/
return distanceToGarbage;
}
double GarbageRecognition::getMaximumDistance(){
return this->wi->getMaximumDistance();
}
double GarbageRecognition::getMinimumDistance(){
return this->wi->getMinimumDistance();
}
double GarbageRecognition::getDistance(double angle){
return this->wi->getDistance(angle);
}
void GarbageRecognition::stepDone(){
this->pooled = false;
}
IplImage * GarbageRecognition::loadImage(std::string filename){
cam->saveImage(filename, 85);
return cvLoadImage(filename.c_str(),1);
}
IplImage * GarbageRecognition::loadImage(void){
IplImage * ret = cam->getImage().toIPL();
return ret;
}
} /* End of namespace utils */
| [
"guicamest@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a",
"NulDiego@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a",
"nuldiego@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a"
] | [
[
[
1,
6
],
[
9,
38
],
[
40,
81
],
[
86,
86
],
[
88,
137
],
[
139,
162
],
[
164,
171
],
[
180,
187
],
[
190,
190
],
[
192,
196
],
[
198,
204
],
[
207,
210
],
[
212,
219
],
[
221,
221
],
[
224,
225
],
[
229,
230
],
[
245,
318
]
],
[
[
7,
8
],
[
39,
39
],
[
163,
163
],
[
211,
211
]
],
[
[
82,
85
],
[
87,
87
],
[
138,
138
],
[
172,
179
],
[
188,
189
],
[
191,
191
],
[
197,
197
],
[
205,
206
],
[
220,
220
],
[
222,
223
],
[
226,
228
],
[
231,
244
]
]
] |
c05bfda597c0707b7a574198dcc78751a3f30a01 | ce0622a0f49dd0ca172db04efdd9484064f20973 | /tools/GameList/Common/AtgScene.h | 9c3db0daff6fb395b431cd5a52d6dc3cf3366858 | [] | no_license | maninha22crazy/xboxplayer | a78b0699d4002058e12c8f2b8c83b1cbc3316500 | e9ff96899ad8e8c93deb3b2fe9168239f6a61fe1 | refs/heads/master | 2020-12-24T18:42:28.174670 | 2010-03-14T13:57:37 | 2010-03-14T13:57:37 | 56,190,024 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,402 | h | //-----------------------------------------------------------------------------
// AtgScene.h
//
// describes a scene which can own per-scene materials and animations
//
// Xbox Advanced Technology Group.
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#pragma once
#ifndef ATG_SCENE_H
#define ATG_SCENE_H
#include <list>
#include "AtgFrame.h"
#include <fxl.h>
namespace ATG
{
class ResourceDatabase;
class EffectGlobalParameterPool;
//-----------------------------------------------------------------------------
// Name: Scene
// Desc: A database containing meshes, materials, and model instances
//-----------------------------------------------------------------------------
class Scene : public Frame
{
DEFINE_TYPE_INFO();
public:
Scene();
~Scene();
ResourceDatabase* GetResourceDatabase() { return m_pResourceDatabase; }
VOID AddObject( NamedTypedObject *pObject ) { m_InstanceDatabase.Add( pObject ); }
NamedTypedObject* FindObject( CONST WCHAR* szName ) { return m_InstanceDatabase.Find( szName ); }
NamedTypedObject* FindObjectOfType( CONST WCHAR* szName, const StringID TypeID ) { return m_InstanceDatabase.FindTyped( szName, TypeID ); }
VOID RemoveObject( NamedTypedObject *pObject ) { m_InstanceDatabase.Remove( pObject ); }
FXLEffectPool* GetEffectParameterPool() { return m_pGlobalParameterPool; }
NameIndexedCollection* GetInstanceList() { return &m_InstanceDatabase; }
VOID SetFileName( const CHAR* strFileName ) { strcpy_s( m_strFileName, strFileName ); }
VOID SetMediaRootPath( const CHAR* strMediaRootPath ) { strcpy_s( m_strMediaRootPath,
strMediaRootPath ); }
const CHAR* GetFileName() const { return m_strFileName; }
const CHAR* GetMediaRootPath() const { return m_strMediaRootPath; }
private:
FXLEffectPool* m_pGlobalParameterPool;
ResourceDatabase* m_pResourceDatabase;
NameIndexedCollection m_InstanceDatabase;
CHAR m_strFileName[MAX_PATH];
CHAR m_strMediaRootPath[MAX_PATH];
};
} // namespace ATG
#endif // ATG_SCENE_H
| [
"goohome@343f5ee6-a13e-11de-ba2c-3b65426ee844"
] | [
[
[
1,
60
]
]
] |
f82a86bfc062e921d2bf45ae697809396c508d27 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/Targets/WayFinder/symbian-r6/PreviewPopUpContent.cpp | 88d7349602e87b213554b94ffe8a482723871506 | [
"BSD-3-Clause"
] | permissive | ravustaja/Wayfinder-S60-Navigator | ef506c418b8c2e6498ece6dcae67e583fb8a4a95 | 14d1b729b2cea52f726874687e78f17492949585 | refs/heads/master | 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,068 | cpp | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
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 Vodafone Group Services Ltd nor the names of its 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 HOLDER 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.
*/
#if defined NAV2_CLIENT_SERIES60_V5
// INCLUDE FILES
#include <coemain.h>
#include <aknutils.h>
#include <eiklabel.h>
#include <aknsutils.h>
#include <gdi.h>
#include <eikapp.h>
#include <gulicon.h>
#include "WFBitmapUtil.h"
#include "PreviewPopUpContent.h"
_LIT(KDefaultText, "");
CPreviewPopUpContent* CPreviewPopUpContent::NewL()
{
CPreviewPopUpContent* self =
CPreviewPopUpContent::NewLC();
CleanupStack::Pop(self);
return self;
}
CPreviewPopUpContent* CPreviewPopUpContent::NewLC()
{
CPreviewPopUpContent* self = new (ELeave) CPreviewPopUpContent();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
void CPreviewPopUpContent::ConstructL()
{
/* Do not call CreateWindowL() as the parent CAknPreviewPopUpController has a
window. But when ConstructL() is called this has not yet been created (as
the CAknPreviewPopUpController has not been created) so defer all construction
which requires a window to InitialiseL() which is called after
CAknPreviewPopUpController has been constructed. */
}
void CPreviewPopUpContent::InitialiseL(const TRect& aRect,
const TDesC& aMbmName,
TInt aNbrOfRows,
TInt aImageId,
TInt aMaskId)
{
// Do not call CreateWindowL() as parent CAknPreviewPopUpController owns window
InitComponentArrayL();
iMbmName = aMbmName.AllocL();
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
TRgb fgcolor(0,0,0);
AknsUtils::GetCachedColor(skin, fgcolor, KAknsIIDQsnTextColors,
EAknsCIQsnTextColorsCG55);
if (aImageId != -1 && aMaskId != -1) {
AknIconUtils::CreateIconL(iBitmap, iMask, *iMbmName, aImageId, aMaskId);
AknIconUtils::SetSize(iBitmap, TSize(10, 10),
EAspectRatioPreservedAndUnusedSpaceRemoved);
}
iStringLengths = new (ELeave) CArrayFixFlat<TInt>(aNbrOfRows);
iLabelContainer.Reset();
// Create one label with standard font size.
iStringLengths->AppendL(aRect.Width());
CEikLabel* label = new (ELeave) CEikLabel();
label->SetContainerWindowL(*this);
Components().AppendLC(label);
label->OverrideColorL(EColorLabelText, fgcolor);
label->SetTextL(KDefaultText);
CleanupStack::Pop(label);
iLabelContainer.AppendL(TLabelData(label));
// The rest of the labels with a smaller font.
const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
for (TInt i = 0; i < aNbrOfRows-1; ++i) {
iStringLengths->AppendL(aRect.Width());
CEikLabel* label = new (ELeave) CEikLabel();
label->SetContainerWindowL(*this);
Components().AppendLC(label);
label->SetFont(font);
label->OverrideColorL(EColorLabelText, fgcolor);
label->SetTextL(KDefaultText);
CleanupStack::Pop(label);
iLabelContainer.AppendL(TLabelData(label));
}
//CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font);
Components().SetControlsOwnedExternally(EFalse);
// Set the windows size
SetRect(aRect);
// Activate the window, which makes it ready to be drawn
ActivateL();
}
CPreviewPopUpContent::CPreviewPopUpContent() :
iBitmap(NULL),
iMask(NULL)
{
}
CPreviewPopUpContent::~CPreviewPopUpContent()
{
delete iMbmName;
delete iBitmap;
delete iMask;
if (iStringLengths) {
iStringLengths->Reset();
delete iStringLengths;
}
iLabelContainer.Reset();
}
void
CPreviewPopUpContent::SetAvailableWidth(TInt aWidth, TInt aPadding,
CPreviewPopUpContent::TContentLayout aLayout,
TInt aHeight)
{
iLayout = aLayout;
TInt numLabels = iLabelContainer.Count();
if (numLabels == 0) {
return;
}
// The large font header label.
CEikLabel* labelLa = iLabelContainer[0].iLabel;
// The small font text label.
CEikLabel* labelSm = iLabelContainer[1].iLabel;
// Font height in pixels
TInt fontHeightLa = labelLa->Font()->HeightInPixels();
// Font descent in pixels
TInt descentLa = labelLa->Font()->DescentInPixels();
// The height of one label
TInt labelHeightLa = fontHeightLa + descentLa;
// Font height in pixels
TInt fontHeightSm = labelSm->Font()->HeightInPixels();
// Font descent in pixels
TInt descentSm = labelSm->Font()->DescentInPixels();
// The height of one label
TInt labelHeightSm = fontHeightSm + descentSm;
// totLabelsHeight will hold the total height of all labels that
// will be drawn (one large font and the rest small fonts).
// We additionaly remove a descent on the last line since that
// it seems otherwise we're over compensating.
TInt totLabelsHeight =
labelHeightLa + labelHeightSm * (numLabels - 1); // - descentSm;
// Calculate the image size.
// This calc will give us the height of two label rows.
iIconSize = fontHeightLa + fontHeightSm + descentLa;
TInt iconSize = iIconSize;
TInt padding = aPadding;
if (iBitmap) {
AknIconUtils::SetSize(iBitmap, TSize(iconSize, iconSize),
EAspectRatioPreservedAndUnusedSpaceRemoved);
iconSize = iBitmap->SizeInPixels().iWidth;
} else {
// We have no bitmap set so dont indent the text around the bitmap.
iconSize = 0;
padding = 0;
}
// controlRect will contain the rect for our control to draw in,
// including padding.
TRect controlRect;
if (iLayout == EFourLinesIndentedTextImageTopLeft) {
if (aHeight > 0) {
controlRect = TRect(TPoint(aPadding, aPadding),
TSize(aWidth, aHeight));
} else {
controlRect = TRect(TPoint(aPadding, aPadding),
TSize(aWidth, totLabelsHeight + aPadding));
}
} else if (iLayout == EFourLinesTextImageTopLeftAbove) {
if (aHeight > 0) {
controlRect = TRect(TPoint(aPadding, aPadding),
TSize(aWidth, aHeight));
} else {
controlRect = TRect(TPoint(aPadding, aPadding),
TSize(aWidth,
totLabelsHeight + iconSize + descentLa + aPadding));
}
}
// iComponentRect will contain the drawing area for our controls
// (image and labels).
iComponentRect = controlRect;
iComponentRect.Shrink(aPadding, aPadding);
// Calculate where the text should wrap and
// calculate the positions and rects for the labels in the control.
TRect labelRectLa;
TRect labelRectSm;
if (iLayout == EFourLinesIndentedTextImageTopLeft) {
// The first line will bew positioned next to the image and
// therefore the width will be a bit shorter.
iStringLengths->At(0) = (iComponentRect.Width() - (iconSize + padding));
// The width of the last line should not be wrapped but rather set to
// cropped later on.
iStringLengths->At(1) = (iComponentRect.Width() + 10000);
// The rect for the first label in the layout mode.
labelRectLa = TRect(TPoint(iComponentRect.iTl.iX + iconSize + padding,
iComponentRect.iTl.iY),
TSize(iComponentRect.Width() - (iconSize + padding),
labelHeightLa));
// The rect for the labels with small font as well.
labelRectSm = TRect(TPoint(iComponentRect.iTl.iX + iconSize + padding,
iComponentRect.iTl.iY),
TSize(iComponentRect.Width() - (iconSize + padding),
labelHeightLa));
} else if (iLayout == EFourLinesTextImageTopLeftAbove) {
// We can use the full length of the container.
iStringLengths->At(0) = iComponentRect.Width();
// The width of the last line should not be wrapped but rather set to
// cropped later on.
iStringLengths->At(1) = (iComponentRect.Width() + 10000);
// The rect for the first label in the layout mode.
labelRectLa = TRect(TPoint(iComponentRect.iTl.iX,
iComponentRect.iTl.iY + iconSize + descentLa),
TSize(iComponentRect.Width(),
labelHeightLa));
// The rect for the labels with small font as well.
labelRectSm = TRect(TPoint(iComponentRect.iTl.iX,
iComponentRect.iTl.iY + iconSize + descentLa),
TSize(iComponentRect.Width(),
labelHeightLa));
}
iLabelContainer[0].SetRect(labelRectLa);
labelRectSm.Move(0, labelHeightLa);
iLabelContainer[1].SetRect(labelRectSm);
// if (iLayout == EFourLinesIndentedTextImageTopLeft) {
// // We need to move back the third label in this layout mode.
// labelRect.iTl.iX -= (iconSize + padding);
// }
labelRectSm.Move(0, labelHeightSm);
iLabelContainer[2].SetRect(labelRectSm);
labelRectSm.Move(0, labelHeightSm);
iLabelContainer[3].SetRect(labelRectSm);
SetRect(controlRect);
}
void CPreviewPopUpContent::SizeChanged()
{
}
void CPreviewPopUpContent::Draw(const TRect& /*aRect*/) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();
TRect rect(Rect());
gc.SetClippingRect(rect);
//gc.DrawRect(rect);
if (iBitmap && iMask) {
gc.BitBltMasked(iComponentRect.iTl, iBitmap,
TRect(TPoint(0, 0), iBitmap->SizeInPixels()),
iMask, EFalse);
}
}
void CPreviewPopUpContent::SetTextL(const TDesC& aFirstText,
const TDesC& aSecondText,
const TDesC& aThirdText)
{
TBuf<256> wrappedText;
AknTextUtils::WrapToStringL(aSecondText, *iStringLengths,
*iLabelContainer[1].iLabel->Font(),
wrappedText);
iLabelContainer[0].iLabel->SetTextL(aFirstText);
iLabelContainer[0].iLabel->CropText();
_LIT(KNewLine, "\n");
TInt pos = wrappedText.Find(KNewLine);
if (pos != KErrNotFound) {
TPtrC leftText = wrappedText.Left(pos);
iLabelContainer[1].iLabel->SetTextL(leftText);
TPtrC rightText = wrappedText.Mid(pos + 1);
if (rightText.Length() < 1) {
// WrapToStringL always seems to add a newline so we need to
// check for length as well.
iLabelContainer[2].iLabel->SetTextL(aThirdText);
iLabelContainer[2].iLabel->CropText();
iLabelContainer[3].iLabel->SetTextL(KDefaultText);
} else {
iLabelContainer[2].iLabel->SetTextL(rightText);
iLabelContainer[2].iLabel->CropText();
iLabelContainer[3].iLabel->SetTextL(aThirdText);
iLabelContainer[3].iLabel->CropText();
}
} else {
// WrapToStringL didnt add a newline (we dont need to wrap) but it
// seems WrapToStringL always adds newline (see above comment).
iLabelContainer[1].iLabel->SetTextL(aSecondText);
iLabelContainer[2].iLabel->SetTextL(aThirdText);
iLabelContainer[2].iLabel->CropText();
iLabelContainer[3].iLabel->SetTextL(KDefaultText);
}
//iLabel->SetRect(iLabelRect);
//iLabel->DrawDeferred();
}
void CPreviewPopUpContent::SetImageL(TInt aImageId, TInt aMaskId)
{
delete iBitmap;
iBitmap = NULL;
delete iMask;
iMask = NULL;
if (aImageId != -1 && aMaskId != -1) {
AknIconUtils::CreateIconL(iBitmap, iMask, *iMbmName, aImageId, aMaskId);
AknIconUtils::SetSize(iBitmap, TSize(iIconSize, iIconSize),
EAspectRatioPreservedAndUnusedSpaceRemoved);
}
}
void CPreviewPopUpContent::SetImageL(CFbsBitmap* aBitmap, CFbsBitmap* aMask)
{
delete iBitmap;
iBitmap = NULL;
delete iMask;
iMask = NULL;
if (aBitmap && aMask) {
iBitmap = aBitmap;
iMask = aMask;
AknIconUtils::SetSize(iBitmap, TSize(iIconSize, iIconSize),
EAspectRatioPreservedAndUnusedSpaceRemoved);
}
}
#endif //NAV2_CLIENT_SERIES60_V5
| [
"[email protected]"
] | [
[
[
1,
360
]
]
] |
28da6e41a73ab208aec7cce8817d62b0e75d1a80 | 7f72fc855742261daf566d90e5280e10ca8033cf | /branches/full-calibration/ground/src/libs/opmapcontrol/src/mapwidget/trailitem.cpp | 9fe8d43e63c74b00c7f34e435100082d56a2efb2 | [] | no_license | caichunyang2007/my_OpenPilot_mods | 8e91f061dc209a38c9049bf6a1c80dfccb26cce4 | 0ca472f4da7da7d5f53aa688f632b1f5c6102671 | refs/heads/master | 2023-06-06T03:17:37.587838 | 2011-02-28T10:25:56 | 2011-02-28T10:25:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,120 | cpp | /**
******************************************************************************
*
* @file trailitem.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief A graphicsItem representing a trail point
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "trailitem.h"
#include <QDateTime>
namespace mapcontrol
{
TrailItem::TrailItem(internals::PointLatLng const& coord,int const& altitude,QGraphicsItem* parent):QGraphicsItem(parent),coord(coord)
{
QDateTime time=QDateTime::currentDateTime();
QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6);
setToolTip(QString(tr("Position:")+"%1\n"+tr("Altitude:")+"%2\n"+tr("Time:")+"%3").arg(coord_str).arg(QString::number(altitude)).arg(time.toString()));
}
void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
// painter->drawRect(QRectF(-3,-3,6,6));
painter->setBrush(Qt::red);
painter->drawEllipse(-2,-2,4,4);
}
QRectF TrailItem::boundingRect()const
{
return QRectF(-2,-2,4,4);
}
int TrailItem::type()const
{
return Type;
}
}
| [
"jonathan@ebee16cc-31ac-478f-84a7-5cbb03baadba"
] | [
[
[
1,
56
]
]
] |
8c993c2b4751b7025d6daffcab0070ada28d6aa4 | d9d008a8defae1fda50c9f67afcc6c2f117d4957 | /src/Tree/Math.hpp | 09fa85d3ba80007e100e08dd5ec6a731e78f745f | [] | no_license | treeman/My-Minions | efb902b34214ab8103fc573293693e7c8cc7930f | 80f85c15c422fcfae67fa2815a5c4da796ef4450 | refs/heads/master | 2021-01-23T22:15:33.635844 | 2011-05-02T07:42:50 | 2011-05-02T07:42:50 | 1,689,566 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,007 | hpp | #ifndef MATH_HPP_INCLUDED
#define MATH_HPP_INCLUDED
#include <cmath>
#include <cstdlib>
#include <cfloat>
namespace math
{
static const float PI = 3.14159265358979323846f;
static const float PI_2 = 1.57079632679489661923f;
static const float PI_4 = 0.785398163397448309616f;
static const float PI2 = 6.28318530717958647692f;
static const float PI_SQR = 9.8696044010893586188344f;
static const float INVPI = 0.318309886183790671538f;
static const float INV2PI = 0.636619772367581343076f;
template<class T> T interpolate( float dt, const T &x0, const T &x1 )
{
return x0 + ( (x1 - x0) * dt );
}
// 0 > x > 1
inline const float frandom() {
return (float)rand() / (float)RAND_MAX;
}
inline const float frandom( float min, float max ) {
return min + ( frandom() * ( max - min ) );
}
inline const int irandom( int min, int max ) {
return min + (int)( frandom() * ( max - min ) + 1 );
}
template<typename T>
inline const T clip( const T &x, const T &min, const T &max ) {
if( x < min ) return min;
if( x > max ) return max;
return x;
}
template<class Iterator>
Iterator random( Iterator first, Iterator last )
{
//will crash if first == last
if( first == last ) {
return first;
}
int n = 0;
Iterator it = first;
for( ; it != last; ++it ) {
++n;
}
if( n == 1 ) {
return first;
}
int r = math::irandom( 0, n - 1 );
for( int i = 0; i < n; ++i, ++first ) {
if( i == r ) {
return first;
}
}
return first;
}
//transform a range [0-1] to [0-255]
inline float enbyten( float zero_to_one )
{
if( zero_to_one == 0 ) return 0;
else return zero_to_one / 1.0f * 255;
}
}
#endif
| [
"[email protected]"
] | [
[
[
1,
75
]
]
] |
34845939e9e8cb9707cbb5d8625378d9e30d02f9 | f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0 | /Depend/MyGUI/Tools/SkinEditor/CommandManager.h | 9ae830eefd21cffef75a2006b9455d6c360b1167 | [] | 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 | UTF-8 | C++ | false | false | 878 | h | /*!
@file
@author Albert Semenov
@date 08/2010
*/
#ifndef __COMMAND_MANAGER_H__
#define __COMMAND_MANAGER_H__
#include <MyGUI.h>
namespace tools
{
typedef MyGUI::delegates::CMultiDelegate1<const MyGUI::UString&> CommandDelegate;
class CommandManager :
public MyGUI::Singleton<CommandManager>
{
public:
CommandManager();
virtual ~CommandManager();
void initialise();
void shutdown();
void registerCommand(const MyGUI::UString& _command, CommandDelegate::IDelegate* _delegate);
void executeCommand(const MyGUI::UString& _command);
void setCommandData(const MyGUI::UString& _data);
const MyGUI::UString& getCommandData();
private:
typedef std::map<MyGUI::UString, CommandDelegate> MapDelegate;
MapDelegate mDelegates;
MyGUI::UString mData;
};
} // namespace tools
#endif // __COMMAND_MANAGER_H__
| [
"albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c"
] | [
[
[
1,
40
]
]
] |
b584ed4da23d489ec7527a2d70760622fb9c2e01 | ef23e388061a637f82b815d32f7af8cb60c5bb1f | /src/mame/includes/hcastle.h | 0381d0812e14d8aaad05c17d8d9720595333b6aa | [] | 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 | 1,219 | h | /*************************************************************************
Haunted Castle
*************************************************************************/
class hcastle_state : public driver_device
{
public:
hcastle_state(running_machine &machine, const driver_device_config_base &config)
: driver_device(machine, config) { }
/* memory pointers */
UINT8 * m_pf1_videoram;
UINT8 * m_pf2_videoram;
UINT8 * m_paletteram;
// UINT8 * m_spriteram;
// UINT8 * m_spriteram2;
/* video-related */
tilemap_t *m_fg_tilemap;
tilemap_t *m_bg_tilemap;
int m_pf2_bankbase;
int m_pf1_bankbase;
int m_old_pf1;
int m_old_pf2;
int m_gfx_bank;
/* devices */
device_t *m_audiocpu;
device_t *m_k007121_1;
device_t *m_k007121_2;
};
/*----------- defined in video/hcastle.c -----------*/
WRITE8_HANDLER( hcastle_pf1_video_w );
WRITE8_HANDLER( hcastle_pf2_video_w );
READ8_HANDLER( hcastle_gfxbank_r );
WRITE8_HANDLER( hcastle_gfxbank_w );
WRITE8_HANDLER( hcastle_pf1_control_w );
WRITE8_HANDLER( hcastle_pf2_control_w );
PALETTE_INIT( hcastle );
SCREEN_UPDATE( hcastle );
VIDEO_START( hcastle );
| [
"Mike@localhost"
] | [
[
[
1,
47
]
]
] |
4091179340223229e00e5e5b78e766f7c5822693 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/NewWheelDirector/include/Logic/StartLogic.h | a06302f451ebbb691b3830b519a838b370033018 | [] | no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 859 | h | #ifndef __Orz_StartLogic_h__
#define __Orz_StartLogic_h__
#include "WheelLogic.h"
#include "TasksManager.h"
#include "GameLogic.h"
#include "WheelAnimalProcess.h"
namespace Orz
{
//ÓÎÏ·µÄlogo
class StartLogic: public FSM::LogicAdv<StartLogic, GameLogic>//, public UpdateToEnable<LogiLogo>
{
public:
StartLogic(my_context ctx);
~StartLogic(void);
typedef boost::mpl::list< sc::custom_reaction< UpdateEvt > , sc::custom_reaction< LogicEvent::AskTime >,sc::custom_reaction< LogicEvent::HowWin > /*, sc::custom_reaction< SetMode> ,sc::custom_reaction< HowWin >, sc::custom_reaction< AskTime > , */> reactions;
sc::result react(const UpdateEvt & evt) ;
sc::result react(const LogicEvent::HowWin & evt);
sc::result react(const LogicEvent::AskTime & evt);
private:
ProcessPtr _process;
};
}
#endif | [
"[email protected]"
] | [
[
[
1,
30
]
]
] |
94cc7be98c83f69dc2c33fc42e2f6f77155d850c | b84a38aad619acf34c22ed6e6caa0f7b00ebfa0a | /Code/box2d/Source/Dynamics/b2World.cpp | 38d16d75d732844e3f9aa128806f734a351f6f12 | [
"Zlib"
] | permissive | SoylentGraham/Tootle | 4ae4e8352f3e778e3743e9167e9b59664d83b9cb | 17002da0936a7af1f9b8d1699d6f3e41bab05137 | refs/heads/master | 2021-01-24T22:44:04.484538 | 2010-11-03T22:53:17 | 2010-11-03T22:53:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 31,116 | cpp | /*
* Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
*
* 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.
*/
#include "b2World.h"
#include "b2Body.h"
#include "b2Fixture.h"
#include "b2Island.h"
#include "Joints/b2PulleyJoint.h"
#include "Contacts/b2Contact.h"
#include "Contacts/b2ContactSolver.h"
#include "Controllers/b2Controller.h"
#include "../Collision/b2Collision.h"
#include "../Collision/Shapes/b2CircleShape.h"
#include "../Collision/Shapes/b2PolygonShape.h"
#include "../Collision/Shapes/b2EdgeShape.h"
#include <new>
b2ContactFilter b2_defaultFilter;
b2ContactListener b2_defaultListener;
b2World::b2World(const b2AABB& worldAABB, const b2Vec2& gravity, bool doSleep)
{
m_destructionListener = NULL;
m_boundaryListener = NULL;
m_contactFilter = &b2_defaultFilter;
m_contactListener = &b2_defaultListener;
m_debugDraw = NULL;
m_bodyList = NULL;
m_contactList = NULL;
m_jointList = NULL;
m_controllerList = NULL;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_controllerCount = 0;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = doSleep;
m_gravity = gravity;
m_lock = false;
m_inv_dt0 = 0.0f;
m_contactManager.m_world = this;
void* mem = b2Alloc(sizeof(b2BroadPhase));
m_broadPhase = new (mem) b2BroadPhase(worldAABB, &m_contactManager);
b2BodyDef bd;
m_groundBody = CreateBody(&bd);
}
b2World::~b2World()
{
DestroyBody(m_groundBody);
m_broadPhase->~b2BroadPhase();
b2Free(m_broadPhase);
}
void b2World::SetDestructionListener(b2DestructionListener* listener)
{
m_destructionListener = listener;
}
void b2World::SetBoundaryListener(b2BoundaryListener* listener)
{
m_boundaryListener = listener;
}
void b2World::SetContactFilter(b2ContactFilter* filter)
{
m_contactFilter = filter;
}
void b2World::SetContactListener(b2ContactListener* listener)
{
m_contactListener = listener;
}
void b2World::SetDebugDraw(b2DebugDraw* debugDraw)
{
m_debugDraw = debugDraw;
}
b2Body* b2World::CreateBody(const b2BodyDef* def)
{
void* mem = m_blockAllocator.Allocate(sizeof(b2Body));
b2Body* b = new (mem) b2Body(def, this);
// Add to world doubly linked list.
b->m_prev = NULL;
b->m_next = m_bodyList;
if (m_bodyList)
{
m_bodyList->m_prev = b;
}
m_bodyList = b;
++m_bodyCount;
return b;
}
void b2World::DestroyBody(b2Body* b)
{
b2Assert(m_bodyCount > 0);
// Delete the attached joints.
b2JointEdge* jn = b->m_jointList;
while (jn)
{
b2JointEdge* jn0 = jn;
jn = jn->next;
if (m_destructionListener)
{
m_destructionListener->SayGoodbye(jn0->joint);
}
DestroyJoint(jn0->joint);
}
//Detach controllers attached to this body
b2ControllerEdge* ce = b->m_controllerList;
while(ce)
{
b2ControllerEdge* ce0 = ce;
ce = ce->nextController;
ce0->controller->RemoveBody(b);
}
// Delete the attached fixtures. This destroys broad-phase
// proxies and pairs, leading to the destruction of contacts.
b2Fixture* f = b->m_fixtureList;
while (f)
{
b2Fixture* f0 = f;
f = f->m_next;
if (m_destructionListener)
{
m_destructionListener->SayGoodbye(f0);
}
f0->Destroy(&m_blockAllocator, m_broadPhase);
f0->~b2Fixture();
m_blockAllocator.Free(f0, sizeof(b2Fixture));
}
// Remove world body list.
if (b->m_prev)
{
b->m_prev->m_next = b->m_next;
}
if (b->m_next)
{
b->m_next->m_prev = b->m_prev;
}
if (b == m_bodyList)
{
m_bodyList = b->m_next;
}
--m_bodyCount;
b->~b2Body();
m_blockAllocator.Free(b, sizeof(b2Body));
}
b2Joint* b2World::CreateJoint(const b2JointDef* def)
{
b2Joint* j = b2Joint::Create(def, &m_blockAllocator);
// Connect to the world list.
j->m_prev = NULL;
j->m_next = m_jointList;
if (m_jointList)
{
m_jointList->m_prev = j;
}
m_jointList = j;
++m_jointCount;
// Connect to the bodies' doubly linked lists.
j->m_node1.joint = j;
j->m_node1.other = j->m_body2;
j->m_node1.prev = NULL;
j->m_node1.next = j->m_body1->m_jointList;
if (j->m_body1->m_jointList) j->m_body1->m_jointList->prev = &j->m_node1;
j->m_body1->m_jointList = &j->m_node1;
j->m_node2.joint = j;
j->m_node2.other = j->m_body1;
j->m_node2.prev = NULL;
j->m_node2.next = j->m_body2->m_jointList;
if (j->m_body2->m_jointList) j->m_body2->m_jointList->prev = &j->m_node2;
j->m_body2->m_jointList = &j->m_node2;
// If the joint prevents collisions, then reset collision filtering.
if (def->collideConnected == false)
{
// Reset the proxies on the body with the minimum number of fixtures.
b2Body* b = def->body1->m_fixtureCount < def->body2->m_fixtureCount ? def->body1 : def->body2;
for (b2Fixture* f = b->m_fixtureList; f; f = f->m_next)
{
f->RefilterProxy(m_broadPhase, b->GetXForm());
}
}
return j;
}
void b2World::DestroyJoint(b2Joint* j)
{
bool collideConnected = j->m_collideConnected;
// Remove from the doubly linked list.
if (j->m_prev)
{
j->m_prev->m_next = j->m_next;
}
if (j->m_next)
{
j->m_next->m_prev = j->m_prev;
}
if (j == m_jointList)
{
m_jointList = j->m_next;
}
// Disconnect from island graph.
b2Body* body1 = j->m_body1;
b2Body* body2 = j->m_body2;
// Wake up connected bodies.
body1->WakeUp();
body2->WakeUp();
// Remove from body 1.
if (j->m_node1.prev)
{
j->m_node1.prev->next = j->m_node1.next;
}
if (j->m_node1.next)
{
j->m_node1.next->prev = j->m_node1.prev;
}
if (&j->m_node1 == body1->m_jointList)
{
body1->m_jointList = j->m_node1.next;
}
j->m_node1.prev = NULL;
j->m_node1.next = NULL;
// Remove from body 2
if (j->m_node2.prev)
{
j->m_node2.prev->next = j->m_node2.next;
}
if (j->m_node2.next)
{
j->m_node2.next->prev = j->m_node2.prev;
}
if (&j->m_node2 == body2->m_jointList)
{
body2->m_jointList = j->m_node2.next;
}
j->m_node2.prev = NULL;
j->m_node2.next = NULL;
b2Joint::Destroy(j, &m_blockAllocator);
b2Assert(m_jointCount > 0);
--m_jointCount;
// If the joint prevents collisions, then reset collision filtering.
if (collideConnected == false)
{
// Reset the proxies on the body with the minimum number of fixtures.
b2Body* b = body1->m_fixtureCount < body2->m_fixtureCount ? body1 : body2;
for (b2Fixture* f = b->m_fixtureList; f; f = f->m_next)
{
f->RefilterProxy(m_broadPhase, b->GetXForm());
}
}
}
b2Controller* b2World::CreateController( const b2ControllerDef* def)
{
b2Controller* controller = def->Create(&m_blockAllocator);
controller->m_next = m_controllerList;
controller->m_prev = NULL;
if (m_controllerList)
{
m_controllerList->m_prev = controller;
}
m_controllerList = controller;
++m_controllerCount;
controller->m_world = this;
return controller;
}
void b2World::DestroyController(b2Controller* controller)
{
b2Assert(m_controllerCount>0);
if(controller->m_next)
{
controller->m_next->m_prev = controller->m_prev;
}
if(controller->m_prev)
{
controller->m_prev->m_next = controller->m_next;
}
if(controller == m_controllerList)
{
m_controllerList = controller->m_next;
}
--m_controllerCount;
b2Controller::Destroy(controller, &m_blockAllocator);
}
void b2World::Refilter(b2Fixture* fixture)
{
fixture->RefilterProxy(m_broadPhase, fixture->GetBody()->GetXForm());
}
// Find islands, integrate and solve constraints, solve position constraints
void b2World::Solve(const b2TimeStep& step)
{
// Step all controllers
for(b2Controller* controller = m_controllerList; controller; controller = controller->m_next)
{
controller->Step(step);
}
// Size the island for the worst case.
b2Island island(m_bodyCount, m_contactCount, m_jointCount, &m_stackAllocator, m_contactListener);
// Clear all the island flags.
for (b2Body* b = m_bodyList; b; b = b->m_next)
{
b->m_flags &= ~b2Body::e_islandFlag;
}
for (b2Contact* c = m_contactList; c; c = c->m_next)
{
c->m_flags &= ~b2Contact::e_islandFlag;
}
for (b2Joint* j = m_jointList; j; j = j->m_next)
{
j->m_islandFlag = false;
}
// Build and simulate all awake islands.
int32 stackSize = m_bodyCount;
b2Body** stack = (b2Body**)m_stackAllocator.Allocate(stackSize * sizeof(b2Body*));
for (b2Body* seed = m_bodyList; seed; seed = seed->m_next)
{
if (seed->m_flags & (b2Body::e_islandFlag | b2Body::e_sleepFlag | b2Body::e_frozenFlag))
{
continue;
}
if (seed->IsStatic())
{
continue;
}
// Reset island and stack.
island.Clear();
int32 stackCount = 0;
stack[stackCount++] = seed;
seed->m_flags |= b2Body::e_islandFlag;
// Perform a depth first search (DFS) on the constraint graph.
while (stackCount > 0)
{
// Grab the next body off the stack and add it to the island.
b2Body* b = stack[--stackCount];
island.Add(b);
// Make sure the body is awake.
b->m_flags &= ~b2Body::e_sleepFlag;
// To keep islands as small as possible, we don't
// propagate islands across static bodies.
if (b->IsStatic())
{
continue;
}
// Search all contacts connected to this body.
for (b2ContactEdge* cn = b->m_contactList; cn; cn = cn->next)
{
// Has this contact already been added to an island?
// Is this contact non-solid (involves a sensor).
if (cn->contact->m_flags & (b2Contact::e_islandFlag | b2Contact::e_nonSolidFlag | b2Contact::e_invalidFlag | b2Contact::e_destroyFlag))
{
continue;
}
// Is this contact touching?
if ((cn->contact->m_flags & b2Contact::e_touchFlag) == 0)
{
continue;
}
island.Add(cn->contact);
cn->contact->m_flags |= b2Contact::e_islandFlag;
b2Body* other = cn->other;
// Was the other body already added to this island?
if (other->m_flags & b2Body::e_islandFlag)
{
continue;
}
b2Assert(stackCount < stackSize);
stack[stackCount++] = other;
other->m_flags |= b2Body::e_islandFlag;
}
// Search all joints connect to this body.
for (b2JointEdge* jn = b->m_jointList; jn; jn = jn->next)
{
if (jn->joint->m_islandFlag == true)
{
continue;
}
island.Add(jn->joint);
jn->joint->m_islandFlag = true;
b2Body* other = jn->other;
if (other->m_flags & b2Body::e_islandFlag)
{
continue;
}
b2Assert(stackCount < stackSize);
stack[stackCount++] = other;
other->m_flags |= b2Body::e_islandFlag;
}
}
island.Solve(step, m_gravity, m_allowSleep);
// Post solve cleanup.
for (int32 i = 0; i < island.m_bodyCount; ++i)
{
// Allow static bodies to participate in other islands.
b2Body* b = island.m_bodies[i];
if (b->IsStatic())
{
b->m_flags &= ~b2Body::e_islandFlag;
}
}
}
m_stackAllocator.Free(stack);
// Synchronize fixtures, check for out of range bodies.
for (b2Body* b = m_bodyList; b; b = b->GetNext())
{
if (b->m_flags & (b2Body::e_sleepFlag | b2Body::e_frozenFlag))
{
continue;
}
if (b->IsStatic())
{
continue;
}
// Update fixtures (for broad-phase). If the fixtures go out of
// the world AABB then fixtures and contacts may be destroyed,
// including contacts that are
bool inRange = b->SynchronizeFixtures();
// Did the body's fixtures leave the world?
if (inRange == false && m_boundaryListener != NULL)
{
m_boundaryListener->Violation(b);
}
}
// Commit fixture proxy movements to the broad-phase so that new contacts are created.
// Also, some contacts can be destroyed.
m_broadPhase->Commit();
}
// Find TOI contacts and solve them.
void b2World::SolveTOI(const b2TimeStep& step)
{
// Reserve an island and a queue for TOI island solution.
b2Island island(m_bodyCount, b2_maxTOIContactsPerIsland, b2_maxTOIJointsPerIsland, &m_stackAllocator, m_contactListener);
//Simple one pass queue
//Relies on the fact that we're only making one pass
//through and each body can only be pushed/popped once.
//To push:
// queue[queueStart+queueSize++] = newElement;
//To pop:
// poppedElement = queue[queueStart++];
// --queueSize;
int32 queueCapacity = m_bodyCount;
b2Body** queue = (b2Body**)m_stackAllocator.Allocate(queueCapacity* sizeof(b2Body*));
for (b2Body* b = m_bodyList; b; b = b->m_next)
{
b->m_flags &= ~b2Body::e_islandFlag;
b->m_sweep.t0 = 0.0f;
}
for (b2Contact* c = m_contactList; c; c = c->m_next)
{
// Invalidate TOI
c->m_flags &= ~(b2Contact::e_toiFlag | b2Contact::e_islandFlag);
}
for (b2Joint* j = m_jointList; j; j = j->m_next)
{
j->m_islandFlag = false;
}
// Find TOI events and solve them.
for (;;)
{
// Find the first TOI.
b2Contact* minContact = NULL;
float32 minTOI = 1.0f;
for (b2Contact* c = m_contactList; c; c = c->m_next)
{
if (c->m_flags & (b2Contact::e_slowFlag | b2Contact::e_nonSolidFlag | b2Contact::e_invalidFlag | b2Contact::e_destroyFlag))
{
continue;
}
// TODO_ERIN keep a counter on the contact, only respond to M TOIs per contact.
float32 toi = 1.0f;
if (c->m_flags & b2Contact::e_toiFlag)
{
// This contact has a valid cached TOI.
toi = c->m_toi;
}
else
{
// Compute the TOI for this contact.
b2Fixture* s1 = c->GetFixtureA();
b2Fixture* s2 = c->GetFixtureB();
b2Body* b1 = s1->GetBody();
b2Body* b2 = s2->GetBody();
if ((b1->IsStatic() || b1->IsSleeping()) && (b2->IsStatic() || b2->IsSleeping()))
{
continue;
}
// Put the sweeps onto the same time interval.
float32 t0 = b1->m_sweep.t0;
if (b1->m_sweep.t0 < b2->m_sweep.t0)
{
t0 = b2->m_sweep.t0;
b1->m_sweep.Advance(t0);
}
else if (b2->m_sweep.t0 < b1->m_sweep.t0)
{
t0 = b1->m_sweep.t0;
b2->m_sweep.Advance(t0);
}
b2Assert(t0 < 1.0f);
// Compute the time of impact.
toi = c->ComputeTOI(b1->m_sweep, b2->m_sweep);
//b2TimeOfImpact(c->m_fixtureA->GetShape(), b1->m_sweep, c->m_fixtureB->GetShape(), b2->m_sweep);
b2Assert(0.0f <= toi && toi <= 1.0f);
// If the TOI is in range ...
if (0.0f < toi && toi < 1.0f)
{
// Interpolate on the actual range.
toi = b2Min((1.0f - toi) * t0 + toi, 1.0f);
}
c->m_toi = toi;
c->m_flags |= b2Contact::e_toiFlag;
}
if (B2_FLT_EPSILON < toi && toi < minTOI)
{
// This is the minimum TOI found so far.
minContact = c;
minTOI = toi;
}
}
if (minContact == NULL || 1.0f - 100.0f * B2_FLT_EPSILON < minTOI)
{
// No more TOI events. Done!
break;
}
// Advance the bodies to the TOI.
b2Fixture* s1 = minContact->GetFixtureA();
b2Fixture* s2 = minContact->GetFixtureB();
b2Body* b1 = s1->GetBody();
b2Body* b2 = s2->GetBody();
b1->Advance(minTOI);
b2->Advance(minTOI);
// The TOI contact likely has some new contact points.
bool destroyed = m_contactManager.Update(minContact);
if (destroyed)
continue;
minContact->m_flags &= ~b2Contact::e_toiFlag;
// Check if some flags have changed in the user callback
// Any of these mean we should now ignore the collision
if (minContact->m_flags & (b2Contact::e_slowFlag | b2Contact::e_nonSolidFlag | b2Contact::e_invalidFlag | b2Contact::e_destroyFlag))
{
continue;
}
if ((minContact->m_flags & b2Contact::e_touchFlag) == 0)
{
// This shouldn't happen. Numerical error?
//b2Assert(false);
continue;
}
// Build the TOI island. We need a dynamic seed.
b2Body* seed = b1;
if (seed->IsStatic())
{
seed = b2;
}
if (seed->IsStatic())
{
continue;
}
// Reset island and queue.
island.Clear();
int32 queueStart = 0; // starting index for queue
int32 queueSize = 0; // elements in queue
queue[queueStart + queueSize++] = seed;
seed->m_flags |= b2Body::e_islandFlag;
// Perform a breadth first search (BFS) on the contact/joint graph.
while (queueSize > 0)
{
// Grab the next body off the stack and add it to the island.
b2Body* b = queue[queueStart++];
--queueSize;
island.Add(b);
// Make sure the body is awake.
b->m_flags &= ~b2Body::e_sleepFlag;
// To keep islands as small as possible, we don't
// propagate islands across static bodies.
if (b->IsStatic())
{
continue;
}
// Search all contacts connected to this body.
for (b2ContactEdge* cEdge = b->m_contactList; cEdge; cEdge = cEdge->next)
{
// Does the TOI island still have space for contacts?
if (island.m_contactCount == island.m_contactCapacity)
{
continue;
}
// Has this contact already been added to an island? Skip slow or non-solid contacts.
if (cEdge->contact->m_flags & (b2Contact::e_islandFlag | b2Contact::e_slowFlag | b2Contact::e_nonSolidFlag))
{
continue;
}
// Is this contact touching? For performance we are not updating this contact.
if ((cEdge->contact->m_flags & b2Contact::e_touchFlag) == 0)
{
continue;
}
island.Add(cEdge->contact);
cEdge->contact->m_flags |= b2Contact::e_islandFlag;
// Update other body.
b2Body* other = cEdge->other;
// Was the other body already added to this island?
if (other->m_flags & b2Body::e_islandFlag)
{
continue;
}
// March forward, this can do no harm since this is the min TOI.
if (other->IsStatic() == false)
{
other->Advance(minTOI);
other->WakeUp();
}
b2Assert(queueStart + queueSize < queueCapacity);
queue[queueStart + queueSize] = other;
++queueSize;
other->m_flags |= b2Body::e_islandFlag;
}
for (b2JointEdge* jEdge = b->m_jointList; jEdge; jEdge = jEdge->next)
{
if (island.m_jointCount == island.m_jointCapacity)
{
continue;
}
if (jEdge->joint->m_islandFlag == true)
{
continue;
}
island.Add(jEdge->joint);
jEdge->joint->m_islandFlag = true;
b2Body* other = jEdge->other;
if (other->m_flags & b2Body::e_islandFlag)
{
continue;
}
if (!other->IsStatic())
{
other->Advance(minTOI);
other->WakeUp();
}
b2Assert(queueStart + queueSize < queueCapacity);
queue[queueStart + queueSize] = other;
++queueSize;
other->m_flags |= b2Body::e_islandFlag;
}
}
b2TimeStep subStep;
subStep.warmStarting = false;
subStep.dt = (1.0f - minTOI) * step.dt;
subStep.inv_dt = 1.0f / subStep.dt;
subStep.dtRatio = 0.0f;
subStep.velocityIterations = step.velocityIterations;
subStep.positionIterations = step.positionIterations;
island.SolveTOI(subStep);
// Post solve cleanup.
for (int32 i = 0; i < island.m_bodyCount; ++i)
{
// Allow bodies to participate in future TOI islands.
b2Body* b = island.m_bodies[i];
b->m_flags &= ~b2Body::e_islandFlag;
if (b->m_flags & (b2Body::e_sleepFlag | b2Body::e_frozenFlag))
{
continue;
}
if (b->IsStatic())
{
continue;
}
// Update fixtures (for broad-phase). If the fixtures go out of
// the world AABB then fixtures and contacts may be destroyed,
// including contacts that are
bool inRange = b->SynchronizeFixtures();
// Did the body's fixtures leave the world?
if (inRange == false && m_boundaryListener != NULL)
{
m_boundaryListener->Violation(b);
}
// Invalidate all contact TOIs associated with this body. Some of these
// may not be in the island because they were not touching.
for (b2ContactEdge* cn = b->m_contactList; cn; cn = cn->next)
{
cn->contact->m_flags &= ~b2Contact::e_toiFlag;
}
}
for (int32 i = 0; i < island.m_contactCount; ++i)
{
// Allow contacts to participate in future TOI islands.
b2Contact* c = island.m_contacts[i];
c->m_flags &= ~(b2Contact::e_toiFlag | b2Contact::e_islandFlag);
}
for (int32 i = 0; i < island.m_jointCount; ++i)
{
// Allow joints to participate in future TOI islands.
b2Joint* j = island.m_joints[i];
j->m_islandFlag = false;
}
// Commit fixture proxy movements to the broad-phase so that new contacts are created.
// Also, some contacts can be destroyed.
m_broadPhase->Commit();
}
m_stackAllocator.Free(queue);
}
void b2World::Step(float32 dt, int32 velocityIterations, int32 positionIterations)
{
m_lock = true;
b2TimeStep step;
step.dt = dt;
step.velocityIterations = velocityIterations;
step.positionIterations = positionIterations;
if (dt > 0.0f)
{
step.inv_dt = 1.0f / dt;
}
else
{
step.inv_dt = 0.0f;
}
step.dtRatio = m_inv_dt0 * dt;
step.warmStarting = m_warmStarting;
// Update contacts.
m_contactManager.Collide();
// Integrate velocities, solve velocity constraints, and integrate positions.
if (step.dt > 0.0f)
{
Solve(step);
}
// Handle TOI events.
if (m_continuousPhysics && step.dt > 0.0f)
{
SolveTOI(step);
}
// Draw debug information.
DrawDebugData();
if (step.dt > 0.0f)
{
m_inv_dt0 = step.inv_dt;
}
m_lock = false;
}
int32 b2World::Query(const b2AABB& aabb, b2Fixture** fixtures, int32 maxCount)
{
void** results = (void**)m_stackAllocator.Allocate(maxCount * sizeof(void*));
int32 count = m_broadPhase->Query(aabb, results, maxCount);
for (int32 i = 0; i < count; ++i)
{
fixtures[i] = (b2Fixture*)results[i];
}
m_stackAllocator.Free(results);
return count;
}
int32 b2World::Raycast(const b2Segment& segment, b2Fixture** fixtures, int32 maxCount, bool solidShapes, void* userData)
{
m_raycastSegment = &segment;
m_raycastUserData = userData;
m_raycastSolidShape = solidShapes;
void** results = (void**)m_stackAllocator.Allocate(maxCount * sizeof(void*));
int32 count = m_broadPhase->QuerySegment(segment,results,maxCount, &RaycastSortKey);
for (int32 i = 0; i < count; ++i)
{
fixtures[i] = (b2Fixture*)results[i];
}
m_stackAllocator.Free(results);
return count;
}
b2Fixture* b2World::RaycastOne(const b2Segment& segment, float32* lambda, b2Vec2* normal, bool solidShapes, void* userData)
{
int32 maxCount = 1;
b2Fixture* fixture;
int32 count = Raycast(segment, &fixture, maxCount, solidShapes, userData);
if(count==0)
return NULL;
b2Assert(count==1);
//Redundantly do TestSegment a second time, as the previous one's results are inaccessible
fixture->TestSegment(lambda, normal,segment,1);
//We already know it returns true
return fixture;
}
void b2World::DrawShape(b2Fixture* fixture, const b2XForm& xf, const b2Color& color)
{
b2Color coreColor(0.9f, 0.6f, 0.6f);
switch (fixture->GetType())
{
case b2_circleShape:
{
b2CircleShape* circle = (b2CircleShape*)fixture->GetShape();
b2Vec2 center = b2Mul(xf, circle->m_p);
float32 radius = circle->m_radius;
b2Vec2 axis = xf.R.col1;
m_debugDraw->DrawSolidCircle(center, radius, axis, color);
}
break;
case b2_polygonShape:
{
b2PolygonShape* poly = (b2PolygonShape*)fixture->GetShape();
int32 vertexCount = poly->m_vertexCount;
b2Assert(vertexCount <= b2_maxPolygonVertices);
b2Vec2 vertices[b2_maxPolygonVertices];
for (int32 i = 0; i < vertexCount; ++i)
{
vertices[i] = b2Mul(xf, poly->m_vertices[i]);
}
m_debugDraw->DrawSolidPolygon(vertices, vertexCount, color);
}
break;
case b2_edgeShape:
{
b2EdgeShape* edge = (b2EdgeShape*)fixture->GetShape();
m_debugDraw->DrawSegment(b2Mul(xf, edge->GetVertex1()), b2Mul(xf, edge->GetVertex2()), color);
}
break;
}
}
void b2World::DrawJoint(b2Joint* joint)
{
b2Body* b1 = joint->GetBody1();
b2Body* b2 = joint->GetBody2();
const b2XForm& xf1 = b1->GetXForm();
const b2XForm& xf2 = b2->GetXForm();
b2Vec2 x1 = xf1.position;
b2Vec2 x2 = xf2.position;
b2Vec2 p1 = joint->GetAnchor1();
b2Vec2 p2 = joint->GetAnchor2();
b2Color color(0.5f, 0.8f, 0.8f);
switch (joint->GetType())
{
case e_distanceJoint:
m_debugDraw->DrawSegment(p1, p2, color);
break;
case e_pulleyJoint:
{
b2PulleyJoint* pulley = (b2PulleyJoint*)joint;
b2Vec2 s1 = pulley->GetGroundAnchor1();
b2Vec2 s2 = pulley->GetGroundAnchor2();
m_debugDraw->DrawSegment(s1, p1, color);
m_debugDraw->DrawSegment(s2, p2, color);
m_debugDraw->DrawSegment(s1, s2, color);
}
break;
case e_fixedJoint:
{
m_debugDraw->DrawSegment(p1, p2, color);
}
break;
case e_mouseJoint:
// don't draw this
break;
default:
m_debugDraw->DrawSegment(x1, p1, color);
m_debugDraw->DrawSegment(p1, p2, color);
m_debugDraw->DrawSegment(x2, p2, color);
}
}
void b2World::DrawDebugData()
{
if (m_debugDraw == NULL)
{
return;
}
uint32 flags = m_debugDraw->GetFlags();
if (flags & b2DebugDraw::e_shapeBit)
{
for (b2Body* b = m_bodyList; b; b = b->GetNext())
{
const b2XForm& xf = b->GetXForm();
for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext())
{
if (b->IsFrozen())
{
DrawShape(f, xf, b2Color(0.25f, 0.25f, 0.25f));
}
else if (b->IsStatic())
{
DrawShape(f, xf, b2Color(0.5f, 0.9f, 0.5f));
}
else if (b->IsSleeping())
{
DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.9f));
}
else
{
DrawShape(f, xf, b2Color(0.9f, 0.9f, 0.9f));
}
}
}
}
if (flags & b2DebugDraw::e_jointBit)
{
for (b2Joint* j = m_jointList; j; j = j->GetNext())
{
if (j->GetType() != e_mouseJoint)
{
DrawJoint(j);
}
}
}
if (flags & b2DebugDraw::e_controllerBit)
{
for (b2Controller* c = m_controllerList; c; c= c->GetNext())
{
c->Draw(m_debugDraw);
}
}
if (flags & b2DebugDraw::e_pairBit)
{
b2BroadPhase* bp = m_broadPhase;
b2Vec2 invQ;
invQ.Set(1.0f / bp->m_quantizationFactor.x, 1.0f / bp->m_quantizationFactor.y);
b2Color color(0.9f, 0.9f, 0.3f);
for (int32 i = 0; i < b2_tableCapacity; ++i)
{
uint16 index = bp->m_pairManager.m_hashTable[i];
while (index != b2_nullPair)
{
b2Pair* pair = bp->m_pairManager.m_pairs + index;
b2Proxy* p1 = bp->m_proxyPool + pair->proxyId1;
b2Proxy* p2 = bp->m_proxyPool + pair->proxyId2;
b2AABB b1, b2;
b1.lowerBound.x = bp->m_worldAABB.lowerBound.x + invQ.x * bp->m_bounds[0][p1->lowerBounds[0]].value;
b1.lowerBound.y = bp->m_worldAABB.lowerBound.y + invQ.y * bp->m_bounds[1][p1->lowerBounds[1]].value;
b1.upperBound.x = bp->m_worldAABB.lowerBound.x + invQ.x * bp->m_bounds[0][p1->upperBounds[0]].value;
b1.upperBound.y = bp->m_worldAABB.lowerBound.y + invQ.y * bp->m_bounds[1][p1->upperBounds[1]].value;
b2.lowerBound.x = bp->m_worldAABB.lowerBound.x + invQ.x * bp->m_bounds[0][p2->lowerBounds[0]].value;
b2.lowerBound.y = bp->m_worldAABB.lowerBound.y + invQ.y * bp->m_bounds[1][p2->lowerBounds[1]].value;
b2.upperBound.x = bp->m_worldAABB.lowerBound.x + invQ.x * bp->m_bounds[0][p2->upperBounds[0]].value;
b2.upperBound.y = bp->m_worldAABB.lowerBound.y + invQ.y * bp->m_bounds[1][p2->upperBounds[1]].value;
b2Vec2 x1 = 0.5f * (b1.lowerBound + b1.upperBound);
b2Vec2 x2 = 0.5f * (b2.lowerBound + b2.upperBound);
m_debugDraw->DrawSegment(x1, x2, color);
index = pair->next;
}
}
}
if (flags & b2DebugDraw::e_aabbBit)
{
b2BroadPhase* bp = m_broadPhase;
b2Vec2 worldLower = bp->m_worldAABB.lowerBound;
b2Vec2 worldUpper = bp->m_worldAABB.upperBound;
b2Vec2 invQ;
invQ.Set(1.0f / bp->m_quantizationFactor.x, 1.0f / bp->m_quantizationFactor.y);
b2Color color(0.9f, 0.3f, 0.9f);
for (int32 i = 0; i < b2_maxProxies; ++i)
{
b2Proxy* p = bp->m_proxyPool + i;
if (p->IsValid() == false)
{
continue;
}
b2AABB b;
b.lowerBound.x = worldLower.x + invQ.x * bp->m_bounds[0][p->lowerBounds[0]].value;
b.lowerBound.y = worldLower.y + invQ.y * bp->m_bounds[1][p->lowerBounds[1]].value;
b.upperBound.x = worldLower.x + invQ.x * bp->m_bounds[0][p->upperBounds[0]].value;
b.upperBound.y = worldLower.y + invQ.y * bp->m_bounds[1][p->upperBounds[1]].value;
b2Vec2 vs[4];
vs[0].Set(b.lowerBound.x, b.lowerBound.y);
vs[1].Set(b.upperBound.x, b.lowerBound.y);
vs[2].Set(b.upperBound.x, b.upperBound.y);
vs[3].Set(b.lowerBound.x, b.upperBound.y);
m_debugDraw->DrawPolygon(vs, 4, color);
}
b2Vec2 vs[4];
vs[0].Set(worldLower.x, worldLower.y);
vs[1].Set(worldUpper.x, worldLower.y);
vs[2].Set(worldUpper.x, worldUpper.y);
vs[3].Set(worldLower.x, worldUpper.y);
m_debugDraw->DrawPolygon(vs, 4, b2Color(0.3f, 0.9f, 0.9f));
}
if (flags & b2DebugDraw::e_centerOfMassBit)
{
for (b2Body* b = m_bodyList; b; b = b->GetNext())
{
b2XForm xf = b->GetXForm();
xf.position = b->GetWorldCenter();
m_debugDraw->DrawXForm(xf);
}
}
}
void b2World::Validate()
{
m_broadPhase->Validate();
}
int32 b2World::GetProxyCount() const
{
return m_broadPhase->m_proxyCount;
}
int32 b2World::GetPairCount() const
{
return m_broadPhase->m_pairManager.m_pairCount;
}
bool b2World::InRange(const b2AABB& aabb) const
{
return m_broadPhase->InRange(aabb);
}
float32 b2World::RaycastSortKey(void* data)
{
b2Fixture* fixture = (b2Fixture*)data;
b2Body* body = fixture->GetBody();
b2World* world = body->GetWorld();
if (world->m_contactFilter && !world->m_contactFilter->RayCollide(world->m_raycastUserData,fixture))
{
return -1;
}
float32 lambda;
b2SegmentCollide collide = fixture->TestSegment(&lambda, &world->m_raycastNormal, *world->m_raycastSegment, 1);
if (world->m_raycastSolidShape && collide == b2_missCollide)
{
return -1;
}
if (!world->m_raycastSolidShape && collide != b2_hitCollide)
{
return -1;
}
return lambda;
}
| [
"[email protected]"
] | [
[
[
1,
1242
]
]
] |
7b4423d0781b596c634264bd210a4ff5bc837854 | 3785a4fa521ee1f941980b9c2d397d9aa3622727 | /Goop/Font.cpp | 9e89588584250d21ed8267f43c542420d23a3e32 | [] | no_license | Synth3tik0/goop-gui-library | 8b6e0d475c27e0213eb8449d8d38ccf18ce88b6e | 3c8f8eda4aa4d575f15ed8af174268e6e28dc6f3 | refs/heads/master | 2021-01-10T15:05:20.157645 | 2011-08-13T14:29:37 | 2011-08-13T14:29:37 | 49,666,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,052 | cpp | #include "Font.h"
using Goop::Font;
using Goop::FontStyle;
Font::Font(const wchar_t *typeface, int size, FontStyle style)
: m_size(size), m_typeface(0)
{
if(typeface != 0)
m_typeface = _wcsdup(typeface);
LOGFONT lf;
GetObjectA(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf);
m_font = CreateFont(
size,
lf.lfWidth,
lf.lfEscapement,
lf.lfOrientation,
((style & Bold) > 0) ? FW_BOLD : FW_NORMAL,
((style & Italic) > 0) ? true : false,
((style & Underline) > 0) ? true : false,
((style & Strikeout) > 0) ? true : false,
lf.lfCharSet,
lf.lfOutPrecision,
lf.lfClipPrecision,
lf.lfQuality,
lf.lfPitchAndFamily,
(typeface != 0 ? typeface : lf.lfFaceName) );
int err = GetLastError();
}
Font::~Font()
{
free(m_typeface);
DeleteObject(m_font);
}
Font *Font::GetDefault()
{
static Font *font = new Font();
return font;
}
const wchar_t *Font::GetTypeface()
{
return m_typeface;
}
int Font::GetSize()
{
return m_size;
} | [
"kiporshnikov@4a631193-2d15-b5e0-78eb-106c76b1a797"
] | [
[
[
1,
52
]
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.