Skip to content

Instantly share code, notes, and snippets.

View Morfly's full-sized avatar

Pavlo Stavytskyi Morfly

View GitHub Profile
import androidx.navigation.NavType
import androidx.navigation.compose.navArgument
abstract class MovieDetailsEntry : AggregateFeatureEntry {
final override val featureRoute = "movie-details?movieId={movieId}"
final override val arguments = listOf(
navArgument("movieId") {
type = NavType.IntType
import androidx.navigation.compose.NamedNavArgument
interface FeatureEntry {
val featureRoute: String
val arguments: List<NamedNavArgument>
get() = emptyList()
}
val destinations: Destinations = ...
val movieSearchScreen = destinations.find<MovieSearchEntry>()
NavHost(navController, startDestination = movieSearchScreen.featureRoute) {
with(movieSearchScreen) {
composable(navController, destinations)
}
...
}
class MovieSearchEntryImpl @Inject constructor() : MovieSearchEntry() {
@Composable
override fun Composable(
navController: NavHostController,
destinations: Destinations,
backStackEntry: NavBackStackEntry
) {
// Build your feature UI here.
...
interface FeatureEntry {
val featureRoute: String
...
@Composable
fun Composable(
navController: NavHostController,
destinations: Destinations,
navController.navigate("movie-details/41835")
val navController = rememberNavController()
NavHost(navController = navController, startDestination = "movie-search") {
composable("movie-search") { MovieSearchScreen(...) }
composable("movie-details") { MovieDetailsScreen(...) }
...
}
@Morfly
Morfly / shader.frag
Last active September 5, 2022 03:31
// triangle/shaders/shader.frag
#version 450
layout(location = 0) in vec3 fragColor;
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(fragColor, 1.0);
}
// triangle/main.cpp
...
void createGraphicsPipeline() {
auto vertShaderCode = readFile("triangle/shaders/shader.vert.spv");
auto fragShaderCode = readFile("triangle/shaders/shader.frag.spv");
...
}
# triangle/BUILD
load("@rules_cc//cc:defs.bzl", "cc_binary")
cc_binary(
name = "triangle",
srcs = glob(["*.cpp"]),
data = [
"//triangle/shaders:vert_shader",
"//triangle/shaders:frag_shader",
],