Jump to content
Sign in to follow this  
nanobot

C++ And Directx

Recommended Posts

Well, I have been learning some C++ and DirectX 9.0c (Long story) and I made a program.

It loops from 0x00 to 0xBF characters and prints them on the screen. (The Black Box is actually an image I printed a bunch, I was testing FPS.)

In that screenshot FPS is 29. (Probably because the code to loop through all those characters is in my Draw sub. Haven't bothered to move it yet.)

Here is the code for that text. (Looping through all the digits. I know, I made the numbers in Hex.)

Most of this is actually C. I am working on rewriting it.

		char buffer [10];

		char string[1536] = "";

		for (int a = 0x00000000; a <= 0x000000BF; ++a)

		{

			sprintf(buffer, "%X %c | ", a, a);

			strcat(string, buffer);

		}

If anyone has any optimization strategies, I would be happy to know them. I can post the rest of the draw code if you want.

Thanks,

EBrown

post-8532-071823600 1288833221_thumb.png

Share this post


Link to post
Share on other sites

Update, I have gotten it to take an array and render it.

	char oneA[100] = "";

	strcat(oneA, "0");

	char oneB[100] = "";

	strcat(oneB, "1111111111111111111111111111111111111111");

	char oneC[100] = "";

	strcat(oneC, "0");

	char twoA[100] = "";

	strcat(twoA, "0");

	char twoB[100] = "";

	strcat(twoB, "1000000010001000100100101000100010100001");

	char twoC[100] = "";

	strcat(twoC, "0");

	char threeA[100] = "";

	strcat(threeA, "0");

	char threeB[100] = "";

	strcat(threeB, "1000000111111111100100111111111111110001");

	char threeC[100] = "";

	strcat(threeC, "0");

	char fourA[100] = "";

	strcat(fourA, "0");

	char fourB[100] = "";

	strcat(fourB, "1000001010001000100100101000100010001001");

	char fourC[100] = "";

	strcat(fourC, "0");

	char fiveA[100] = "";

	strcat(fiveA, "1111111111111111111111111111111111111111");

	char fiveB[100] = "";

	strcat(fiveB, "1111110010001000111111101000100010000111");

	char fiveC[100] = "";

	strcat(fiveC, "1111111111111111111111111111111111111111");

Basically, it renders an image in a certain color if that spot is a "1".

In this screenshot FPS is 60.

Thanks,

EBrown

post-8532-012127500 1288925061_thumb.png

Share this post


Link to post
Share on other sites

Got some Alpha Blending done. (This screenshot is an image overlayed on top of the background, again, 60 FPS)

The background image is actually 60,127,255, not the 30,64,128 that the image says. (That's what my Alpha did. :) )

I have to do a little bit of math to make my render screen 800x600 as opposed to the actual window being 800x600.

Thanks,

EBrown

post-8532-061759000 1289064778_thumb.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...