craftworkgames / MonoGame.WpfCore

MonoGame embedded inside a WPF app.
MIT License
71 stars 13 forks source link

Allow multiple `MonoGameContentControl` #9

Closed FaustVX closed 5 months ago

FaustVX commented 2 years ago
damian-666 commented 2 years ago

thanks.. im forked it an merging your changes to my mg3.81 version that has a shared content core... ill put it somewher.. i use tabbed dialogs and now im getting weird isseus with sharp still whne i put this i my ribbon versoin.. i tried marc stans version but its too complex and it has the sample problem, SetSharedHandle method not found, in sharp DX only when i put in my ribbon tab....anywasy this is stronger version...thx... ill put it somewhere even if its not merged...it seems more robust.. tabbed/ docking or custom window calss windon dialogs are because it unloads on each activation... i dont evne remember how got around it last time... but its might leak that donest matter.

damian-666 commented 2 years ago

hey thanks!!! i took your the PR for the wpf contorl , which is in a tagged dialog , dockable i n mine ( worse thatn just doing two instances) merge with mine, stuck, in old docking ribbon level editor thats net6- windows, but has net 4.8 legacy controls , uses a shared net 6 gamecore lib, shared assets, and my MG view works again.. now i FINALLY have my tooling up to Net 6 LTS with no netstandard or 4.8.. in my own code.. multiple tabbed dialogs is still weird and has issues and or leaks.... becasue it unloads and disposes... Marck stan way is to let it leak... but his way is way too complex.. i dont use the GameComponent model.. or input..

before i got a Method not found in CreateRenderTarget. GetSharedHandle..... and its wanst even stepping in to the content control ovveride.. so i spend weeks and tried mark stans version but its too complex. i didnt wanan build MG nad sharp DX.. but now i dont have to .. i just dropped ur version on mine and made it stretch, to overlay my WPF viewport adn now i mix wpf adorners with MG graphics.. perfecto.... the 60 fps limit is gone too if i wanna run my game loop at 2000 fps i can..

FaustVX commented 2 years ago

Hi @damian-666 To be honest, I didn't fully understand what you're saying. I'm not a native English speaker.

So if I understand what you're saying, is that you've had a hard time to make it works with your project, but at the end everything work very well (200fps is really a lot 😄 ) But I don't understand if the issue was on my side, or in your project.

damian-666 commented 2 years ago

. not sure exacly why but its generally looks like a proper upgrade... with good coding practices. Merci beaucoup!!! :) netcore6 wpf is is little different and its was a mysterious SharpDX error... après trop de nuits d'enfer, i finally gave up, came back weeks later . tried ur code, it went away and i could at least see the render target as soon as i dropped your 4 core control files on.

.anywasy its a generallly good PR upgrade and good codeing practice. i dont have nullable context on so i just get a warning ,no problem.

if you are curious about the fps i mentioned i meant on my backgroud update thread as i don't use the monogame DRaw and Update Components or call Monogaem update because its on the UI thread.. ... so i #ifdef that out of your code. i only use the draw call.

the crazy fast update, its still drawing at 60 fps but i can update my physics animation at even 2000 fps with net6 , on a background thread..., but draw at 60 fps the llast finished frame using the lockless producer/ consumer pattern... .. and put the wpf editing grips and adorners stuff overlaid.... . so the mgview content control in hte same canvas , if the transforms are aligned , it lets me do that instead of using WPF to draw the graphics. I still have to adjust the viewports and size but at least i can see what im doing now thx..

FaustVX commented 2 years ago

. not sure exacly why but its generally looks like a proper upgrade... with good coding practices. Merci beaucoup!!! :)

.anywasy its a generallly good PR upgrade and good codeing practice. i dont have nullable context on so i just get a warning ,no problem.

Thanks ;p

So I went to your GH profile, and in fact, what you're saying is that you've had to put my modifications in your own version of MonoGameWPF ? Am I correct ?

damian-666 commented 2 years ago

