FusePowered

Range Slider

Posted by R4T40, Posted on January 11, 2014

GitHub URL: 
https://github.com/PauloPeres/RangeSlider

This Range Slider is a Two Handles Sliders with maximum and minimum values if you want.
This is the same code as the widget.slider from the corona guys i just made some changes and added the ability to use as a double handle slider.
It's easier to make ranges selections this way and if someone find any error please let me know.

to download the code go Github.

The link to take look on youtube and see woking
http://www.youtube.com/watch?v=ZGUbkVtVmqI&feature=youtu.be

1
-- Don`t forget the widget because the slider use the slider theme of the corona.

Stroke for Text Fonts

Posted by marcior, Posted on December 11, 2013

Got the base function from the forum and improved it a bit: http://forums.coronalabs.com/topic/8895-stroke-on-text/
PS. note that parameters "color" and "strokecolor" need to be tables such as {1,1,1}.

Follows the function:

1
2
3
4
5
6
7
8
local newText = function(str, font, size, color, strokewidth, strokecolor)
    local bg
    local t = display.newGroup()
    t.anchorChildren = true
 
    for c1 = -strokewidth, strokewidth do
        for c2 = -strokewidth, strokewidth do
            if c1 ~= 0 or c2 ~= 0 then

Continue using setReferencePoint() to set new anchor points in Graphics2.0

Posted by AlanPlantPot, Posted on November 29, 2013

GitHub URL: 
https://github.com/alanthomson/CoronaSDKReferencePoint2.0

Requiring this function will re-enable obj:setReferencePoint() for the following objects:

*display.newGroup
*display.newImageRect
*display.newImage
*display.newRect
*display.newRoundedRect
*display.newText
*display.newEmbossedText
*display.newCircle
*display.newLine
*display.newSprite

Just include the lua file in your project, and then call

require("refPointConversions")

at the start of main.lua.

Choosing Color Values for Graphics 2.0 Format

Posted by Bead Pond, Posted on November 27, 2013

GitHub URL: 
https://github.com/beadpond/colors

This is a quick tool for choosing color values in Graphics 2.0 format. The values are arrayed from 0 to 1. Each of the three sliders controls a color, and there is one to control the alpha as desired. The goal of the tool is to grab some color values to use in your projects as you need.

Hope it helps! Let me know if something needs to be fixed.

Kiffin Ayers

Magnet: Position Helper for Corona SDK Graphics 2.0

Posted by Iván Juárez, Posted on November 26, 2013

GitHub URL: 
https://github.com/radixzz/magnet

A module to position display objects on different screen resolutions. This helper will only work with the newest version of Corona (aka 2.0). Anchors and screen orientations are internally managed to provide consistency.

Example:

1
2
local c = display.newCircle(0, 0, 10) -- inside currentStage or currentView
magnet:bottomRight(c, 20, 10) -- Align to the bottom right edge of the screen effectively. With 20px of margin from the right and 10px from the bottom

*All display objects are aligned relative to the parents. It supports groups, containers and snapshots.

PinchZoom with Pan also

Posted by miko0, Posted on November 7, 2013

GitHub URL: 
https://gist.github.com/mikofh/7360955

I needed to use simple pan in a huge map. I took the PinchZoom example from Interface from Corona.
This is the simple example using DragMe together with pinchZoom. Notice that I have a huge image around 3000 x 3000 px.
Then it makes sense to use dragme to drag the picture around and then zoom in and out for better view.

I also added comments to use swipe and then transition.to to move the map. It was not how I intended it to work, so after the coding I made comment, so it is there, but not used at all.

Create dynamic text with strokes, drop shadow, rotation, resizing. Interface is as simple as working with a display object.

Posted by benchow, Posted on October 29, 2013

GitHub URL: 
https://github.com/benchow/Text

local Text = {}
--[[------------------------------------------------------------
-- Text.draw
----------------------------------------------------------------
-- returns a proxy object that allows you to change text
OPTIONS:
text => text to draw
font => font name
fontSize
shadow => boolean turns on/off dropshadow (default true)
stroke => boolean turns on/off stroke this default false
color => {r,g,b,alpha}
stroke_color => {r,g,b,alpha}
shadow_color => {r,g,b,alpha}
group => parent display group
x,y

Equalizer type of bars

Posted by lessmsios, Posted on October 15, 2013

A simple bar graph I used in one of my apps. Just stick the code into a main.lua file and run it. This is an early version but works. Enjoy!

1
2
3
4
5
6
7
8
9
10
11
local widget = require( "widget" );
_W, _H = display.viewableContentWidth, display.viewableContentHeight;
display.setDefault( "background", 255, 255, 255 );
 
local function newBars(dobars, w, h, segcolor, x, y)
    local retBar = {};
    local barSegments = {};
    local newbargroup = display.newGroup();
    local xgap = 2;
    local xinc = w/dobars;
    for i=1,dobars do

Image Cropper

Posted by yosu, Posted on October 14, 2013

I was looking for a simple image cropper, and found it in the forums. Thought it would be a good idea to post it here too, as it is very helpful.

Inputs :
1) Image object (or could be other objects)
2) width of final object (crop)
3) height of final object (crop)

Modification done :
- Does not create any additional file
- Returns the image object directly.

Taken from : http://forums.coronalabs.com/topic/38773-how-to-crop-a-scaled-picture/
All credit goes to 'jonjonsson'

The function :

1
2
3
local function crop(photo, width, height)
    
    -- End size we want

Display Multiline (multi line) Text using newText

Posted by yosu, Posted on September 26, 2013

A simple and fast way to display a long text into several lines of text (using the 'newText' function with align feature). Code is still ugly as more testing is being done. Please let me know if there are any bugs.

Concept was taken from Satheesh (http://developer.coronalabs.com/code/useful-multiline-text-library), but tried to improve on it with faster processing.

Notes : If the text has "/n", it will break into a new line.

Usage :

1
2
3
require("multiline2")
local multiLineText = display.newMultiLineText2
{