if(): howe much time consuming it is?
I though the statement was the part that the if looks at? Statements can be true or false. If is a function, it does something,it has an input and an output.
It even has its own opcode, with the statement being the input and the output being changing the state and redirecting code excution.
It even has its own opcode, with the statement being the input and the output being changing the state and redirecting code excution.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
I agree since just look at the definition of a function from wikipedia
well you could think of an if statement as the if funtion with the expression inside?
Im sure the guys that chose the naming conventions for thing in programming languages followed the alrady exsisting definition.an abstract entity that associates an input to a corresponding output according to some rule
well you could think of an if statement as the if funtion with the expression inside?
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
I am updating each tile from data array everytime camera change position more than one tile. Sure I can awoid it if I would shift tiles instead of mooving them.
You could draw the tiles based on there x and y position + (or -) the camera position.
And only loop though the tiles that will be on the screen.
Eg:
Code: Select all
//This is not real code....
Tiles[100][100];
TileSize=30? ;
TilesInScreen=15 ;
CamX, CamY;
for (s32 x=CamX/TileSize -1;x<CamX/TileSize +TilesInScreen;++x)
for (s32 y=CamY/TileSize -1;y<CamY/TileSize +TilesInScreen;++y)
{
//(you should check the x and y values are safe)
DrawTile(Tiles[x][y], x*TileSize +CamX, y*TileSize +CamY);
}
btw: sorry if i missed that, but what do you want to use instead of the if-statement ?
i think its a, no its THE fundemental thing in programming to decide wether to go on with the current string of ops or jump to another. well and how do you do it if not by testing a condition? (e.g. assembler has jnz and its.. well i dont know 1 cycle or so...)
i think its a, no its THE fundemental thing in programming to decide wether to go on with the current string of ops or jump to another. well and how do you do it if not by testing a condition? (e.g. assembler has jnz and its.. well i dont know 1 cycle or so...)
worst programming style ever seen...
You can avoid using the if statement using a container without null pointers. It's not the if itself, but looping for a bunch of elements that will never meet the condition.Frodenius wrote:btw: sorry if i missed that, but what do you want to use instead of the if-statement ?
Warchief's Warboard 3D Now hotseat release
Hi,
It is fast indeed.
Code: Select all
cmp eax, 1