Embedded
Book shelf - Embedded
this book shelf app contains the multiple kwik projects inside. The lua files of each project are embedded in the master app but the assets such as images, audio files of each book are not embedded.They are downloadable from http server. Due to Apple’s regulation, Solar2D does not allow to load the lua files (programming codes) via Internet. The lua files must be embedded in the app but the other assets can be retrieved from http server.
The master app controls which book to be loaded with In App Purchase. Each book project can be built as a single standalone project.
When you like to add new books, you need to update the master app as well to include the new lua files of the new books.
You can create each book as a normal Kwik project but this embedded version is not appropriate the master app to hold hundreds of books.
For Each book project or TOC project, Ultimate configuration of Kwik4 is default. New Universal or other configuration of Kwik3 are not supported.
Sample file
Please download the sample project from here. The sample contains KwikShelf plugin
- https://kwiksher.com/tutorials/Kwik4/BookShelf.zip
- BookshelfEmbedded
- BookTOC
- Book01
- Book02
- BookServer
Please put them into ~/Documents/Kwik folder. BookShelfEmbedded is the master app to control BookTOC, Book01 and Book02.. and you find copy_books script that archive assets.zip in BookServer. BookTOC project offers the thumbnail page and the information page of Books.
Bookshelf Embedded project
this project is not a normal Kwik project. You need a text editor to edit main.lua. All you have to do is just to write the one line of code. App folders contains the build4 files from BookTOC, Book01 and Book04. You can use copy.bat(WIN) or copy.command(MAC) in BookServer to copy them.
├─App
│ ├─book01
│ ├─book02
│ └─TOC
├─extlib
├─lib
└─plugin
└─kwikshelf
build.settings
config.lua
main.lua
copy.command
copy.bat
main.lua is just one line to load “TOC” of App
require("plugin.KwikShelf").start("TOC", 1)
BookTOC project
page1 - Shelf shows the thumbnail of books and the buttons for purchase and download

- With each book{{Num}}Icon, the following layers are displayed.
- downloadBtn
- savedBtn
- savingTxt
- purchaseBtn
- restoreBtn
page2 - INFO shows a book image and the IAP buttons and information text

- downloadBtn
- savedBtn
- savingTxt
- purchaseBtn
- infoTxt
- hideOverlayBtn
Book01 project
page1 - Title. this title - bg.png will be displayed in the thumbnail view of the TOC in Book shelf master

- page2 image only
- page3 image only
- page4 image only
- page5 image only
- page6 shows the following goto buttons

- Goto TOC
- GOto Title
- Goto Next Book
- Goto Previous Book
the build4 folders are copied as App/book01 and App/book02 of Bookshelf Embedded project folder
Book02 project
page1 - Title. this title - bg.png will be displayed in the thumbnail view of the TOC in Book shelf master

- page2 image only
- page3 shows the following goto buttons

- Goto TOC
- GOto Title
- Goto Next Book
- Goto Previous Book
the build4 folders are copied as App/book02 of Bookshelf Embedded project folder
BookServer
Please use the script to zip the image, audio files as zip files
-
compress_assets/main.lua for Corona Simulator
command.setServerFolder("macos", "bookshelf") --command.setServerFolder("win32", "bookshelf") local books = { {project = "Book01", serverFolder = "book01"}, {project = "Book02", serverFolder = "book02"}, } local onLineImages = { {project = "Book01", serverFolder = "book01en", image = "build4/assets/images/p1/bg@4x.png"}, {project = "Book01", serverFolder = "book01jp", image = "build4/assets/images/p1/bg@4x.png"}, {project = "Book02", serverFolder = "book02en", image = "build4/assets/images/p1/bg@4x.png"}, {project = "Book02", serverFolder = "book02jp", image = "build4/assets/images/p1/bg@4x.png"}, } ... ...