This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AppDataLocation.h" | |
#ifdef NEEDS_UWP_APP_DATA_LOCATION | |
#include <winrt/Windows.Storage.h> | |
#include <winrt/Windows.Foundation.h> | |
#endif | |
QString appDataLocationPath() | |
{ | |
static QString path; // calculate it only once and store it here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an anonymised and annotated version of my CMake | |
# This enabled me to build / archive / validate / distribute my app in Xcode | |
# without having to manually edit any configuration in Xcode | |
cmake_minimum_required(VERSION 3.24) | |
# Some variables needed more than once below | |
set(MY_APP_PROJECT_NAME "My App") | |
set(PROJECT_VERSION 1.2.3) | |
set(MY_APP_REVERSE_DNS_IDENTIFIER "com.mycompany.myapp") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.16) | |
project(minimalSynthesizer VERSION 0.1 LANGUAGES CXX) | |
set(CMAKE_AUTOMOC ON) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
find_package(Qt6 6.2 COMPONENTS Quick Multimedia REQUIRED) | |
qt_add_executable(appSynth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
namespace PaulMasriStone.Utility2D | |
{ | |
public static class Utility2D | |
{ | |
public static bool IsPointWithinCollider2D(Vector2 targetPoint, Vector2 externalPoint, int layerMask = Physics2D.DefaultRaycastLayers) | |
{ | |
var direction = (targetPoint - externalPoint).normalized; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on code by James Frowen https://james-frowen.github.io/unity_tips/latefixedupdate/ | |
// but with order of execution switched so that LateFixedUpdate() is not called during OnEnable() | |
public void OnEnable() | |
{ | |
StartCoroutine(RunLateFixedUpdate()); | |
} | |
public void OnDisable() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyClass.h" | |
MyClass::MyClass(QObject *parent) | |
: QThread(parent) | |
{ | |
start(); | |
} | |
MyClass::~MyClass() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <QNetworkAccessManager> | |
class QNetworkAccessManagerWithPatch : public QNetworkAccessManager | |
{ | |
Q_OBJECT | |
public: | |
explicit QNetworkAccessManagerWithPatch(QObject *parent = Q_NULLPTR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.qmake.cache | |
/.qmake.stash | |
*.pro.user | |
*.pro.user.* | |
*.qbs.user | |
*.qbs.user.* | |
*.moc | |
moc_*.cpp | |
qrc_*.cpp | |
ui_*.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Problem: I have two objects that have animations. I want the animations to be synchronised. | |
However one of the animations depends on an asynchronous function `grabToImage()` | |
Below are 3 versions of the script. | |
The first one is out of sync. | |
The second one is in-sync but is a horribly messy solution. I posed the question: Is there a neater way to achieve this? | |
The third one uses promises, using Ben Lau's QuickPromise | |
VERSION 1: out of sync |