Sodabread 88 Posting Whiz in Training

Why not just have all items inherit from an 'Item' base class and make a vector of Items? I.E., a helmet is a piece of armor, which is a piece of equipment, which is an item. A healing potion is a potion, which is an item. A +3 vorpal short sword is a sword, which is a weapon, which is equipment, which is an item.

Nick Evan commented: That a step in the right direction +11
Sodabread 88 Posting Whiz in Training

I've recently taken to designing board games in my spare time. It seems like the only project I can actually complete without spending gobs of time looking for people to help just to have them bail anyway.

Sodabread 88 Posting Whiz in Training

Congrats, Jack =) What kinda job?

Sodabread 88 Posting Whiz in Training

I think I may have had it backwards. When you do your resize, try resetting the viewport to use the original client height & width. I.E., if you had your window open at 1024 * 768, use those same numbers on resize. This way, the size of the box/torus/sphere/whatever never changes, but just the way OpenGL views it. I'll take a look at some of my 3D code tonight and make sure, but I think that may work. It's been a while since I've done any good graphics stuff, like 4 years =)

Sodabread 88 Posting Whiz in Training

I think you'll have to reset the viewport on resize. Using the window's size in the viewport *should* give you the desired effect.

Sodabread 88 Posting Whiz in Training

For the most part, I have a lot of respect for Mr. Torvalds for what he's done for FOSS and the OS and development worlds, but this post makes him seem nothing more than a kid who's throwing a temper tantrum because he didn't get his way.

Sodabread 88 Posting Whiz in Training
Sodabread 88 Posting Whiz in Training

Glad to see things are working well. Keep learning & practicing. There's a lot to learn with OpenGL, but it's mostly fun along the way.

Sodabread 88 Posting Whiz in Training

I'd be up for it come the new year. Any chance to make myself a better programmer.

Sodabread 88 Posting Whiz in Training

I have made my own image load function that reads the file extension and loads the image with the appropriate method. but at the moment it can only load bitmaps. and i know now why the image wasn't loading properly, the image was 8 bit but the function was reading it assuming it was 24 bit. how could i discard the pixels that are a certain colour (the colour around the edge)?

You'll need to do some research on "color keys". I've never actually implemented it myself as I've always used .tga files for my OpenGL projects and DirectX has built in color key functionality.

Sodabread 88 Posting Whiz in Training

Read, read code, code. A lot.

Sodabread 88 Posting Whiz in Training

Here's my bmp loader from an older project. Some stuff in here is using C conventions, and some may be deprecated. I'm not sure. I'm still using VS2003 =) I'm including windows.h, gl.h, and glu.h on mostly everything in this project.

void AETextureManager::LoadBMP(const char *filePath)
{
	AETexture *tempTexture = new AETexture;
	tempTexture->SetTexID(curTexID);

	glGenTextures(1, tempTexture->GetTexIDpt());

	tempTexture->SetFilePath(filePath);

	glEnable(GL_TEXTURE_2D);

	glBindTexture(GL_TEXTURE_2D, tempTexture->GetTexID());

	BYTE *bytes = bmpReadBits(tempTexture->GetFilePath(), tempTexture->GetWidthpt(), tempTexture->GetHeightpt());

	if(bytes == NULL)
	{
		MessageBox(NULL, "Broke in \"LoadBMP\"", "Error!", MB_OK);
		return;
	}

	gluBuild2DMipmaps(GL_TEXTURE_2D, 3, tempTexture->GetWidth(), tempTexture->GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, bytes);
	delete [] bytes;

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

	vTextures.push_back(tempTexture);
}

BYTE *AETextureManager::bmpReadBits(const char *filePath, AEuint *iWidth, AEuint *iHeight)
{
	//TODO: Finish up the LoadBMP function, then rock this out and get the dang game started.
	HANDLE handle;
	BITMAPINFO *bmpInfo = NULL;
	AEulong infoSize = 0;
	AEulong bitSize = 0;
	BYTE *bits = NULL;

	handle = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);

	if(handle == INVALID_HANDLE_VALUE)
		return NULL;

	BITMAPFILEHEADER bmpHeader;
	DWORD bytes;
	
	ReadFile(handle, &bmpHeader, sizeof(BITMAPFILEHEADER), &bytes, NULL);

	if(bytes != sizeof(BITMAPFILEHEADER))
		return NULL;

	if(bmpHeader.bfType != 'MB')
		return NULL;

	infoSize = bmpHeader.bfOffBits - sizeof(BITMAPFILEHEADER);
	bmpInfo = (BITMAPINFO *)new BYTE[infoSize];
	
	ReadFile(handle, bmpInfo, infoSize, &bytes, NULL);

	if(bytes != infoSize)
	{
		delete [] bmpInfo;
		CloseHandle(handle);
		return NULL;
	}

	*iWidth = bmpInfo->bmiHeader.biWidth;
	*iHeight = bmpInfo->bmiHeader.biHeight;
	bitSize = bmpInfo->bmiHeader.biSizeImage;

	if(bmpInfo->bmiHeader.biBitCount != 24)
	{
		delete [] bmpInfo;
		return NULL;
	}

	if(bitSize == 0)
		bitSize = (*iWidth * bmpInfo->bmiHeader.biBitCount + 7) / 8 * abs(*iHeight);

	delete [] bmpInfo;
	bits = new BYTE[bitSize];

	if(!ReadFile(handle, bits, bitSize, &bytes, NULL) || bytes …
Sodabread 88 Posting Whiz in Training

When I get home from work, I can post some snippets of my graphics code, 2D and 3D if you want to take a look at it.

Sodabread 88 Posting Whiz in Training

It will take 40 years before everybody knows how to use a PC as the average 45 year old does not know how to use a computer. And when people do get their first pc they want something simple. However with googles system you need to have a great understanding of networking devices to troubleshoot networking problems otherwise your google netbook will be useless or in some cases will result in a higher repair bill as network connectivity problems are very urgent with the google netbook. However if you choose windows or the Free Linux then you can wait a month or two before you fix your internet. In addition you don't have to pay for all of that extra bandwidth which the google netbook will use to continually download and upload all of your files and you can't use large files. What if a person only has access to dialup speed internet (common in Australia) and your working on a CAD project which is 500MB. Just won't happen. That is why Windows and Linux is by far better. Linux is my favorite by the way.

Agreed almost entirely. I think the point behind netbooks is more for those who are always on the go and need to hit wifi spots all over the place, rather than their own home, where a primary desktop/laptop would be that isn't using Chrome OS. At least, I'd hope that people are smart enough not to use Chrome OS as their primary/only system because …

Sodabread 88 Posting Whiz in Training

For C++, I'm finding Professional C++ (Solter & Kleper) to be a pretty interesting read. I'm learning a decent amount about the language that I didn't learn in school.

The Essentials of Computer Organization & Architecture (Null & Lobur) is pretty good.

Design Patterns (Gamma, et al.) is an excellent and, if not mistaken, the industry standard on, well, design patterns.

I haven't read it yet, but I've heard nothing but good things on Hacking: The Art of Explotation (Erickson) is a fantastic first book on security.

Sodabread 88 Posting Whiz in Training

Bitmaps can't use alpha blending. Bitmaps are a max of 24 bits, 8 per channel (RGB) where targas can be 24 bit RGB, or 32 bit RGBA (A for alpha).

Sodabread 88 Posting Whiz in Training

I've got 6 left as well if anyone wants in.

Sodabread 88 Posting Whiz in Training

Sentient - DEBC, off of Dieselboy's System Upgrade album.

Sodabread 88 Posting Whiz in Training

All functions that do not have a return type of 'void' must return a value. To return a value from a function, just do the following:

return variableName;

where variableName is a variable type the same as the return type. This can also be a value, such as:

return 6;

if you're returning an int.

In your main function, where you call the function that should be returning something, you can set a variable to the function such as:

rate = get_pay_rate(Choice);

This will set rate equal to whatever value was returned by the function.

Sodabread 88 Posting Whiz in Training

I game, (try to) make games, watch hockey, skateboard, and pretty much do too much other stuff which drastically reduces the time I have to do anything. I don't know if that made sense.

Sodabread 88 Posting Whiz in Training

It may be better than Windows starter editions, but beyond that, it's going to be useless to most anyone who doesn't use a netbook. And even then, it will be useless to people using netbooks out of WiFi range. Its main advantage, in my opinion, is going to be the fact that it will reduce the cost of particular netbooks even further due to the reduction in necessary hardware.

Sodabread 88 Posting Whiz in Training

I can help on the 2nd and 3rd, but just like the first, you need to put some effort into it first. Show some code and I'll do what I can to help.

Sodabread 88 Posting Whiz in Training

I haven't bought a new copy of Windows since 2003, so I'd probably keep using that one. I'd probably dual boot with new Ubuntu releases or something of the sort, though.

Sodabread 88 Posting Whiz in Training

Let me see if I get your objective correct. You want an application that takes 3 int inputs, h, w and t and creates a "C" in *s where h is the total height, w is the width for the top & bottom parts and t is the thickness which determines both height and width for the center piece?

If so, your for loops are nested backwards and your loop count is wrong.

The nesting should look more like:

for(int i = 0; i < h / 2; i++)
{
    for(int j = 0; j < w; j++)
    {
       cout << "*";
    }
    cout << endl;
}

You'll need to loop the number of times of height / 2, then loop the width for spelling out *s, where you currently have it looping width, then height / 2. This goes for the bottom half too. Your center piece is right, as long as my assumption of what you want is right. If not, please give an example of expected output.

Counting should look like this (at least for this application)

for(int i = 0; i < w; i++)

Also, as another tip, variables defined in for loops go out of scope when the loop ends, so you can use int i & int j for each nest, rather than picking from all over the alphabet. It's a bit cleaner.

Sodabread 88 Posting Whiz in Training

Since I don't have a way to test out your code right now, I can at least point out one possible issue, and I'm also assuming that by DrawSeed, you meant DrawLeaf. You never end your glBegin(GL_QUADS) statement in your DrawLeaf function. That may cause potential problems if you're trying to draw stuff later. I've seen OGL do some funky things when missing a line like that.

Sodabread 88 Posting Whiz in Training

I'll be somewhere in the Caribbean. 12 night cruise honeymoon. Can't wait.

Sodabread 88 Posting Whiz in Training

I started off with C++ Primer Plus and a data structures book (I'll post which later). They seemed to help fairly well. I'm now reading Professional C++ from Wrox, which is nice as it goes a bit deeper into the language and is helping me solidify some of the lesser known/harder to understand concepts.

Sodabread 88 Posting Whiz in Training

Holy Grail holds a special place in my heart because it was my first foray into the world of Monty Python and British comedy in general.

Sodabread 88 Posting Whiz in Training

When your definition of a party is 100+ people in a fire hall playing Counter Strike and Warcraft 3.

Sodabread 88 Posting Whiz in Training

It's gotta be Monty Python & the Holy Grail. I love those Brits, and Gilliam too.

Sodabread 88 Posting Whiz in Training

There are a few issues in here that could cause your output to be incorrect.

First, your keystroke input is generally going to be a lowercase letter, but your data file only uses capital letters. You'll have to error check the input and make the character an uppercase letter. The following is a quick & dirty way to make that happen w/out error checking.

keystroke = *keystroke.c_str() - 32

Second, your assignment is backwards on lines 140-142.

Third, I would recommend only incrementing the count variable when valid input is received, rather than every time it enters that function.

Hope that points you in the right direction. Good luck.

Sodabread 88 Posting Whiz in Training

Greetings, everyone. My name's Travis and I'm primarily a game developer focusing on C++, with a little experience in C#, Java, ASP, .NET, PowerShell, and a few other languages that I don't particularly ever want to use again. I joined up here at DaniWeb to use some of my knowledge to try and help others, and to learn a bit more myself, plus I just want to talk code sometimes ;)

I'm looking forward to some good discussions here. See you all on the boards.

Sodabread 88 Posting Whiz in Training

I have the following code that tests a string to see if it is a palindrome. The only error I am getting is when I try to pass each character to the queue and stack. Is there another way to pass it to each?

//Implement the palindrome-recognition algotithm described in "Simple Applications of the ADT Queue"

#include <iostream>
#include <queue>
#include <stack>
#include <string>


using namespace std;

void isPal(string);

void isPal(string s)
{
	queue <string> aQueue;		
	stack <string> aStack;	
	
	for(int i = 0; i < s.length(); i++)
	{	
	
		aQueue.push(s[i]);               //problem is right 
		aStack.push(s[i]);                // here
	}...

What's your actual error?

Sodabread 88 Posting Whiz in Training

Double posted. My bad.

Sodabread 88 Posting Whiz in Training

The problem is the setting of strSoFar to whatever EnumAll returns and changing what the previous function needs to have in that variable.

Not setting strSoFar in your for loop gives you this effect:

Initial function call: strSoFar = ""
1st recurse: strSoFar = "T"
2nd recurse: strSoFar = "TC"
1st 3rd recurse: strSoFar = "TCC" (print from if statement)
Fall back to 2nd w/out setting strSoFar: strSoFar = "TC"
2nd 3rd recurse: strSoFar = "TCG" (print from if statement)
Fall back to 2nd w/out setting strSoFar: strSoFar = "TC"
3rd 3rd recurse: strSoFar = "TCT" (print from if statement)

Sorry if my numbering is confusing. It's early and I couldn't come up with anything better =)

Recursion is really tricky when you're first starting out, but keep working at it and it will become almost second nature.

Hope that helps you.