<commit_before># This file is part of NIT ( http://www.nitlanguage.org ).
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/projects/COPYING.WTFPL for more details.

# Template for a 2D gamnit game
module template is
	app_name "gamnit template"
	app_namespace "org.gamnit.template"
	app_version(0, 1, git_revision)
	android_api_target 10
end

import gamnit::flat # The 2D API, use `gamnit::depth` for 3D

redef class App

	# Texture, loaded in `create_scene`
	var texture = new Texture("fighter.png")

	# Sound effect, lazy loaded at first use
	var sound = new Sound("laser.mp3")

	# Sprite, must be loaded in or after `on_create`
	var sprite = new Sprite(texture, new Point3d[Float](0.0, 0.0, 0.0)) is lazy

	redef fun create_scene
	do
		super

		# Report errors on all loaded textures.
		# Root textures are associated to pixel data,
		# whereas other texture may be subtextures of root textures.
		for tex in all_root_textures do
			var error = tex.error
			if error != null then print_error "Texture '{tex}' failed to load: {error}"
		end

		# Draw the texture as pixelated, it looks better for such
		# a small texture.
		texture.as(TextureAsset).pixelated = true

		# Create the sprite and make it visible.
		sprites.add sprite

		# Make the sprite smaller, by default each pixel corresponds to 1 world unit.
		# However, it is often preferable to make 1 world unit correspond to
		# something meaningful in the game world, such as 1 meter.
		#
		# Scale the ship so it is approximately 5 world units wide.
		sprite.scale = 5.0 / texture.width

		# Move the camera to show 10 world units on the Y axis at Z = 0.
		# The `sprite` should take approximately 1/4 of the height of the screen.
		world_camera.reset_height 20.0

		# Move the near clip wall closer to the camera because our world unit
		# range is small. Moving the clip wall too close to the camera can
		# cause glitches on mobiles devices with small depth buffer.<commit_msg>gamnit: fix error between comment and code in template project<commit_after># This file is part of NIT ( http://www.nitlanguage.org ).
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/projects/COPYING.WTFPL for more details.

# Template for a 2D gamnit game
module template is
	app_name "gamnit template"
	app_namespace "org.gamnit.template"
	app_version(0, 1, git_revision)
	android_api_target 10
end

import gamnit::flat # The 2D API, use `gamnit::depth` for 3D

redef class App

	# Texture, loaded in `create_scene`
	var texture = new Texture("fighter.png")

	# Sound effect, lazy loaded at first use
	var sound = new Sound("laser.mp3")

	# Sprite, must be loaded in or after `on_create`
	var sprite = new Sprite(texture, new Point3d[Float](0.0, 0.0, 0.0)) is lazy

	redef fun create_scene
	do
		super

		# Report errors on all loaded textures.
		# Root textures are associated to pixel data,
		# whereas other texture may be subtextures of root textures.
		for tex in all_root_textures do
			var error = tex.error
			if error != null then print_error "Texture '{tex}' failed to load: {error}"
		end

		# Draw the texture as pixelated, it looks better for such
		# a small texture.
		texture.as(TextureAsset).pixelated = true

		# Create the sprite and make it visible.
		sprites.add sprite

		# Make the sprite smaller, by default each pixel corresponds to 1 world unit.
		# However, it is often preferable to make 1 world unit correspond to
		# something meaningful in the game world, such as 1 meter.
		#
		# Scale the ship so it is approximately 5 world units wide.
		sprite.scale = 5.0 / texture.width

		# Move the camera to show 20 world units on the Y axis at Z = 0.
		# The `sprite` should take approximately 1/4 of the height of the screen.
		world_camera.reset_height 20.0

		# Move the near clip wall closer to the camera because our world unit
		# range is small. Moving the clip wall too close to the camera can
		# cause glitches on mobiles devices with small depth buffer.
{'fraction_non_alphanumeric': 0.06923257451302511, 'fraction_numerical': 0.014081201595869515, 'mean_word_length': 3.6225596529284165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7311449', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1261, 'n_words': 606}