What do you think about my small game made with Window's GDI on WINAPI and C++?

46d18dc92ae7cd35698347bd4b97f0fb
0
andyharglesis 101 Jun 18, 2011 at 07:18

It’s RAW, no tools, no algorithms, no engines, nothing. Purely written, and I know it’s pretty sucky, but, all in all, it’s not so bad.

The source code to the game can be found here: http://13andincrediblycut.wordpress.com/windows-gdi-pixel-game-source-code/

Thanks in advance! XD

12 Replies

Please log in or register to post a reply.

9e12fd9593856942e67ae31463c1223a
0
RedAdder 101 Jun 22, 2011 at 18:04

Well, I see two trees and after following the instructions, I found a key ..
Is that it?

You should use more sensible controls, not ones that need explaining.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jun 22, 2011 at 18:36
SetPixel(hdc, 485, 178, RGB(0, 0, 0));
SetPixel(hdc, 486, 177, RGB(0, 0, 0));
SetPixel(hdc, 487, 176, RGB(0, 0, 0));
SetPixel(hdc, 488, 175, RGB(0, 0, 0));
SetPixel(hdc, 489, 175, RGB(0, 0, 0));
SetPixel(hdc, 490, 175, RGB(0, 0, 0));
SetPixel(hdc, 490, 175, RGB(0, 0, 0));
SetPixel(hdc, 490, 174, RGB(0, 0, 0));
SetPixel(hdc, 490, 173, RGB(0, 0, 0));
SetPixel(hdc, 490, 172, RGB(0, 0, 0));
SetPixel(hdc, 490, 171, RGB(0, 0, 0));
SetPixel(hdc, 490, 170, RGB(0, 0, 0));
SetPixel(hdc, 490, 169, RGB(0, 0, 0));
SetPixel(hdc, 490, 168, RGB(0, 0, 0));
SetPixel(hdc, 491, 168, RGB(0, 0, 0));
SetPixel(hdc, 491, 167, RGB(0, 0, 0));
SetPixel(hdc, 491, 166, RGB(0, 0, 0));
SetPixel(hdc, 492, 165, RGB(0, 0, 0));
SetPixel(hdc, 493, 165, RGB(0, 0, 0));
SetPixel(hdc, 494, 165, RGB(0, 0, 0));
SetPixel(hdc, 495, 165, RGB(0, 0, 0));
SetPixel(hdc, 496, 165, RGB(0, 0, 0));
SetPixel(hdc, 495, 166, RGB(0, 0, 0));
SetPixel(hdc, 494, 167, RGB(0, 0, 0));
SetPixel(hdc, 493, 168, RGB(0, 0, 0));
SetPixel(hdc, 494, 168, RGB(0, 0, 0));
SetPixel(hdc, 495, 168, RGB(0, 0, 0));
SetPixel(hdc, 496, 168, RGB(0, 0, 0));
SetPixel(hdc, 497, 169, RGB(0, 0, 0));
SetPixel(hdc, 496, 170, RGB(0, 0, 0));
SetPixel(hdc, 495, 171, RGB(0, 0, 0));
SetPixel(hdc, 494, 171, RGB(0, 0, 0));
SetPixel(hdc, 493, 172, RGB(0, 0, 0));
SetPixel(hdc, 493, 173, RGB(0, 0, 0));
SetPixel(hdc, 493, 174, RGB(0, 0, 0));
SetPixel(hdc, 493, 175, RGB(0, 0, 0));
SetPixel(hdc, 493, 176, RGB(0, 0, 0));
SetPixel(hdc, 493, 177, RGB(0, 0, 0));
SetPixel(hdc, 493, 178, RGB(0, 0, 0));
SetPixel(hdc, 493, 179, RGB(0, 0, 0));
SetPixel(hdc, 493, 180, RGB(0, 0, 0));
SetPixel(hdc, 493, 181, RGB(0, 0, 0));
SetPixel(hdc, 493, 182, RGB(0, 0, 0));
SetPixel(hdc, 493, 183, RGB(0, 0, 0));
SetPixel(hdc, 493, 184, RGB(0, 0, 0));
SetPixel(hdc, 492, 185, RGB(0, 0, 0));
SetPixel(hdc, 491, 186, RGB(0, 0, 0));
SetPixel(hdc, 490, 187, RGB(0, 0, 0));
SetPixel(hdc, 489, 187, RGB(0, 0, 0));
SetPixel(hdc, 488, 187, RGB(0, 0, 0));
SetPixel(hdc, 487, 187, RGB(0, 0, 0));
SetPixel(hdc, 486, 187, RGB(0, 0, 0));
SetPixel(hdc, 485, 187, RGB(0, 0, 0));
SetPixel(hdc, 484, 187, RGB(0, 0, 0));
SetPixel(hdc, 483, 187, RGB(0, 0, 0));
SetPixel(hdc, 482, 186, RGB(0, 0, 0));
SetPixel(hdc, 482, 185, RGB(0, 0, 0));
SetPixel(hdc, 481, 184, RGB(0, 0, 0));
SetPixel(hdc, 481, 183, RGB(0, 0, 0));
SetPixel(hdc, 481, 182, RGB(0, 0, 0));
SetPixel(hdc, 481, 181, RGB(0, 0, 0));
SetPixel(hdc, 481, 180, RGB(0, 0, 0));
SetPixel(hdc, 481, 179, RGB(0, 0, 0));
SetPixel(hdc, 482, 179, RGB(0, 0, 0));
SetPixel(hdc, 483, 178, RGB(0, 0, 0));
SetPixel(hdc, 484, 179, RGB(0, 0, 0));
SetPixel(hdc, 487, 184, RGB(0, 0, 0));
SetPixel(hdc, 488, 184, RGB(0, 0, 0));
SetPixel(hdc, 489, 183, RGB(0, 0, 0));
SetPixel(hdc, 490, 182, RGB(0, 0, 0));
SetPixel(hdc, 490, 181, RGB(0, 0, 0));
SetPixel(hdc, 490, 180, RGB(0, 0, 0));
SetPixel(hdc, 490, 179, RGB(0, 0, 0));
SetPixel(hdc, 489, 179, RGB(0, 0, 0));
SetPixel(hdc, 488, 179, RGB(0, 0, 0));
SetPixel(hdc, 487, 179, RGB(0, 0, 0));
SetPixel(hdc, 486, 179, RGB(0, 0, 0));
SetPixel(hdc, 486, 180, RGB(0, 0, 0));
SetPixel(hdc, 486, 181, RGB(0, 0, 0));
SetPixel(hdc, 486, 182, RGB(0, 0, 0));
SetPixel(hdc, 486, 183, RGB(0, 0, 0));
SetPixel(hdc, 486, 184, RGB(0, 0, 0));

