CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2012
    Posts
    2

    Unhappy How to accelerate c2flash

    I spent a lot of time to find this tool to convert c++ to flash. So my c++ game can run in explorer. But the last flash swf runs too slow. Is there any way to optimize?

  2. #2
    Join Date
    May 2012
    Location
    Bejing China
    Posts
    6

    Re: How to accelerate c2flash

    En~~~~~, If there is some code that occupies a lot of time,
    and the work can be done parallelly.
    You can try CBlockMemory::ParallelCompute & CBlockMemory::ParallelComputeIf
    to save time.
    The function prototype is
    static int ParallelCompute(CBlockMemory & data1,int data1_start,int data1_step,CBlockMemory & data2,int data2_start,int data2_step,BOOL sign,int width,BOOL float_point,CBlockMemory & data3,int data3_start,int data3_step,int data3_width,EParallelOperator operator_,int count);
    (ParallelComputeIf will be discussed later)
    There are many parameters.
    To explain them, there is an example:

    Getting the sum of an int array.

    int data[]={0,1,2,3,4,5,6,7,8,9};//The array stores data
    int sum;//to get the sum
    sum=0;
    //ParallelCompute acceptes only CBlockMemory,convert
    CBlockMemory data_buffer;
    data_buffer.Write(0,data,sizeof(data));
    CBlockMemory sum_buffer;
    sum_buffer.Write(0,&sum,sizeof(sum));
    //Get sum using ParallelCompute
    CBlockMemory::ParallelCompute(
    sum_buffer,//data1
    0,//data1_start
    0,//data1_step
    data_buffer,//data2
    0,//data2_start
    sizeof(data[0]),//data2_step
    TRUE,//sign
    sizeof(sum)*8,//width
    FALSE,//float_point
    *(CBlockMemory*)NULL,//data3 (not used)
    0,//data3_start
    0,//data3_step
    0,//data3_width,
    PARALLEL_OPERATOR_ADD,//operator_
    sizeof(data)/sizeof(data[0]));//count

    sum_buffer.Read(&sum,sizeof(sum),0);

    //finished, sum is the last result.

  3. #3
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: How to accelerate c2flash

    Quote Originally Posted by zhaolei_swf View Post
    I spent a lot of time to find this tool to convert c++ to flash. So my c++ game can run in explorer. But the last flash swf runs too slow. Is there any way to optimize?
    What is c2flash?

    EDIT: Please post the questions in relevant section.
    Last edited by Ejaz; May 18th, 2012 at 07:11 AM.

  4. #4
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: How to accelerate c2flash

    Quote Originally Posted by zhaolei_cpp View Post
    En~~~~~, If there is some code that occupies a lot of time,
    and the work can be done parallelly.
    You can try CBlockMemory::ParallelCompute & CBlockMemory::ParallelComputeIf
    to save time.
    The function prototype is
    static int ParallelCompute(CBlockMemory & data1,int data1_start,int data1_step,CBlockMemory & data2,int data2_start,int data2_step,BOOL sign,int width,BOOL float_point,CBlockMemory & data3,int data3_start,int data3_step,int data3_width,EParallelOperator operator_,int count);
    (ParallelComputeIf will be discussed later)
    There are many parameters.
    To explain them, there is an example:

    Getting the sum of an int array.

    int data[]={0,1,2,3,4,5,6,7,8,9};//The array stores data
    int sum;//to get the sum
    sum=0;
    //ParallelCompute acceptes only CBlockMemory,convert
    CBlockMemory data_buffer;
    data_buffer.Write(0,data,sizeof(data));
    CBlockMemory sum_buffer;
    sum_buffer.Write(0,&sum,sizeof(sum));
    //Get sum using ParallelCompute
    CBlockMemory::ParallelCompute(
    sum_buffer,//data1
    0,//data1_start
    0,//data1_step
    data_buffer,//data2
    0,//data2_start
    sizeof(data[0]),//data2_step
    TRUE,//sign
    sizeof(sum)*8,//width
    FALSE,//float_point
    *(CBlockMemory*)NULL,//data3 (not used)
    0,//data3_start
    0,//data3_step
    0,//data3_width,
    PARALLEL_OPERATOR_ADD,//operator_
    sizeof(data)/sizeof(data[0]));//count

    sum_buffer.Read(&sum,sizeof(sum),0);

    //finished, sum is the last result.
    What *is* this?

  5. #5
    Join Date
    May 2012
    Location
    Bonn, Germany
    Posts
    43

    Re: How to accelerate c2flash

    He answered to himself, from a different account.
    The same question & answer can be found on codeproject.com!

  6. #6
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: How to accelerate c2flash

    Quote Originally Posted by TomasRiker View Post
    He answered to himself, from a different account.
    The same question & answer can be found on codeproject.com!
    Great

    How much time people have to waste on useless activities like that

  7. #7
    Join Date
    May 2012
    Posts
    2

    Re: How to accelerate c2flash

    I am quite different from zhaolei_cpp, he is a c/c++ programmer, while I am a Flash as programmer. Both of us work for zhaolei company.

  8. #8
    Join Date
    May 2012
    Location
    Bejing China
    Posts
    6

    Re: How to accelerate c2flash

    Quote Originally Posted by TomasRiker View Post
    He answered to himself, from a different account.
    The same question & answer can be found on codeproject.com!
    Hi Tomas, I visited "Derivative Calculator", I believe that if users can input formatted math formula, your calculator could be better. why not just have a try?

    I believe that you are very good at c/c++, but you can not develop a web site calculator just by c/c++.

    by the way three accounts in codeproject is deleted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured