Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE-261 Pocket Code - Example Project #5044

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -72,7 +72,7 @@ public void testCreateScaledDefaultProject() {
Scene currentScene = project.getDefaultScene();
List<Sprite> spriteList = currentScene.getSpriteList();

assertEquals(4, spriteList.size());
assertEquals(8, spriteList.size());

assertEquals(1, spriteList.get(1).getNumberOfScripts());
assertEquals(1, spriteList.get(2).getNumberOfScripts());
Expand All @@ -82,6 +82,10 @@ public void testCreateScaledDefaultProject() {
assertEquals(1, spriteList.get(1).getLookList().size());
assertEquals(1, spriteList.get(2).getLookList().size());
assertEquals(2, spriteList.get(3).getLookList().size());
assertEquals(1, spriteList.get(4).getLookList().size());
assertEquals(1, spriteList.get(5).getLookList().size());
assertEquals(1, spriteList.get(6).getLookList().size());
assertEquals(1, spriteList.get(7).getLookList().size());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -163,17 +163,51 @@ public Project createDefaultProject(String name, Context context, boolean landsc
SCREENSHOT_AUTOMATIC_FILE_NAME,
1);

File pandaFile = ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
R.drawable.panda_a,
imageDir,
imageFileName,
backgroundImageScaleFactor);

File lynxFile = ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
R.drawable.lynx_a,
imageDir,
imageFileName,
backgroundImageScaleFactor);

File elephantFile =
ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
R.drawable.elephant,
imageDir,
imageFileName,
backgroundImageScaleFactor);

File appleFile =
ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
R.drawable.apple,
imageDir,
imageFileName,
backgroundImageScaleFactor);

Sprite background = scene.getSpriteList().get(0);
background.getLookList()
.add(new LookData(context.getString(R.string.default_project_background_name), backgroundFile));

Sprite cloud1 = new Sprite(context.getString(R.string.default_project_cloud_sprite_name_1));
Sprite cloud2 = new Sprite(context.getString(R.string.default_project_cloud_sprite_name_2));
Sprite bird = new Sprite(context.getString(R.string.default_project_sprites_animal_name));
Sprite panda = new Sprite(context.getString(R.string.default_project_panda_sprite_name));
Sprite lynx = new Sprite(context.getString(R.string.default_project_lynx_sprite_name));
Sprite elephant = new Sprite(context.getString(R.string.default_project_elephant_sprite_name));
Sprite apple = new Sprite(context.getString(R.string.default_project_apple_sprite_name));

scene.addSprite(cloud1);
scene.addSprite(cloud2);
scene.addSprite(bird);
scene.addSprite(panda);
scene.addSprite(lynx);
scene.addSprite(elephant);
scene.addSprite(apple);

cloud1.getLookList()
.add(new LookData(context.getString(R.string.default_project_cloud_name), cloudFile1));
Expand All @@ -187,6 +221,10 @@ public Project createDefaultProject(String name, Context context, boolean landsc
.add(new SoundInfo(context.getString(R.string.default_project_sprites_tweet_1), tweetFile1));
bird.getSoundList()
.add(new SoundInfo(context.getString(R.string.default_project_sprites_tweet_2), tweetFile2));
panda.getLookList().add(new LookData(context.getString(R.string.default_project_panda_name), pandaFile));
lynx.getLookList().add(new LookData(context.getString(R.string.default_project_lynx_name), lynxFile));
elephant.getLookList().add(new LookData(context.getString(R.string.default_project_elephant_name), elephantFile));
apple.getLookList().add(new LookData(context.getString(R.string.default_project_apple_sprite_name), appleFile));

Script script = new StartScript();
script.addBrick(new PlaceAtBrick(new Formula(0), new Formula(0)));
Expand Down
10 changes: 9 additions & 1 deletion catroid/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2023 The Catrobat Team
~ Copyright (C) 2010-2024 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -1362,6 +1362,14 @@
<string formatted="false" name="default_project_outer_loop">Outer Loop</string>
<!--suppress UnusedResources -->
<string formatted="false" name="default_project_inner_loop">Inner Loop</string>
<string formatted="false" name="default_project_panda_sprite_name">Panda</string>
<string formatted="false" name="default_project_panda_name">Panda (1)</string>
<string formatted="false" name="default_project_lynx_sprite_name">Lynx</string>
<string formatted="false" name="default_project_lynx_name">Lynx (1)</string>
<string formatted="false" name="default_project_elephant_sprite_name">Elephant</string>
<string formatted="false" name="default_project_elephant_name">Elephant (1)</string>
<string formatted="false" name="default_project_apple_sprite_name">Apple</string>
<string formatted="false" name="default_project_apple_name">Apple (1)</string>

<!-- Default ChromeCast Values -->
<string formatted="false" name="default_cast_project_background_name">Background</string>
Expand Down