Gods, man, have you never heard of a bitmap? :surprise:

F861248e62fd7640cb766decacdb1d15
0
Tottel 101 Jun 22, 2011 at 20:12

Or a for-loop at the very least.. :)

Ceee4d1295c32a0c1c08a9eae8c9459d
0
v71 105 Jun 23, 2011 at 17:43

Not bad for a first game, bu yes, use bitmap, setting pixels like that is slooooooooow

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Jun 23, 2011 at 21:59

Haha, the SetPixel-code is epic :D

46d18dc92ae7cd35698347bd4b97f0fb
0
andyharglesis 101 Jan 04, 2012 at 07:44

Epic? Yeah right.

Not bad for a first game, bu yes, use bitmap, setting pixels like that is slooooooooow

Care to explain how to load a bitmap? :P

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 04, 2012 at 18:25

Enthusiastic, have a look at this link.

46d18dc92ae7cd35698347bd4b97f0fb
0
andyharglesis 101 Jan 05, 2012 at 05:04

Reedbeta, I’m sorry if you think I haven’t searched for tutorials(which I have), but none helped.

If a tutorial had helped, why would I have asked how to do it?

Plus, the first result that appears from relisoft is so obscure and everything is assigned into classes that I can’t even break down what the hell I’m supposed to do after the second paragraph - it’s confusing and not straight forward at all, plus I tried it and it just gave errors.

I didn’t really understand it well enough. Same with most other tutorials.

Oh, and please click here: http://bit.ly/Ac0YHG

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 05, 2012 at 06:49

Haha, okay, but note that your one-line question didn’t show any evidence of having done any of your own research. ;) There are lots of people on the internet who seemingly want to be spoonfed all the information and without doing research of their own.

Anywhere, here is a specific link to the Windows API function that loads bitmaps. You can load a .bmp file quite easily by doing:

HBITMAP hbitmap = (HBITMAP)LoadImage(0, "mybitmap.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

Select that into a device context created with CreateCompatibleDC or similar, and blit away. There is an example of doing this on the second link from that Google search, here (see the WM_PAINT handler under the section “Displaying Bitmaps”).

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jan 06, 2012 at 14:21

But, Reedbeta, isn’t he a multiple award winner for his algorithms and assembly code? ;)

46d18dc92ae7cd35698347bd4b97f0fb
0
andyharglesis 101 Jan 06, 2012 at 23:01

:)

6d1c6284507519ddacab9e8242df98f9
0
darksmaster923 101 Jan 09, 2012 at 09:58

You could have at least used a loop :P