Skip to content

Commit

Permalink
- added curl libs, headers and an example stub for implementation, up…
Browse files Browse the repository at this point in the history
…dated pmbuild with improved warning feedback when running jobs which perform no work, improved formatting / tabs and spaces in some files
  • Loading branch information
polymonster committed Oct 1, 2023
1 parent b658b6f commit c551c39
Show file tree
Hide file tree
Showing 37 changed files with 5,452 additions and 80 deletions.
12 changes: 12 additions & 0 deletions core/put/source/curl/curl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// camera.cpp
// Copyright 2014 - 2023 Alex Dixon.
// License: https://github.com/polymonster/pmtech/blob/master/license.md

#include "pen.h"

using namespace pen;

namespace put
{

} // namespace put
10 changes: 10 additions & 0 deletions core/put/source/curl/curl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// camera.h
// Copyright 2014 - 2023 Alex Dixon.
// License: https://github.com/polymonster/pmtech/blob/master/license.md

#pragma once

namespace put
{

} // namespace put
72 changes: 46 additions & 26 deletions examples/assets/textures/formats/export.jsn
Original file line number Diff line number Diff line change
@@ -1,45 +1,65 @@
{
texturec:
{
"-t": "RGBA8",
"--mips": true
texturec: {
-t: RGBA8
--mips: true

rules:
{
texfmt_rgb8:
{
rules: {
bc1: {
files: [
"texfmt_rgb8.png",
"**/texfmt_bc1.png"
]

"-t": "RGBA8"
-t: BC1
}

bc1n: {
files: [
"**/texfmt_bc1n.png"
]
-t: BC1
--normal: true
}

bc1:
{
bc2: {
files: [
"texfmt_bc1.png"
"**/texfmt_bc2.png"
]

"-t": "BC1"
-t: BC2
}

bc2:
{
bc3: {
files: [
"**/texfmt_bc3.png"
]
-t: BC3
}

bc3n: {
files: [
"texfmt_bc2.png"
"**/texfmt_bc3n.png"
]

"-t": "BC2"
-t: BC3
--normal: true
}

bc4: {
files: [
"**/texfmt_bc4.png"
]
-t: BC4
}

bc3:
{
bc5: {
files: [
"**/texfmt_bc5.png"
]
-t: BC5
}

lumi: {
files: [
"texfmt_bc3.png"
"**/texfmt_lumi.png"
]

"-t": "BC3"
-t: A8
}
}
}
Expand Down
77 changes: 77 additions & 0 deletions examples/code/curl/curl_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#include "console.h"
#include "file_system.h"
#include "pen.h"
#include "threads.h"

// curls include
#define CURL_STATICLIB
#include <curl/curl.h>

namespace
{
void* user_setup(void* params);
loop_t user_update();
void user_shutdown();
} // namespace

// entry function, where we can configure low level details, like window or renderer in pen_creation_params
namespace pen
{
pen_creation_params pen_entry(int argc, char** argv)
{
pen::pen_creation_params p;
p.window_width = 1280;
p.window_height = 720;
p.window_title = "curl_example";
p.window_sample_count = 4;
p.user_thread_function = user_setup;
p.flags = pen::e_pen_create_flags::console_app;
return p;
}
} // namespace pen

// web friendly main loop
namespace
{
pen::job_thread_params* job_params;
pen::job* p_thread_info;

void* user_setup(void* params)
{
// unpack the params passed to the thread and signal to the engine it ok to proceed
job_params = (pen::job_thread_params*)params;
p_thread_info = job_params->job_info;
pen::semaphore_post(p_thread_info->p_sem_continue, 1);

// we call user_update once per frame
pen_main_loop(user_update);
return PEN_THREAD_OK;
}

void user_shutdown()
{
pen::semaphore_post(p_thread_info->p_sem_terminated, 1);
}

loop_t user_update()
{
pen::thread_sleep_ms(16);

// msg from the engine we want to terminate
if (pen::semaphore_try_wait(p_thread_info->p_sem_exit))
{
user_shutdown();
pen_main_loop_exit();
}

exit(0);
pen_main_loop_continue();
}


const c8* list[] = {
"hello"
"world"
};

} // namespace
35 changes: 18 additions & 17 deletions examples/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ dofile "../tools/premake/app_template.lua"

-- Solution
solution ("pmtech_examples_" .. platform)
location ("build/" .. platform_dir )
configurations { "Debug", "Release" }
startproject "empty_project"
buildoptions { build_cmd }
linkoptions { link_cmd }
-- to include shader_structs/
includedirs
{
"."
}
-- Engine Project
location ("build/" .. platform_dir )
configurations { "Debug", "Release" }
startproject "empty_project"
buildoptions { build_cmd }
linkoptions { link_cmd }
-- to include shader_structs/
includedirs
{
"."
}
-- Engine Project
dofile "../core/pen/project.lua"

-- Toolkit Project
-- Toolkit Project
dofile "../core/put/project.lua"

-- Example projects
-- Example projects
-- ( project name, current script dir, )
create_app_example( "empty_project", script_path() ) -- hide
create_app_example( "clear", script_path() )
Expand Down Expand Up @@ -72,10 +72,11 @@ create_app_example( "stencil_shadows", script_path() )
create_app_example( "compute_demo", script_path() ) -- hide
create_app_example( "global_illumination", script_path() )
create_app_example( "game", script_path() ) -- hide
create_app_example( "curl", script_path() ) -- hide

-- currently web audio is not implemented
if platform ~= "web" then
create_app_example( "play_sound", script_path() )
create_app_example( "audio_player", script_path() )
create_app_example( "play_sound", script_path() )
create_app_example( "audio_player", script_path() )
end

3 changes: 3 additions & 0 deletions third_party/libcurl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!/lib
!*.lib
!*.a
Loading

0 comments on commit c551c39

Please sign in to comment.