flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Custom Multiple Document Interface and Visual Page Viewer

Author
Thread Post new topic Reply to topic
soul_master



Joined: 30 Jun 2023
Posts: 23
soul_master 18 Sep 2023, 03:50
How to create a custom Multiple Document Interface (MDI). Written in pure C from scratch with no WinAPI/MFC/NET/etc. Easily portable to any system: Arduino, Android, RPI, ESP32.

Example: Multiple Document Viewer (MDV): https://github.com/starpow3r/mdv (Click "[<> Code]" > Download). See MULTIPLE_DOCUMENT_VIEWER.C for the program, and INCLUDE/DOCUMENT.H for the code. Requirements: Win95+. Resolution: HD 1920x1080x32. Compiler: TinyC. Setup: Just copy /TCC/ folder to C:/. Target: C:/TCC/TCC.EXE.

Supports several document types: Text, Code, Binary, Image, Palette, Page. Initial beta release. Version -1. No links yet. No networking. Not quite an editor yet. No open or save. Not entirely functional.

Here's how it works: INTERFACE is a dynamic ARRAY of DOCUMENTs which are files that are currently open with a name, tab, icon and close button. A DOCUMENT can be a TEXT_DOCUMENT, CODE_DOCUMENT, BINARY_DOCUMENT (as hexadecimal bytes), IMAGE_DOCUMENT, PALETTE_DOCUMENT, SOUL_DOCUMENT (PAGE), or any type. For each DOCUMENT type, there are functions that must be defined: open, draw, input and timer. It is upgradeable to support new file formats like .FONT, .SPRITE (animation, array of IMAGEs) and .ACTOR (array of SPRITE animations, a player with "actions" like walk, block, punch, kick).

Code:
DOCUMENT *open_document(text name);
DOCUMENT *open_text_document(text name);
DOCUMENT *open_code_document(text name);
DOCUMENT *open_binary_document(text name);
DOCUMENT *open_palette_document(text name);
DOCUMENT *open_image_document(text name);
DOCUMENT *open_soul_document(text name);

int save_document(DOCUMENT *document, text as);
int save_text_document(DOCUMENT *document, text as);
int save_code_document(DOCUMENT *document, text as);
int save_binary_document(DOCUMENT *document, text as);
int save_palette_document(DOCUMENT *document, text as);
int save_image_document(DOCUMENT *document, text as);
int save_soul_document(DOCUMENT *document, text as);

int draw_document(DOCUMENT *document);
int draw_text_document(DOCUMENT *document);
int draw_code_document(DOCUMENT *document);
int draw_binary_document(DOCUMENT *document);
int draw_palette_document(DOCUMENT *document);
int draw_image_document(DOCUMENT *document);
int draw_soul_document(DOCUMENT *document);

int input_document(DOCUMENT *document);
int input_text_document(DOCUMENT *document);
int input_code_document(DOCUMENT *document);
int input_binary_document(DOCUMENT *document);
int input_palette_document(DOCUMENT *document);
int input_image_document(DOCUMENT *document);
int input_soul_document(DOCUMENT *document);

int timer_document(DOCUMENT *document);
int timer_text_document(DOCUMENT *document);
int timer_code_document(DOCUMENT *document);
int timer_binary_document(DOCUMENT *document);
int timer_palette_document(DOCUMENT *document);
int timer_image_document(DOCUMENT *document);
int timer_soul_document(DOCUMENT *document);    


Soulscript. My custom PAGE script. Easy alternative to HTML/CSS. See INCLUDE/PAGE/PAGE.H.

Code:
; Soulscript example

<t>Example:<>

<code>
  puts("Hello");
<>    


PAGE is a visual document, an ARRAY of ELEMENTs (text, code, images). See INCLUDE/PAGE/SCRIPT.H for load_page(PAGE *page, text name).

Advantages of PAGE: Easiest, clearest, fastest, portable, efficient, modular, customizable, ultra lightweight compared to HTML/CSS, low memory usage, no browser required (PAGE.H is the browser), and raster fonts with real outline (not in HTML/CSS). Designed for tutorials, examples and help files. Disadvantages: Beta. Limited. No links or jumps within pages. No error checking. It expects code to be written perfectly, or it may crash instantly.


Description:
Filesize: 419.57 KB
Viewed: 1372 Time(s)

soulscript.jpg


Post 18 Sep 2023, 03:50
View user's profile Send private message Reply with quote
soul_master



Joined: 30 Jun 2023
Posts: 23
soul_master 18 Sep 2023, 08:40
Example:

Code:
page.image='stars'
page.text.color=#fff

<t4>Soulscript Test<>

<t3><#2cf>Soulscript<> <#f4b>Test<><>

<t2><#f0c>Soulscript<> <#ff3>Test<><>

<t><#4f3>Soulscript Test<><>

<code>
  // Example C program

  #include <stdio.h>

  int main() {
    puts("Hello");
    return 0;
  }
<>

<t3>
  Colors:
  <#f00>RED<>, <#0f0>GREEN<>, <#00f>BLUE<>,
  <#0ff>CYAN<>, <#f0f>MAGENTA<>, <#ff0>YELLOW<>
<>

where='media/image/soul'
image='microbe,cell,plant,animal,user,earth,star'
<r>    


Output:


Description:
Filesize: 198.25 KB
Viewed: 1358 Time(s)

soulscript2.jpg


Post 18 Sep 2023, 08:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.