tototam

Members
  • Content count

    19
  • Joined

  • Last visited

Community Reputation

122 Neutral

About tototam

  • Rank
    Member
  1. how to write testing paper?

    I am doing a Final Year Project at school. My tutor ask us to writing a test script to him. I think it must some test item on the script (e.g. test data), but i don't know how to write it. It is better i have a sample of test script.
  2. can you show me how to write a testing paper? or which items should include in the testing paper? or give me some reference web site
  3. I use the class name as WC_TABCONTROL, #include "windows.h" but it seems not work! error C2065: 'WC_TABCONTROL' : undeclared identifier error C2065: 'TCITEM' : undeclared identifier is it need to load in any DLL file? can you show me some code of using TabControl in VC++(not MFC)?
  4. hungarian notation, anyone use it?

    Quote:Original post by Oluseyi Quote:Original post by Nitage The purpose of hungarian notation is to let you see what type a variable is without looking at its definition.Wrong. The intent of the original Hungarian Notation (aka Apps Hungarian) was to indicate the usage of the data in a variable as a means of promoting good code. Read the links I provided for more information. Unfortunately, Charles Simonyi was Hungarian, so he used the word "type" where he clearly meant "usage," and even though the text of his paper made his meaning clear, it was still misunderstood by the legions who created what is known as Systems Hungarian or Anti-Hungarian Notation. Apps Hungarian is useful in dynamically typed languages; Systems Hungarian is not. Apps Hungarian provides information that resides in the application design, not the code; Systems Hungarian does not. Apps Hungarian allows code to grow, such as changing the actual type of the variable; Systems Hungarian does not, leading to travesties such as lparam in the Win32 code tree (which should be dwparam since the conversion from 16 to 32 bits), a legacy of Win16. The great problem of Hungarian Notation is that most people are familiar with A-NH or Systems Hungarian thanks to the books of Charles Petzold, but not aware that that is a complete misapplication of the system. They rightly reject this system as unproductive and detrimental to code quality, but wrongly lay the blame on Hungarian Notation as a whole. Apps Hungarian is a Good Thing™. I think it may be a gap between the programmers. As you said, Hungarian Notation is "to indicate the usage of the data in a variable as a means of promoting good code", therefore, any programmer can have their own notation. Nowadays, our programs may be maintained by the others, we need the common notation to indicate what type and what usage of the variable. Hungarian Notation may be a good way. Everyone in this forum may note that, as the program and the API develop more, the naming convension is also more complex than that of past. I think most programmers in this forum, they may discover that it is hard to maintain Hungarian Notation inside DirectX program, Microsoft sometimes can't keep using Hungarian Notation in DirectX. For me, I just use Hungarian Notation in some original type, such as sz, n, lp, etc. But if it is a class, i will not use it since it is hard to maintain.
  5. Quote:Original post by derek7 Quote:template<class T> class singleton { public: static T& getInstance() { if(!instance) { instance = new T; } return *instance; } private: static T* instance; }; template<class T> T* singleton<T>::instance = 0; what is "T* singleton<T>::instance = 0;"? it is a function? because have return type T*. it is a memeber of data? because ::instance is static T* instance; it is not a function, it just like the format of declare an object T is a template class. every static instance need to redeclare outside the class
  6. problem of type convention

    how can i change a character array/pointer into a integer and change integer into character array/pointer? it have tried the following: int i = 1024; char ch[] = "HI all"; cout<< char(i); it is nothing to show! cout<< int(ch); 2293584 is shown! help me!!!!!!!!!!!!
  7. Unknown problem

    #include "d3dx9math.h" #pragma comment(lib, "d3dx9.lib") #include "d3d9.h" #pragma comment(lib, "d3d9.lib") #include "d3dx9.h" #pragma comment(lib, "d3dx9.lib") //TWorld must have a IDirect3DDevice9 object class TWorld{ public: TWorld(); TWorld(IDirect3DDevice9 *pd3dDevice); ~TWorld(); //this method overloads the D3DXMatrixRotation functions with D3DTS_WORLD void rotate(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle); //this method rotate with relate to the current angle void rotateRel(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle); void getRotAngle(FLOAT &XAngle, FLOAT &YAngle, FLOAT &ZAngle); //this method overloads the D3DXMatrixTranslation functions with D3DTS_WORLD void move(FLOAT XMove, FLOAT YMove, FLOAT ZMove); //this method translate with relate to the current position void moveRel(FLOAT XMove, FLOAT YMove, FLOAT ZMove); void getMove(FLOAT &XMove, FLOAT &YMove, FLOAT &ZMove); //this method overloads the D3DXMatrixTranslation functions with D3DTS_WORLD void scale(FLOAT XScale, FLOAT YScale, FLOAT ZScale); //this method translate with relate to the current position void scaleRel(FLOAT XScale, FLOAT YScale, FLOAT ZScale); void getScale(FLOAT &XScale, FLOAT &YScale, FLOAT &ZScale); //this method is used when the Device is losed void setDevice(IDirect3DDevice9 *pd3dDevice); //this method is overload the D3DXMAtrixMultiply and do all multiply operation void combinAll(); /* this method is overload the D3DXMAtrixMultiply the order of world combination should be scale -> rotate x -> rotate y -> rotate z -> translate and this method must call the upDate() at the end */ void combin(D3DXMATRIX matIn); //this method is only overload the SetTransformat void upDate(); //this method is only overload the D3DXMatrixIdentity void reset(); private: D3DXMATRIX m_matWorld; D3DXMATRIX m_matRotX, m_matRotY, m_matRotZ, m_matMove, m_matScale; IDirect3DDevice9 *m_pd3dDevice; FLOAT m_XAngle, m_YAngle, m_ZAngle; FLOAT m_XMove, m_YMove, m_ZMove; FLOAT m_XScale, m_YScale, m_ZScale; }; //TView must have a IDirect3DDevice9 object class TView{ public: TView(); TView(IDirect3DDevice9 *pd3dDevice); ~TView(); //this method overloads the D3DXMatrixRotation functions with D3DTS_VIEW void rotate(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle); //this method rotate with relate to the current angle void rotateRel(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle); void getRotAngle(FLOAT &XAngle, FLOAT &YAngle, FLOAT &ZAngle); //this method overloads the D3DXMatrixTranslation functions with D3DTS_WORLD void move(FLOAT XMove, FLOAT YMove, FLOAT ZMove); //this method translate with relate to the current position void moveRel(FLOAT XMove, FLOAT YMove, FLOAT ZMove); void getMove(FLOAT &XMove, FLOAT &YMove, FLOAT &ZMove); //this method is used when the Device is losed void setDevice(IDirect3DDevice9 *pd3dDevice); void setEye(FLOAT x, FLOAT y, FLOAT z); void setPostion(FLOAT x, FLOAT y, FLOAT z); void setYAix(FLOAT x, FLOAT y, FLOAT z); //this method is overload the D3DXMAtrixMultiply and do all multiply operation void combinAll(); /* this method is overload the D3DXMAtrixMultiply the order of world combination should be translation -> rotate z -> rotate y -> rotate x -> scale and this method must call the upDate() at the end */ void combin(D3DXMATRIX matIn); //this method is only overload the SetTransformat void upDate(); //this method is only overload the D3DXMatrixIdentity void reset(); private: D3DXMATRIX m_matView; D3DXMATRIX m_matRotX, m_matRotY, m_matRotZ, m_matMove; IDirect3DDevice9 *m_pd3dDevice; FLOAT m_XAngle, m_YAngle, m_ZAngle; FLOAT m_XMove, m_YMove, m_ZMove; D3DXVECTOR3 m_eye; D3DXVECTOR3 m_at; D3DXVECTOR3 m_up; }; /* You will must use the setDevice Otherwise the projector can't be work */ class TProjector{ public: TProjector(); TProjector(float fov, float aspect, float near, float far); ~TProjector(); void setDevice(IDirect3DDevice9 *pd3dDevice); //fill the data void setPerspective(float fov, float aspect, float near, float far); //setTransform void project(); private: D3DXMATRIX m_matProj; IDirect3DDevice9 *m_pd3dDevice; float m_fovY; float m_aspect; float m_zn; float m_zf; }; TWorld::TWorld(){ reset(); } TWorld::TWorld(IDirect3DDevice9 *pd3dDevice){ reset(); setDevice(pd3dDevice); } TWorld::~TWorld(){ } void TWorld::setDevice(IDirect3DDevice9 *pd3dDevice){ m_pd3dDevice = pd3dDevice; } void TWorld::rotate(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle){ m_XAngle = XAngle; m_YAngle = YAngle; m_ZAngle = ZAngle; D3DXMatrixRotationX(&m_matRotX, m_XAngle); D3DXMatrixRotationY(&m_matRotY, m_YAngle); D3DXMatrixRotationZ(&m_matRotZ, m_ZAngle); } void TWorld::rotateRel(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle){ m_XAngle += XAngle; m_YAngle += YAngle; m_ZAngle += ZAngle; D3DXMatrixRotationX(&m_matRotX, m_XAngle); D3DXMatrixRotationY(&m_matRotY, m_YAngle); D3DXMatrixRotationZ(&m_matRotZ, m_ZAngle); } void TWorld::getRotAngle(FLOAT &XAngle, FLOAT &YAngle, FLOAT &ZAngle){ XAngle = m_XAngle; YAngle = m_YAngle; ZAngle = m_ZAngle; } void TWorld::move(FLOAT XMove, FLOAT YMove, FLOAT ZMove){ m_XMove = XMove; m_YMove = YMove; m_ZMove = ZMove; D3DXMatrixTranslation(&m_matMove, m_XMove, m_YMove, m_ZMove); } void TWorld::moveRel(FLOAT XMove, FLOAT YMove, FLOAT ZMove){ m_XMove += XMove; m_YMove += YMove; m_ZMove += ZMove; D3DXMatrixTranslation(&m_matMove, m_XMove, m_YMove, m_ZMove); } void TWorld::getMove(FLOAT &XMove, FLOAT &YMove, FLOAT &ZMove){ XMove = m_XMove; YMove = m_YMove; ZMove = m_ZMove; } void TWorld::scale(FLOAT XScale, FLOAT YScale, FLOAT ZScale){ m_XScale = XScale; m_YScale = YScale; m_ZScale = ZScale; D3DXMatrixTranslation(&m_matMove, m_XMove, m_YMove, m_ZMove); } void TWorld::scaleRel(FLOAT XScale, FLOAT YScale, FLOAT ZScale){ m_XScale += XScale; m_YScale += YScale; m_ZScale += ZScale; D3DXMatrixScaling(&m_matScale, m_XScale, m_YScale, m_ZScale); } void TWorld::getScale(FLOAT &XScale, FLOAT &YScale, FLOAT &ZScale){ XScale = m_XScale; YScale = m_YScale; ZScale = m_ZScale; } void TWorld::combinAll(){ reset(); D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &m_matScale); D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &m_matRotX); D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &m_matRotY); D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &m_matRotZ); D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &m_matMove); upDate(); } void TWorld::combin(D3DXMATRIX matIn){ D3DXMatrixMultiply(&m_matWorld, &m_matWorld, &matIn); } void TWorld::upDate(){ m_pd3dDevice->SetTransform(D3DTS_WORLD, &m_matWorld); } void TWorld::reset(){ D3DXMatrixIdentity(&m_matWorld); } TView::TView(){ setEye(0, 0, 1); setPostion(0, 0, 0); D3DXMatrixIdentity(&m_matView); } TView::TView(IDirect3DDevice9 *pd3dDevice){ D3DXMatrixIdentity(&m_matView); setDevice(pd3dDevice); upDate(); } TView::~TView(){ } void TView::setDevice(IDirect3DDevice9 *pd3dDevice){ m_pd3dDevice = pd3dDevice; } void TView::rotate(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle){ m_XAngle = XAngle; m_YAngle = YAngle; m_ZAngle = ZAngle; D3DXMatrixRotationX(&m_matRotX, m_XAngle); D3DXMatrixRotationY(&m_matRotY, m_YAngle); D3DXMatrixRotationZ(&m_matRotZ, m_ZAngle); } void TView::rotateRel(FLOAT XAngle, FLOAT YAngle, FLOAT ZAngle){ m_XAngle += XAngle; m_YAngle += YAngle; m_ZAngle += ZAngle; D3DXMatrixRotationX(&m_matRotX, m_XAngle); D3DXMatrixRotationY(&m_matRotY, m_YAngle); D3DXMatrixRotationZ(&m_matRotZ, m_ZAngle); } void TView::getRotAngle(FLOAT &XAngle, FLOAT &YAngle, FLOAT &ZAngle){ XAngle = m_XAngle; YAngle = m_YAngle; ZAngle = m_ZAngle; } void TView::move(FLOAT XMove, FLOAT YMove, FLOAT ZMove){ m_XMove = XMove; m_YMove = YMove; m_ZMove = ZMove; D3DXMatrixTranslation(&m_matMove, m_XMove, m_YMove, m_ZMove); } void TView::moveRel(FLOAT XMove, FLOAT YMove, FLOAT ZMove){ m_XMove += XMove; m_YMove += YMove; m_ZMove += ZMove; D3DXMatrixTranslation(&m_matMove, m_XMove, m_YMove, m_ZMove); } void TView::getMove(FLOAT &XMove, FLOAT &YMove, FLOAT &ZMove){ XMove = m_XMove; YMove = m_YMove; ZMove = m_ZMove; } void TView::setEye(FLOAT x, FLOAT y, FLOAT z){ m_eye.x = x; m_eye.y = y; m_eye.z = z; } void TView::setPostion(FLOAT x, FLOAT y, FLOAT z){ m_at.x = x; m_at.y = y; m_at.z = z; } void TView::setYAix(FLOAT x, FLOAT y, FLOAT z){ m_up.x = x; m_up.y = y; m_up.z = z; } void TView::combinAll(){ reset(); D3DXMatrixMultiply(&m_matView, &m_matView, &m_matMove); D3DXMatrixMultiply(&m_matView, &m_matView, &m_matRotZ); D3DXMatrixMultiply(&m_matView, &m_matView, &m_matRotY); D3DXMatrixMultiply(&m_matView, &m_matView, &m_matRotX); upDate(); } void TView::combin(D3DXMATRIX matIn){ D3DXMatrixMultiply(&m_matView, &m_matView, &matIn); } void TView::upDate(){ D3DXMatrixLookAtLH(&m_matView, &m_eye, &m_at, &m_up); m_pd3dDevice->SetTransform(D3DTS_VIEW, &m_matView); } void TView::reset(){ D3DXMatrixIdentity(&m_matView); } TProjector::TProjector(){ setPerspective(D3DX_PI / 4, 1.0f, 0.5f, 100.0f); } TProjector::TProjector(float fov, float aspect, float near, float far){ setPerspective(fov, aspect, near, //can't complie! syntax error : ',' far); } TProjector::~TProjector(){ } void TProjector::setDevice(IDirect3DDevice9 *pd3dDevice){ m_pd3dDevice = pd3dDevice; } void TProjector::setPerspective(float fov, float aspect, float near, float far) { m_fovY = fov; m_aspect = aspect; m_zf = near; //can't complie! syntax error : ';' m_zn = far; //can't complie! syntax error : ';' } void TProjector::project(){ D3DXMatrixPerspectiveFovLH(&m_matProj, m_fovY, m_aspect, m_zn, m_zf); m_pd3dDevice->SetTransform(D3DTS_PROJECTION, &m_matProj); } I am using Visual C++, i don't know why it can complie There are 3 error Fruny - added source tags.