- Viewing Profile: Reputation: Nanoha
Community Stats
- Group Members
- Active Posts 774
- Profile Views 2,433
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
Nanoha hasn't added any contacts yet.
#4889508 Displaying text in OpenGL. why so hard?
Posted by Nanoha
on 01 December 2011 - 12:51 PM
Displaying text slowly like you have shouldn't be too difficult. You have 2 strings, one is the text in its entirety, the other is the part your actually showing. Every so often (miliseconds/ticks, whatever time your game uses) you add a little more to the displayed text (substring).
#4870627 [C#] Checking the amount of items in a List?
Posted by Nanoha
on 08 October 2011 - 04:46 PM
bool first = true;
foreach (string items in mInventory.List)
{
if(first)
{
Console.WriteLine(" \"{0}\"", items);
first = false;
}
else
{
Console.WriteLine(", \"{0}\"", items);
}
}
#4865419 3D Movement
Posted by Nanoha
on 24 September 2011 - 02:18 AM
What your doing looks somewhat correct. This might possibly work:
bool movingUp = true; // flag to show if we're moving up or down
float moveSpeed = 1.2f;
float maxY = 20.0f; // Max value y can be
float minY = -20.0f; // min value y can be
while (1)
{
if(movingUp)
{
cube[0][5]._pos.y += 1.20f;
// Chek we've not gone too far and swap direction
if(cube[0][5]._pos.y >= maxY)
{
cube[0][5]._pos.y = maxY
movingUp = false;
}
}
else
{
cube[0][5]._pos.y -= 1.20f;
// Chek we've not gone too far and swap direction
if(cube[0][5]._pos.y <= minY)
{
cube[0][5]._pos.y = minY
movingUp = true;
}
}
}I don't really know what cube[0][5] is so you could be more desriptive with your indices (magic numbers that no one knows what they do), define them with a descriptive name. That code will likely go very fast, possibly making the cube look like its flickering. You could use some kind of time variable and move it based on that instead.
#4863529 Might just be my way of seeing things, but........
Posted by Nanoha
on 19 September 2011 - 03:37 PM
#4862702 Cube Class
Posted by Nanoha
on 17 September 2011 - 01:20 AM
void Cube::Set_Position(Vec3f p)
{
_pos = p;
glPushMatrix();
ci::gl::translate(p);
glPopMatrix();
}The push/pop/translate part does nothing. You push the matrix, translate it but then just pop it again (reverting the changes you just made). you should remove that part.
#4861589 Component Based Entity System Question
Posted by Nanoha
on 14 September 2011 - 09:30 AM
<Entity> <Components> <Graphical> <SceneNode> <Mesh> </Mesh> </SceneNode> </Graphics> </Components> </Entity>
The entity factory checks if it can load a given component type, if it can - then it goes ahead uses its sub factory to do so. As I'm using factories, once the entity factory is initially created, I do longer need to pass around anything like the scene/physics and so the factory can be used pretty much anywhere without problem.
My Graphical component just holds a "SceneNode" pointer, thats enough to do what I need with it (move the visuals mainly).
#4855824 Facts about John Carmack
Posted by Nanoha
on 31 August 2011 - 05:25 AM
Carmack doesn't like to keep doors opened because opened visible portal reduces FPS
Lol, I liked that one.
#4855170 How to find average alpha in texture?
Posted by Nanoha
on 29 August 2011 - 12:56 PM
What kind of values are you getting? Is that 10th mipmap 1 pixel in size?
#4842885 Thread-safe iteration/traversal
Posted by Nanoha
on 31 July 2011 - 12:19 PM
#4836296 variable problems
Posted by Nanoha
on 17 July 2011 - 03:50 AM
const int map_height = 1;
const int map_width = 1;
terrainbox terrain1[map_height][map_width];
Of course they need to be known before you declare your terrain. Otherwise will have to do somethign like:
terrainbox *terrain1 = new terrainbox[map_height*map_width];
// Make sure to delete it at the end with
delete [] terrain1;
terrain1 = NULL;
Althought its declared as just an array (not a 2 dimensional one), indexing should still work but you might have to do this:
terrain1[x][y] now becomes terrain1[x+y*map_width]; (or maybe terrain1[x*map_height+y]; depending if you want your array to be row or column major).
#4833076 GIMP Brush Blending
Posted by Nanoha
on 09 July 2011 - 07:02 AM
#4831046 game programming with librarys
Posted by Nanoha
on 04 July 2011 - 11:08 AM
#4829711 Calculating how much to move to some position
Posted by Nanoha
on 30 June 2011 - 12:42 PM
#4829705 Calculating how much to move to some position
Posted by Nanoha
on 30 June 2011 - 12:25 PM
new_position = old_position + (speed * (target_position - old_position))
step1: new_position = 100 + (1.0f * (338-100))
step2: = new_position = 338
Now im flying!
target_position - old_position needs to be normalized before scaling for speed, it'll end up being eithe -1, 1 or 0 which will work out ok with speed. It makes more sense if these are vectors rather than just numbers.
new_position = old_position + (speed * normalize(target_position - old_position))
step1: new_position = 100 + (1.0f * normalize(338-100))
step2: new_position = 100 + (1.0f * normalize(238))
step3: new_position = 100 + (1.0f * 1))
step4: = new_position = 101
if speed was 10, you'd be at 110 now which makes sense.
#4825348 Desturation as I die...
Posted by Nanoha
on 20 June 2011 - 01:19 AM
- Home
- » Viewing Profile: Reputation: Nanoha

Find content