make web
parent
9e2d449d92
commit
e5b504773f
10
MAKE.bat
10
MAKE.bat
|
@ -262,6 +262,8 @@ if "%1"=="help" (
|
||||||
echo %0 [sync] ; sync repo to latest
|
echo %0 [sync] ; sync repo to latest
|
||||||
echo %0 [fwk] ; prepare files for fwk PR
|
echo %0 [fwk] ; prepare files for fwk PR
|
||||||
echo %0 [lua] ; execute lua script with v4k
|
echo %0 [lua] ; execute lua script with v4k
|
||||||
|
echo %0 [html5] ; build HTML5 demo
|
||||||
|
echo %0 [web] ; run Python webserver in html5 dir
|
||||||
echo %0 [pull] ; pull changes from 'latest' upstream
|
echo %0 [pull] ; pull changes from 'latest' upstream
|
||||||
echo %0 [git] ; prepare for commit
|
echo %0 [git] ; prepare for commit
|
||||||
echo %0 [push] ; prepare for commit, stage changes and commit them
|
echo %0 [push] ; prepare for commit, stage changes and commit them
|
||||||
|
@ -436,6 +438,11 @@ if "%1"=="html5" (
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "%1"=="web" (
|
||||||
|
python -m http.server --directory demos\html5 --bind 127.0.0.1 8000
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
if "%1"=="fwk" (
|
if "%1"=="fwk" (
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
if not exist "_fwk" mkdir "_fwk"
|
if not exist "_fwk" mkdir "_fwk"
|
||||||
|
@ -740,10 +747,11 @@ if "!vis!"=="yes" echo !cc! !o! editor.exe tools\editor\editor.c !edit! !impor
|
||||||
|
|
||||||
rem demos
|
rem demos
|
||||||
if "!demos!"=="yes" (
|
if "!demos!"=="yes" (
|
||||||
!echo! hello && !cc! !o! hello.exe hello.c !args! || set rc=1
|
rem !echo! hello && !cc! !o! hello.exe hello.c !args! || set rc=1
|
||||||
!echo! 99-syncdemo && !cc! !o! 99-syncdemo.exe demos\99-syncdemo.c !import! !args! || set rc=1
|
!echo! 99-syncdemo && !cc! !o! 99-syncdemo.exe demos\99-syncdemo.c !import! !args! || set rc=1
|
||||||
!echo! 99-shadertoy && !cc! !o! 99-shadertoy.exe demos\99-shadertoy.c !import! !args! || set rc=1
|
!echo! 99-shadertoy && !cc! !o! 99-shadertoy.exe demos\99-shadertoy.c !import! !args! || set rc=1
|
||||||
!echo! 99-material && !cc! !o! 99-material.exe demos\99-material.c !import! !args! || set rc=1
|
!echo! 99-material && !cc! !o! 99-material.exe demos\99-material.c !import! !args! || set rc=1
|
||||||
|
!echo! 99-video && !cc! !o! 99-video.exe demos\99-video.c !import! !args! || set rc=1
|
||||||
rem !echo! 00-ui && !cc! !o! 00-ui.exe demos\00-ui.c !import! !args! || set rc=1
|
rem !echo! 00-ui && !cc! !o! 00-ui.exe demos\00-ui.c !import! !args! || set rc=1
|
||||||
rem !echo! 01-sprite && !cc! !o! 01-sprite.exe demos\01-sprite.c !import! !args! || set rc=1
|
rem !echo! 01-sprite && !cc! !o! 01-sprite.exe demos\01-sprite.c !import! !args! || set rc=1
|
||||||
rem !echo! 02-ddraw && !cc! !o! 02-ddraw.exe demos\02-ddraw.c !import! !args! || set rc=1
|
rem !echo! 02-ddraw && !cc! !o! 02-ddraw.exe demos\02-ddraw.c !import! !args! || set rc=1
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
// video player
|
||||||
|
// - rlyeh, public domain
|
||||||
|
|
||||||
|
#include "v4k.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
// 75% window, msaa x2
|
||||||
|
window_create( 35, WINDOW_MSAA2 );
|
||||||
|
window_aspect_lock(910, 540);
|
||||||
|
|
||||||
|
// load video
|
||||||
|
int is_rgb = flag("--rgb") ? 1 : 0;
|
||||||
|
video_t *v = video( "bjork-all-is-full-of-love.mp4", is_rgb ? VIDEO_RGB : VIDEO_YCBCR );
|
||||||
|
|
||||||
|
while( window_swap() ) {
|
||||||
|
// decode video frame and get associated textures (audio is automatically sent to audiomixer)
|
||||||
|
texture_t *textures;
|
||||||
|
profile( "Video decoder" ) {
|
||||||
|
textures = video_decode( v );
|
||||||
|
}
|
||||||
|
|
||||||
|
// present decoded textures as a fullscreen composed quad
|
||||||
|
profile( "Video quad" ) {
|
||||||
|
if(is_rgb) fullscreen_quad_rgb( textures[0], 1.3f );
|
||||||
|
else fullscreen_quad_ycbcr( textures, 1.3f );
|
||||||
|
}
|
||||||
|
|
||||||
|
// input controls
|
||||||
|
if( input(KEY_ESC) ) break;
|
||||||
|
|
||||||
|
// ui video
|
||||||
|
if( ui_panel("Video", 0) ) {
|
||||||
|
if( ui_button("Rewind") ) video_seek(v, video_position(v) - 3);
|
||||||
|
if( ui_button("Pause") ) video_pause(v, video_is_paused(v) ^ 1);
|
||||||
|
if( ui_button("Forward") ) video_seek(v, video_position(v) + 3);
|
||||||
|
ui_panel_end();
|
||||||
|
}
|
||||||
|
// audio
|
||||||
|
if( ui_panel("Audio", 0)) {
|
||||||
|
static float master = 1;
|
||||||
|
if( ui_slider2("Master", &master, va("%.2f", master))) audio_volume_master(master);
|
||||||
|
ui_panel_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,10 @@ exit
|
||||||
|
|
||||||
if "%1"=="" MAKE.bat demo_ui.c
|
if "%1"=="" MAKE.bat demo_ui.c
|
||||||
|
|
||||||
|
del index.html 2>NUL >NUL
|
||||||
|
del index.worker.js 2>NUL >NUL
|
||||||
|
del index.data 2>NUL >NUL
|
||||||
|
|
||||||
rem clone emscripten sdk
|
rem clone emscripten sdk
|
||||||
if not exist "emsdk" (
|
if not exist "emsdk" (
|
||||||
git clone https://github.com/emscripten-core/emsdk emsdk
|
git clone https://github.com/emscripten-core/emsdk emsdk
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#include "v4k.h"
|
||||||
|
|
||||||
|
void render(void *arg) {
|
||||||
|
video_t *v = arg;
|
||||||
|
|
||||||
|
// decode video frame and get associated textures (audio is automatically sent to audiomixer)
|
||||||
|
texture_t *textures;
|
||||||
|
profile( "Video decoder" ) {
|
||||||
|
textures = video_decode( v );
|
||||||
|
}
|
||||||
|
|
||||||
|
// present decoded textures as a fullscreen composed quad
|
||||||
|
profile( "Video quad" ) {
|
||||||
|
fullscreen_quad_rgb( textures[0], 1.3f );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ui video
|
||||||
|
if( ui_panel("Video", 0) ) {
|
||||||
|
if( ui_button("Rewind") ) video_seek(v, video_position(v) - 3);
|
||||||
|
if( ui_button("Pause") ) video_pause(v, video_is_paused(v) ^ 1);
|
||||||
|
if( ui_button("Forward") ) video_seek(v, video_position(v) + 3);
|
||||||
|
ui_panel_end();
|
||||||
|
}
|
||||||
|
// audio
|
||||||
|
if( ui_panel("Audio", 0)) {
|
||||||
|
static float master = 1;
|
||||||
|
if( ui_slider2("Master", &master, va("%.2f", master))) audio_volume_master(master);
|
||||||
|
ui_panel_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
// 75% window, msaa x2
|
||||||
|
window_create(0.75f, 0);
|
||||||
|
window_aspect_lock(910, 540);
|
||||||
|
video_t *v = video( "bjork-all-is-full-of-love.mp4", VIDEO_RGB );
|
||||||
|
window_loop(render, v);
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -173,7 +173,7 @@ static void* editor_selected_obj = 0;
|
||||||
static int editor_key = 0;
|
static int editor_key = 0;
|
||||||
static vec2 editor_mouse = {0}; // 2d coord for ray/picking
|
static vec2 editor_mouse = {0}; // 2d coord for ray/picking
|
||||||
static bool editor_gamepad = 1;
|
static bool editor_gamepad = 1;
|
||||||
static int editor_hz = 60;
|
static int editor_hz = 144;
|
||||||
static int editor_hz_mid = 18;
|
static int editor_hz_mid = 18;
|
||||||
static int editor_hz_low = 5;
|
static int editor_hz_low = 5;
|
||||||
static bool editor_power_saving = 0;
|
static bool editor_power_saving = 0;
|
||||||
|
|
Loading…
Reference in New Issue