Skip to content

Commit

Permalink
(master) Finishing image positioning and emotions
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinmuthukumar committed Jun 18, 2023
1 parent ac81275 commit 02afef1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
Binary file modified images/bg bg_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bg bg_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bg bg_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bg bg_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/bg bg_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 17 additions & 7 deletions src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ pub fn write_script(ctx: &mut ScriptCtx, game: &Game) -> Result<()> {
))?;
}
}
ctx.write("transform midleft:".to_string())?;
ctx.indent();
ctx.write("xalign 0.1 yalign 0.5".to_string())?;
ctx.unindent();
ctx.write("transform midright:".to_string())?;
ctx.indent();
ctx.write("xalign 0.9 yalign 0.5".to_string())?;
ctx.unindent();

ctx.write(format!("label start:"))?;
for (i, scene) in game.scenes.iter().enumerate() {
Expand All @@ -132,6 +140,8 @@ fn gen_scene(ctx: &mut ScriptCtx, game: &Game, scene: &Scene, i: usize) -> Resul
ctx.write(format!("zoom 2"))?;
ctx.unindent();

ctx.write("with dissolve".to_string())?;

for d in scene.script.iter() {
if game
.characters
Expand All @@ -142,18 +152,13 @@ fn gen_scene(ctx: &mut ScriptCtx, game: &Game, scene: &Scene, i: usize) -> Resul
{
if !char_pos.contains_key(&d.speaker) {
let position = match char_pos.len() {
1 => "left",
2 => "right",
0 => "midleft",
1 => "midright",
_ => "center",
};

char_pos.insert(d.speaker.clone(), position.to_string());
}
ctx.write(format!(
r#"{} "{}""#,
d.speaker,
d.content.split(": ").last().unwrap_or(d.content.as_str())
))?;
let express: String = if EXPRESSIONS.contains(&d.facial_expression.as_str()) {
d.facial_expression.clone()
} else {
Expand All @@ -163,6 +168,11 @@ fn gen_scene(ctx: &mut ScriptCtx, game: &Game, scene: &Scene, i: usize) -> Resul
"show {}_img {} at {}",
d.speaker, express, char_pos[&d.speaker]
))?;
ctx.write(format!(
r#"{} "{}""#,
d.speaker,
d.content.split(": ").last().unwrap_or(d.content.as_str())
))?;
} else {
ctx.write(format!(r#""{}""#, d.content))?;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn generate_game(args: &Cli, openai_token: &str) -> Game {
// Otherwise generate game from scratch

println!("Generating game...");
let prompt = "Write a love story about two LGBTQ+ individuals falling in love and overcoming stigma and hardships.";
let prompt = "Write a love story about two gay individuals falling in love and overcoming stigma and hardships.";
let game = generate_story(openai_token, prompt).unwrap();
println!("{:?}", game);

Expand All @@ -129,6 +129,7 @@ fn generate_game(args: &Cli, openai_token: &str) -> Game {
}
}
pub fn run_game(ren_path: &PathBuf, out: &PathBuf, game: &Game) -> Result<()> {
println!("Running Game");
if cfg!(target_os = "windows") {
} else {
Command::new(ren_path.to_str().unwrap())
Expand Down

0 comments on commit 02afef1

Please sign in to comment.