Index: cpp/common/2d.h
===================================================================
--- cpp/common/2d.h	(revision 1125)
+++ cpp/common/2d.h	(revision 1130)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -6,6 +6,6 @@
 #define _2D_H_
 
-#include "nonstd_stl.h"
 #include <math.h>
+#include <algorithm>
 
 //unification of old GUIXY and Pt2D
@@ -58,6 +58,6 @@
 template<> inline bool XY<int>::operator==(const XY<int> &p) const { return (x == p.x) && (y == p.y); }
 
-template <typename T> XY<T> xymin(const XY<T> &a, const XY<T> &b) { return XY<T>(min(a.x, b.x), min(a.y, b.y)); }
-template <typename T> XY<T> xymax(const XY<T> &a, const XY<T> &b) { return XY<T>(max(a.x, b.x), max(a.y, b.y)); }
+template <typename T> XY<T> xymin(const XY<T> &a, const XY<T> &b) { return XY<T>(std::min(a.x, b.x), std::min(a.y, b.y)); }
+template <typename T> XY<T> xymax(const XY<T> &a, const XY<T> &b) { return XY<T>(std::max(a.x, b.x), std::max(a.y, b.y)); }
 
 template <typename T>
@@ -74,5 +74,5 @@
 	T vertical() const { return top + bottom; }
 	bool operator==(const XYMargin &other) const { return left == other.left && top == other.top && right == other.right && bottom == other.bottom; }
-	XYMargin normalized() const { return XYMargin(max(left, T(0)), max(top, T(0)), max(right, T(0)), max(bottom, T(0))); }
+	XYMargin normalized() const { return XYMargin(std::max(left, T(0)), std::max(top, T(0)), std::max(right, T(0)), std::max(bottom, T(0))); }
 };
 
@@ -162,5 +162,5 @@
 	}
 
-	XYRect fitAspect(float aspect) ///< place a new rectangle having 'aspect' inside the rectangle
+	XYRect fitAspect(float aspect) const ///< place a new rectangle having 'aspect' inside the rectangle
 	{
 		XYRect r;
@@ -179,8 +179,8 @@
 		XY<T> p2 = p + size;
 		XY<T> rp2 = r.p + r.size;
-		i.p.x = max(p.x, r.p.x);
-		i.p.y = max(p.y, r.p.y);
-		i.size.x = min(p2.x, rp2.x) - i.p.x;
-		i.size.y = min(p2.y, rp2.y) - i.p.y;
+		i.p.x = std::max(p.x, r.p.x);
+		i.p.y = std::max(p.y, r.p.y);
+		i.size.x = std::min(p2.x, rp2.x) - i.p.x;
+		i.size.y = std::min(p2.y, rp2.y) - i.p.y;
 		return i;
 	}
Index: cpp/common/Convert.cpp
===================================================================
--- cpp/common/Convert.cpp	(revision 1125)
+++ cpp/common/Convert.cpp	(revision 1130)
@@ -1,8 +1,9 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
 #include "Convert.h"
 #include <sstream>
+#include <algorithm>
 
 #if defined __ANDROID__ || defined __BORLANDC__
Index: cpp/common/log.cpp
===================================================================
--- cpp/common/log.cpp	(revision 1125)
+++ cpp/common/log.cpp	(revision 1130)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -8,4 +8,5 @@
 #include "Convert.h"
 #include <assert.h>
+#include <algorithm>
 
 const char* LOG_LEVEL_ARRAY[] = { "[DEBUG] ", "", "[WARN] ", "[ERROR] ", "[CRITICAL] " };
@@ -36,5 +37,5 @@
 {
 	assert((level>=LOG_MIN) && (level<=LOG_MAX));
-	level = min(LOG_MAX, max(LOG_MIN, level));
+	level = std::min(LOG_MAX, std::max(LOG_MIN, level));
 	return LOG_LEVEL_ARRAY[level + 1];
 }
Index: cpp/common/loggers/loggers.h
===================================================================
--- cpp/common/loggers/loggers.h	(revision 1125)
+++ cpp/common/loggers/loggers.h	(revision 1130)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -9,4 +9,5 @@
 #include <common/threads.h>
 #include <common/nonstd_stl.h>
+#include <algorithm>
 
 class LoggerBase;
