Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 05 Feb 2005
Offline Last Active Oct 02 2013 09:07 AM

#4872578 Strange issue with default deconstructors

Posted by yewbie on 14 October 2011 - 10:51 AM

3) use gflags to temporarily enable 'full heap' option for your process so that you're more likely to get an actual access violation when your heap corruption occurs

I love you, I never even knew this existed!
I found it, I was writing to a array:
int MapPath[200][200]
using a formula to get my cordinates, well due to a quirk in how I wrote my formula I would sometimes get a result outside of my range of 200.
I have fixed the offending formula, I have added range checking, not sure why I didn't to being with!

edit: I love the disclaimer on the bottom of the glflags page:
Note Incorrect use of this tool can degrade system performance or prevent Windows from starting, requiring you to reinstall Windows.

#4867762 Quake 2 MS-VC 6 does not transfer to VS2010 Express

Posted by yewbie on 30 September 2011 - 04:44 PM

Good luck friend, I tried something similar to that with VS2008 after a few hours of fixing syntax bugs and things the compiler was not happy with I gave up =p

#4860230 Looking for some "best practices" advice

Posted by yewbie on 10 September 2011 - 11:18 PM

This is not something based out of a book but something based on my personal experience:

Make sure you know what your making before you make it, I don't know how many times I have ran into a problem because my idea is not fully fleshed out.
Also be aware of feature creep (its a bitch =) )

Make sure you program in such a way that you understand whats going, if you program 10000 lines of code and you dont know whats going on but it works you need to learn some more =)

#4860183 Intro of an up-and-coming game programmer!

Posted by yewbie on 10 September 2011 - 06:57 PM

Heya welcome to the community!
I don't know anything about C# or XNA but welcome and I wish you good luck on your game prospects!
edit: I thought about it, and I wanted to post this too:
I really appreciated people who want to be involved in the community more than people that just drop in to ask a quick question never to be seen again.
I asked many questions on these forums for years, and I try to help as many people as I can, I hope you do the same!

#4855522 Resolution Independence in DirectX

Posted by yewbie on 30 August 2011 - 11:01 AM

Or you could not allow manual window size changes and make people use a interface to change resolutions.

But as far as directx automatically resizing your content based on what your drawing, it depends on how your drawing it.

#4838598 Tile transitions

Posted by yewbie on 21 July 2011 - 01:33 PM

Hey that looks nice!

#4835725 Cross-Platform Help Files?

Posted by yewbie on 15 July 2011 - 11:17 AM

I think the best solution would be to host the help files on your website, if you have to make any changes it will be globally changed.
And it would be much easier to drop a new language help file to your website than to release another revision of your game just for new language localization on a help file =p

#4835673 Drawing a Texture

Posted by yewbie on 15 July 2011 - 08:30 AM

Thanks so much. I just noticed that the MSDN is like a gold cave full of information!

What about the pointers? Do you know any good tutorials that covers mostly about pointers? Exersizes would be great too Posted Image


Cplusplus.com has some really detailed infromation.

#4835374 Drawing a Texture

Posted by yewbie on 14 July 2011 - 12:44 PM

Thanks for the MSDN link Posted Image I can't find the navigation path to DirectX though. Any ideas?

I start from here:

#4835018 C++ Text Input

Posted by yewbie on 13 July 2011 - 03:52 PM

This is my method but it is a little convoluted:

I make a windows resource dialog in ResEdit (code below) for login details

Then I create the dialog on the fly and grab the information from the form when it returns... this involves adding the dialog and having a second message loop so I am not sure how to interface it with allegro.
Also this will only work for windows :/

Login,Password,IP Are declared as global strings
Port is a global int

Called from inside your code you would call it like so:
if (DialogBox(Windows.hInstMain, MAKEINTRESOURCE(IDD_DIALOG1),hWndMain,DialogProc) == IDCANCEL) 
						return 0; // we hit cancel exit program

						Network.Connect(IP, Port);
						Network.SetLogin(Login, Password);


forward declaration for Dialog's message handler
static BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); //dialog message proc

And here is what I use for the dialogproc hander function
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
				//grab our IP and port from our config file	
				SetDlgItemText(hwndDlg, IDC_IPADDRESS, "");
				SetDlgItemInt(hwndDlg, IDC_PORT, 7777, false);
			}return(false); // focus was set

			case WM_COMMAND:
	  		WORD idControl = LOWORD(wParam); // control, identifier 
	  		HWND hwndCtl = (HWND) lParam;  	// handle of control

					case IDOK: // OK button hit!
							// grab the info for username and password
							char username[13];
							char password[13];
							char IPAddress[25];
							int port;

							//username and password and IP
							GetDlgItemText(hwndDlg, IDC_USERNAME, username, 12); //max of 12 characters
							GetDlgItemText(hwndDlg, IDC_PASSWORD, password, 12); //max of 12 characters
							GetDlgItemText(hwndDlg, IDC_IPADDRESS, IPAddress, 25);
							port = GetDlgItemInt(hwndDlg, IDC_PORT, NULL, false);
							Login = username;
							Password = password;
							IP = IPAddress;
							Port = port;
							cout << username << " : " << password << " : " << IPAddress << ":" << port << endl;
							EndDialog(hwndDlg, IDOK); // end this dialog box.
					case IDCANCEL: // cancel button hit!
							EndDialog(hwndDlg, IDCANCEL); // end this dialog box.

 	}//end  switch(uMsg) 
  return(false); // did not process message

include these with your source:
#define IDD_DIALOG1                 			100
#define IDC_USERNAME                        	1006
#define IDC_PASSWORD                        	1007
#define IDC_IPADDRESS               			1008
#define IDC_PORT                            	1009

// Generated by ResEdit
// Copyright (C) 2006-2008
// http://www.resedit.net

#include "login.h"
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

// Dialog resources
IDD_DIALOG1 DIALOG 0, 0, 186, 95
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg 2"
	PUSHBUTTON  	"Cancel", IDCANCEL, 129, 24, 50, 14, BS_PUSHBUTTON
	LTEXT   		"Username", IDC_STATIC, 5, 10, 33, 8, SS_LEFT
	LTEXT   		"Password", IDC_STATIC, 5, 30, 32, 8, SS_LEFT
	LTEXT   		"Server IP Address", IDC_STATIC, 35, 78, 59, 8, SS_LEFT
	LTEXT   		"Port", IDC_STATIC, 139, 80, 14, 8, SS_LEFT

Ends up looking similar to this:

#4834504 Drawing a Texture

Posted by yewbie on 12 July 2011 - 02:59 PM

d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
this turns off direct3d lighting because we are doing it manually.

This enables the alpha channel, so if you have multiple overlapping textures if you change the alpha it will make one of them transparent/

This inverts the source alpha value, and tells us to use destination for blending, im not 100% on these

This I think tells directx to use the alpha of the source and destion on a blend, im not 100% on these

d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
d3ddev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
Not sure on these but I did need them for some reason

Here is a link to to an explantion on some of these:

or even better:


#4834427 Drawing a Texture

Posted by yewbie on 12 July 2011 - 12:28 PM

Your textures need to be in power of 2 sizes for them to work properly.
32x32, 64x64, 128x128, 256x256, 512x512 etc.

if you resize your image to 512x512 with your code it works fine.

I think what directx is doing is scaling the image to make it fix a power of 2 in some way.
I ran it , its up-scaling it to 1024x1024

#4833973 Drawing a Texture

Posted by yewbie on 11 July 2011 - 02:34 PM

Oh wait I think I might just be really dumb.

You used a DWORD for your color instead of D3DCOLOR

Actually its the ordering, it must be in this order

struct CUSTOMVERTEX { float X, Y, Z, RHW; D3DCOLOR COLOR; float U, V; };

just change that line and your code should work.

because when we declare this:

Its telling direct X that we want (raw coordinates, color, texture cordianates)
You were giving it (Raw cordinates, texture cordinates, and dword color) and it was freaking out.

#4833965 Drawing a Texture

Posted by yewbie on 11 July 2011 - 02:23 PM

I removed this please see my very last post, it corrects the problem.

#4833917 Drawing a Texture

Posted by yewbie on 11 July 2011 - 01:16 PM

Strange if it loaded it, it should be fine.

Also depending on your video card textures need to be in power of 2 sizes: 32x32, 64x64, 512x512 etc.
Unless your video card supports them, although I think Directx might take care of this for you if the texture is a strange size.

Could you post your entire code here so I can try to compile it?

edit: you know what im using some different texture states, trying adding these:

//Setup rendering states
	d3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
	d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

	d3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
	d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );