Author Topic: Mouse  (Read 11972 times)

0 Members and 1 Guest are viewing this topic.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Mouse
« Reply #30 on: December 05, 2010, 02:32:41 pm »
 
That's what you are doing in Powder Game, right?

It's a very good way, but truly complicated to get there. Nice brain ya got

Yes, it's how I'm doing the menu in Powder. Thanks.
« Last Edit: December 05, 2010, 02:33:25 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Mouse
« Reply #31 on: December 05, 2010, 02:34:00 pm »
Yes, it's how I doing the menu in Powder. Thanks.

If I evert get problems in my current code I'll use that, mine is not any of the above referenced, it's a bad one, 10 lines, but I like it

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Mouse
« Reply #32 on: December 05, 2010, 06:13:10 pm »
There's actually a slightly more efficient way of doing it. Let's say that you have a series of buttons arranged vertically, as is common in many GUIs. You could arrange the buttons with a simple algorithm like this:

Code: [Select]
:"WTRSNDMTLSPKOILFIRERS"→Str1
:For(A,0,6
:A*8+5→B
:Text(80,B,3*A+Str1)
:RectI(78,B-1,15,9
:RectI(79,B,13,7
:End

This will display three characters from the string for each button and draw a box around the text. When you go to click on a button, you just have to redo the algorithm with with the Y coordinate.

I love optimizing code. :)

Code: [Select]
:"WTRSNDMTLSPKOILFIRERS"→Str1
:8→A
:While A-1→A
:Text(*8-3→B*256+80)
:Text A*3-3+Str1
:RectI(78,B-1,15,9)
:RectI(79,B,13,7)
:End
« Last Edit: December 05, 2010, 06:27:04 pm by Runer112 »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Mouse
« Reply #33 on: December 05, 2010, 06:14:50 pm »
Cool, mind if I use that?
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Mouse
« Reply #34 on: December 05, 2010, 06:17:46 pm »
Of course, I optimized it so you could use it! (And because I get random impulses to optimize stuff)

EDIT: By the way, I just noticed that -4-Str1 should be -3-Str1. Make sure you got the changed version.

EDIT 2: In actually testing the code, it doesn't work as it should have... let me look into this.

EDIT 3: Found the error and corrected it. I got my argument for the pen movement command backwards so it was trying to draw things at a Y-value of 80. Make sure you get the version that has the line Text(*8-3→B*256+80).

EDIT 4: (Wow this is a lot of edits!) I'm guessing your code does this too, but do you also get the lack of borders between the middle buttons? This would fix it:

Code: [Select]
:"WTRSNDMTLSPKOILFIRERS"→Str1
:8→A+1→C
:While A-1→A
:Text(*8-3→B*256+80)
:Text A*3-3+Str1
:RectI(78,B-1,15,C)
:RectI(79,B,13,8→C-1)
:End
« Last Edit: December 05, 2010, 06:52:13 pm by Runer112 »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Mouse
« Reply #35 on: December 05, 2010, 06:22:57 pm »
Runner, you are one hell of optimizer!

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Mouse
« Reply #36 on: December 05, 2010, 07:08:54 pm »
EDIT 4: (Wow this is a lot of edits!) I'm guessing your code does this too, but do you also get the lack of borders between the middle buttons? This would fix it:
<snip>

I don't actually draw the borders in my code during loading. I added that part for Scout to use.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Mouse
« Reply #37 on: December 06, 2010, 08:44:30 am »
* Qwerty.55 is a helpful person