So I went to this website:
http://prairiewest.net/blog/2013/12/text-shadow-glow-corona-sdk/
From there I went to the github site and downloaded the stylizedText.lua. I put it into my folder, did the require(“styledText”) line and created a test font so that I can figure out what I want exactly. The problem is, that it works… once. The first time I loaded it, it worked. Then if I wanted to reload the simulator, it would just come up as white text (without any style). I removed the files and brought them back… same thing. First time simulator ran it it worked, then after reload it went away and just had plain white text. (little note is that my page or,main menu, has a fade but it happened even when deleting fade.
I tried ensuring it was inserted into the sceneGroup. I brought it to the front. I even did a forward declaration. I then moved it around within the scene phases. I noticed that if I put it in the scene create phase, it will do as described above, load once then never again. However, if I put it into the scene:show section under did, it works fine (granted it doesn’t fade in and actually waits for the fade to complete before it pops on the screen. But it does load correctly every time.
Is this a corona simulator issue, or some issue with the code?
Below is the code I was running. The styledText.lua can be found at the above link.
--------------------------------------------------------------------------------- -- -- scene.lua -- --------------------------------------------------------------------------------- local sceneName = ... local composer = require( "composer" ) -- Load scene with same root filename as this file local scene = composer.newScene( sceneName ) local styledText = require("styledText") --local loadsave = require("loadSave") --local appodeal = require("plugin.appodeal") --------------------------------------------------------------------------------- local screenW, screenH, halfW = display.actualContentWidth, display.actualContentHeight, display.contentCenterX local sheetWindowOptions = { frames = { { name=border, x = 772, y = 1401, width = 13, height = 602}, { name=levelBG, x = 0, y = 0, width = 927, height = 742}, { name=menuSkinnyBorder, x = 0, y = 1401, width = 770}, { name=menuThickBorder, x = 0, y = 744, width = 927}, { name=skinnyBar, x = 0, y = 1936, width = 445} }, sheetContentWidth = 1024, sheetContentHeight = 2048 } local windowSheet = graphics.newImageSheet("windowSprite.png", sheetWindowOptions) local window local myText function scene:create( event ) local sceneGroup = self.view -- Called when the scene's view does not exist -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc local background = display.newImageRect( sceneGroup, "background.png", display.actualContentWidth, display.actualContentHeight ) background.anchorX = 0 background.anchorY = 0 background.x = 0 + display.screenOriginX background.y = 0 + display.screenOriginY window = display.newImageRect(sceneGroup, windowSheet, 2, screenW\*.60, screenH\*.95) window.x = display.contentCenterX window.y = display.contentCenterY myText = styledText.newText({ text = "Welcome to the game!", textColor = {255,255,255,255}, x = display.contentCenterX, y = display.contentCenterY, font = "Arial", size = 60, shadowOffset = 5, shadowColor = {0,0,0,.5}, glowOffset = 1, glowColor = {120,3,3,180}, blurGlow = 0 }) myText:toFront() sceneGroup:insert(myText) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen -- yourScoreText = display.newEmbossedText(sceneGroup, "GAME OVER", display.contentCenterX, screenH\*.05, native.systemFont, 36) -- yourScoreText:setFillColor(0) elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene