Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop files onto viewer. Windows and Linux #95

Open
coderextreme opened this issue May 14, 2024 · 7 comments
Open

Drag and drop files onto viewer. Windows and Linux #95

coderextreme opened this issue May 14, 2024 · 7 comments

Comments

@coderextreme
Copy link

From Discord:

Question, can I drag and drop files into the model viewer?

Request approved by Michalis.

@michaliskambi
Copy link
Member

Implementation notes (to self, or to any brave contributor that would like to submit pull request solving this -- we welcome it, it's an easy task, and you can learn Pascal, and GTK or WinAPI, and some Castle Game Engine along the way!) :

On the user side (developer using the engine through TCastleWindow), one can observe the files being dropped using TCastleWindow.OnDropFiles. The castle-model-viewer code already listens and reacts to this event ( https://github.com/castle-engine/castle-model-viewer/blob/master/castle_model_viewer.dpr#L1329 implements DropFiles callback). So, if you do the above-described tasks on the Windows and GTK backends, the rest should "just work" -- castle-model-viewer will react to files being dropped on it.

@coderextreme
Copy link
Author

coderextreme commented May 16, 2024 via email

@coderextreme
Copy link
Author

coderextreme commented May 16, 2024 via email

@michaliskambi
Copy link
Member

Our GTK backend supports only Unix now, not Windows.

Reasons: In principle, GTK works on Windows too, but it required various tweaks, and then context initialization would require to combine GTK + wgl. It is possible, and it was working in the past, but we consciously removed that possibility -- because of low practical usage. In the end, every Windows developer wanted to use WinAPI backend, not GTK. And trying to extend GTK backend by testing only "GTK on Windows" would be doomed, since you should actually test it when users use it, which is on Linux.

So, the simplest answer: You need Linux (real or in virtual machine) to test GTK backend. If you are on Windows, using WSL is actually the simplest way to "get Linux inside your Windows box". But if you are also new to Linux, I advise to just install Linux as a regular system on your computer.

@coderextreme
Copy link
Author

coderextreme commented May 18, 2024 via email

@coderextreme
Copy link
Author

coderextreme commented May 18, 2024

Okay, I have created a new source environment for engine, now going to look at Windows Drag and Drop.

@michaliskambi
Copy link
Member

Note: On Windows the solution is in castle-engine/castle-engine#608 (only pending review now, but looks good :) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants