Skip to content

Commit 02afef1

Browse files
(master) Finishing image positioning and emotions
1 parent ac81275 commit 02afef1

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

images/bg bg_0.png

-296 KB
Loading

images/bg bg_1.png

154 KB
Loading

images/bg bg_2.png

142 KB
Loading

images/bg bg_3.png

97 KB
Loading

images/bg bg_4.png

91.8 KB
Loading

src/codegen.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ pub fn write_script(ctx: &mut ScriptCtx, game: &Game) -> Result<()> {
112112
))?;
113113
}
114114
}
115+
ctx.write("transform midleft:".to_string())?;
116+
ctx.indent();
117+
ctx.write("xalign 0.1 yalign 0.5".to_string())?;
118+
ctx.unindent();
119+
ctx.write("transform midright:".to_string())?;
120+
ctx.indent();
121+
ctx.write("xalign 0.9 yalign 0.5".to_string())?;
122+
ctx.unindent();
115123

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

143+
ctx.write("with dissolve".to_string())?;
144+
135145
for d in scene.script.iter() {
136146
if game
137147
.characters
@@ -142,18 +152,13 @@ fn gen_scene(ctx: &mut ScriptCtx, game: &Game, scene: &Scene, i: usize) -> Resul
142152
{
143153
if !char_pos.contains_key(&d.speaker) {
144154
let position = match char_pos.len() {
145-
1 => "left",
146-
2 => "right",
155+
0 => "midleft",
156+
1 => "midright",
147157
_ => "center",
148158
};
149159

150160
char_pos.insert(d.speaker.clone(), position.to_string());
151161
}
152-
ctx.write(format!(
153-
r#"{} "{}""#,
154-
d.speaker,
155-
d.content.split(": ").last().unwrap_or(d.content.as_str())
156-
))?;
157162
let express: String = if EXPRESSIONS.contains(&d.facial_expression.as_str()) {
158163
d.facial_expression.clone()
159164
} else {
@@ -163,6 +168,11 @@ fn gen_scene(ctx: &mut ScriptCtx, game: &Game, scene: &Scene, i: usize) -> Resul
163168
"show {}_img {} at {}",
164169
d.speaker, express, char_pos[&d.speaker]
165170
))?;
171+
ctx.write(format!(
172+
r#"{} "{}""#,
173+
d.speaker,
174+
d.content.split(": ").last().unwrap_or(d.content.as_str())
175+
))?;
166176
} else {
167177
ctx.write(format!(r#""{}""#, d.content))?;
168178
}

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn generate_game(args: &Cli, openai_token: &str) -> Game {
107107
// Otherwise generate game from scratch
108108

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

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

0 commit comments

Comments
 (0)