Jump to content

  • Log In with Google      Sign In   
  • Create Account

EvanV

Member Since 30 Jun 2011
Offline Last Active Jul 26 2012 10:54 PM

Posts I've Made

In Topic: Loading swf files

22 July 2012 - 04:06 PM

Okay, I'm getting closer. What I currently have for getting the function I want is..

[DllImport("libgameswf.dll")]
public static extern void get_movie_info(
[MarshalAs(UnmanagedType.LPStr)]string filename,
ref int ver,
ref int width,
ref int height,
ref float framesPerSecond,
ref int frameCount,
ref int tagCount);

But now I'm getting a DllNotFoundException for some reason. The libgameswf.dll is currently in the debug folder and the main folder but still no luck.

In Topic: Loading swf files

22 July 2012 - 11:11 AM

Definitely nice knowing the format if I have to do it from scratch. But I'm hoping to find some library that I could use to save time. Right now, I'm still checking out GameSWF. It looks like it's exactly what I need. I'm trying to figure out how to import the functions I need from a C++ dll to C# and some of the parameters in the signatures C# doesn't get along with. Take this function signature for example,

void get_movie_info( const char* filename,int* version, int* width, int* height,float* frames_per_second, int* frame_count, int* tag_count); //C++ version

Trying to find the C# equivalent

[DllImport("libgameswf.dll")]
public static extern void get_movie_info(string filename, out int ver, out int width, out int height, out float framesPerSecond, out int frameCount, out int tagCount);

In Topic: Loading swf files

21 July 2012 - 09:54 PM

GameSWF looks like it might be a good choice. But I need to figure out what to PInvoke so I can use it. During my research I also came across Fluix, which is XNA functionality of loading a swf file and playing it. However, XNA loads in assets from the ContentManager and I need to load it from a file.

In Topic: Attaching/Parsing Scripts Functionality

02 February 2012 - 09:11 PM

Just found something that could have been exactly what I was looking for. It is a C# interpreter that would help me extend my classes the way I was planning to (http://eco148-88394.innterhost.net/paxscriptnet/). But it looks like I'll have to purchase it in order to use it. Does anyone have any experience with paxScript or know of anything similar?

In Topic: Access Violation with glDrawElements

30 September 2011 - 04:10 PM

So I got it to work but I'm not quite sure what I did. I took a break and came back, compiled a couple times and it stopped giving me an access violation. I've tried disabling the states right after my glDrawElements several times already but I don't understand why it started working now. But I still can't see the texture on my model yet nor are the lights affecting it.

Here is my end result.

for(int i = m_vMeshes.size() - 1; i >= 0; --i)
	{
		//Make sure texture is loaded, get handle
		std::string szTex; 
		int texHandle;

		//If the mesh has a texture
		if(m_vMeshes[i]->m_vTextureNames.size() != 0)
		{
			szTex = "data/Textures/" + m_vMeshes[i]->m_vTextureNames[0];
			texHandle = CTextureManager::GetInstance()->GetTextureHandle(szTex.c_str());

			//Bind Texture
			if(texHandle != -1)
			{
				glEnable(GL_TEXTURE_2D);
				glActiveTexture(GL_TEXTURE0);
				glBindTexture(GL_TEXTURE_2D, texHandle);
			}
		}
		
	//	Draw Model
		glPushMatrix();
			glEnableClientState( GL_VERTEX_ARRAY );
			glEnableClientState( GL_NORMAL_ARRAY );
			glEnableClientState( GL_TEXTURE_COORD_ARRAY );
						
			glNormalPointer(GL_FLOAT, 0, &m_vMeshes[i]->GetNormals()[0]);
			glTexCoordPointer(2, GL_FLOAT, 0, &m_vMeshes[i]->GetTexCoords()[0]);
			glVertexPointer( 3, GL_FLOAT, 0, &m_vMeshes[i]->GetVertices()[0] ); //NOTE: Remember the [0] at the end when using vectors

			glEnable(GL_LIGHTING);
				glDrawElements( GL_TRIANGLES, (GLsizei)m_vMeshes[i]->GetIndices().size(), GL_UNSIGNED_INT, &m_vMeshes[i]->GetIndices()[0] );

				glDisableClientState(GL_VERTEX_ARRAY);
				glDisableClientState(GL_NORMAL_ARRAY);
				glDisableClientState(GL_TEXTURE_COORD_ARRAY);

			glDisable(GL_LIGHTING);
		glPopMatrix();
	}

PARTNERS