Index: cpp/common/loggers/loggertostdout.cpp
===================================================================
--- cpp/common/loggers/loggertostdout.cpp	(revision 1125)
+++ cpp/common/loggers/loggertostdout.cpp	(revision 1130)
@@ -1,8 +1,9 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
 #include "loggertostdout.h"
 #include <common/console.h>
+#include <algorithm>
 #include <assert.h>
 #ifdef SHP
@@ -38,5 +39,5 @@
 	{
 		assert((level>=LOG_MIN) && (level<=LOG_MAX));
-		level = min(LOG_MAX, max(LOG_MIN, level));
+		level = std::min(LOG_MAX, std::max(LOG_MIN, level));
 		printf(log_format, log_level[level + 1], obj, method, msg, "\n");
 	}
Index: cpp/common/nonstd_stl.h
===================================================================
--- cpp/common/nonstd_stl.h	(revision 1125)
+++ cpp/common/nonstd_stl.h	(revision 1130)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -6,9 +6,9 @@
 #define _NONSTD_STL_H_
 
-//stl jak sama nazwa glosi wcale nie jest nonstd
+//making STL more standard
 
 #include <string>
 using std::string;
-#ifndef SHP //bada nie ma wstring
+#ifndef SHP //STL in the bada OS has no wstring
 using std::wstring;
 #endif
@@ -17,22 +17,19 @@
 using std::vector;
 
-#include <algorithm> //std::min,max,swap
-using std::min;
-using std::max;
-using std::swap;
 
+//below: not used since 2020 (these macros are replaced by std::ssize()), may be removed...
 
 // ------------------- ARRAY_LENGTH -------------------
 
-//staromodne makro, niezabezpieczone przed uzyciem wskaznika w roli "x"
+//old-fashioned macro, unprotected against the use of the pointer as "x"
 //#define ARRAY_LENGTH(x) (sizeof(x)/sizeof((x)[0]))
 
-//hakerskie makro ktore wykrywa czesc pomy³kowych przypadkow uzycia
+//hacker macro that detects some of the misuse cases
 //#define ARRAY_LENGTH(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
 
-//szablonowa funkcja pisana przez sredniozaawansowanych, jak to funkcja - nie daje niestety sta³ej w czasie kompilacji
+//template function by intermediate-level devs, as a function it unfortunately does not give a constant at compile time
 //template<typename T, std::size_t N> inline std::size_t ARRAY_LENGTH( T(&)[N] ) { return N; } //"constexpr" dopiero w C++0x
 
-//szablony hakerskie: tablica bajtow o dlugosci N - tak dluga jak tablica o któr¹ pytamy...
+//hacker templates: array of bytes of length N - as long as the array we are asking for...
 //template <typename T, std::size_t N>
 //char (&array_temp(T (&a)[N]))[N];
@@ -44,9 +41,10 @@
 //char (&array_temp(const T (&a)[N]))[N];
 
-//...ktor¹ mozna potem uzyc normalnie w sizeof i dzieki temu mamy const w compile-time. tak uzyteczne jak staromodne makro ale z pelna kontrola bledow
+//...which can then be used in sizeof and thus we have const in compile-time. This is as useful as the old-fashioned macro above, but with full error control
 //#define ARRAY_LENGTH(x) sizeof(array_temp(x))
 
 //final and no longer needed version ;-) (c++17)
-#define ARRAY_LENGTH(x) int(std::size(x))
+//#define ARRAY_LENGTH(x) int(std::size(x))
+//(still room for improvement because unsigned=risky, ssize() upcoming since C++20)
 
 
Index: cpp/common/util-stl.h
===================================================================
--- cpp/common/util-stl.h	(revision 1125)
+++ cpp/common/util-stl.h	(revision 1130)
@@ -6,6 +6,6 @@
 #define _UTIL_STL_H_
 
-#include "nonstd_stl.h"
 #include <map>
+#include <algorithm>
 
 template<typename T, std::size_t N> void push_back(vector<T>& v, T(&d)[N])
Index: cpp/common/util-string.cpp
===================================================================
--- cpp/common/util-string.cpp	(revision 1125)
+++ cpp/common/util-string.cpp	(revision 1130)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -9,4 +9,5 @@
 #include <assert.h>
 #include <cstdlib> //malloc()
+#include <algorithm>
 #ifdef USE_VIRTFILE
 #include <common/virtfile/virtfile.h>
