mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-06 17:09:06 +01:00
Docs update and news section, ok button, versioing, about and project properties (wip)
This commit is contained in:
parent
caa0e73935
commit
628a72adf7
16 changed files with 1728 additions and 847 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -63,3 +63,5 @@ story-editor-v2/src/.vscode/
|
|||
build-story-editor-v2-Desktop-Debug/
|
||||
|
||||
build-story-editor-Desktop-Debug/
|
||||
|
||||
docs/.vitepress/cache/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,14 @@ import { defineConfig } from 'vitepress'
|
|||
export default defineConfig({
|
||||
title: "Open Story Teller",
|
||||
description: "Make your own device that tells stories",
|
||||
lastUpdated: true,
|
||||
cleanUrls: true,
|
||||
|
||||
|
||||
themeConfig: {
|
||||
|
||||
logo: { src: '/logo_hat_only.png', width: 29, height: 24 },
|
||||
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
nav: [
|
||||
{ text: 'Home', link: '/' },
|
||||
|
|
@ -55,6 +62,11 @@ export default defineConfig({
|
|||
}
|
||||
],
|
||||
|
||||
footer: {
|
||||
message: 'Source code under the MIT License, art under the CC0 License.',
|
||||
copyright: 'Copyright © 2020-present Anthony Rabine'
|
||||
},
|
||||
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/arabine/open-story-teller' }
|
||||
]
|
||||
|
|
|
|||
44
docs/.vitepress/theme/HomeContent.vue
Normal file
44
docs/.vitepress/theme/HomeContent.vue
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<script setup>
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import { onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const lastNews = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
fetch('https://piaille.fr/api/v1/timelines/tag/openstoryteller?limit=5').then(
|
||||
resp => resp.json() // this returns a promise
|
||||
).then(messages => {
|
||||
|
||||
// lastNews = ref([]);
|
||||
for (const m of messages) {
|
||||
if (m.account.username === "arabine") {
|
||||
// console.log(m)
|
||||
console.log(m.content);
|
||||
lastNews.value.push({ content: m.content, date: new Date(m.created_at).toDateString() })
|
||||
}
|
||||
}
|
||||
}).catch(ex => {
|
||||
console.error(ex);
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<div class="vp-doc custom-block">
|
||||
<h1>Latest news</h1>
|
||||
<div v-for="item in lastNews">
|
||||
<h3>{{item.date}}</h3>
|
||||
<p v-html="item.content"></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -3,10 +3,13 @@ import { h } from 'vue'
|
|||
import Theme from 'vitepress/theme'
|
||||
import './style.css'
|
||||
|
||||
import HomeContent from './HomeContent.vue'
|
||||
|
||||
export default {
|
||||
...Theme,
|
||||
Layout: () => {
|
||||
return h(Theme.Layout, null, {
|
||||
'home-features-after': () => h(HomeContent)
|
||||
// https://vitepress.dev/guide/extending-default-theme#layout-slots
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ hero:
|
|||
name: "Open Story Teller"
|
||||
text: "Hardware and software that tell stories"
|
||||
tagline: Make your own, its free sofware
|
||||
image:
|
||||
src: /logo.png
|
||||
alt: logo
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Getting started
|
||||
|
|
@ -16,6 +13,9 @@ hero:
|
|||
- theme: alt
|
||||
text: Assembly guidelines
|
||||
link: /guide-intro
|
||||
image:
|
||||
src: /logo.png
|
||||
alt: logo
|
||||
|
||||
features:
|
||||
- title: Easy to repair
|
||||
|
|
|
|||
2369
docs/package-lock.json
generated
2369
docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"vitepress": "^1.0.0-alpha.73"
|
||||
"vitepress": "^1.0.0-rc.33"
|
||||
},
|
||||
"scripts": {
|
||||
"docs:dev": "vitepress dev",
|
||||
|
|
@ -8,6 +9,6 @@
|
|||
"docs:preview": "vitepress preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.47"
|
||||
"vue": "^3.3.13"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
docs/public/logo_hat_only.png
Normal file
BIN
docs/public/logo_hat_only.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -126,7 +126,7 @@ bool StoryProject::Load(const std::string &file_path, nlohmann::json &model, Res
|
|||
|
||||
nlohmann::json j = nlohmann::json::parse(f);
|
||||
|
||||
m_nodes.clear();
|
||||
// m_nodes.clear();
|
||||
manager.Clear();
|
||||
|
||||
if (j.contains("project"))
|
||||
|
|
@ -256,7 +256,7 @@ void StoryProject::Save(const nlohmann::json &model, ResourceManager &manager)
|
|||
std::ofstream o(m_story_file_path);
|
||||
o << std::setw(4) << j << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
void StoryProject::CreateTree()
|
||||
{
|
||||
// Algorithm: level order traversal of N-ary tree
|
||||
|
|
@ -289,6 +289,15 @@ void StoryProject::CreateTree()
|
|||
nlist.pop();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void StoryProject::Clear()
|
||||
{
|
||||
m_uuid = "";
|
||||
m_working_dir = "";
|
||||
m_story_file_path = "";
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void StoryProject::EraseString(std::string &theString, const std::string &toErase)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,13 +6,8 @@
|
|||
#include <filesystem>
|
||||
#include "json.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <random>
|
||||
|
||||
#include "json.hpp"
|
||||
#include "resource_manager.h"
|
||||
#include "audio_player.h"
|
||||
|
||||
|
||||
|
||||
// FIXME : Structure très Lunii style, à utiliser pour la conversion peut-être ...
|
||||
|
|
@ -48,30 +43,26 @@ struct StoryNode
|
|||
|
||||
struct StoryProject
|
||||
{
|
||||
|
||||
public:
|
||||
enum ImageFormat { IMG_FORMAT_BMP_4BITS, IMG_FORMAT_QOIF, IMG_FORMAT_COUNT };
|
||||
enum SoundFormat { SND_FORMAT_WAV, SND_FORMAT_QOAF, SND_FORMAT_COUNT };
|
||||
|
||||
StoryProject();
|
||||
~StoryProject();
|
||||
|
||||
/*
|
||||
std::vector<StoryNode> m_nodes;
|
||||
|
||||
std::string m_type;
|
||||
std::string m_code;
|
||||
|
||||
StoryNode *m_tree;
|
||||
|
||||
*/
|
||||
bool Load(const std::string &file_path, nlohmann::json &model, ResourceManager &manager);
|
||||
void Save(const nlohmann::json &model, ResourceManager &manager);
|
||||
|
||||
void CreateTree();
|
||||
void Clear()
|
||||
{
|
||||
m_uuid = "";
|
||||
m_working_dir = "";
|
||||
m_story_file_path = "";
|
||||
m_initialized = false;
|
||||
}
|
||||
void Clear();
|
||||
|
||||
void SetImageFormat(ImageFormat format);
|
||||
void SetSoundFormat(SoundFormat format);
|
||||
|
|
@ -100,9 +91,9 @@ struct StoryProject
|
|||
std::string GetTitleImage() const { return m_titleImage; }
|
||||
std::string GetTitleSound() const { return m_titleSound; }
|
||||
|
||||
public:
|
||||
// Initialize with an existing project
|
||||
void Initialize(const std::string &file_path);
|
||||
const bool IsInitialized() const { return m_initialized; }
|
||||
void New(const std::string &uuid, const std::string &file_path);
|
||||
|
||||
static void EraseString(std::string &theString, const std::string &toErase);
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ target_include_directories(${STORY_EDITOR_PROJECT} PUBLIC
|
|||
../software/chip32/
|
||||
)
|
||||
|
||||
add_definitions(-DIMGUI_USE_WCHAR32)
|
||||
add_definitions(-DIMGUI_USE_WCHAR32 -DVERSION_MAJOR=${PROJECT_VERSION_MAJOR} -DVERSION_MINOR=${PROJECT_VERSION_MINOR} -DVERSION_PATCH=${PROJECT_VERSION_PATCH})
|
||||
add_link_options(-static-libgcc -static-libstdc++)
|
||||
|
||||
target_compile_definitions(${STORY_EDITOR_PROJECT} PUBLIC cimg_display=0)
|
||||
|
|
|
|||
|
|
@ -50,10 +50,9 @@ void EmulatorWindow::Draw()
|
|||
|
||||
ImGui::PushFont(ImGui::GetFont());
|
||||
|
||||
|
||||
if (ImGui::Button(ICON_MDI_PLAY_CIRCLE_OUTLINE, ImVec2(50, 50)))
|
||||
if (ImGui::Button(ICON_MDI_CHECK_CIRCLE_OUTLINE, ImVec2(50, 50)))
|
||||
{
|
||||
m_story.Play();
|
||||
m_story.Ok();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_MDI_STOP_CIRCLE_OUTLINE, ImVec2(50, 50)))
|
||||
|
|
@ -80,6 +79,12 @@ void EmulatorWindow::Draw()
|
|||
{
|
||||
m_story.Build();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Build & Play"))
|
||||
{
|
||||
m_story.Play();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
WindowBase::EndDraw();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public:
|
|||
virtual std::list<std::shared_ptr<Connection>> GetNodeConnections(unsigned long nodeId) = 0;
|
||||
virtual std::string GetNodeEntryLabel(unsigned long nodeId) = 0;
|
||||
virtual void Play() = 0;
|
||||
virtual void Ok() = 0;
|
||||
virtual void Pause() = 0;
|
||||
virtual void Next() = 0;
|
||||
virtual void Previous() = 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "main_window.h"
|
||||
#include <filesystem>
|
||||
#include <random>
|
||||
|
||||
#include <SDL.h>
|
||||
#include "platform_folders.h"
|
||||
#include "uuid.h"
|
||||
#include "media_converter.h"
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
#include "IconsMaterialDesignIcons.h"
|
||||
#include "ImGuiFileDialog.h"
|
||||
|
||||
static std::string gVersion;
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: m_emulatorWindow(*this)
|
||||
, m_resourcesWindow(*this)
|
||||
|
|
@ -26,6 +28,8 @@ MainWindow::MainWindow()
|
|||
, m_player(*this)
|
||||
{
|
||||
|
||||
gVersion = std::to_string(VERSION_MAJOR) + '.' + std::to_string(VERSION_MINOR) + '.' + std::to_string(VERSION_PATCH);
|
||||
|
||||
// VM Initialize
|
||||
m_chip32_ctx.stack_size = 512;
|
||||
|
||||
|
|
@ -78,6 +82,11 @@ void MainWindow::Play()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::Ok()
|
||||
{
|
||||
m_eventQueue.push({VmEventType::EvOkButton});
|
||||
}
|
||||
|
||||
void MainWindow::Pause()
|
||||
{
|
||||
|
||||
|
|
@ -280,6 +289,9 @@ void MainWindow::DrawMainMenuBar()
|
|||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (!m_story.IsInitialized())
|
||||
ImGui::BeginDisabled();
|
||||
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Save project"))
|
||||
{
|
||||
|
|
@ -296,6 +308,9 @@ void MainWindow::DrawMainMenuBar()
|
|||
showParameters = true;
|
||||
}
|
||||
|
||||
if (!m_story.IsInitialized())
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +333,10 @@ void MainWindow::DrawMainMenuBar()
|
|||
|
||||
if (showParameters)
|
||||
{
|
||||
ImGui::OpenPopup("Options");
|
||||
if (m_story.IsInitialized())
|
||||
{
|
||||
ImGui::OpenPopup("ProjectPropertiesPopup");
|
||||
}
|
||||
}
|
||||
|
||||
if (showNewProject)
|
||||
|
|
@ -341,18 +359,19 @@ void MainWindow::DrawMainMenuBar()
|
|||
|
||||
if (ImGui::BeginPopupModal("AboutPopup", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::Text("Story Editor V2");
|
||||
ImGui::Text("Story Editor - v%s", gVersion.c_str());
|
||||
ImGui::Text("http://www.openstoryteller.org");
|
||||
ImGui::Separator();
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), "Platform");
|
||||
ImGui::Text("http://www.openstoryteller.org");
|
||||
// ImGui::Text("%s", SDL_GetPlatform());
|
||||
// ImGui::Text("CPU cores: %d", SDL_GetCPUCount());
|
||||
// ImGui::Text("RAM: %.2f GB", SDL_GetSystemRAM() / 1024.0f);
|
||||
|
||||
ImGui::Text("%s", SDL_GetPlatform());
|
||||
ImGui::Text("CPU cores: %d", SDL_GetCPUCount());
|
||||
ImGui::Text("RAM: %.2f GB", SDL_GetSystemRAM() / 1024.0f);
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::SameLine(300);
|
||||
if (ImGui::Button("Close", ImVec2(120, 40)))
|
||||
if (ImGui::Button("Close", ImVec2(100, 35)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
|
@ -441,33 +460,38 @@ void MainWindow::NewProjectPopup()
|
|||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
std::string projdir = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||
|
||||
std::string uuid = UUID().String();
|
||||
auto p = std::filesystem::path(projdir) / uuid / std::filesystem::path("project.json");
|
||||
m_story.Initialize(p.generic_string());
|
||||
if (!std::filesystem::is_directory(projdir))
|
||||
{
|
||||
|
||||
m_story.SetDisplayFormat(320, 240);
|
||||
m_story.SetImageFormat(StoryProject::IMG_FORMAT_QOIF);
|
||||
m_story.SetSoundFormat(StoryProject::SND_FORMAT_WAV);
|
||||
m_story.SetName("New project");
|
||||
m_story.SetUuid(uuid);
|
||||
std::string uuid = UUID().String();
|
||||
auto p = std::filesystem::path(projdir) / uuid / std::filesystem::path("project.json");
|
||||
m_story.Initialize(p.generic_string());
|
||||
|
||||
SaveProject();
|
||||
OpenProject(p.generic_string());
|
||||
m_story.SetDisplayFormat(320, 240);
|
||||
m_story.SetImageFormat(StoryProject::IMG_FORMAT_QOIF);
|
||||
m_story.SetSoundFormat(StoryProject::SND_FORMAT_WAV);
|
||||
m_story.SetName("New project");
|
||||
m_story.SetUuid(uuid);
|
||||
|
||||
SaveProject();
|
||||
OpenProject(p.generic_string());
|
||||
}
|
||||
}
|
||||
|
||||
// close
|
||||
ImGuiFileDialog::Instance()->Close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
void MainWindow::ProjectPropertiesPopup()
|
||||
{
|
||||
|
||||
static std::string projdir;
|
||||
// Always center this window when appearing
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
if (ImGui::BeginPopupModal("NewProjectPopup", NULL, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
if (ImGui::BeginPopupModal("ProjectPropertiesPopup", NULL, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::Text("New project parameters (directory must be empty)");
|
||||
ImGui::Separator();
|
||||
|
|
@ -615,8 +639,6 @@ void MainWindow::NewProjectPopup()
|
|||
|
||||
if (valid)
|
||||
{
|
||||
auto p = std::filesystem::path(projdir) / std::filesystem::path("project.json");
|
||||
m_story.Initialize(p.generic_string());
|
||||
|
||||
if (display_item_current_idx == 0)
|
||||
{
|
||||
|
|
@ -630,10 +652,8 @@ void MainWindow::NewProjectPopup()
|
|||
m_story.SetImageFormat(GetImageFormat(image_item_current_idx));
|
||||
m_story.SetSoundFormat(GetSoundFormat(sound_item_current_idx));
|
||||
m_story.SetName(project_name);
|
||||
m_story.SetUuid(UUID().String());
|
||||
|
||||
SaveProject();
|
||||
OpenProject(p.generic_string());
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
|
@ -650,7 +670,6 @@ void MainWindow::NewProjectPopup()
|
|||
{
|
||||
projdir = "";
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::SaveProject()
|
||||
|
|
@ -701,7 +720,8 @@ void MainWindow::OpenProject(const std::string &filename)
|
|||
|
||||
void MainWindow::RefreshProjectInformation()
|
||||
{
|
||||
m_gui.SetWindowTitle("Story Editor - " + m_story.GetProjectFilePath());
|
||||
std::string fullText = "Story Editor " + gVersion + " - " + m_story.GetProjectFilePath();
|
||||
m_gui.SetWindowTitle(fullText);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -759,6 +779,7 @@ void MainWindow::Loop()
|
|||
|
||||
NewProjectPopup();
|
||||
OpenProjectDialog();
|
||||
ProjectPropertiesPopup();
|
||||
|
||||
if (aboutToClose)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "story_project.h"
|
||||
#include "i_story_manager.h"
|
||||
#include "thread_safe_queue.h"
|
||||
#include "audio_player.h"
|
||||
|
||||
struct DebugContext
|
||||
{
|
||||
|
|
@ -145,6 +146,7 @@ private:
|
|||
virtual std::list<std::shared_ptr<Connection>> GetNodeConnections(unsigned long nodeId) override;
|
||||
virtual std::string GetNodeEntryLabel(unsigned long nodeId) override;
|
||||
virtual void Play() override;
|
||||
virtual void Ok() override;
|
||||
virtual void Pause() override;
|
||||
virtual void Next() override;
|
||||
virtual void Previous() override;
|
||||
|
|
@ -174,6 +176,7 @@ private:
|
|||
void ProcessStory();
|
||||
void StepInstruction();
|
||||
void RefreshProjectInformation();
|
||||
void ProjectPropertiesPopup();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "properties_window.h"
|
||||
#include "gui.h"
|
||||
|
||||
PropertiesWindow::PropertiesWindow()
|
||||
: WindowBase("Properties")
|
||||
|
|
@ -16,15 +15,10 @@ void PropertiesWindow::Initialize() {
|
|||
|
||||
void PropertiesWindow::Draw()
|
||||
{
|
||||
// if (!IsVisible())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
WindowBase::BeginDraw();
|
||||
ImGui::SetWindowSize(ImVec2(626, 744), ImGuiCond_FirstUseEver);
|
||||
|
||||
|
||||
ImGui::SeparatorText("Selected node");
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue