Monday, November 15, 2021

Unity 2D Tilemap Side Scrolling study

I've created a GitHub repository that contains a simple demo Unity project which was born to compare performance of different solutions implementing a very basic classic side scroller where the scrolled terrain is built up from a Grid + Tilemap + Rigidbody 2D + Tilemap Collider 2D + Composite Collider 2D

Check it here.

Thursday, May 10, 2018

Status menu macOS applications that could come foreground

Switching properly from a status menu only state to a normal foreground application state programmatically could be tricky on macOS, here is one possible solution of the problem.  (works 10.7+)
  1. DO NOT USE LSBackgroundOnly NOR LSUIElement in the app plist
  2. Add and init your menu and NSStatusBar menu
  3. After app initialized but not yet shown any window take a place where you might want to show the first window if any. We use applicationDidFinishLaunching.
    • If you do not want to show any window yet after app initialized use
      [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
      on 10.9+ you can use at last the otherwise much correct
      [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
    • If you should open any window after app init finished than simply show the main window
  4. Maintain your list of windows
  5. If last window closed, call
    [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
    on 10.9+ you can use at last the otherwise much correct
    [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
  6. When your first window shown next time, call
    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    [NSApp activateIgnoringOtherApps:YES];

    [[self window] makeKeyAndOrderFront:nil];
This should do the trick, if at least one app window is visible you will have menu, dock icon with state signaled, and cmd+tab element with your app, if last app window closed only your NSStatusBar element stays.

 

Known issues:

  • The first step is important because without that if a system modal dialog suspends your startup (f.e. your app is downloaded from the net and become quarantined a confirmation dialog might appear at first startup depending on your security settings) your menubar might not be owned by your app after your first app window shown.
    Workaround: Starting as normal app (step 1.) would solve this problem, but will cause another small one, your app icon might appear for a moment in the dock at startup even if you would like to startup without any window shown. (but we can deal with this, not owning the menubar was a bigger problem for us, so we chose this instead)
  • Changing between NSApplicationActivationPolicyRegular and NSApplicationActivationPolicyAccessory (or NSApplicationActivationPolicyProhibited on OSes bellow 10.9) will kill your tooltip of status bar menu element, the tooltip will be shown initially but will not ever after the second call of NSApplicationActivationPolicyAccessory -> NSApplicationActivationPolicyProhibited
    Workaround: We could not find a working workaround for this and reported to Apple as a bug.
  • Changing from NSApplicationActivationPolicyRegular to NSApplicationActivationPolicyAccessory has other problems on some OS versions like there might be no more mouse events in visible app windows sometimes
    Workaround: switch first to NSApplicationActivationPolicyProhibited (take care this leads to unwanted app messages, like NSApplicationWillResignActiveNotification, NSWindowDidResignMainNotification, etc. !)
  • Changing from NSApplicationActivationPolicyAccessory to NSApplicationActivationPolicyRegular is bogus as on some OS versions
    • the app main menu is frozen till the first app front status change
    • the app activated after this policy not always get placed front in the application order
    Workaround: switch first to NSApplicationActivationPolicyProhibited, take care the final switch to the desired NSApplicationActivationPolicyRegular should be mafe delayed, use f.e. dispatch_async or similar

Wednesday, June 01, 2016

Stream Player 1.0.15

What's new
  • Enhancements, changes
    • Added new UStream embedding template to support the updated HTML5 UI usage
  • Bug Fixes
    • Stream lists, close, close all, tile menu elements enabling was bogus if app modal window displayed 
    • Confirm multiple stream opening option had no effect
    • Minimized (miniaturized) windows had not treated as open 
    • Stream window menu enabling was bogus after search menu opened 
    • None stream windows stayed over windows of other application after that application activated via mouse click
    • Embedding templates order was bogus after updating/resetting to defaults 
    Currently available Mac app features
    • Quick opening as a source of a media stream
      • URLs
      • URL text or HTML source snippet selection
      • local HTML files
    either from OSX services and context menus or using drag & drop onto the application dock icon, status menu icon or any stream window.
    • Full screen, always on top and caption less player windows.
    • iCloud drive sync to share and synchronize the stream list between your iOS and Mac devices.
    • Player window arrangement in tile layout, ideal for watching f.e. multiple web cams at once.
    • Automatic stream title detection.
    • Automatic, user configurable embedding of well known video URLs as full sized window content.
    • Automatic reopen of selected stream windows at Stream Player startup.
    • Customizable sub-menu hierarchy to store streams in a structured manner, Watch Later, Favorites, etc. lists.
    • Customizable application quit behavior, you can keep Stream Player in status menu or let it exit normally or automatically if all windows closed.
    • Customizable web stream content behaviors, enabling-disabling navigation, context menus, editing. 
    The minimum required OSX version is 10.8 Mountain Lion and iOS 9.1 for Stream Player! 
    Purchase and see more about Stream Player.

    Wednesday, May 04, 2016

    Stream Player 1.0.13

    What's new
    • Implemented Feature Requests
    • Added share extensions ‘Add to Stream Player’ and ‘Watch Later in Stream Player’
    • NOTE: As application extensions not allowed to start the main application if Stream Player is not running the new streams will be added to your lists only at the next application startup! Stream Player is lightweight internet stream player with several smart features to aid OneClick stream playing in a dedicated player window.
    • Bug Fixes
    • Fixed still crashing deleted stream list cleanup
    Currently available Mac app features
    • Quick opening as a source of a media stream
    • URLs
    • URL text or HTML source snippet selection
    • local HTML files
    either from OSX services and context menus or using drag & drop onto the application dock icon, status menu icon or any stream window.
    • Full screen, always on top and caption less player windows.
    • iCloud drive sync to share and synchronize the stream list between your iOS and Mac devices.
    • Player window arrangement in tile layout, ideal for watching f.e. multiple web cams at once.
    • Automatic stream title detection.
    • Automatic, user configurable embedding of well known video URLs as full sized window content.
    • Automatic reopen of selected stream windows at Stream Player startup.
    • Customizable sub-menu hierarchy to store streams in a structured manner, Watch Later, Favorites, etc. lists.
    • Customizable application quit behavior, you can keep Stream Player in status menu or let it exit normally or automatically if all windows closed.
    • Customizable web stream content behaviors, enabling-disabling navigation, context menus, editing. 
    The minimum required OSX version is 10.8 Mountain Lion and iOS 9.1 for Stream Player! 
    Purchase and see more about Stream Player.

    Wednesday, April 06, 2016

    Useful Services (UMS) 1.3.6

    UMS is a collection of handy Mac OS X Services and an Application to manage, configure services on your system. Services are contextual workflows available throughout Mac OS X. They accept text or files from the current application or the Finder and appear in the Services menu. They can be used to shorten repetitive tasks f.e on files or folders.

    The UMS app supports on-the-fly Service customization via configuration plugins, also let you easily edit the icon and description of each installed service. Letting UMS to run continuously will add ability to get notified about any changes in your services folder or about available new or updated services.

    Currently selectable service components

    • Symbolize services 
    Symbolize service menu items are simple service wrappers around symbolizelog, symbolizealllogs and add2symbolpath scripts (together with symbolizehelpers helper script) that can be used to symbolize OS X crash logs, hang, stall or sample files.
    • Copy Paths services 
    Copy Paths add ability to copy full path, directory name or file name parts of the selected finder items to the clipboard. 
    • Mail Creation services
    Mail Creation add ability to create mail with attachments (from the currently selected files/directories), with currently selected texts as message body or from clipboard content both via the default mailer of the current user. 
    • Terminal services 
    Terminal service menu item currently serves one simple task, opens a new terminal tab and navigates to the selected path the service was invoked for
    • Run Elevated services
    Run elevated menu item currently serves one simple task, runs the selected application or binary as root after elevating for gain proper rights to do so
    The minimum required OSX version is 10.7 Lion for UMS!

    Purchase and see more about UMS.

    Tuesday, April 05, 2016

    Connect DELL U2713HM monitor to iMac 27-inch, Late 2013 running OSX 10.11 via the thunderbolt port at full resolution

    You can find a lot of tips of  'How to' solve the problem in the topic f.e. here or here,  but the one and only solution for me was to choose the proper cable, guess which one?
    The Display Port - Mini Display Port.
    Neither the dual channel DVI nor the HDMI - Mini Display Port version had worked. I have not had to do any EDID tricks, just had to find the right cable :$
    Hope it would help for others to save some time if fighting with the same configuration.

    Saturday, March 26, 2016

    Stream Player 1.0.12

    Stream Player is lightweight internet stream player with several smart features to aid OneClick stream playing in a dedicated player window.

    Currently available Mac app features
    • Quick opening as a source of a media stream
    • URLs
    • URL text or HTML source snippet selection
    • local HTML files
    either from OSX services and context menus or using drag & drop onto the application dock icon, status menu icon or any stream window.
    • Full screen, always on top and caption less player windows.
    • iCloud drive sync to share and synchronize the stream list between your iOS and Mac devices.
    • Player window arrangement in tile layout, ideal for watching f.e. multiple web cams at once.
    • Automatic stream title detection.
    • Automatic, user configurable embedding of well known video URLs as full sized window content.
    • Automatic reopen of selected stream windows at Stream Player startup.
    • Customizable sub-menu hierarchy to store streams in a structured manner, Watch Later, Favorites, etc. lists.
    • Customizable application quit behavior, you can keep Stream Player in status menu or let it exit normally or automatically if all windows closed.
    • Customizable web stream content behaviors, enabling-disabling navigation, context menus, editing. 

    The minimum required OSX version is 10.8 Mountain Lion and iOS 9.1 for Stream Player! 
    Purchase and see more about Stream Player.

    Thursday, March 24, 2016

    Submitting to App Store and Mac App Store from beta version OSX box

    You probably met already the following error during submitting your product to the (Mac) App Store:
    Don't submit apps built with beta software including beta OS X builds
    The reason is that Xcode adds the OS version to the application Info.plist file by default and if you are using a pre-release, beta version of OSX you will get the above error during the app validation process in iTunes connect.
    It looks like something like this in the Info.plist
    <key>BuildMachineOSBuild</key>
    <string>14D87h</string>
    Quick and dirty solution can be the next one,  add a new 'Run Script' build step at the end of your Build Phases of the given build target, like

    if [ "${CONFIGURATION_TYPE}" == "Release" ]; then
        // "15E65" <- 10.11.4 Any other older is fine if not beta, pre-release, etc. like "14C2043" 10.10.2
        defaults write "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Info.plist" BuildMachineOSBuild "15E65"
    fi

    This will replace the BuildMachineOSBuild key value to the currently latest official OSX version number of 10.11.4 and lies to iTunes connect your app built on that OS.

    p.s: No, this is not recommended all the times, but can be a quick solution if you have not got a backup OSX developer machine with an official (not beta, pre release, etc.) OS version and you have to deploy urgently.