-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
class Game extends hxd.App | ||
{ | ||
static function main() | ||
{ | ||
hxd.Res.initLocal(); | ||
|
||
new Game(); | ||
} | ||
class Game extends hxd.App { | ||
static function main() { | ||
hxd.Res.initLocal(); | ||
new Game(); | ||
} | ||
|
||
var g:h2d.TileGroup; | ||
var g:h2d.TileGroup; | ||
|
||
override function init() | ||
{ | ||
// Разбиваем текстуру на кадры по сетке | ||
var tiles = hxd.Res.haxeLogo.toTile().gridFlatten(10, 0, 0); | ||
// создаем группу | ||
g = new h2d.TileGroup(tiles[0], s2d); | ||
// отключим blend mode для группы, это ускорит отрисовку тайлов | ||
g.blendMode = None; | ||
// и добавляем в нее тайлы, произвольно расположенные на экране | ||
for (i in 0...1000) | ||
{ | ||
g.add(Std.random(s2d.width), Std.random(s2d.height), tiles[i % tiles.length]); | ||
} | ||
} | ||
override function init() { | ||
// gridFlatten will split a tile into a list of tiles 10x10 | ||
// https://heaps.io/api/h2d/Tile.html#gridFlatten | ||
var tiles = hxd.Res.haxeLogo.toTile().gridFlatten(10, 0, 0); | ||
// we create a TileGroup | ||
g = new h2d.TileGroup(tiles[0], s2d); | ||
// we disable blend mode (for performance purposes) | ||
g.blendMode = None; | ||
// and then we add to it other radom pieces of the initially split tile | ||
for (i in 0...1000) { | ||
g.add(Std.random(s2d.width), Std.random(s2d.height), tiles[i % tiles.length]); | ||
} | ||
} | ||
|
||
override function update(dt:Float) | ||
{ | ||
g.rotation += 0.01; | ||
} | ||
} | ||
override function update(dt:Float) { | ||
g.rotation += 0.01; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Подключение библиотеки heaps | ||
# linking heaps library | ||
-lib heaps | ||
# Подключение библиотеки hldx (работает только под Windows) | ||
# Альтернативно можно использовать hlsdl | ||
-lib hldx | ||
# Задаем основной класс приложения с точкой входа | ||
# linking the hldx (DirectX) library (works only under Windows) | ||
# on other OS you can use hlsdl to link SDL, -lib hlsdl | ||
#-lib hldx | ||
-lib hlsdl | ||
# Define the main class of the application with an entry point | ||
-main Game | ||
# Выходной файл | ||
# Output file | ||
-hl game.hl |