-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from matejsemancik/feature/raspberry-pi-standa…
…lone Standalone Raspberry Pi app
- Loading branch information
Showing
16 changed files
with
478 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
object ProjectSettings { | ||
const val version = "2.1.0" | ||
const val version = "2.2.0" | ||
const val group = "dev.matsem" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
out/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import java.util.* | ||
|
||
plugins { | ||
kotlin("jvm") | ||
application | ||
} | ||
|
||
apply<dev.matsem.astral.CommonDependencies>() | ||
|
||
application { | ||
val props = Properties().apply { | ||
load(file("${rootDir}/local.properties").inputStream()) | ||
} | ||
val nativesDir = props["processing.core.natives.rpi"] | ||
|
||
mainClass.set("dev.matsem.astral.raspberrypi.RaspberryApp") | ||
applicationDefaultJvmArgs = listOf( | ||
"-Djava.library.path=$nativesDir" | ||
) | ||
applicationName = "visuals" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core")) | ||
} | ||
|
||
group = ProjectSettings.group | ||
version = ProjectSettings.version | ||
|
||
tasks { | ||
compileKotlin { | ||
kotlinOptions.jvmTarget = "11" | ||
} | ||
compileTestKotlin { | ||
kotlinOptions.jvmTarget = "11" | ||
} | ||
} | ||
|
||
tasks.getByName<Zip>("distZip") { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
tasks.getByName<Sync>("installDist") { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
mkdir lib/shader | ||
mv lib/*.glsl lib/shader/ | ||
mv images/ bin/images | ||
mv fonts/ bin/fonts |
35 changes: 35 additions & 0 deletions
35
raspberrypi/src/main/kotlin/dev/matsem/astral/raspberrypi/RaspberryApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package dev.matsem.astral.raspberrypi | ||
|
||
import dev.matsem.astral.core.di.coreModule | ||
import dev.matsem.astral.raspberrypi.sketches.NeonLogo | ||
import org.koin.core.KoinComponent | ||
import org.koin.core.context.startKoin | ||
import org.koin.core.inject | ||
import org.koin.core.logger.Level | ||
import processing.core.PApplet | ||
|
||
class RaspberryApp : KoinComponent { | ||
|
||
companion object { | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
RaspberryApp().run(args) | ||
} | ||
} | ||
|
||
private val sketch: PApplet by inject() | ||
|
||
/** | ||
* Launches PApplet with specified arguments. Be sure to include --sketch-path argument for proper data | ||
* folder resolution (dir containing your Processing data folder), | ||
* @see https://processing.github.io/processing-javadocs/core/ | ||
*/ | ||
fun run(processingArgs: Array<String>) { | ||
startKoin { | ||
printLogger(Level.ERROR) | ||
modules(coreModule + raspberryModule { NeonLogo() }) | ||
} | ||
|
||
PApplet.runSketch(processingArgs + arrayOf("RaspberryVisuals"), sketch) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
raspberrypi/src/main/kotlin/dev/matsem/astral/raspberrypi/RaspberryModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.matsem.astral.raspberrypi | ||
|
||
import org.koin.dsl.bind | ||
import org.koin.dsl.module | ||
import processing.core.PApplet | ||
|
||
fun raspberryModule(providePApplet: () -> PApplet) = module { | ||
single { providePApplet() } bind PApplet::class | ||
} |
21 changes: 21 additions & 0 deletions
21
raspberrypi/src/main/kotlin/dev/matsem/astral/raspberrypi/sketches/Blank.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dev.matsem.astral.raspberrypi.sketches | ||
|
||
import dev.matsem.astral.core.tools.extensions.colorModeHsb | ||
import org.koin.core.KoinComponent | ||
import processing.core.PApplet | ||
import processing.core.PConstants | ||
|
||
class Blank : PApplet(), KoinComponent { | ||
|
||
override fun settings() { | ||
size(420, 420, PConstants.P2D) | ||
} | ||
|
||
override fun setup() { | ||
colorModeHsb() | ||
} | ||
|
||
override fun draw() { | ||
background(0f, 100f, 100f) | ||
} | ||
} |
Oops, something went wrong.