소스 검색

easier setColour() function (support for rgb and monochrome) + tweaks for builder

tags/v0.0.6_dev
Niro 2 년 전
부모
커밋
1d9446df67
10개의 변경된 파일66개의 추가작업 그리고 37개의 파일을 삭제
  1. +0
    -2
      .build/builds/readme.txt
  2. +14
    -5
      .build/make-exe.sh
  3. +2
    -1
      .build/make-love.sh
  4. +14
    -1
      build.sh
  5. +1
    -1
      data/starshipTypes.lua
  6. +19
    -5
      src/calc.lua
  7. +4
    -4
      src/class/Button.lua
  8. +4
    -10
      src/class/Menubutton.lua
  9. +2
    -2
      src/class/Planet.lua
  10. +6
    -6
      src/class/Textbox.lua

+ 0
- 2
.build/builds/readme.txt 파일 보기

@@ -1,2 +0,0 @@
your builds will be moved into this folder :)
dont delete me, im here so github doesn't delete this directory... i found out the hard way qwq

+ 14
- 5
.build/make-exe.sh 파일 보기

@@ -1,13 +1,22 @@
#!/bin/bash
echo -e "\e[1;33m Building .exe! \e[0m"
doZip=true
path="./.build"

# Windows Folder
winPATH=$path"/builds/"$1"-win"
mkdir $winPATH
winPATH=$path"/builds/$1-win"
mkdir "$winPATH"

# Creating .exe
cat $path"/love/love.exe" $path"/builds/"$1.love > $1.exe
mv $1.exe $winPATH
cat $path"/love/love.exe" $path"/builds/$1.love" > "$1.exe"
mv "$1.exe" "$winPATH"

# Moving dll's
cp $path"/win/"* $winPATH
cp $path"/win/"* "$winPATH"

# Zip it if $doZip == "true"
if [[ $doZip == "true" ]]; then
name=$1"-win.zip"
zip "$path/builds/$name" -r "$winPATH"
rm -rf "$winPATH"
fi

+ 2
- 1
.build/make-love.sh 파일 보기

@@ -1,3 +1,4 @@
#!/bin/bash
echo -e "\e[1;33m Building .love \e[0m"
zip -9 -r $1.love . -x ./.build/**\* ./.git/**\*
mv $1.love ./.build/builds
mv $1.love ./.build/builds

+ 14
- 1
build.sh 파일 보기

@@ -1,11 +1,24 @@
#!/bin/bash
project=$1

# Give Permissions
# Check if main.lua exists:
if [[ ! -f "main.lua" ]]; then
echo -e "\e[31m !! Could not find main.lua file, terminating build process !! \e[0m"
exit 1
fi

# Give Permissions and check for build directory:
chmod +x -R ./.build
if [[ ! -d ./.build/builds ]]; then
mkdir ./.build/builds
fi

# Build .love
./.build/make-love.sh $project

# Build .exe
./.build/make-exe.sh $project

# End
echo -e "\e[1;33m Finished Building Project! \e[0m"
exit 0

+ 1
- 1
data/starshipTypes.lua 파일 보기

@@ -3,7 +3,7 @@ starshipTypes = {
orbiter = {
name = "Classic Orbiter",
description = "Dolor fugiat irure sit aliqua labore. Culpa voluptate occaecat anim exercitation proident sint ex dolor. Officia in labore sint Lorem ea. Ad minim aliqua aliqua non commodo qui in ea sit excepteur excepteur qui.",
impacttolerance = 3,
impacttolerance = 5,
mass = 1000000, -- idk, feels better but holy fuck thats a thicc ass boi xD
speed = 0.01,
specials = {"orbitSync"},


+ 19
- 5
src/calc.lua 파일 보기

@@ -15,14 +15,26 @@ function calc.debug(text)
end
end

function calc.colour(r, g, b)
return { r/255, g/255, b/255 }
end
-- Turn 0-1 colour to 0-range (default: 255):
function calc.setColour(r, g, b, a)
-- Supported Inputs:
-- RGB: (r, g, b, a)
-- Greyscale: (luminance, a)
local range = 255

-- Set g and b value to r if in greyscale and :
if b == nil and a == nil then
a = g
g, b = r, r
end
-- Colour Conversion (0-1 -> 0-range)
r, g, b = r/range, g/range, b/range

-- If alpha not provided, set to 1 by default:
if a == nil then a = 1 end

function calc.c(value)
return value/255
-- Change Draw Colour:
love.graphics.setColor(r, g, b, a)
end

-- Distance Formula:


+ 4
- 4
src/class/Button.lua 파일 보기

@@ -13,8 +13,8 @@ function Button:init(tempX, tempY, tempW, tempH, tempText, tempTC, tempBC, tempA
-- Text and Colours:
self.text = tempText
self.colour = {
text = calc.colour(tempTC[1], tempTC[2], tempTC[3]),
background = calc.colour(tempBC[1], tempBC[2], tempBC[3])
text = tempTC,
background = tempBC
}

-- Click Cooldown:
@@ -76,11 +76,11 @@ function Button:draw()
end

-- Draw Background
love.graphics.setColor(bg[1], bg[2], bg[3])
calc.setColour(bg[1], bg[2], bg[3], bg[4])
love.graphics.rectangle("fill", x, y, w, h)

-- Draw Text
love.graphics.setFont(font.default)
love.graphics.setColor(tx[1], tx[2], tx[3])
calc.setColour(tx[1], tx[2], tx[3], tx[4])
love.graphics.printf(self.text, x, y+h/8, w, "center")
end

+ 4
- 10
src/class/Menubutton.lua 파일 보기

@@ -60,26 +60,20 @@ end
function Menubutton:draw()
local x, y, w, h = self.x, self.y, self.w, self.h
local bg, tx = self.colour.background, self.colour.text
bg, tx = calc.colour(bg[1], bg[2], bg[3]), calc.colour(tx[1], tx[2], tx[3])

-- Hover Effects
-- Hover Effects:
if self:hover() then
-- Slight Colour Lightup
for i = 1, #bg do
bg[i] = bg[i]*1.1
end

-- Slight pop up effect (purly visual)
-- Slight pop up effect (purly visual):
local pop = 3
x, y, w, h = x-pop, y-pop, w+pop*2, h+pop*2
end

-- Draw Background
love.graphics.setColor(bg[1], bg[2], bg[3])
calc.setColour(bg[1], bg[2], bg[3], bg[4])
love.graphics.rectangle("fill", x, y, w, h)

-- Draw Text
love.graphics.setFont(font.default)
love.graphics.setColor(tx[1], tx[2], tx[3])
calc.setColour(tx[1], tx[2], tx[3], tx[4])
love.graphics.printf(self.text, x, y, w, "center")
end

+ 2
- 2
src/class/Planet.lua 파일 보기

@@ -93,8 +93,8 @@ end

function Planet:draw()
local col = self.colour
love.graphics.setColor(calc.c(col[1]), calc.c(col[2]), calc.c(col[3]))
calc.setColour(col[1], col[2], col[3], col[4])
love.graphics.circle("fill", self.x, self.y, self.r)
love.graphics.setColor(0.1,0.1,0.1,0.2)
love.graphics.setColor(0.1, 0.1, 0.1, 0.2)
love.graphics.circle("fill", self.x, self.y, self.r*2)
end

+ 6
- 6
src/class/Textbox.lua 파일 보기

@@ -13,8 +13,8 @@ function Textbox:init(tempX, tempY, tempW, tempH, tempText, tempAlign, tempTC, t

-- Colours:
self.colour = {
text = calc.colour(tempTC[1], tempTC[2], tempTC[3]),
background = calc.colour(tempBC[1], tempBC[2], tempBC[3])
text = tempTC,
background = tempBC
}
end

@@ -22,16 +22,16 @@ end
-- FUNCTIONS

function Textbox:drawBox()
local c = self.colour.background
love.graphics.setColor(c[1], c[2], c[3], 0.7)
local col = self.colour.background
calc.setColour(col[1], col[2], col[3], 0.7)
love.graphics.rectangle("fill", self.x, self.y, self.w, self.h)
end

function Textbox:drawText()
local border = 3
local c = self.colour.text
local col = self.colour.text
love.graphics.setFont(font.default)
love.graphics.setColor(c[1], c[2], c[3])
calc.setColour(col[1], col[2], col[3])
love.graphics.printf(self.text, self.x + border, self.y + border, self.w + border*2, self.align)
end



불러오는 중...
취소
저장