No it's the nuget package mg 3.81. but I had to chang ethe sample to work with net6..so I also put a Pr in...I just merged.both our prs and put it with mg 3.81 out of.nuget...I don't know if it will break older setups.tho. Upgrading to msg 3.81 is quite a big tooling change.

On Sat, Sep 17, 2022, 10:34 PM FaustVX @.***> wrote:

. not sure exacly why but its generally looks like a proper upgrade... with good coding practices. Merci beaucoup!!! :)

.anywasy its a generallly good PR upgrade and good codeing practice. i dont have nullable context on so i just get a warning ,no problem.

Thanks ;p

So I went to your GH profile, and in fact, what you're saying is that you've had to put my modifications in your own version of MonoGameWPF ? Am I correct ?

— Reply to this email directly, view it on GitHub https://github.com/craftworkgames/MonoGame.WpfCore/pull/9#issuecomment-1250189050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD74XGP2NEAMP2PHFXIHEADV62LU3ANCNFSM5ZGWCAHA . You are receiving this because you were mentioned.Message ID: @.***>

damian-666 commented 2 years ago

U can see my Pr. In the vault uyour Pr is in... Most of my special changes are in the control that based on the wpfcore that's inmy own derived class. With tabbed windows it's a bit harder. ..but anyways I think ur pr should work for anyone , bit not sure if mine will load in net 4.8. .. .that's why lot of mg based git project aren't updated i guess it's very early...it's breaking changes...

On Sat, Sep 17, 2022, 11:20 PM Damian @.***> wrote:

No it's the nuget package mg 3.81. but I had to chang ethe sample to work with net6..so I also put a Pr in...I just merged.both our prs and put it with mg 3.81 out of.nuget...I don't know if it will break older setups.tho. Upgrading to msg 3.81 is quite a big tooling change.

On Sat, Sep 17, 2022, 10:34 PM FaustVX @.***> wrote:

. not sure exacly why but its generally looks like a proper upgrade... with good coding practices. Merci beaucoup!!! :)

.anywasy its a generallly good PR upgrade and good codeing practice. i dont have nullable context on so i just get a warning ,no problem.

Thanks ;p

So I went to your GH profile, and in fact, what you're saying is that you've had to put my modifications in your own version of MonoGameWPF ? Am I correct ?

— Reply to this email directly, view it on GitHub https://github.com/craftworkgames/MonoGame.WpfCore/pull/9#issuecomment-1250189050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD74XGP2NEAMP2PHFXIHEADV62LU3ANCNFSM5ZGWCAHA . You are receiving this because you were mentioned.Message ID: @.***>

DavidFidge commented 1 year ago

I didn't see this before I opened my own pull request to update to MonoGame 3.8.1 and .Net 6. You went a bit further with nullables and the like. Looks very clean.

damian-666 commented 1 year ago

you can alsio try avalonia.inside wiht the dock branch.. its works ok but stiil buggy.. mimare but with view models and react ab too much..

On Fri, Apr 21, 2023 at 8:53 PM David Fidge @.***> wrote:

I didn't see this before I opened my own pull request to update to MonoGame 3.8.1 and .Net 6. You went a bit further with nullables and the like. Looks very clean.

— Reply to this email directly, view it on GitHub https://github.com/craftworkgames/MonoGame.WpfCore/pull/9#issuecomment-1518482039, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD74XGOOEAQZQBOTBCBWI5LXCNBZZANCNFSM5ZGWCAHA . You are receiving this because you were mentioned.Message ID: @.***>

damian-666 commented 1 year ago

and you cant have two windows.. that would need more wokr.. i spornsor him and he fixes stuff fast tho.. mutipalfrom but uiwng gl..on all.

On Sat, Apr 22, 2023 at 9:07 PM Damian @.***> wrote:

you can alsio try avalonia.inside wiht the dock branch.. its works ok but stiil buggy.. mimare but with view models and react ab too much..

On Fri, Apr 21, 2023 at 8:53 PM David Fidge @.***> wrote:

I didn't see this before I opened my own pull request to update to MonoGame 3.8.1 and .Net 6. You went a bit further with nullables and the like. Looks very clean.

— Reply to this email directly, view it on GitHub https://github.com/craftworkgames/MonoGame.WpfCore/pull/9#issuecomment-1518482039, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD74XGOOEAQZQBOTBCBWI5LXCNBZZANCNFSM5ZGWCAHA . You are receiving this because you were mentioned.Message ID: @.***>

joumasehare commented 1 year ago

This definitely works for multiple Windows as well as multiple Viewports in one window. All in the same process.

See my proof attached image

damian-666 commented 4 months ago

Notes: the Avalonia.Dock is being fixed now. the redocking is still broken. im going to wait a bit.,

this addresses a lot of issues and i try to see if there is overlap and if just waiting for someelse to do it in a very basic mimimal was is happening. its not. but the code they sue and architectuer is worth a look.

this is about moving toward avalonia, and also about GraphicsDeviceService , the MVVM itself, is now bound to a Game class. the original was cound to a MonoGameViewModel base class thats how i would like to keep my branch since it have my own key mape and render loop , models and timers.

Playing Songs in is still one at a time. you need a window handle to parent the Medial player. SoundEffects you dont

There should be a control that just renders to the avalonia system and does not require binding to a game or any Binding..

for an out of game IDE i have scaffolding, i might use different UI. the other choice is a full in game render like ImgUI. or bother.

one comment if you undock windows you might want to create a backing surface as big was the desktop. to share it. this was dont in markstans over-engineered version. it has mouse capture and text and too much.

for my game i take input from avalonia and just sysc render. thats it.

now im trying to get an avalonia one as a sample , the ones i see aer using swapchain and or anopenGL with an FBO so no passing bufferes to the GPU.. or writeable bitmap is needed.

but id like to use a GRaphicsDeviceService like this sample doest.  .. here it is being done:

https://github.com/Macabresoft/Macabre2D/commit/1a4d5136b645004015537270647cade16866a639

https://github.com/Macabresoft/Macabre2D/blob/7ab211ead720b00535a46d5d05197159704e46c0/UI/AvaloniaInterop/MonoGameControl.cs

https://github.com/nkast i i see a vulcan version and a dxverion. i would like to use the KNI verion for openGL desktop as some point. it has a better shader mojoshader transpiler . for fx to opengl

silk has an opengl binding.
https://github.com/wieslawsoltes/Dock/issues but the redock is still an issue. . there is a new release.

also the sample of docking is being fixed now..

there is no need to have a game directed class and the Components used by mark stan, and added inths..

i would need a thin launcher and a shared view module. on for dx , one for win GL, and linux and ios.

note.., thsi might go in another vault, i don't want to merge any UI stuff , use Game class or GameComponent, too tightly coupled. or like the key maps but others might want to fork it.

my IDE has it own general keymap. gamepad, thats broken out separately ,, the control is use to get into a avalonica window, shared the same backing , be drawn first , annotated over with avalonia UI.. on the render class i copy the vectors,, as immtupile map to sprite, etc, wth rendertargets. then aligned the viewport /window and draw. on the update i set the viewport and the window to the current zoom.

please sponsor avalonia guys wike Wieslaw the community has stuff but his projects are way too many .. like Dock2d. it has everything an IDE would want..

the KNI branch is good and the monogame branch is is active again but supports console so it harder to maintain
https://github.com/kniEngine/kni/commits/main/

there is compute branch but not there is a ComputeNet project by Microsoft. that is more like cude

Stride is moving to Avalonia _ the same dock ( i linked) but the parts are abir tightly coupled.. the ECS, the undo redo in the viewdole and edit code is mixed with the view code viewModel, tht might be ok.

in stride they bind the viewodels to things like SceneEditorViewModel AssetCompositeHierarchyEditorViewModel
SceneEditorGame

as long s it implemtns IUpdate, ContentLoad, IDraw it shouild be bindible to a class like that. a

MGVVMBase or something.

string is a way from having this working. its very complex. for me i like Core2D but i dont konw if dock will get merged to thata.,

so just adding this so peple aer awarer what others are working on ... this is a dicksterDock allso but its maintained by one person and its has more feature but not as close to the core Avalonia samples and community.