don't click here

WindowsZone

Discussion in 'Fangaming Discussion' started by MainMemory, Mar 31, 2010.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    Interesting... I've never used WPF, but I wonder if this is that much faster because drawing is faster or because it's not looping through all the open windows every frame...
     
  2. Nibble

    Nibble

    Oldbie
    Well, WPF is also hardware-accelerated. In the backend they use Direct3D to render it, with software rendering as a fallback.

    In any case, I can't imagine it taking a lot of time to loop through open windows. I mean, normally the number of open windows isn't very high, compared to how many loop iterations a modern CPU can chew through. Then again, I don't know the inner-workings of Win32 API calls.
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    I don't know much about the internals of Win32 API stuff either, but getting the list itself didn't take too long when I was doing it myself.

    Can I convert WindowsZone to WPF in-place or would I need to start a new project?
     
  4. Nibble

    Nibble

    Oldbie
    Far as I know, WinForms projects cannot be converted automatically. Manually, it'd probably take more work than just starting a new project and copying some of your code over.

    One nice thing is that .xaml files can transfer over directly—for those, it doesn't matter whether the project is C# or VB.NET. You'll have to translate .xaml.cs files though.
     
  5. Conan Kudo

    Conan Kudo

    「真実はいつも一つ!」工藤新一 Member
    478
    1
    18
    GTK# seems to also offer a similar capability. GTK# drawing functions are assisted by Cairo, which can be hardware accelerated. The GTK# package for Microsoft's .NET Framework as well as Mono seem to allow mixing with WinForms, so you could hybridize between the two....

    And as for Window enumeration and position APIs, Linux has wnck-sharp, while you may need to use WinForms/WPF/ManagedWinapi for Windows. Mac OS X has nothing currently.

    It seems you don't actually use much of the ManagedWinapi, so ripping that out for a Linux version might be easier than reimplementing the ManagedWinapi.

    I don't seem to have time right now to do anything though... I've got an argument paper and a speech due next week. And a test next week....
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    I'm getting nowhere with WPF, I have to try to reimplement everything and I can't figure out how to get the objects to draw themselves like they do currently.
     
  7. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    I've updated WindowsZone so that you can give it an INI file as an argument or drop it onto the EXE. I've also fixed the animation editor so that it saves frame times now. I've also added a sprite set for Amy, although she uses (Pink) Sonic's sprites for braking and pushing.

    I don't think that I'll be able to get WPF figured out, but is there a way I could use Direct3D with a transparent BG or something?
     
  8. Conan Kudo

    Conan Kudo

    「真実はいつも一つ!」工藤新一 Member
    478
    1
    18
    I separated out the Cairo binding source code from the rest of the Mono tree and provided an archive containing the Cairo library, the C headers and dev libs, the .NET binding library source code, and the source code of the original Cairo library.

    The archive is available here.

    Documentation of the Cairo binding is available <a href="http://www.go-mono.com/docs/index.aspx?tlink=18@N:Cairo" target="_blank">here</a>.

    If you want to try Cairo to accelerate it with Winforms, this can let you try it without grabbing the whole GTK# package.

    I found a blog post about using Cairo with OpenGL here. The links referring to the Tao Framework website go to a broken site though, here's a link to the SourceForge project page for the Tao Framework.
     
  9. Wombat Wallace

    Wombat Wallace

    Someone. Member
    This program is great. Fun to fool around with when you're bored. I also put together a Sonic 2 version of Sonic for it so I can use either Sonic 3 Sonic or Sonic 2 Sonic. I hope to see some cool updates to it in the future.
     
  10. I think your link my be broken, or at least it won't let me download.

    EDIT: Ah, mistake. This is about the best thing, incredible work!
     
  11. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    It works fine for me. Make sure to right-click the link and use "Save Target As" or "Save Link As" because the server reports the file as a text file for some reason.

    Also, I've made an INI that allows you to play as Motobug, inspired by Polygon Jim's hack.
     
  12. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    Update with an entirely different collision method that checks for the intersection of the bounding rectangle rather than checking if Sonic has moved through the bounds of an object. A major benefit of this is that Sonic will be pushed by a window moving through him.
    I've also introduced a vertical speed limit to prevent Sonic from simply falling through things because he's going too fast.
    Also, there is now an option to stand on the bottom of the screen rather than just dying, and "Show Collision" is now "Show Debug Info", and includes Sonic's position and speed in the upper left corner along with a frame timer.
     
  13. Chaos Knux

    Chaos Knux

    Stable avatar temporary. Randomizer site down. Banned
    Well, at least the old version could load up!
    [​IMG]
    Code (Text):
    1. See the end of this message for details on invoking
    2. just-in-time (JIT) debugging instead of this dialog box.
    3.  
    4. ************** Exception Text **************
    5. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DirectX.DirectInput, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    6. File name: 'Microsoft.DirectX.DirectInput, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    7. &nbsp;&nbsp; at WindowsZone.Controller.UpdateControllerData()
    8. &nbsp;&nbsp; at WindowsZone.Form1.Timer1_Tick(Object sender, EventArgs e) in C:\Users\Mike\Documents\Visual Studio 2008\Projects\WindowsZone\WindowsZone\Form1.vb:line 40
    9. &nbsp;&nbsp; at System.Windows.Forms.Timer.OnTick(EventArgs e)
    10. &nbsp;&nbsp; at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
    11. &nbsp;&nbsp; at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    12.  
    13. WRN: Assembly binding logging is turned OFF.
    14. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    15. Note: There is some performance penalty associated with assembly bind failure logging.
    16. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    17.  
    18.  
    19.  
    20. ************** Loaded Assemblies **************
    21. mscorlib
    22. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    23. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
    24. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    25. ----------------------------------------
    26. WindowsZone
    27. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 1.0.0.0
    28. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 1.0.0.0
    29. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/Documents%20and%20Settings/Daniel/My%20Documents/WindowsZone/WindowsZone.exe
    30. ----------------------------------------
    31. Microsoft.VisualBasic
    32. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 8.0.0.0
    33. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    34. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    35. ----------------------------------------
    36. System
    37. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    38. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    39. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    40. ----------------------------------------
    41. System.Windows.Forms
    42. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    43. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    44. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    45. ----------------------------------------
    46. System.Drawing
    47. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    48. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    49. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    50. ----------------------------------------
    51. System.Runtime.Remoting
    52. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    53. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    54. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    55. ----------------------------------------
    56. System.Core
    57. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 3.5.0.0
    58. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 3.5.30729.1 built by: SP
    59. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
    60. ----------------------------------------
    61. Rat234
    62. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 1.0.0.0
    63. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 1.0.0.0
    64. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/Documents%20and%20Settings/Daniel/My%20Documents/WindowsZone/Rat234.DLL
    65. ----------------------------------------
    66. System.Web
    67. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 2.0.0.0
    68. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    69. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
    70. ----------------------------------------
    71. ManagedWinapi
    72. &nbsp;&nbsp;&nbsp;&nbsp;Assembly Version: 0.3.0.0
    73. &nbsp;&nbsp;&nbsp;&nbsp;Win32 Version: 0.3
    74. &nbsp;&nbsp;&nbsp;&nbsp;CodeBase: file:///C:/Documents%20and%20Settings/Daniel/My%20Documents/WindowsZone/ManagedWinapi.DLL
    75. ----------------------------------------
    76.  
    77. ************** JIT Debugging **************
    78. To enable just-in-time (JIT) debugging, the .config file for this
    79. application or computer (machine.config) must have the
    80. jitDebugging value set in the system.windows.forms section.
    81. The application must also be compiled with debugging
    82. enabled.
    83.  
    84. For example:
    85.  
    86. <configuration>
    87. &nbsp;&nbsp;&nbsp;&nbsp;<system.windows.forms jitDebugging="true" />
    88. </configuration>
    89.  
    90. When JIT debugging is enabled, any unhandled exception
    91. will be sent to the JIT debugger registered on the computer
    92. rather than be handled by this dialog box.
     
  14. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    ...You haven't updated in a while have you?

    Get the DirectX runtime download from the first post.
     
  15. Issue with the Latest build:

    [​IMG]

    All characters do this on my Vista.
     
  16. Wombat Wallace

    Wombat Wallace

    Someone. Member
    Same happens to me on Windows 7, even my custom made character does it. When they push windows, they levitate a bit off the ground and fall back down when they stop.
     
  17. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    Yes, this happens for me too. I think I'll have to go back to the old method. In fact, I think I can start adding objects.

    I'll get gliding/climbing and flying in eventually, I promise!
     
  18. Wombat Wallace

    Wombat Wallace

    Someone. Member
    Sounds promising, I've already started making a custom character that isn't from a Sonic game.
     
  19. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    Update, but this time I had to drop a feature. Sonic can no longer interact with the inside borders of windows.
    But, I have added the first object, a ring. Currently 10 of them spawn at random points on startup, and another one spawns every time you collect one.
    I've also added a HUD with time and ring counters, and a non-functioning score counter.

    Edit: bugfix, now you can let go of the rings and they can spawn properly if you have a screen with a negative position.
     
  20. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,791
    381
    63
    SonLVL
    Here's another update: Debug Mode! Press 'X' on the keyboard and you'll turn into a ring. Use the direction buttons or the mouse to move and press the jump button to place a ring. A minor note about this is that the character will always use the image at "ring\spin1.png" when in debug mode, so make sure there's an image there (there should be unless you changed ring.ini).

    Also, with debug info enabled, the screen you're currently in will be surrounded by an aqua rectangle.

    I've also improved the sound code a bit, eliminated the pause when it loads the audio and preventing it from trying to play a sound if a sound is already playing.