art: new system fonts

video: support VIDEO_LOOP
html5: drop JS worker
main
Dominik Madarász 2023-09-17 11:50:34 +02:00
parent 9724d064cf
commit 5451fa6e9d
29 changed files with 252 additions and 349 deletions

View File

@ -1,5 +1,3 @@
// @todo: object_print(obj, "");
#include "v4k.h" #include "v4k.h"
int main() { int main() {
@ -9,7 +7,7 @@ int main() {
// create camera // create camera
camera_t cam = camera(); camera_t cam = camera();
// load video, RGB texture, no audio // load video, RGB texture, no audio
video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_RGB | VIDEO_NO_AUDIO ); video_seek(v, 30); video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_RGB | VIDEO_NO_AUDIO | VIDEO_LOOP ); video_seek(v, 30);
// load texture // load texture
texture_t t1 = texture("kgirl/g01_texture.png", TEXTURE_RGB); texture_t t1 = texture("kgirl/g01_texture.png", TEXTURE_RGB);
texture_t t2 = texture("matcaps/material3", 0); texture_t t2 = texture("matcaps/material3", 0);
@ -45,13 +43,12 @@ int main() {
// draw environment // draw environment
viewport_color( RGB3(22,22,32) ); viewport_color( RGB3(22,22,32) );
ddraw_grid(0); ddraw_grid(0);
ddraw_flush();
// update video // update video
video_decode( v ); video_decode( v );
// draw scene // draw scene
scene_render(SCENE_FOREGROUND); scene_render(SCENE_FOREGROUND|SCENE_BACKGROUND);
// fps camera // fps camera
bool active = ui_active() || ui_hover() || gizmo_active() ? false : input(MOUSE_L) || input(MOUSE_M) || input(MOUSE_R); bool active = ui_active() || ui_hover() || gizmo_active() ? false : input(MOUSE_L) || input(MOUSE_M) || input(MOUSE_R);

View File

@ -10,7 +10,7 @@ int main() {
// load video // load video
int is_rgb = flag("--rgb") ? 1 : 0; int is_rgb = flag("--rgb") ? 1 : 0;
video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", is_rgb ? VIDEO_RGB : VIDEO_YCBCR ); video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_LOOP | (is_rgb ? VIDEO_RGB : VIDEO_YCBCR) );
while( window_swap() ) { while( window_swap() ) {
// decode video frame and get associated textures (audio is automatically sent to audiomixer) // decode video frame and get associated textures (audio is automatically sent to audiomixer)

View File

@ -1,37 +1,3 @@
#!/bin/bash 2>nul || goto :windows
if [ "$1" = "" ]; then
sh MAKE.bat demo_collide.c
exit
fi
## clone emscripten sdk
git clone https://github.com/emscripten-core/emsdk ../../../../../emsdk
pushd ../../../../../emsdk
./emsdk install 3.0.0 ## latest
./emsdk activate 3.0.0 ## latest
source ./emsdk_env.sh
popd
## cook art
if [ "$(uname)" = "Darwin" ]; then
chmod +x ../../tools/cook.osx
../../tools/cook.osx --cook-jobs=1 --cook-ini=../../tools/cook.ini
cp .art[00].zip index.data
else
chmod +x ../../tools/cook.linux
../../tools/cook.linux --cook-jobs=1 --cook-ini=../../tools/cook.ini
cp .art[00].zip index.data
fi
## host webserver, compile and launch
python -m http.server --bind 127.0.0.1 8000 1> /dev/null 2> /dev/null &
emcc $@ -g ../../engine/v4k.c -I../../engine -o index.html -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip -s ALLOW_MEMORY_GROWTH=1 -lidbfs.js && xdg-open http://localhost:8000/index.html
exit
:windows
if "%1"=="" MAKE.bat demo_collide.c if "%1"=="" MAKE.bat demo_collide.c
del index.html 2>NUL >NUL del index.html 2>NUL >NUL
@ -53,5 +19,5 @@ rem cook art
rem host webserver, compile and launch rem host webserver, compile and launch
rem start python -m http.server --bind 127.0.0.1 8000 rem start python -m http.server --bind 127.0.0.1 8000
emcc %* -g ..\..\engine\v4k.c -I..\..\engine -o index.html -pthread -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip@index.zip -s ALLOW_MEMORY_GROWTH=1 -lidbfs.js call emcc %* -g ..\..\engine\v4k.c -I..\..\engine -o index.html -pthread -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip@index.zip -lidbfs.js
rem && start "" http://localhost:8000/index.html rem emrun index.html

View File

@ -18,6 +18,9 @@ void game_loop(void *userdata) {
// animation // animation
static float dx = 0, dy = 0; static float dx = 0, dy = 0;
static bool draw_skybox = 1;
static bool draw_cols = 1;
if (input_down(KEY_SPACE)) paused ^= 1; if (input_down(KEY_SPACE)) paused ^= 1;
float delta = (0.25f / 60.f) * !paused; float delta = (0.25f / 60.f) * !paused;
dx = dx + delta * 2.0f; dx = dx + delta * 2.0f;
@ -69,16 +72,19 @@ void game_loop(void *userdata) {
viewport_clip(vec2(0,0), vec2(window_width(), window_height())); viewport_clip(vec2(0,0), vec2(window_width(), window_height()));
#endif #endif
// debug draw collisions
{
// 3D // 3D
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
if (draw_skybox)
skybox_render(&sky, cam.proj, cam.view); skybox_render(&sky, cam.proj, cam.view);
// grid // grid
ddraw_grid(0); ddraw_grid(0);
if (draw_cols)
// debug draw collisions
{
{ {
// Triangle-Ray Intersection*/ // Triangle-Ray Intersection*/
vec3 ro, rd; vec3 ro, rd;
@ -580,16 +586,11 @@ void game_loop(void *userdata) {
//ddraw_flush(); //ddraw_flush();
//fx_end(); //fx_end();
// if( ui_panel("Audio", 0) ) { if( ui_panel("Vis", 0) ) {
// if( ui_button("test audio") ) { ui_bool("Skybox render", &draw_skybox);
// // audio (both clips & streams) ui_bool("Collisions render", &draw_cols);
// static audio_t voice; voice = audio_clip("coin.wav"); // "pew.sfxr" ui_panel_end();
// static audio_t stream; stream = audio_stream("wrath_of_the_djinn.xm"); // "larry.mid" }
// audio_play(voice, 0);
// audio_play(stream, 0);
// }
// ui_panel_end();
// }
// if( ui_panel("FX", 0) ) { // if( ui_panel("FX", 0) ) {
// for( int i = 0; i < 64; ++i ) { // for( int i = 0; i < 64; ++i ) {
@ -604,7 +605,7 @@ void game_loop(void *userdata) {
int main(void) { int main(void) {
// 75% sized, msaa x4 enabled // 75% sized, msaa x4 enabled
window_create(0.75f, WINDOW_MSAA4/*|WINDOW_FIXED*/); window_create(1, 0);
window_title( "V4K - SPACE pauses simulation" ); window_title( "V4K - SPACE pauses simulation" );
// fx_load("fx**.fs"); // fx_load("fx**.fs");

View File

@ -157,7 +157,5 @@
// document.addEventListener('MSFullscreenChange', exitFullscreen, false); // document.addEventListener('MSFullscreenChange', exitFullscreen, false);
// document.addEventListener('webkitfullscreenchange', exitFullscreen, false); // document.addEventListener('webkitfullscreenchange', exitFullscreen, false);
</script> </script>
<script src="index.coi.worker.js"></script>
</body> </body>
</html> </html>

View File

@ -1,9 +1,7 @@
cl game.c PureDOOM.c -I ..\..\..\engine ..\..\..\engine\v4k.c ^ ..\..\..\tools\tcc game.c PureDOOM.c -I ..\..\..\engine ..\..\..\engine\v4k.c ^
-DWIN32 ^ -DWIN32 ^
%* ^ %*
/link /SUBSYSTEM:WINDOWS /entry:mainCRTStartup
del *.obj del *.obj
del *.exp del *.exp
del *.lib del *.lib
del *.pdb

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,93 @@
Copyright 2012 The B612 Project Authors (https://github.com/polarsys/b612)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,95 +0,0 @@
Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito".
This Font Software is licensed under the SIL Open Font License,
Version 1.1 as shown below.
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
worldwide development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to provide
a free and open framework in which fonts may be shared and improved in
partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves.
The fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such.
This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components
as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting ? in part or in whole ?
any of the components of the Original Version, by changing formats or
by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer
or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under
this license does not apply to any document created using the Font
Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.

View File

@ -1,95 +0,0 @@
Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito".
This Font Software is licensed under the SIL Open Font License,
Version 1.1 as shown below.
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
worldwide development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to provide
a free and open framework in which fonts may be shared and improved in
partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves.
The fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such.
This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components
as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting ? in part or in whole ?
any of the components of the Original Version, by changing formats or
by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer
or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under
this license does not apply to any document created using the Font
Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View File

@ -2852,9 +2852,10 @@ PANEL_OPEN = 1,
int ui_demo(int do_windows); int ui_demo(int do_windows);
enum VIDEO_FLAGS { enum VIDEO_FLAGS {
VIDEO_YCBCR = 0, VIDEO_YCBCR = 0,
VIDEO_RGB = 1, VIDEO_RGB = 2,
VIDEO_AUDIO = 0, VIDEO_AUDIO = 0,
VIDEO_NO_AUDIO = 2, VIDEO_NO_AUDIO = 4,
VIDEO_LOOP = 8,
}; };
typedef struct video_t video_t; typedef struct video_t video_t;
video_t* video( const char *filename, int flags ); video_t* video( const char *filename, int flags );

View File

@ -17457,10 +17457,12 @@ API int ui_demo(int do_windows);
enum VIDEO_FLAGS { enum VIDEO_FLAGS {
VIDEO_YCBCR = 0, VIDEO_YCBCR = 0,
VIDEO_RGB = 1, VIDEO_RGB = 2,
VIDEO_AUDIO = 0, VIDEO_AUDIO = 0,
VIDEO_NO_AUDIO = 2, VIDEO_NO_AUDIO = 4,
VIDEO_LOOP = 8,
}; };
typedef struct video_t video_t; typedef struct video_t video_t;
@ -344771,6 +344773,9 @@ camera_t camera() {
cam.up = vec3(0,1,0); cam.up = vec3(0,1,0);
cam.fov = 45; cam.fov = 45;
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
// @todo: remove this hack // @todo: remove this hack
static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth");
if( smoothing ) { if( smoothing ) {
@ -344780,9 +344785,6 @@ camera_t camera() {
} }
} }
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
last_camera = old; last_camera = old;
*camera_get_active() = cam; *camera_get_active() = cam;
return cam; return cam;
@ -346427,6 +346429,13 @@ void thread_destroy( void *thd ) {
//#define UI_ICONS_SMALL 1 //#define UI_ICONS_SMALL 1
#endif #endif
#define UI_FONT_ENUM(carlito,b612) b612 // carlito
#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf"
#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf"
#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf"
#if UI_LESSER_SPACING #if UI_LESSER_SPACING
enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 };
#else #else
@ -346434,24 +346443,27 @@ void thread_destroy( void *thd ) {
#endif #endif
#if UI_FONT_LARGE #if UI_FONT_LARGE
#define UI_FONT_REGULAR_SIZE 18 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17)
#define UI_FONT_BOLD_SIZE 20 #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#elif UI_FONT_SMALL #elif UI_FONT_SMALL
#define UI_FONT_REGULAR_SIZE 13 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14)
#define UI_FONT_BOLD_SIZE 14.5f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#else #else
#define UI_FONT_REGULAR_SIZE 14.5f #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5)
#define UI_FONT_BOLD_SIZE 16.0f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#endif #endif
#if UI_ICONS_SMALL #if UI_ICONS_SMALL
#define UI_ICON_FONTSIZE 16.5f #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f)
#define UI_ICON_SPACING_X -2 #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2)
#define UI_ICON_SPACING_Y 4.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f)
#else #else
#define UI_ICON_FONTSIZE 20 #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20)
#define UI_ICON_SPACING_X 0 #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0)
#define UI_ICON_SPACING_Y 6.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f)
#endif #endif
#define MAX_VERTEX_MEMORY 512 * 1024 #define MAX_VERTEX_MEMORY 512 * 1024
@ -346469,8 +346481,6 @@ static void nk_config_custom_fonts() {
#define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MED ICON_MAX_16_MD
#define UI_ICON_MAX ICON_MAX_MD #define UI_ICON_MAX ICON_MAX_MD
#define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define ICON_BARS ICON_MD_MENU #define ICON_BARS ICON_MD_MENU
#define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE
#define ICON_TRASH ICON_MD_DELETE #define ICON_TRASH ICON_MD_DELETE
@ -346481,19 +346491,19 @@ static void nk_config_custom_fonts() {
// Default font(#1)... // Default font(#1)...
for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) {
float font_size = UI_FONT_REGULAR_SIZE; float font_size = UI_FONT_REGULAR_SIZE;
struct nk_font_config cfg = nk_font_config(font_size); struct nk_font_config cfg = nk_font_config(font_size);
cfg.oversample_v = 2; cfg.oversample_v = 2;
cfg.pixel_snap = 0; cfg.pixel_snap = 0;
// win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font;
// struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font;
struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font;
} }
// ...with icons embedded on it. // ...with icons embedded on it.
for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) {
static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0};
struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE);
@ -346509,30 +346519,30 @@ static void nk_config_custom_fonts() {
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg);
} }
// Monospaced font. Used in terminals or consoles. // Monospaced font. Used in terminals or consoles.
for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) {
const float fontsize = 14.f; // 18.f; const float font_size = UI_FONT_REGULAR_SIZE;
static const nk_rune icon_range[] = {32, 127, 0}; static const nk_rune icon_range[] = {32, 127, 0};
struct nk_font_config cfg = nk_font_config(fontsize); struct nk_font_config cfg = nk_font_config(font_size);
cfg.range = icon_range; cfg.range = icon_range;
cfg.oversample_h = 1; cfg.oversample_h = 1;
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
// struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg);
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg);
} }
// Extra optional fonts from here... // Extra optional fonts from here...
for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) {
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font;
} }
nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end();
@ -348940,7 +348950,7 @@ video_t* video( const char *filename, int flags ) {
v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1;
plm_set_loop(plm, false); plm_set_loop(plm, flags & VIDEO_LOOP);
plm_set_video_decode_callback(plm, mpeg_video_callback, v); plm_set_video_decode_callback(plm, mpeg_video_callback, v);
if( v->has_audio ) { if( v->has_audio ) {
plm_set_audio_enabled(plm, true); plm_set_audio_enabled(plm, true);
@ -349265,6 +349275,9 @@ void window_hints(unsigned flags) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330
#else #else
// Compute shaders need 4.5 otherwise. But...
// According to the GLFW docs, the context version hint acts as a minimum version.
// i.e, the context you actually get may be a higher or highest version (which is usually the case)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
#endif #endif

View File

@ -13,6 +13,9 @@ camera_t camera() {
cam.up = vec3(0,1,0); cam.up = vec3(0,1,0);
cam.fov = 45; cam.fov = 45;
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
// @todo: remove this hack // @todo: remove this hack
static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth");
if( smoothing ) { if( smoothing ) {
@ -22,9 +25,6 @@ camera_t camera() {
} }
} }
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
last_camera = old; last_camera = old;
*camera_get_active() = cam; *camera_get_active() = cam;
return cam; return cam;

View File

@ -3,6 +3,13 @@
//#define UI_ICONS_SMALL 1 //#define UI_ICONS_SMALL 1
#endif #endif
#define UI_FONT_ENUM(carlito,b612) b612 // carlito
#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf"
#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf"
#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf"
#if UI_LESSER_SPACING #if UI_LESSER_SPACING
enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 };
#else #else
@ -10,24 +17,27 @@
#endif #endif
#if UI_FONT_LARGE #if UI_FONT_LARGE
#define UI_FONT_REGULAR_SIZE 18 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17)
#define UI_FONT_BOLD_SIZE 20 #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#elif UI_FONT_SMALL #elif UI_FONT_SMALL
#define UI_FONT_REGULAR_SIZE 13 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14)
#define UI_FONT_BOLD_SIZE 14.5f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#else #else
#define UI_FONT_REGULAR_SIZE 14.5f #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5)
#define UI_FONT_BOLD_SIZE 16.0f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#endif #endif
#if UI_ICONS_SMALL #if UI_ICONS_SMALL
#define UI_ICON_FONTSIZE 16.5f #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f)
#define UI_ICON_SPACING_X -2 #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2)
#define UI_ICON_SPACING_Y 4.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f)
#else #else
#define UI_ICON_FONTSIZE 20 #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20)
#define UI_ICON_SPACING_X 0 #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0)
#define UI_ICON_SPACING_Y 6.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f)
#endif #endif
#define MAX_VERTEX_MEMORY 512 * 1024 #define MAX_VERTEX_MEMORY 512 * 1024
@ -45,8 +55,6 @@ static void nk_config_custom_fonts() {
#define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MED ICON_MAX_16_MD
#define UI_ICON_MAX ICON_MAX_MD #define UI_ICON_MAX ICON_MAX_MD
#define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define ICON_BARS ICON_MD_MENU #define ICON_BARS ICON_MD_MENU
#define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE
#define ICON_TRASH ICON_MD_DELETE #define ICON_TRASH ICON_MD_DELETE
@ -57,19 +65,19 @@ static void nk_config_custom_fonts() {
// Default font(#1)... // Default font(#1)...
for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) {
float font_size = UI_FONT_REGULAR_SIZE; float font_size = UI_FONT_REGULAR_SIZE;
struct nk_font_config cfg = nk_font_config(font_size); struct nk_font_config cfg = nk_font_config(font_size);
cfg.oversample_v = 2; cfg.oversample_v = 2;
cfg.pixel_snap = 0; cfg.pixel_snap = 0;
// win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font;
// struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font;
struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font;
} }
// ...with icons embedded on it. // ...with icons embedded on it.
for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) {
static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0};
struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE);
@ -85,30 +93,30 @@ static void nk_config_custom_fonts() {
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg);
} }
// Monospaced font. Used in terminals or consoles. // Monospaced font. Used in terminals or consoles.
for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) {
const float fontsize = 14.f; // 18.f; const float font_size = UI_FONT_REGULAR_SIZE;
static const nk_rune icon_range[] = {32, 127, 0}; static const nk_rune icon_range[] = {32, 127, 0};
struct nk_font_config cfg = nk_font_config(fontsize); struct nk_font_config cfg = nk_font_config(font_size);
cfg.range = icon_range; cfg.range = icon_range;
cfg.oversample_h = 1; cfg.oversample_h = 1;
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
// struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg);
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg);
} }
// Extra optional fonts from here... // Extra optional fonts from here...
for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) {
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font;
} }
nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end();

View File

@ -82,7 +82,7 @@ video_t* video( const char *filename, int flags ) {
v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1;
plm_set_loop(plm, false); plm_set_loop(plm, flags & VIDEO_LOOP);
plm_set_video_decode_callback(plm, mpeg_video_callback, v); plm_set_video_decode_callback(plm, mpeg_video_callback, v);
if( v->has_audio ) { if( v->has_audio ) {
plm_set_audio_enabled(plm, true); plm_set_audio_enabled(plm, true);

View File

@ -7,10 +7,12 @@
enum VIDEO_FLAGS { enum VIDEO_FLAGS {
VIDEO_YCBCR = 0, VIDEO_YCBCR = 0,
VIDEO_RGB = 1, VIDEO_RGB = 2,
VIDEO_AUDIO = 0, VIDEO_AUDIO = 0,
VIDEO_NO_AUDIO = 2, VIDEO_NO_AUDIO = 4,
VIDEO_LOOP = 8,
}; };
typedef struct video_t video_t; typedef struct video_t video_t;

View File

@ -175,6 +175,9 @@ void window_hints(unsigned flags) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330
#else #else
// Compute shaders need 4.5 otherwise. But...
// According to the GLFW docs, the context version hint acts as a minimum version.
// i.e, the context you actually get may be a higher or highest version (which is usually the case)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
#endif #endif

View File

@ -15482,6 +15482,9 @@ camera_t camera() {
cam.up = vec3(0,1,0); cam.up = vec3(0,1,0);
cam.fov = 45; cam.fov = 45;
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
// @todo: remove this hack // @todo: remove this hack
static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth");
if( smoothing ) { if( smoothing ) {
@ -15491,9 +15494,6 @@ camera_t camera() {
} }
} }
// update proj & view
camera_lookat(&cam,vec3(-5,0,-5));
last_camera = old; last_camera = old;
*camera_get_active() = cam; *camera_get_active() = cam;
return cam; return cam;
@ -17138,6 +17138,13 @@ void thread_destroy( void *thd ) {
//#define UI_ICONS_SMALL 1 //#define UI_ICONS_SMALL 1
#endif #endif
#define UI_FONT_ENUM(carlito,b612) b612 // carlito
#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf"
#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf"
#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf"
#if UI_LESSER_SPACING #if UI_LESSER_SPACING
enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 };
#else #else
@ -17145,24 +17152,27 @@ void thread_destroy( void *thd ) {
#endif #endif
#if UI_FONT_LARGE #if UI_FONT_LARGE
#define UI_FONT_REGULAR_SIZE 18 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17)
#define UI_FONT_BOLD_SIZE 20 #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#elif UI_FONT_SMALL #elif UI_FONT_SMALL
#define UI_FONT_REGULAR_SIZE 13 #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14)
#define UI_FONT_BOLD_SIZE 14.5f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#else #else
#define UI_FONT_REGULAR_SIZE 14.5f #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5)
#define UI_FONT_BOLD_SIZE 16.0f #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17)
#define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14)
#endif #endif
#if UI_ICONS_SMALL #if UI_ICONS_SMALL
#define UI_ICON_FONTSIZE 16.5f #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f)
#define UI_ICON_SPACING_X -2 #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2)
#define UI_ICON_SPACING_Y 4.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f)
#else #else
#define UI_ICON_FONTSIZE 20 #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20)
#define UI_ICON_SPACING_X 0 #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0)
#define UI_ICON_SPACING_Y 6.5f #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f)
#endif #endif
#define MAX_VERTEX_MEMORY 512 * 1024 #define MAX_VERTEX_MEMORY 512 * 1024
@ -17180,8 +17190,6 @@ static void nk_config_custom_fonts() {
#define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MED ICON_MAX_16_MD
#define UI_ICON_MAX ICON_MAX_MD #define UI_ICON_MAX ICON_MAX_MD
#define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" //
#define ICON_BARS ICON_MD_MENU #define ICON_BARS ICON_MD_MENU
#define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE
#define ICON_TRASH ICON_MD_DELETE #define ICON_TRASH ICON_MD_DELETE
@ -17192,19 +17200,19 @@ static void nk_config_custom_fonts() {
// Default font(#1)... // Default font(#1)...
for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) {
float font_size = UI_FONT_REGULAR_SIZE; float font_size = UI_FONT_REGULAR_SIZE;
struct nk_font_config cfg = nk_font_config(font_size); struct nk_font_config cfg = nk_font_config(font_size);
cfg.oversample_v = 2; cfg.oversample_v = 2;
cfg.pixel_snap = 0; cfg.pixel_snap = 0;
// win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font;
// struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font;
struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font;
} }
// ...with icons embedded on it. // ...with icons embedded on it.
for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) {
static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0};
struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE);
@ -17220,30 +17228,30 @@ static void nk_config_custom_fonts() {
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg);
} }
// Monospaced font. Used in terminals or consoles. // Monospaced font. Used in terminals or consoles.
for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) {
const float fontsize = 14.f; // 18.f; const float font_size = UI_FONT_REGULAR_SIZE;
static const nk_rune icon_range[] = {32, 127, 0}; static const nk_rune icon_range[] = {32, 127, 0};
struct nk_font_config cfg = nk_font_config(fontsize); struct nk_font_config cfg = nk_font_config(font_size);
cfg.range = icon_range; cfg.range = icon_range;
cfg.oversample_h = 1; cfg.oversample_h = 1;
cfg.oversample_v = 1; cfg.oversample_v = 1;
cfg.pixel_snap = 1; cfg.pixel_snap = 1;
// struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg);
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg);
} }
// Extra optional fonts from here... // Extra optional fonts from here...
for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) {
struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font;
} }
nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end();
@ -19651,7 +19659,7 @@ video_t* video( const char *filename, int flags ) {
v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1;
plm_set_loop(plm, false); plm_set_loop(plm, flags & VIDEO_LOOP);
plm_set_video_decode_callback(plm, mpeg_video_callback, v); plm_set_video_decode_callback(plm, mpeg_video_callback, v);
if( v->has_audio ) { if( v->has_audio ) {
plm_set_audio_enabled(plm, true); plm_set_audio_enabled(plm, true);
@ -19976,6 +19984,9 @@ void window_hints(unsigned flags) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330
#else #else
// Compute shaders need 4.5 otherwise. But...
// According to the GLFW docs, the context version hint acts as a minimum version.
// i.e, the context you actually get may be a higher or highest version (which is usually the case)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
#endif #endif

View File

@ -3540,10 +3540,12 @@ API int ui_demo(int do_windows);
enum VIDEO_FLAGS { enum VIDEO_FLAGS {
VIDEO_YCBCR = 0, VIDEO_YCBCR = 0,
VIDEO_RGB = 1, VIDEO_RGB = 2,
VIDEO_AUDIO = 0, VIDEO_AUDIO = 0,
VIDEO_NO_AUDIO = 2, VIDEO_NO_AUDIO = 4,
VIDEO_LOOP = 8,
}; };
typedef struct video_t video_t; typedef struct video_t video_t;

View File

@ -1,4 +1,4 @@
; this is where you specify and configure the FWK pipeline. ; this is where you specify and configure the V4K pipeline.
; tweak the pipeline and add new importers just by editing this file. ; tweak the pipeline and add new importers just by editing this file.
; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom. ; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom.