Put Them Together - Bookshelf
BookShelf Overview
Terms
- An Episode consists of a single or multiple pages.
- Assets.zip contains the images, audio etc of pages
- A Book is a single Kwik project Assets of a Book are locatd in build4/assets folder.
- Book{NUM} means Book01, Book02, …
- Table of content(TOC) page shows the thumbnail of Episodes or Books which are downloadable from a serverXS
- BookShelf type. You can choose one of them to make a Book Shelf app.
- pages
- embedded
- template
Project setting
For Each book project or TOC project, Ultimate configuration of Kwik4 is default. New Universal or other configuration of Kwik3 are not supported.
Project properites - Book Shelf Project

- Advanced Settings > Book Shelf Project
- pages
- embedded
- template
- Downloadable book project. this checkbox is only applicable for a book project to be embedded in the master book shelf app.

BookShelf.zip contains the following project folders. Book01 and Book02 projects are shared for BookShelfEmbedded and BookShelfTmplt.
https://kwiksher.com/tutorials/Kwik4/BookShelf.zip
- Book01
- Book02
- BookServer
- BookShelfEmbedded
- BookShelfPages
- BookShelfTmplt
- BookTOC
BookShelfPages
A single Kwik project contains multiple episodes. the page asset of each episode is downloadable.
1 | Shelf.psd | table of contents, user to read an episode or to purchase an episode | free |
2 | ep01.psd | Episode01 | free |
3 | ep02_info.psd | Episode02 Purchase Information | free |
4 | ep02_1 | Episode02-1 | paid |
5 | ep02_2 | Episode02-2 | paid |
6 | ep03 | Episode03 | paid |
BookShelfEmbedded
Multiple Kwik projects are bundled with KwikShelf plugin. BookTOC project shows the thumbnail of books. BookTOC and Book{Num} projects are compiled with KwikShelf plugin. The assets of Book{Num} are downloadable.
-
Master project with KwikShelf. This is not a Kwik project. It is a normal corona SDK project
- copy.bat(WIN), copy.command(MAC) to copy the build4 folders of BOOK projects to the master project.
MyCopy Book01 book01 MyCopy Book02 book02
-
BookTOC project
1 | Shelf.psd | table of contents for books | |
2 | INFO.psd | a Book’s Info is loaded |
- Book{Num} project
1 | page1.psd | ||
2 | page2.psd | ||
3 | page3..psd | ||
.. | … | … | … |
BookShelfTmplt
the master project consists of TOC, INFO and template scenes. The assets from a Book project are loaded to the master project. Each page of a Book project is associated with one of the template scene of the master.
1 | Shelf.psd | table of contents for books | |
2 | INFO.psd | a Book’s Info is loaded | |
3 | title.psd | template scene for book’s title page | |
4 | pageA | template scene A | |
5 | pageB | template scene B | |
6 | pageC | template scene C |
- Book{Num} project
1 | page1.psd | loaded to title scene | |
2 | page2.psd | loaded to scene A | |
3 | page3..psd | loaded to scene B | |
.. | … | … | … |
after published, build4/model.lua must be edited for the pages to be associated with the template scene of the master . The detail is described in Tmplt - Book. This model.json tells which tmplt page of the master is associated with a page of Book{num} project
BookServer - Utility to make assets.zip
the following files are used to produce the assets.zip files by zipping, copying&pasting the expected folders. You need to edit each file manually to assign a episode or book name to the variable of scripts
- BookServer
- copyright.txt
- copy_pages.bat, copy_pages.command for BookShelfPages
- compress_assets/main.lua for BookShelfEmbedded
- copy_books.bat, copy_books.command for BookShelfTmplt
copy_pages for pages
fol=./_book/tutorials/Kwik4/Bookshelf
proj=~/Documents/Kwik/BookshelfPages
...
...
MyCopy Episode02 4
MyCopy Episode02 5
MyCopy Episode03 6
compress_assets for embedded
command.setServerFolder("macos", "bookshelf")
local books = {
{project = "Book01", serverFolder = "book01"},
{project = "Book02", serverFolder = "book02"},
}
copy_books for tmplt
fol=./_book/tutorials/Kwik4/Bookshelf
MyCopy Book01 book01
MyCopy Book02 book02
these files above are mainly used after each project is published and compress PNGs are done. The details are described in the sub sections of this document.
Summary
- Shelf.psd shows the table of content that shows the thumbnail of episodes or books
- Info.psd shows the information of one episode or one book when user clicks the episode/book icon of the thumbnail on Shelf.psd
- Book{Num} project is for Embedded or Tmplt version of Bookshelf. Each images of Book(Num)’s pages are zipped. It is downloaded to the master shelf app.
- BookShelfEmbedded uses KwikShelf.plugin. It controls TOC, BOOK{Nm} project.
Notes
please read the following information on Monetization and IAP setting&testing.
Kwik' bookshelf implementation does not have a server-side receipt verification. By adding external codes of your own, you may send a product ID and a user unique ID to your server that manages the receipt verification with Apple/Google/Amazon service and controls the downloadable contents.
these Solar2D APIs are not used in Kwik' bookshelf implementation currently. You may add external codes for them. Or please contact me for the feature request if you need them.
- iOS: store.canMakePurchases
- Google: event.transaction.state with “refunded”
- Amazon: store.isSandboxMode