Jump to content

  • Log In with Google      Sign In   
  • Create Account


samgj

Member Since 13 Feb 2013
Offline Last Active Jul 25 2014 11:03 AM
-----

#5112775 Viability of Java For Video Games

Posted by samgj on 28 November 2013 - 09:39 AM

Java can be compiled to native machine code with GCJ, so then as long as you use the right libraries it would have the same performance as C++.




#5080946 Open a File as a String in Physics FS

Posted by samgj on 27 July 2013 - 08:15 AM

 

So you actually need something like:

Thanks, the with various versions of the function I tried when a script was runa script, I either got no output or, Python gave me an error like this:

  File "<string>", line 5
    Yr6S\sٶbxض
     ^
SyntaxError: invalid syntax

I now have this:

bool runscript(const char* pyname)
{
 //Loads and runs a specified script

 PHYSFS_File* pyfile = PHYSFS_openRead(pyname);

 if(pyfile != NULL)
 {
  PHYSFS_sint64 filesize = PHYSFS_fileLength(pyfile);
  char* scriptbuffer = new char[ filesize ]; //Create the string the script will be stored in

  PHYSFS_read( pyfile, scriptbuffer, 1, filesize ); //opens the script

  PyRun_SimpleString( scriptbuffer ); //run the requested script. This is a temporary version, the final version will have low level embedding

  delete[] scriptbuffer;

  return true;
 }

 else //if unable to open script
 {
  return false;
 }

}

This new version works. Promit, you had the last two arguments of PHYSFS_read() wrong. It should be size in bytes of each object then number of objects to read.




#5076156 Soviet Itellectual Property

Posted by samgj on 08 July 2013 - 10:28 AM

If something was created inside the Soviet Union, or another nation that no longer exists, is it still protected by copyrights or trademarks?




PARTNERS