Jump to content
SSForum.net is back!

Recommended Posts

Posted (edited)

I think theres something like this in linux, but i made one for windows.

 

I made a custom window form derived off of .net framework that allows you to "throw" your windows around your desktop. It has friction, MinLimit, and DivideRate variables. Dividerate should be between 2 and 4. friction is between 0 and 1, 1 being no friction.

Edited by tcsoccerman
I love lamp
Posted

If you do a single click in the window, it will launch itself real fast (most likely considering the last MouseMove event)

 

If you drop it partially outside of your screen, it bounces left and right over and over (until speed reaches 0)

Posted (edited)

i noticedthat first comment too, so i founda a way to fix it. just reset the velocities on some certain clicks and moves.

 

 

the second one is because i have to invert the xvel and yvel if it gets to a wall, which is why that happens. don't feel like fixing that.

Edited by tcsoccerman
I love lamp
Posted

To fix the first problem, it's pretty simple...

 

I assume you keep a 'previouslocation' coordinate on each MouseMove events, then compare it with the current position on a MouseUp event to determine the velocity?

So to fix the problem, simply set the previouslocation to the currentlocation on the MouseDown event

 

And the second one, yeah... but you simply have to make it check for a right-edge collision only if the velocity is positive, and check for a left-edge collision if negative (same for Y velocity)

Posted (edited)

well what i did was reset the x and y velocity to 0 at certain events.

 

for the second one, thats what i do, but if you think about it deeply and look at my source, you will see why that happens. it's fixable if i create more variables and other stuff, but i just don't feel like worrying so much over a small thing like that.

 

the new version is alot better trust me.

Edited by tcsoccerman
I love lamp
Posted

if(xVel > 0 && xVel < minLimit && yVel > 0 && yVel < minLimit ||
xVel < 0 && xVel > -minLimit && yVel < 0 && yVel > -minLimit)

 

Make that:

if (abs(xVel) > 0 && abs(xVel) < minLimit && abs(yVel) > 0 && abs(yVel) < minLimit)

Might be Math.abs, not sure...

 

 

 

On subject:

if(((this.Location.X  + (int)(xVel)) + this.Width) > Screen.PrimaryScreen.Bounds.Width ||
 (this.Location.X  + (int)(xVel)) < 0)
{
xVel = - xVel;
}
else if(((this.Location.Y  + (int)(yVel)) + this.Height) > Screen.PrimaryScreen.Bounds.Height ||
   (this.Location.Y  + (int)(yVel)) < 0)
{
yVel = - yVel;
}

 

if(((this.Location.X + (int)(xVel)) + this.Width) > Screen.PrimaryScreen.Bounds.Width && xVel > 0 ||

(this.Location.X + (int)(xVel)) < 0 && xVel < 0)

{

xVel = - xVel;

}

else if(((this.Location.Y + (int)(yVel)) + this.Height) > Screen.PrimaryScreen.Bounds.Height && yVel > 0 ||

(this.Location.Y + (int)(yVel)) < 0 && yVel < 0)

{

yVel = - yVel;

}

 

That's what I meant

Posted

um, how do i run it?

theres no readme or instructions or anything

http://i157.photobucket.com/albums/t54/badgersocks/FHTG/FHTG%20-%20redone%20shizniz/tgmember11.png

rootbear75> here is me nude <spoiler tag: Pervert... how many of you actually clicked this?>

Samapico> I actually clicked the spoiler before reading what it was

Corey> I clicked it cause i read what sama said first.

darkreb0rn> I clicked it because I wanted to see you naked...

rootbear75> O.o __________________________________

2:IdleRPG> Mr Snuffleluphagus walked face-first into a tree. This terrible calamity has slowed them 0 days, 00:01:22 from level 18.

2:rootbear75> for fucks sake...

Posted
There's an EXE somewhere, it's just an empty window that you can throw around, it doesn't make you throw around ALL your windows

i found a debug exe, but it crashed upon opening

http://i157.photobucket.com/albums/t54/badgersocks/FHTG/FHTG%20-%20redone%20shizniz/tgmember11.png

rootbear75> here is me nude <spoiler tag: Pervert... how many of you actually clicked this?>

Samapico> I actually clicked the spoiler before reading what it was

Corey> I clicked it cause i read what sama said first.

darkreb0rn> I clicked it because I wanted to see you naked...

rootbear75> O.o __________________________________

2:IdleRPG> Mr Snuffleluphagus walked face-first into a tree. This terrible calamity has slowed them 0 days, 00:01:22 from level 18.

2:rootbear75> for fucks sake...

Posted (edited)

rootbear-make sure you have .net framework installed. i'd also use the bin/debug/testgrounds.exe one

 

edit:

 

ok, i added sam's changes. thank you!

i also added some textbox's to change the settings while using it.

 

from top to buttom these are what they are

 

top textbox-slipperiness. the higher this number the more slippery. 1 there is no friction.

middle - dividerate. sord of confusing just mess around with it. pretty much determines how far it is thrown, 1 being farthest.

buttom - minlimit. determines when to stop moving the form, otherwise it would continue forever, moving ever so slightly.

 

have fun messing around

TestApp.zip

Edited by tcsoccerman
I love lamp
Guest
This topic is now closed to further replies.
×
×
  • Create New...