Sciter SDK

repository·master·Indexed 24 days ago

https://github.com/c-smile/sciter-sdk

An embeddable HTML/CSS/scripting engine for Windows, Mac OSX, and Linux used to build high-performance native user interfaces. This version (Sciter.TIS) uses TIScript as the scripting language; for new projects, Sciter.JS is recommended. The SDK includes C++ integration headers such as sciter-x-dom.hpp and sciter-x-window.hpp, and provides various demo applications including usciter, uminimal, and a COM/ActiveX wrapper.

Tokens
8K
Snippets
2
Records
66
Agent score
79%

What's inside sciter-sdk

  1. Introduction to GLFW

    master

    GLFW is an open-source, multi-platform library designed for OpenGL, OpenGL ES, and Vulkan application development. It provides a platform-independent API for:

    • Creating windows, contexts, and surfaces.
    • Reading input.
    • Handling events.

    Supported Platforms:

    • Windows: Windows XP and later.
    • macOS: macOS 10.8 and later.
    • Linux/Unix-like: Supports X11 and Wayland. Works even without a desktop environment, though some features require a running window or clipboard manager.

    License: zlib/libpng license.

  2. Understand the structure of a generated ui-framework project

    master

    When using the AppWizard to create a ui-framework application, the project is structured as a standard Win32 VC++ application. The core components include:

    • Main Application Logic: ui-framework.cpp serves as the primary source file for the application.
    • Project Configuration: ui-framework.vcxproj manages Visual C++ project settings, platforms, and configurations.
    • Resource Management:
      • ui-framework.rc: The Microsoft Windows resource file containing icons, bitmaps, and cursors.
      • Resource.h: The header file defining resource IDs used by the application.
      • ui-framework.ico and small.ico: The application's icon files (32x32 and 16x16 respectively).
    • Precompiled Headers: StdAfx.h and StdAfx.cpp are used to manage precompiled header (PCH) files to improve build times.
  3. Migrate to Sciter.JS if starting a new project

    master

    Development of this specific repository (Sciter.TIS) has stopped in favor of Sciter.JS.

    While this version uses TIScript as the scripting language behind the UI, Sciter.JS uses modern JavaScript (ES2020). If you are starting a new project, it is recommended to use the Sciter.JS SDK instead.

  4. Understand the structure of a Sciter Win32 application

    master

    A Sciter Win32 application generated by the AppWizard consists of several key components:

    • Main Source: sciter.cpp is the primary application source file where the main logic resides.
    • Project Files: sciter.vcxproj (the main VC++ project file) and sciter.vcxproj.filters (used by the IDE for file grouping) manage the build configuration.
    • Windows Resources: sciter.rc defines the Microsoft Windows resources used by the program (icons, bitmaps, cursors), while Resource.h defines the resource IDs.
    • Icons: sciter.ico (32x32) and small.ico (16x16) are the application icons included via the resource file.
    • Precompiled Headers: StdAfx.h and StdAfx.cpp are used to build precompiled header (PCH) files to speed up compilation.

    When customizing a generated project, look for TODO: comments in the source code to identify areas intended for user implementation.

  5. Understand the structure of a plain-win Win32 application

    master

    A plain-win application is a standard Win32 project generated by the Sciter AppWizard. It consists of several key components:

    Core Source Files

    • plain-win.cpp: The main application source file containing the entry point and core logic.
    • StdAfx.h & StdAfx.cpp: Files used to implement Precompiled Headers (PCH) to speed up build times.

    Project & IDE Files

    • plain-win.vcxproj: The main Visual C++ project file containing platform, configuration, and feature settings.
    • plain-win.vcxproj.filters: An IDE-specific file that manages how files are grouped (e.g., grouping .cpp files under "Source Files") within Visual Studio.

    Windows Resources

    • plain-win.rc: The resource script listing all Microsoft Windows resources used by the program (icons, bitmaps, cursors).
    • Resource.h: The header file defining resource IDs used by the application and the resource script.
    • plain-win.ico & small.ico: Icon files (32x32 and 16x16 respectively) used for the application's visual identity.

    Customization Note

    When reviewing generated code, look for TODO: comments. These indicate specific locations where you are expected to add or customize application logic.

  6. Project structure of the layered Win32 application

    master

    The layered project is a Win32 application generated by the Sciter AppWizard. It follows a standard Visual C++ project structure. Key components include:

    • Source Code: layered.cpp is the main application entry point.
    • Build Configuration: layered.vcxproj is the main VC++ project file, and layered.vcxproj.filters manages file grouping in the IDE.
    • Windows Resources: layered.rc defines the application's resources (icons, bitmaps, cursors), while Resource.h defines the resource IDs used by the system.
    • Precompiled Headers: StdAfx.h and StdAfx.cpp are used to manage precompiled headers (layered.pch) to speed up build times.

    Note: Look for TODO: comments within the source code to identify areas intended for customization or additional logic.

  7. Use ready-to-use widgets in Sciter

    master
    The widgets directory contains a collection of pre-built, ready-to-use UI components designed for Sciter applications. These widgets can be integrated into your project to provide common UI patterns without requiring manual implementation from scratch.
  8. Project structure of the sciter-opengl Win32 application

    master

    The sciter-opengl project is a Win32 application generated by the Sciter Application Wizard. It is structured as a standard Visual C++ project.

    Key components include:

    • sciter-opengl.cpp: The main application source file containing the core logic.
    • sciter-opengl.vcxproj: The main Visual C++ project file defining platforms, configurations, and features.
    • sciter-opengl.rc & Resource.h: Windows resource files used to manage application icons, bitmaps, and cursors.
    • StdAfx.h & StdAfx.cpp: Precompiled header (PCH) files used to accelerate build times.

    When customizing the application, look for TODO: comments in the source code to identify areas intended for user implementation.

  9. Compile GLFW from source

    master

    GLFW requires only the headers and libraries for your specific OS and window system. It does not require headers for context creation APIs (like WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan) to enable support for them.

    Supported Compilers:

    • Windows: Visual C++ 2010 and later, MinGW, and MinGW-w64.
    • macOS: Clang.
    • Linux/Unix-like: GCC and Clang.

    Note on Wayland: If using the experimental Wayland backend on Linux, you must have the extra-cmake-modules package installed to generate Wayland protocol headers.

    For detailed instructions, refer to the official compilation guide.

  10. Integrate the SQLite3 extension into a Sciter application

    master

    The SQLite3 engine is provided as a Sciter extension library. To use it, you must link the source files statically with your application.

    1. Add all *.c and *.cpp files from the SQLite directory to your project.
    2. Implement a wrapper function in your window class to expose the database opening capability to the Sciter engine.
    3. Register the function in your class's SOM (Sciter Object Model) passport so it is accessible from the UI/scripting layer.
    // 1. Define the wrapper function in your window class
    sciter::value openDb(sciter::string path) {
        sqlite::DB* pdb = sqlite::DB::open(path);
        if (pdb)
          return sciter::value::wrap_asset(pdb);
        else
          return sciter::value();
    }
    
    // 2. Register the function in the SOM passport
    SOM_PASSPORT_BEGIN(frame)
        SOM_FUNCS( SOM_FUNC(openDb) )
    SOM_PASSPORT_END
  11. Select the correct Sciter binaries for your platform

    master

    Sciter provides pre-compiled binaries organized by operating system and rendering backend. Choose the directory that matches your target platform and preferred graphics engine:

    • Windows (Direct2D & GDI+): Use /bin.
    • Windows (Direct2D & Skia): Use /bin.skia.
    • macOS (CoreGraphics & Skia): Use /bin.osx.