From ed3a76144dd487ddaa933cd376003e3487a98a4b Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Thu, 18 Nov 2021 01:22:51 +0300 Subject: [PATCH] add Solar2D prj example --- Solar2D/SampleProject/HISTORY.md | 10 ++++ Solar2D/SampleProject/TODO.md | 1 + Solar2D/SampleProject/build.settings | 37 ++++++++++++++ Solar2D/SampleProject/config.lua | 18 +++++++ Solar2D/SampleProject/main.lua | 0 Solar2D/SampleProject/scenes/game.lua | 70 +++++++++++++++++++++++++++ 6 files changed, 136 insertions(+) create mode 100644 Solar2D/SampleProject/HISTORY.md create mode 100644 Solar2D/SampleProject/TODO.md create mode 100644 Solar2D/SampleProject/build.settings create mode 100644 Solar2D/SampleProject/config.lua create mode 100644 Solar2D/SampleProject/main.lua create mode 100644 Solar2D/SampleProject/scenes/game.lua diff --git a/Solar2D/SampleProject/HISTORY.md b/Solar2D/SampleProject/HISTORY.md new file mode 100644 index 0000000..64487ca --- /dev/null +++ b/Solar2D/SampleProject/HISTORY.md @@ -0,0 +1,10 @@ +## Legend +- 🐛 - Bug +- ✔ī¸ - Fixed +- ❌ - Removed +- ➕ - Added +- ℹī¸ - Information +- â™ģī¸ - Edited + +## 0.1.0 - [17/04/2021] - (not work) +- diff --git a/Solar2D/SampleProject/TODO.md b/Solar2D/SampleProject/TODO.md new file mode 100644 index 0000000..277cc02 --- /dev/null +++ b/Solar2D/SampleProject/TODO.md @@ -0,0 +1 @@ +- diff --git a/Solar2D/SampleProject/build.settings b/Solar2D/SampleProject/build.settings new file mode 100644 index 0000000..b542f73 --- /dev/null +++ b/Solar2D/SampleProject/build.settings @@ -0,0 +1,37 @@ +settings = +{ + orientation = + { + default = "portrait", + supported = { "portrait", }, + }, + + android = + { + usesPermissions = + { + "android.permission.INTERNET", + }, + }, + + iphone = + { + xcassets = "Images.xcassets", + plist = + { + UIStatusBarHidden = false, + UILaunchStoryboardName = "LaunchScreen", + }, + }, + + plugins = + { + + }, + + excludeFiles = + { + all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", }, + android = { "LaunchScreen.storyboardc", }, + }, +} diff --git a/Solar2D/SampleProject/config.lua b/Solar2D/SampleProject/config.lua new file mode 100644 index 0000000..eb59aeb --- /dev/null +++ b/Solar2D/SampleProject/config.lua @@ -0,0 +1,18 @@ +application = +{ + content = + { + width = 1080, + height = 1920, + scale = "letterbox", + fps = 60, + + --[[ + imageSuffix = + { + ["@2x"] = 2, + ["@4x"] = 4, + }, + --]] + }, +} diff --git a/Solar2D/SampleProject/main.lua b/Solar2D/SampleProject/main.lua new file mode 100644 index 0000000..e69de29 diff --git a/Solar2D/SampleProject/scenes/game.lua b/Solar2D/SampleProject/scenes/game.lua new file mode 100644 index 0000000..25e501f --- /dev/null +++ b/Solar2D/SampleProject/scenes/game.lua @@ -0,0 +1,70 @@ +local composer = require('composer') + +local scene = composer.newScene() + +local groupBack +local groupMain +local groupUI + + +function gameLoop() + -- +end + +local function onFrame(event) + -- +end + + +function scene:create(event) + local sceneGroup = self.view + + groupBack = display.newGroup() + groupMain = display.newGroup() + groupUI = display.newGroup() + + local debugRect = display.newRect(display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight ) + debugRect:setFillColor(0.807, 0.925, 0.956) +end + + +function scene:show(event) + local sceneGroup = self.view + local phase = event.phase + + if (phase == "will") then + -- Code here runs when the scene is still off screen (but is about to come on screen) + + elseif (phase == "did") then + gameLoopTimer = timer.performWithDelay(500, gameLoop, 0) + end +end + + +function scene:hide(event) + local sceneGroup = self.view + local phase = event.phase + + if (phase == "will") then + -- Code here runs when the scene is on screen (but is about to go off screen) + + elseif (phase == "did") then + -- Code here runs immediately after the scene goes entirely off screen + + end +end + + +function scene:destroy(event) + local sceneGroup = self.view + -- Code here runs prior to the removal of scene's view +end + + +scene:addEventListener('create', scene) +scene:addEventListener('show', scene) +scene:addEventListener('hide', scene) +scene:addEventListener('destroy', scene) +Runtime:addEventListener('enterFrame', onFrame) + +return scene