Tekijä | SHA1 | Viesti | Päivämäärä |
---|---|---|---|
Niro | ff0422e6d7 | Merge branch 'main' of https://github.com/NiroUwU/Questionable-Oerbital-Mechanics | 2 vuotta sitten |
Niro | 0813681c19 | removed calc.getText() out of Textbox.lua | 2 vuotta sitten |
nirokay |
7734685c40
|
Update README.md | 2 vuotta sitten |
Niro | 7d495afebd | added Buttons, Textboxes, and a basic tutorial ingame | 2 vuotta sitten |
Niro | 00b96ce5f6 | texture changes, minor tweaks | 2 vuotta sitten |
Niro | 0016c01a0f | added gamestate, completed Menubutton, added menu | 2 vuotta sitten |
nirokay |
63820e69f9
|
Merge pull request #5 from NiroUwU/testing
Please please end my suffering as well |
2 vuotta sitten |
@@ -1,14 +1,14 @@ | |||
# Questionable Örbital Mechanics | |||
## What is this? | |||
Questionable Örbital Mechanics - or as i like to call it: *QÖM* - is an open-source Space Simulation "Game" written in Lua using the Löve game engine. | |||
Questionable Örbital Mechanics - or as we like to call it: *QÖM* - is an open-source Space Simulation "Game" written in Lua using the Löve game engine. | |||
For now it is very basic, as it is still heavily in development. | |||
## How do i play this game? | |||
In order to play this game you need to ... | |||
1) ...have the Lua (5.4.3) programming language installed | |||
1) ...have the Lua (5.4.3) programming language installed (optional, as Löve comes with Lua) | |||
1) ...have the Löve (11.3) game engine installed | |||
For now this is the only way to play this game. In future there will be binary versions availabe. | |||
@@ -25,6 +25,9 @@ https://www.lua.org/download.html | |||
Arch Linux: | |||
`sudo pacman -S love` | |||
Debian/Ubuntu Linux: | |||
`sudo snap install love` | |||
Windows: | |||
https://love2d.org | |||
@@ -0,0 +1,6 @@ | |||
font = { | |||
default = love.graphics.setNewFont(20), | |||
gametitle = love.graphics.setNewFont(40) | |||
} | |||
return font |
@@ -1,7 +1,8 @@ | |||
info = {} | |||
info.name = "Questionable Örbital Mechanics" | |||
info.version = "0.0.2_dev" | |||
info.title = info.name | |||
info.version = "0.0.6_dev" | |||
info.authors = { | |||
"NiroUwU", | |||
"Madiwka4" | |||
@@ -3,11 +3,12 @@ settings = { | |||
min = 0.0001, | |||
max = 4, | |||
step = 0.05, | |||
reset = 0.0001 | |||
reset = 0.2, | |||
arrowAppear = 0.03 | |||
}, | |||
warp = { | |||
min = 1, | |||
max = 10, | |||
max = 25, | |||
step = 1, | |||
cooldown = 10 | |||
@@ -3,11 +3,11 @@ 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 = 9999, | |||
mass = 100000, -- idk, feels better but holy fuck thats a thicc ass boi xD | |||
speed = 0.05, | |||
impacttolerance = 3, | |||
mass = 1000000, -- idk, feels better but holy fuck thats a thicc ass boi xD | |||
speed = 0.01, | |||
specials = {"orbitSync"}, | |||
texture = texture.player.orbiter | |||
textures = texture.player.orbiter | |||
} | |||
} | |||
@@ -0,0 +1,28 @@ | |||
-- Storage for longer text strings and dialogue (?) in future for primarily textboxes | |||
text = { | |||
tutorial = { | |||
"Throttle:\n", | |||
" " .. controls.flight.throttle.up .. ", " .. controls.flight.throttle.down .. " - Changes your throttle (gui box left bottom)\n", | |||
" " .. controls.flight.throttle.full .. ", " .. controls.flight.throttle.none .. " - Quick toggle full or no thrust\n\n", | |||
"Engines:\n", | |||
" " .. controls.flight.thrust.engine .. " - Hold to activate your main engine", | |||
" " .. controls.flight.thrust.up .. ", "..controls.flight.thrust.left .. ", " .. controls.flight.thrust.down .. ", " .. controls.flight.thrust.right .. " - Small thrust in the four directions\n\n", | |||
"Steering:\n", | |||
" " .. controls.flight.thrust.rotleft .. ", " .. controls.flight.thrust.rotright .. " - Rotate spacecraft left and right\n\n", | |||
"Time Warp:\n", | |||
" " .. controls.flight.warp.up .. ", " .. controls.flight.warp.down .. " (period and comma) - Speed time warp up/down \n", | |||
" " .. controls.flight.warp.reset .. " (minus) - Reset time warp to default (1)\n\n", | |||
"Camera:\n", | |||
" " .. "Scroll mouse wheel" .. " - Zoom in and out\n", | |||
" " .. "Mouse Button "..controls.camera.zoom.reset .. " - Reset zoom to default\n\n\n", | |||
"Key bindings can be changed in game files [data/controls.lua]!" | |||
} | |||
} | |||
return text |
@@ -4,19 +4,21 @@ | |||
require "libraries" | |||
-- General Data: | |||
info = require "data/info" | |||
texture = require "textures/textures" | |||
info = require "data/info" | |||
controls = require "data/controls" | |||
settings = require "data/settings" | |||
starshipTypes = require "data/starshipTypes" | |||
font = require "data/font" | |||
text = require "data/textbox" | |||
-- Game Source: | |||
calc = require "src/calc" | |||
font = require "src/font" | |||
-- Game Classes: | |||
require "src/class/Menubutton" | |||
require "src/class/Button" | |||
require "src/class/Textbox" | |||
require "src/class/Player" | |||
require "src/class/Gui" | |||
require "src/class/Planet" | |||
@@ -1,14 +1,43 @@ | |||
require "import" | |||
debug = calc.debug | |||
calc.isDebug = true | |||
function love.load() | |||
require "import" | |||
-- Debugging / Logging: | |||
debug = calc.debug | |||
calc.isDebug = true | |||
-- Declaration: | |||
love.window.setTitle(info.name.." - v"..info.version) | |||
--love.graphics.setDefaultFilter("nearest", "nearest") | |||
width, height = love.graphics.getDimensions() | |||
-- Gamestate: | |||
gamestate = { | |||
quit = "stateQUIT", | |||
menu = "stateMENU", | |||
game = "stateGAME" | |||
} | |||
GAMESTATE = gamestate.menu | |||
-- Menubuttons: | |||
menubutton = { | |||
menu = { | |||
Menubutton(20, 100, 200, 50, gamestate.game, nil, "Start Game", {255, 255, 255}, {57, 45, 66}), | |||
Menubutton(30, 170, 180, 40, gamestate.quit, nil, "Quit Game", {255, 255, 255}, {57, 45, 66}) | |||
}, | |||
game = { | |||
-- Pause button or something here in future? | |||
} | |||
} | |||
-- Buttons: | |||
button = { | |||
tutorial = Button(width - 70, 20, 50, 30, "help", {255, 255, 255}, {40, 40, 40}, false) | |||
} | |||
-- Textboxes: | |||
textbox = { | |||
tutorial = Textbox(40, 40, width-80, height-80, getText(text.tutorial), "center", {255, 255, 255}, {0, 0, 0}) | |||
} | |||
-- Camera: | |||
cam = Camera() | |||
zoomlevel = settings.zoom.reset | |||
@@ -64,6 +93,9 @@ function drawPlanets() | |||
end | |||
end | |||
-- Effects | |||
function drawEffects() | |||
for i=1, #effects do | |||
effects[i]:draw() | |||
@@ -78,8 +110,6 @@ end | |||
-- Camera | |||
function cameraControls() | |||
local step = settings.zoom.step | |||
@@ -99,8 +129,7 @@ function cameraControls() | |||
end | |||
-- Zoom Limit: | |||
local max = settings.zoom.max | |||
local min = settings.zoom.min | |||
local max, min = settings.zoom.max, settings.zoom.min | |||
if zoomlevel < min then | |||
zoomlevel = min | |||
end | |||
@@ -111,6 +140,9 @@ function cameraControls() | |||
cam:zoomTo(zoomlevel) | |||
end | |||
-- Time Warp | |||
function timewarpControls() | |||
-- Time Warp Toggle Cooldowns: | |||
local maxCooldown = settings.warp.cooldown | |||
@@ -148,41 +180,88 @@ function timewarpControls() | |||
end | |||
-- Menubuttons | |||
function menubuttonUpdate() | |||
if GAMESTATE == gamestate.menu then | |||
for i, button in ipairs(menubutton.menu) do | |||
button:update() | |||
end | |||
elseif GAMESTATE == gamestate.game then | |||
for i, button in ipairs(menubutton.game) do | |||
button:update() | |||
end | |||
function love.update(dt) | |||
-- Game Objects: | |||
for i=1, timewarpControls() do | |||
-- Physics go in here: | |||
updatePlanets() | |||
player:update(dt) | |||
end | |||
player:throttleControls() | |||
end | |||
-- Gui: | |||
gui:update(dt) | |||
function menubuttonDraw() | |||
if GAMESTATE == gamestate.menu then | |||
for i, button in ipairs(menubutton.menu) do | |||
button:draw() | |||
end | |||
-- Camera: | |||
cam:lookAt(player.x, player.y) | |||
cameraControls() | |||
--debug(player.x .. " " .. player.y) | |||
elseif GAMESTATE == gamestate.game then | |||
for i, button in ipairs(menubutton.game) do | |||
button:draw() | |||
end | |||
end | |||
end | |||
function love.draw() | |||
cam:attach() | |||
-- MAIN | |||
function love.update(dt) | |||
if GAMESTATE == gamestate.quit then | |||
debug("Game has been quit, goodbye :)") | |||
love.event.quit(0) | |||
elseif GAMESTATE == gamestate.menu then | |||
elseif GAMESTATE == gamestate.game then | |||
-- Game Objects: | |||
drawPlanets() | |||
drawEffects() | |||
player:draw() | |||
-- Camera Zoom Player Location Indicator: OVERWORK SOON PLS KAY; IT UGLY | |||
if zoomlevel < 0.3 then | |||
love.graphics.setColor(1, 1, 1, 0.2) | |||
love.graphics.circle("fill", player.x, player.y, (1/zoomlevel)*10) | |||
for i=1, timewarpControls() do | |||
-- Physics go in here: | |||
updatePlanets() | |||
player:update(dt) | |||
end | |||
cam:detach() | |||
player:throttleControls() | |||
-- Gui: | |||
gui:update(dt) | |||
button.tutorial:update() | |||
-- Camera: | |||
cam:lookAt(player.x, player.y) | |||
cameraControls() | |||
end | |||
menubuttonUpdate() | |||
end | |||
-- Gui: | |||
gui:draw() | |||
function love.draw() | |||
if GAMESTATE == gamestate.menu then | |||
-- Game Title: | |||
love.graphics.setColor(1, 1, 0.6) | |||
love.graphics.setFont(font.gametitle) | |||
love.graphics.printf(info.title, 20, 20, width, "left") | |||
elseif GAMESTATE == gamestate.game then | |||
cam:attach() | |||
-- Game Objects: | |||
drawPlanets() | |||
drawEffects() | |||
player:draw() | |||
cam:detach() | |||
-- Gui: | |||
player:drawPositionIndicator() | |||
gui:draw() | |||
if button.tutorial.isActive then | |||
textbox.tutorial:draw() | |||
end | |||
button.tutorial:draw() | |||
end | |||
menubuttonDraw() | |||
end |
@@ -4,6 +4,7 @@ calc = {} | |||
-- G-Constant | |||
calc.G = 6.67e-11 -- TWEAKABLE FOR LATER DEPENDING ON SCALE!!!!!!!!!!! | |||
calc.pi = 3.14 | |||
-- Development debugging/logging thing | |||
function calc.debug(text) | |||
if calc.isDebug then | |||
@@ -50,5 +51,13 @@ function calc.closestObj(target) | |||
return minPlanet | |||
end | |||
-- Loops through a table and concatenate all stings (for textboxes) | |||
function calc.getText(stringTable) | |||
local string = "" | |||
for i, s in ipairs(stringTable) do | |||
string = string .. s | |||
end | |||
return string | |||
end | |||
return calc |
@@ -0,0 +1,80 @@ | |||
Button = Class {} | |||
function Button:init(tempX, tempY, tempW, tempH, tempText, tempTC, tempBC, tempActive) | |||
-- Position and Dimensions: | |||
self.x = tempX | |||
self.y = tempY | |||
self.w = tempW | |||
self.h = tempH | |||
-- Status: | |||
self.isActive = tempActive | |||
-- 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]) | |||
} | |||
-- Click Cooldown: | |||
self.cooldownLimit = 30 | |||
self.cooldown = 0 | |||
end | |||
-- FUNCTIONS | |||
function Button:hover() | |||
local hover = false | |||
local x,y = love.mouse.getPosition() | |||
if x > self.x and x < self.x + self.w and y > self.y and y < self.y + self.h then | |||
hover = true | |||
end | |||
return hover | |||
end | |||
function Button:click() | |||
local click = false | |||
if self:hover() and love.mouse.isDown(1) then | |||
click = true | |||
end | |||
return click | |||
end | |||
-- MAIN | |||
function Button:update(dt) | |||
if self:click() and self.cooldown <= 0 then | |||
self.isActive = not self.isActive | |||
self.cooldown = self.cooldownLimit | |||
end | |||
self.cooldown = self.cooldown - 1 | |||
end | |||
function Button:draw() | |||
local x, y, w, h = self.x, self.y, self.w, self.h | |||
local bg, tx = self.colour.background, self.colour.text | |||
-- Hover Effects | |||
if self:hover() and self.cooldown <= 0 then | |||
--[[ Slight Colour Lightup -- broken and idk why qwq | |||
for i = 1, #bg do | |||
bg[i] = bg[i]*1.1 | |||
end]] | |||
-- Slight pop up effect (purly visual) | |||
local pop = 1 | |||
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]) | |||
love.graphics.rectangle("fill", x, y, w, h) | |||
-- Draw Text | |||
love.graphics.setFont(font.default) | |||
love.graphics.setColor(tx[1], tx[2], tx[3]) | |||
love.graphics.printf(self.text, x, y, w, "center") | |||
end |
@@ -1,5 +1,85 @@ | |||
Menubutton = Class {} | |||
function Menubutton:init(tempX, tempY, tempW, tempH) | |||
function Menubutton:init(tempX, tempY, tempW, tempH, tempState, tempFormat, tempText, tempTC, tempBC) | |||
-- Position and Dimensions: | |||
self.x = tempX | |||
self.y = tempY | |||
self.w = tempW | |||
self.h = tempH | |||
-- State to jump to: | |||
self.toState = tempState | |||
-- Formatting: | |||
self.format = tempFormat | |||
if self.format == "center" or self.format == "centre" then | |||
self.x = self.x - self.w | |||
self.y = self.y - self.h | |||
end | |||
-- Text and Colours: | |||
self.text = tempText | |||
self.colour = { | |||
text = tempTC, | |||
background = tempBC | |||
} | |||
end | |||
-- FUNCTIONS | |||
function Menubutton:hover() | |||
local hover = false | |||
local x,y = love.mouse.getPosition() | |||
if x > self.x and x < self.x + self.w and y > self.y and y < self.y + self.h then | |||
hover = true | |||
end | |||
return hover | |||
end | |||
function Menubutton:click() | |||
local click = false | |||
if self:hover() and love.mouse.isDown(1) then | |||
click = true | |||
end | |||
return click | |||
end | |||
-- MAIN | |||
function Menubutton:update(dt) | |||
if self:click() then | |||
-- Here is room for calling effects or something... looking at you madi qwq xD | |||
GAMESTATE = self.toState | |||
end | |||
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 | |||
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) | |||
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]) | |||
love.graphics.rectangle("fill", x, y, w, h) | |||
-- Draw Text | |||
love.graphics.setFont(font.default) | |||
love.graphics.setColor(tx[1], tx[2], tx[3]) | |||
love.graphics.printf(self.text, x, y, w, "center") | |||
end |
@@ -9,6 +9,7 @@ function Player:init(tempX, tempY, tempT) | |||
self.xStart = tempX | |||
self.yStart = tempY | |||
-- Speed of Parent: | |||
self.orbitalX = 0 | |||
self.orbitalY = 0 | |||
@@ -32,19 +33,26 @@ function Player:init(tempX, tempY, tempT) | |||
self.angle = calc.pi/2 | |||
-- Status: | |||
self.isAccelerating = false | |||
self.exploding = false | |||
self.inRange = nil | |||
--TEXTURE HERE? | |||
self.texture = love.graphics.newImage(starshipTypes[tempT].texture) | |||
self.width = self.texture:getWidth() | |||
self.height = self.texture:getHeight() | |||
-- Spacecraft Textures: | |||
self.texture = { | |||
ship = starshipTypes[tempT].textures.ship, | |||
fullThrust = starshipTypes[tempT].textures.fullThrust, | |||
lowThrust = starshipTypes[tempT].textures.lowThrust | |||
} | |||
self.width = self.texture.ship:getWidth() | |||
self.height = self.texture.ship:getHeight() | |||
end | |||
-- FUNCTIONS | |||
-- Player Controls: | |||
function Player:throttleControls() | |||
local change = 0.01 | |||
local max, min = 1, 0 | |||
@@ -129,9 +137,11 @@ function Player:flightControls() | |||
if (calc.distance(closestPla.x, closestPla.y, self.x, self.y) > calc.distance(closestPla.x, closestPla.y, self.x+self.xSpeed + math.cos(self.angle) * speedChange*2, self.y+self.ySpeed - math.sin(self.angle) * speedChange*2) and self:isLanded()) then --Holy moly this is long | |||
debug("Flying into a planet!") | |||
else | |||
self.xSpeed = self.xSpeed + math.cos(self.angle) * speedChange*2 | |||
self.xSpeed = self.xSpeed + math.cos(self.angle) * speedChange*10 | |||
--debug("Ship thrusters X: " .. math.cos(self.angle) .. " " .. math.sin(self.angle) .. " " .. self.angle) | |||
self.ySpeed = self.ySpeed - math.sin(self.angle) * speedChange*2 | |||
self.ySpeed = self.ySpeed - math.sin(self.angle) * speedChange*10 | |||
self.isAccelerating = true | |||
end | |||
end | |||
if love.keyboard.isDown(controls.flight.thrust.rotleft) then | |||
@@ -148,6 +158,9 @@ function Player:flightControls() | |||
end | |||
end | |||
-- Get Player Data: | |||
function Player:getSpeed() -- absolute speed | |||
return math.abs(self.xSpeed) + math.abs(self.ySpeed) + math.abs(self.orbitalY) + math.abs(self.orbitalX) | |||
end | |||
@@ -176,7 +189,7 @@ function Player:isLanded() | |||
if self:getOrbitHeight(p) <= 1 then | |||
landed = true | |||
self.landedOn = p | |||
debug("Player touched down on: "..p.name) | |||
--debug("Player touched down on: "..p.name) | |||
end | |||
end | |||
-- Save Landing Speed: | |||
@@ -185,12 +198,15 @@ function Player:isLanded() | |||
local planet = math.abs(self.landedOn:getSpeed()) | |||
self.landingspeed = math.abs(player-planet) | |||
debug("Landing speed: "..self.landingspeed) | |||
--debug("Landing speed: "..self.landingspeed) | |||
end | |||
self:hasCrashed() | |||
return landed | |||
end | |||
-- Player Calculations: | |||
function Player:gravity() | |||
if self:isLanded() then | |||
-- Player is landed: | |||
@@ -220,21 +236,33 @@ function Player:updatePosition() | |||
self.y = self.y + self.ySpeed + self.orbitalY | |||
end | |||
function Player:drawTexture(x, y, r) | |||
-- Graphics / Drawing: | |||
function Player:drawTexture(x, y, r, s, texture) | |||
-- Texture offset and size | |||
local t = {s = 50} | |||
local w, h = texture:getWidth(), texture:getHeight() | |||
-- Draw Texture | |||
love.graphics.setColor(1, 1, 1) | |||
love.graphics.draw(self.texture, self.x, self.y, -(self.angle-calc.pi/2), 1, 1, self.width/2, self.height/2) | |||
love.graphics.draw(texture, x, y, -(self.angle-calc.pi/2), s, s, w/2, h/2) | |||
--debug("Angle: "..self.angle) | |||
end | |||
function Player:drawPositionIndicator(x, y) | |||
-- Directional Arrow (when zoomed out) | |||
if zoomlevel < settings.zoom.arrowAppear then | |||
local s = 0.03 | |||
self:drawTexture(width/2, height/2, calc.pi/2 - self.angle, s, texture.ui.arrow.red) | |||
end | |||
end | |||
-- MAIN | |||
function Player:update(dt) | |||
self.isAccelerating = false | |||
if self.angle > calc.pi*2 then | |||
self.angle = 0 | |||
elseif self.angle < 0 then | |||
@@ -248,22 +276,29 @@ function Player:update(dt) | |||
end | |||
function Player:draw() | |||
local x, y = self.x, self.y | |||
local x, y, scale = self.x, self.y, 1 | |||
local dist = 10 | |||
if not self.exploding then | |||
self:drawTexture(x, y, calc.pi/2 - self.angle) | |||
end | |||
local shake = 0 | |||
-- Shake (to textures): | |||
if self.isAccelerating then | |||
shake = math.random(0, 1) * self.throttle | |||
x, y = x + shake, y + shake | |||
end | |||
-- Draw Spacecraft: | |||
if not self.exploding then | |||
if calc.isDebug then | |||
-- Debugging Draw of actual Player Position | |||
love.graphics.setColor(1, 0, 0) | |||
love.graphics.circle("fill", x, y, 5, 20) | |||
-- Draw Thrust Exhaust: | |||
if self.isAccelerating and self.throttle ~= 0 then | |||
local limit = 0.5 | |||
if self.throttle < limit then | |||
self:drawTexture(x, y, calc.pi/2 - self.angle, scale, self.texture.lowThrust) | |||
else | |||
self:drawTexture(x, y, calc.pi/2 - self.angle, scale, self.texture.fullThrust) | |||
end | |||
end | |||
-- Directional Circle (temporary until actual rotatable ship texture is made) | |||
love.graphics.circle("fill", x+dist*(1/zoomlevel*2)*math.cos(self.angle), y-dist*(1/zoomlevel*2)*math.sin(self.angle), 1/zoomlevel*2) | |||
end | |||
-- Ship Texture Drawing: | |||
self:drawTexture(x, y, calc.pi/2 - self.angle, scale, self.texture.ship) | |||
end | |||
end |
@@ -0,0 +1,45 @@ | |||
Textbox = Class {} | |||
function Textbox:init(tempX, tempY, tempW, tempH, tempText, tempAlign, tempTC, tempBC) | |||
-- Dimensions: | |||
self.x = tempX | |||
self.y = tempY | |||
self.w = tempW | |||
self.h = tempH | |||
-- Text: | |||
self.text = tempText | |||
self.align = tempAlign | |||
-- Colours: | |||
self.colour = { | |||
text = calc.colour(tempTC[1], tempTC[2], tempTC[3]), | |||
background = calc.colour(tempBC[1], tempBC[2], tempBC[3]) | |||
} | |||
end | |||
-- FUNCTIONS | |||
function Textbox:drawBox() | |||
local c = self.colour.background | |||
love.graphics.setColor(c[1], c[2], c[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 | |||
love.graphics.setFont(font.default) | |||
love.graphics.setColor(c[1], c[2], c[3]) | |||
love.graphics.printf(self.text, self.x + border, self.y + border, self.w + border*2, self.align) | |||
end | |||
-- MAIN | |||
function Textbox:draw() | |||
self:drawBox() | |||
self:drawText() | |||
end |
@@ -1 +0,0 @@ | |||
default = love.graphics.setNewFont(20) |
@@ -1,10 +1,24 @@ | |||
texture = { | |||
-- (G)UI Textures: | |||
ui = { | |||
arrow = { | |||
grey = love.graphics.newImage("textures/ui/arrow_grey.png"), | |||
red = love.graphics.newImage("textures/ui/arrow_red.png") | |||
} | |||
}, | |||
-- Player/Spacecraft Textures: | |||
player = { | |||
orbiter = "textures/player/orbiter.png" | |||
-- Orbiter Spacecraft: | |||
orbiter = { | |||
ship = love.graphics.newImage("textures/player/orbiter/orbiter.png"), | |||
lowThrust = love.graphics.newImage("textures/player/orbiter/lowThrust.png"), | |||
fullThrust = love.graphics.newImage("textures/player/orbiter/fullThrust.png") | |||
} | |||
}, | |||
planet = { | |||
-- here will go planet textures in future | |||
} | |||
-- Planet Textures: | |||
planet = {} | |||
} | |||
return texture |