How can I make my 2d app/game fit or scale with all android and iPhone devices? [closed] - c#

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have an app that has normal button on the corners and some in the mid-down and something like a frame covering the buttons.
When I go to Game then change game to simulator and change the device scene(for example iPhone 12), some of the buttons go out of the screen, some of them do not stay in the same position. When I change it to another device screen like "Samsung Galaxy J7" most of the buttons are in the right position but in other devices it is not. I have tried to see YouTube videos and downloaded some scripts but it did not work for me, I tried to use anchors but I could not really understand how to do it.
I am not sure if it is in Unity Player Settings because I checked most of it and I could not find but if it is there please tell.

Editing your Canvas Components (my settings) might help : https://docs.unity3d.com/Packages/com.unity.ugui#1.0/manual/HOWTO-UIMultiResolution.html
Make sure your Canvas Render Mode: Screen Space Camera then attach your camera.
Set the UI Scale mode: Scale with Screen Size.
Set your Button Anchors according to your needs.

Related

i am making a raycast from the cursor plz help unity 3d [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm trying to make a ray cast from the Cursor PLZ HELP
this is unity 3d
iv looked every where got nothing
btw the camera it standing still its not a movent camera
Have a look at the Unity Docs for this. It is built in functionality
https://docs.unity3d.com/ScriptReference/Camera.ScreenToWorldPoint.html
You can get the cursor position by using Input.mousePosition.x and Input.mousePosition.y
Also take a look at this question
Getting mouse position in unity
I would try to implement IPointerClickHandler
Beware that, as adviced in the docs:
1.- Ensure an Event System exists in the Scene to allow click detection
2.- For click detection on non-UI GameObjects, ensure a PhysicsRaycaster is attached to the Camera
There is a very simple example in the documentation which you can try to implement and once you make it work, adapt or extend that to your needs.

Simplest way to display colored 3D boxes in winforms [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 3 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Improve this question
For a project I want to display a 3D scene with boxes in a winform application. For each box I want to set the length/width/height x/y/z coordinates and the color.I want this to be as simple as possible, although the user should be able to rotate the scene with the mouse.
I've been doing a lot of googling, but all solutions that I find are way more complicated than I believe they need to be. Every example makes you draw every point and every vertice yourself.
The closest I've come to a simple solution is the SharpGL library with the scenecontrol. There you can simple code:
var cube = new Cube();
cube.Transformation.ScaleX = 0.3f;
cube.Transformation.ScaleY = 0.2f;
cube.Transformation.ScaleZ = 0.4f;
cube.Transformation.TranslateX = 1f;
cube.Transformation.TranslateX = 2f;
cube.Transformation.TranslateX = 3f;
sceneControl1.Scene.SceneContainer.AddChild(cube);
But I'm unable to find out how to add color and user controls. I found almost no documentation of this library.
Shouldn't there be a really simple library where you can just code something like:
Scene.AddBox(length, width, height, x, y, z, Rx, Ry, Rx, color)
Or am I missing something? I hope someone can point me in the right direction.
You should use WPF/C# and get the AB4D library or Helix Toolkit.
AB4D costs money but it would be super easy to do this. I have used AB4D but not the Helix toolkit.
Check out Powertoys at: https://www.ab4d.com/powertoys.aspx
Forget about using windows forms for this, it was meant for interfaces not 3D rendering, and it still does a poor job.
Running OpenGL with winforms to render a cube seems hard to me but it's possible.
I suggest you use the web version of opengl. WebGL.
You'll need a browser. Problem is winforms has a bad web browser built in. So you'll need a more modern browser.
You got a few options:
Edge (EdgeHTML)
Chrome (Chromium)
Firefox (Gecko)
I had an experience with all of them in winforms. They all have some advantages and some drawbacks.
We'll go with Edge since this browser is built into Windows 10 and you can embedde it straight into your WinForms app by using the Windows Community Toolkit.
Please install the Windows Community Toolkit for WinForms NuGet package on your project.
Now refresh your toolbox and drag a WebView control to where ever you want the cube.
(Design size up to you ...)
Next step is writing some code.
You'll have to write a bit of JavaScript and HTML to get the cube on the screen.
Here's an example I found online:
https://codepen.io/dbrandt/pen/mEbqZz
After you got your HTML right do something like this:
webView.NavigateToString(yourHtmlAsString);
And you got yourself a 3d cube rendering with opengl on Winforms !

Take sound effect from video [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need a digital typeing sound effect.when numbers are typed,Sound effect appears in background of the video.I want to make a program that when I press the keyboard, I also listen this sound effect.How can I find this sound effect or take from this video?
the sound effect between 0:50 and 1:15
www.youtube.com/embed/kIXNpePYzZU
For the 'extracting the sound effect' part of the question, you would likely want to use an online video/audio downloader/converter. In the past, I have used youtube-mp3.org and clipconverter.cc.
For the second part of the question, it depends what exactly you want. If you want it to apply only to a specific text box in a WinForms/WPF/UWP app you are writing, this should be reasonably easy. The exact method depends on what you are doing, but involves adding a keydown, keyup, or keypress event handler to the text box
If you want it system wide, this is more difficult. Searching for 'Global Keyboard Hook C#' appears to give good results.
Once you have detected the key press, have a look at this question for how to play the sound. The answer by bporter gives the following code:
System.Media.SoundPlayer player = new System.Media.SoundPlayer(#"c:\mywavfile.wav");
player.Play();
Use this to convert the video to mp3. Clip the sound effect out of the mp3. Then play the mp3 file with your code.

How to detect if any video is being played now? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How to detect if any video is being played now using autohotkey, autoit, vbscript, c#, or c?
Video could be being played/streamed in any local player, web based player, or html5 player. We do not know the name of player also player may not be in the full screen.
PS. Detecting CPU load may not give the correct result always, so it is not acceptable.
I've done a small bit of work on this back in the day. There is a WIN32API (old school) that gets/sets whether or not to disable the screensaver (in user32.dll, GetScreenSaverActive(), SetScreenSaverActive - see: http://www.codeproject.com/Articles/17067/Controlling-The-Screen-Saver-With-C). This is the most likely flag to be set when a video is playing but it not 100% reliable as not every player will implement it. It WILL work for most browser videos, whether played through plugin, natively, or via DirectX. This also works for most (all?) external players such as vlc, windvd, etc.
But.
There is no sure-fire, 100% way of determining a video playing. You cannot;
1. Check for sound playing as the user may be using iTunes and not all videos have sound
2. Check for full screen (usually the better option) as the video may be playing in a browser
3. Check cpu/gpu load as it's not reliable and you have no other way to determine
4. Be absolutely sure that the player hasn't cleared/reset the win32 flag when minimized
Another option would be to try and collate a list of possile executable names for all known players (doable but time consuming to find data, espesially on older versions), and check to see if they're running. This isn't 100% reliable either as a plugin by be preloaded but a browser but not actually playing a video at that moment in time.
In short, there's no 100% way that I know of but several ways that'll get you 90-95% there. That is the purpose of knowing if there's a video playing? Perhaps there's an easier way to find what you're looking for...

WPF MediaElement pauses when trying to play Windows Media Center recording [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I have an WPF application that starts a live tv recording using Windows Media Center, using the Windows Media Center SDK, waits 2 minutes and then plays the currently recording file (.wtv) in a WPF MediaElement. The problem is that the video visual will freeze and it is not consistent on when it happens. I have looked into it and discovered that the timeline is still moving so the MediaElement still thinks that the video is playing.
This happens only when trying to play a video file that is currently being recorded, previously recorded shows play just fine. Both Media Center and Media Player can play those files without any hiccups; it is only the WPF MediaElement that has this problem. Any help would be appreciated.
My guess is that the way the media element works is that it grabs the size of the file it's about to stream at the time you first play it and gets stuck after that. It's just a guess but I have no other information to go off of.
I do know that the MediaElement is really good at switching streams and resuming in those streams. Perhaps there is a work around you can find where every so often it will refresh the stream and resume from it's current position.
This sounds like an MS bug.
You could possible set up an HTTP proxy for the wtv file, then tell the MediaElement to play the stream and not give it the actual size. Its a lot of work but may just work.

Categories

Resources