Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


xiajia

Member Since 13 Nov 2012
Offline Last Active Jun 06 2013 10:03 PM

Topics I've Started

how to encapsulation the "action"

22 April 2013 - 08:25 PM

there are a lot of "action"s in a game.
some are simple,e.g. the disappearance of a buttom.
and some are complicated.e.g.the disappearance of a button array.
Is there a way to abstract the "action", making it the reuse and modification easy?
e.g.The convergence of the interface elements .Combination of elements of the game action , if the package is suitable , you can make the action more delicate and rich .

about color mix

06 April 2013 - 06:43 AM

Description of the problem are as follows:
the first color1(c1) RGB value is rgb1,
the second color2(c2) RGB value is rgb2,
How to calculate the RGB(rgb3) of the color3(c3) mixed with c1 and c2,the mixing ratio is x: y.
For example:red and green 1:1 mixture is yellow, red and black 1:1 mixture is dark red.


about OpenMP

06 March 2013 - 03:38 AM

I am the beginner of OpenMP.the code below:

 

#include "windows.h"
#include "math.h"
#include <omp.h>
#include <iostream>

int main(void)
{
    double t1 = omp_get_wtime( );
    for(int i = 0;i < 8;i ++)
    {
        float a = 0;
        for(int j = 0;j < 10000000;j++)
        {
            a += sqrtf(j);
        }
    }
    double t2 = omp_get_wtime( );
    std::cout<<"time: "<<t2 - t1<<std::endl;
#pragma omp parallel for
    for(int i = 0;i < 8;i ++)
    {
        float a = 0;
        for(int j = 0;j < 10000000;j++)
        {
            a += sqrtf(j);
        }
    }
    t1 = omp_get_wtime( );
    std::cout<<"time: "<<t1 - t2<<std::endl;
    system("pause");
    return 0;
}
 

when i release with VS2010,and run,there is no upgrade!In some cases , it will decline.i don't know Y?


about "delete" and "delete []"

14 January 2013 - 11:51 PM

code like this:
 

 

 

int * a = new int(0);
int * b = new int(0);
int * c = new int[2];
int * d = new int[2];
int * e = new int[1];
delete a;
delete []b;
delete c;
delete []d;
delete e;

 

The compiler does not prompt "error" or "warning"(vs 2005 at warning level 4).
But such use of "delete" and "delete []" is incorrect according the book(line "delete []b;" and "delete c;").
Is that so?what problem will cause?


How to use bool variable.

24 December 2012 - 12:19 AM

When I use a variable of type bool.People warned me:you'd better written if(a == true) as if(a). I do not know why we must do this. What are the advantages of doing?

My opinion, simply follow the following principles: 'bool' defined variables must be used and can only use 'true' and 'false' initialization and assignment, in the judgment must be written as if (a == true) or if (a== false).
then can avoid all ambiguity and hidden meaning.

Is that true?


PARTNERS