Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~1K People Reached
Favorite Forums
Favorite Tags
c++ x 11
Member Avatar for loushou

okay i have an array of a struct. [CODE]struct MYSTRUCT { float myFirstVal, mySecondVal, myThirdVal; unsigned char myByte; } int myCountFunction(MYSTRUCT *&myArrayOfStructs) { int myCount; // question area return myCount; } [/CODE] here is my question. how do i count the number of elements in an array of type blah …

Member Avatar for daviddoria
0
135
Member Avatar for loushou

Here is my code of the function in questiion: [CODE]void DrawScene(LPDIRECT3DDEVICE9 p_dx_Device, LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer, LPDIRECT3DINDEXBUFFER9 p_dx_IndexBuffer) { p_dx_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,60), 1.0f, 0); p_dx_Device->BeginScene(); p_dx_Device->SetStreamSource(0, p_dx_VertexBuffer, 0, sizeof(OURCUSTOMVERTEX)); p_dx_Device->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); p_dx_Device->SetIndices(p_dx_IndexBuffer); D3DXMATRIX m_Rotation; D3DXMatrixRotationZ(&m_Rotation, flt_Angle); D3DXMATRIX m_Translation; D3DXMatrixTranslation(&m_Translation, 32, -32, 0); D3DXMATRIX m_World; D3DXMatrixMultiply(&m_World, &m_Translation, &m_Rotation); p_dx_Device->SetTransform(D3DTS_WORLD, &m_World); p_dx_Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, …

Member Avatar for loushou
0
554
Member Avatar for loushou

Here is my code: [CODE]int LoadVerts(char *s_fName, OURCUSTOMVERTEX *p_Verts, short *p_Indices) { long i_CountVerts; long i_CountInds; unsigned char buffer[sizeof(OURCUSTOMVERTEX)]; basic_ifstream<unsigned char> f_DataFile; f_DataFile.open(s_fName, std::ios_base::in | std::ios_base::binary); f_DataFile.read(buffer, sizeof(long)); memcpy(&i_CountVerts, buffer, sizeof(long)); f_DataFile.read(buffer, sizeof(long)); memcpy(&i_CountInds, buffer, sizeof(long)); if ((p_Verts = (OURCUSTOMVERTEX *)realloc(p_Verts, sizeof(OURCUSTOMVERTEX) * i_CountVerts)) == NULL) exit( 1 ); if …

Member Avatar for Salem
0
268
Member Avatar for loushou

Okay... my goal is to start with an array of for instance 5 entries. [CODE]int myArray[5];[/CODE] Then at some point once the array is passed to a function, change the number of entries (example: load a new list of something into the array that has a different number of entries) …

Member Avatar for Narue
0
79
Member Avatar for loushou

So finally after a little waking up i fixed my write to a file in raw binary problem. Now I am trying to load the same data from the file i created. Here is the code I came up with. [CODE]#include <fstream> #include ".\vertexs.h" using namespace std; int LoadVerts(char *s_fName, …

Member Avatar for Duoas
0
106
Member Avatar for loushou

I am trying to dump 2 longs, an array of floats and DWORDs, and an array of shorts into a file, USING BINARY out mode. Here is my code: [CODE]#include <windows.h> #include <fstream> #include ".\vertexs.h" using namespace std; int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { OURCUSTOMVERTEX p_verts[5] …

Member Avatar for Duoas
0
98