Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • The previous thread might be a bit offtopic for these questions so creating a new one was more appropriate.

    This is a basic program I did, in an effort to understand how win32 works. It is supposed to draw a 32x32 box, using a custom function called drawpixel. Additionally when the right mouse button is clicked it is meant to draw a single pixel at 700, 600. But none of the two works as expected. The drawpixel function only draws a 32pixel-long line and the right-click drawing case doesn't work at all. Any ideas?

    (This was also posted in neogaf.com, but didn't get an answer.)


  • Quote

    The drawpixel function only draws a 32pixel-long line

    This is because its inner for loop increments both X and Y at the end of each loop. Additionally, you can enter an infinite loop if the height is greater than the width, but this does not happen as they're hardcoded to 32.

    Quote

    and the right-click drawing case doesn't work at all

    Because you may only draw to the window during WM_PAINT.

    If you require a drawing surface you should create an offscreen DC and bitmap, and bitblt the bitmap onto the window during WM_PAINT. Here's a Please login to see this link.. You should really invest in a Win32 programming book though.

  • The first problem, yeah it needs "x=x-32;" at the end. Spent 7 days on that one... don't know how I missed it. Thanks Chris.

    Books are fine but too many words and I get schizophrenic. Regardless, win32 looks like spaghetti from the outside. Maybe it's simpler once you are inside.

  • You should use new variables inside loops, like this:

    EDIT: Also y = y++ potentially does nothing. You're asking two things in one line, increase y by one (y++) and set y to the old value from before increasing it (y = (y++)).

    Please login to see this picture.

  • Quote from keokeo

    Regardless, win32 looks like spaghetti from the outside. Maybe it's simpler once you are inside.


    Maybe you should try something like Please login to see this link.? Then you don't have to bother with win32, and as an added bonus any code you write will be cross-platform.

  • Actually, it is worse than that: I believe "y = y++" is behaviour which is undefined by the C/C++ standards. It means that even in the same compiler, it could behave differently depending on how it is used.

    (Although I might technically be wrong. Look up sequence points)

    - Please login to see this link./Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!