guillaumechereau / noc Goto Github PK
View Code? Open in Web Editor NEWA potpourri of various code I want to release online
A potpourri of various code I want to release online
I managed to get noc to work under windows. I used msys2 and the packages mingw-w64-i686-glew,
mingw-w64-i686-glfw.
To compile it I used
gcc -s -O3 -o test_turtle tests\turtle.c noc_turtle.c -Wall -lopengl32 -lglfw3 -lglew32 -I.
Everything draws fine but sun, blowfish objs, shapes, stencil and colors samples are flickering however.
I'm unable to filter multiple file extension with noc_file_dialog_open().
Instead of just using a single file extension per selection, like here:
"png\0*.png\0jpeg\0*.jpeg\0All Files\0*.*"
I'd like to filter a category of extensions. For example, Image formats and video formats.
This seems to work for Windows when I do...
noc_file_dialog_open(NOC_FILE_DIALOG_OPEN, "Video Files\0*.mov;*.mp4;*.mpg;*.mkv\0All Files\0*.*\0", NULL, NULL);
This seems to only work in Windows but not on other OSs.
I have some luck on OSX in that it doesn't even give you the option to select filters.
noc_file_dialog_open(NOC_FILE_DIALOG_OPEN, "Video Files\0*.mov\0Matroska\0*.mkv\0MPEG\0*.mpg\0MPEG-4\0*.mp4\0", NULL, NULL);
This works as expected for the native dialog box by showing all the categories at once.
However, I can't figure out how to group the right string that GTK2 on Ubuntu parses multiple file extensions together.
Is there a single format that I should be using to group my extensions into categories or am I going to have to create different string filters for each OS?
Hi
Thx for the code
I try to compile turtle
make turtle > a.txt
In file included from /usr/include/c++/11/bits/specfun.h:45,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/bits/stl_algobase.h:300:56: error: macro "max" passed 3 arguments, but takes just 2
300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:321:11: error: macro "max" requires 2 arguments, but only 1 given
321 | max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:392:11: error: macro "max" requires 2 arguments, but only 1 given
392 | max() _GLIBCXX_USE_NOEXCEPT { return true; }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:461:11: error: macro "max" requires 2 arguments, but only 1 given
461 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:528:11: error: macro "max" requires 2 arguments, but only 1 given
528 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:598:11: error: macro "max" requires 2 arguments, but only 1 given
598 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
|
In file included from /usr/include/c++/11/bits/specfun.h:46,
from /usr/include/c++/11/cmath:1935,
from /usr/include/c++/11/math.h:36,
from tests/turtle.c:35:
/usr/include/c++/11/limits:671:11: error: macro "max" requires 2 arguments, but only 1 given
671 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); }
| ^
In file included from tests/turtle.c:33:
tests/font.h:12: note: macro "max" defined here
12 | #define max(x, y) ((x) >= (y) ? (x) : (y))
...
How can I solve it ?
When I build noc_file_dialog with Visual Studio 2015 I get a compiler error about strdup() on line 181:
"The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup."
If I change strdup() to _strdup() it compiles fine.
Hey.
Default path as well as default name aren't getting set corrently in the OPENFILENAME struct.
Here's the fixed version:
const char *noc_file_dialog_open(int flags,
const char *filters,
const char *default_path,
const char *default_name)
{
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
int ret;
// init default file name
if (default_name)
strncpy(szFile, default_name, sizeof(szFile) - 1);
else
szFile[0] = '\0';
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = filters;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = (LPSTR)default_path;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (flags & NOC_FILE_DIALOG_OPEN)
ret = GetOpenFileName(&ofn);
else
ret = GetSaveFileName(&ofn);
free(g_noc_file_dialog_ret);
g_noc_file_dialog_ret = ret ? strdup(szFile) : NULL;
return g_noc_file_dialog_ret;
}
These are the important bits:
// init default file name
if (default_name)
strncpy(szFile, default_name, sizeof(szFile) - 1);
else
szFile[0] = '\0';
// ...
ofn.lpstrInitialDir = (LPSTR)default_path;
Quoting from the README A list of public domain libraries for C/C++, inspired by the stb libraries.
.
However, all the libs are MIT licensed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.