Sign in to follow this  
Followers 0
SlimShady

Request: Rotate images

11 posts in this topic

#1 ·  Posted (edited)

The topic title is clear.

If you're bored, here's a story why...

This morning at school, a friend showed me a game he made.

Really interesting and great that you can create a working game by typing code.

Makes you wonder how many lines of code Doom III has.

Anyways, he told me he tried to create a Tetris game.

And he gave up because it's too hard and alot of work/code.

Then I thought: Great idea! A tetris clone!

So I started working on it.

1. I assigned HotKeys to the arrow keys.

2. I created a label control with a black background. It became the long bar.

3. using the arrow keys, I could move the label

4. Then I added checks so the label didn't move outside the window

5. I added another 'object'. A 2x2 square.

6. When an object hits the ground, another object should appear at the top

7. Two dilemmas: 1. I can't rotate the labels 2. I can't create the orginal Tetris objects using labels.

For 2nd dilemma, I made images.

(I think I'll make an array so I know when it's an image or label.)

Can you add the ability to rotate a control?

Edit:

Removed typos

Edited by SlimShady

Share this post


Link to post
Share on other sites



I'm sure its possible by overriding the painting process, but I don't recall ever seeing a simple API call to change the orientation of a control. In short, I wouldn't count on seeing that as doing custom/special things with the painting is just a mess.

Share this post


Link to post
Share on other sites

mmm...interesting.

Maybe, 2nd. dilemma:

You could 'construct' every piece with several labels. (An array)

...and to manipulate the positions. :)

Although really it requires more code than simply to rotate an image... :);)

Good luck! :D

Share this post


Link to post
Share on other sites

I'm sure its possible by overriding the painting process, but I don't recall ever seeing a simple API call to change the orientation of a control.  In short, I wouldn't count on seeing that as doing custom/special things with the painting is just a mess.

<{POST_SNAPBACK}>

You're talking with a call from DllCall? :)

Share this post


Link to post
Share on other sites

You say "several labels"...

That requires more thinking, because currently it's just one control (image or label) that moves to the bottom.

Fnishing this, is a real challenge.

But this is nice when I'm bored and it's raining outside...

Share this post


Link to post
Share on other sites

You're talking with a call from DllCall:)

<{POST_SNAPBACK}>

No, I'm talking internal.

Share this post


Link to post
Share on other sites

I knew it would be difficult to do...

And I'm using ControlGetPos in a very sloppy way atm.

A GUI function for it would help me alot.

Share this post


Link to post
Share on other sites

I would use pictures and move the control when you want to rotate it update it with a new picture that has that orientation.

red

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I would use pictures and move the control when you want to rotate it update it with a new picture that has that orientation.

red

<{POST_SNAPBACK}>

I'm doing that now.

But I have a feeling that ControlGetPos caused a new problem.

The width of the control is incorrect.

I'm going to test a little to be sure.

Edit:

I forgot that $Pos[3] contains the height of the control instead of the width.

Edited by SlimShady

Share this post


Link to post
Share on other sites

@josbe:

Looks really good. The code is very advanced.

I'll use it for future reference.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0