Добавил вторую главу занимательного программирования

This commit is contained in:
2025-12-15 00:36:33 +01:00
parent c1147629f7
commit 2878f1e34c
128 changed files with 6744 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project.name = appName + "-core"

View File

@@ -0,0 +1,49 @@
package net.caraus.curtain;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.ScreenUtils;
public class Curtain extends ApplicationAdapter {
SpriteBatch batch;
Texture background;
Texture foreground;
TextureRegion leftRegion;
TextureRegion rightRegion;
int delta = 0;
@Override
public void create () {
batch = new SpriteBatch();
background = new Texture("badlogic.bmp");
foreground = new Texture("background2.bmp");
}
@Override
public void render () {
ScreenUtils.clear(1, 0, 0, 1);
leftRegion = new TextureRegion(foreground, 128 - delta, 256);
rightRegion = new TextureRegion(foreground, 128, 0, 128 - delta, 256);
batch.begin();
batch.draw(background, 0, 0);
if (delta < 128) {
batch.draw(leftRegion, 0 - delta, 0);
batch.draw(rightRegion, 128 + delta, 0);
}
batch.end();
++delta;
}
@Override
public void dispose () {
batch.dispose();
background.dispose();
foreground.dispose();
}
}