Skip to content

Commit

Permalink
Merge branch 'procedural_generation' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
L4ZZA committed Jul 1, 2020
2 parents d1f4acd + 66a4214 commit e0a8bac
Show file tree
Hide file tree
Showing 112 changed files with 4,150 additions and 1,169 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ inter/
## Files
*.user
*.filters
Sandbox/imgui\.ini
**/imgui\.ini

## VisualStudio Specific
*.vcxproj
*.sln
enc_temp_folder/

pyro_profile*.json

*.lnk
2 changes: 1 addition & 1 deletion LICENSE.MD → License.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Pietro Lazzarotto
Copyright (c) 2020 Pietro Lazzarotto

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Pyro

Engine that I will use for the AI project and for the
# Ember Editor [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build status](https://ci.appveyor.com/api/projects/status/r3k87jbaegd8v3fc/branch/procedural_generation?svg=true)](https://ci.appveyor.com/project/L4ZZA/pyro-procedural-gen/branch/procedural_generation)
==================


> A small piece of burning or glowing coal or wood in a dying fire.
Real-time 2D level editor using Pyro engine.

### How to build code

- Clone the repository using `git clone --recurse-submodules -j8`
- `recurse-submodules` will automatically initialize and update each submodule.
- `j8` tells git to use different _jobs_ to download and updated the submodules, hence makes it faster.
- Generate the solution running `scripts/generate_solution_*.bat` [double-click or run from cmd].
- Open `pyro.sln` solution just generated and build usin Visual Studio [other build systems are not supported yet].
- Run the solution (press F5).
[WARNING: if you want to run the application from the output folder you'll need to copy the assets folder from the project directory and paste in the same folder of the executable]

### How to build the installer

> **Requirements**
> - Install [NSIS: Nullsoft Scriptable Install System](https://sourceforge.net/projects/nsis/) to its default location `C:\Program Files (x86)\NSIS`
> - Add the install directory to your system path like so:![image](https://i.imgur.com/cTZquD7.png)
- Run the `create_installer.bat`, thie will generate the installer in the bin directory.
- go to `bin\Release-windows-x86_64\installers` and run `LevelEditorSetup.exe`.
152 changes: 152 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#
# Reference list
# - https://raw.githubusercontent.com/malaterre/GDCM/master/appveyor.yml
#
#
# http://www.appveyor.com/docs/build-cache#caching-chocolatey-packages
# https://github.com/kvirc/KVIrc/blob/master/.appveyor.yml
cache:
- C:\Tools\vcpkg\installed -> appveyor.yml
# caching binries and intermediates to allow incremental build
- C:\dev\source\bin -> appveyor.yml
- C:\dev\source\inter -> appveyor.yml
# - 'C:\Program Files (x86)\NSIS'
# - C:\ProgramData\chocolatey\bin -> appveyor.yml
# - C:\ProgramData\chocolatey\lib -> appveyor.yml

# Set build version format here instead of in the admin panel.
version: '{build}'

environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ROOT: c:\dev\source
SCRIPTS: '%ROOT%\scripts\'
CONFIG_PARTIAL: 'Release'
OS_PARTIAL: 'windows'
PLAT_PARTIAL: 'x86_64'
PRODUCT_NAME: Ember
RELEASE_VERSION: 0.0
OUTPUT_FOLDER: 'bin\$(CONFIG_PARTIAL)-$(OS_PARTIAL)-$(PLAT_PARTIAL)'
FILE_VERSION: 'v%RELEASE_VERSION%.$(appveyor_build_version)-beta'
GITHUB_TOKEN:
secure: ShOkS4UEj4aiSabXwn0u0d0d3BoaVF0wW7TO4JyFdmMfdckHk5IbF1rAJO3aaSRg

image:
- Visual Studio 2019

# branches to build
branches:
# whitelist
only:
- procedural_generation

#---------------------------------#
# scripts that are called at #
# very beginning, before #
# repo cloning #
#---------------------------------#

init:
# Updating build version with correct values
# [has to be done here as environment variable are evaluated later in the process]
- cmd: appveyor UpdateBuild -Version "%RELEASE_VERSION%.%APPVEYOR_BUILD_NUMBER%"
# Print environment info ( set / systeminfo)
# - set PATH=%JAVA_HOME%\bin;%PYTHONHOME%;%PATH%
- msbuild /version
# https://github.com/chocolatey/chocolatey/issues/431
# - del c:\programdata\chocolatey\bin\cpack.exe
# separating output
- cmd: ''

clone_folder: $(ROOT)

configuration:
- Release

#---------------------------------#
# scripts that install/setup #
#---------------------------------#

install:
# Recursively remove all outadet vcpkg packages
- cmd: vcpkg remove --outdated --recurse
# Install boost package
- cmd: vcpkg install boost-test:x64-windows-static
# Update all submodules
- cmd: git submodule update --init

#---------------------------------#
# scripts to run before build #
#---------------------------------#

before_build:
# Generate VS2019 solution
- cmd: '%SCRIPTS%\generate_solution_vs2019.bat -s'


#---------------------------------#
# build step #
#---------------------------------#

build:
parallel: true # enable MSBuild parallel builds
project: pyro.sln # path to Visual Studio solution or project


#---------------------------------#
# scripts to run after build #
#---------------------------------#

after_build:
# Run test manually [until appveyor ]
- cmd: '%ROOT%/bin/%CONFIG_PARTIAL%-%OS_PARTIAL%-%PLAT_PARTIAL%/tests/tests.exe'
# Create installer [it works because appveyor image comes with NSIS installed]
- cmd: '%SCRIPTS%\create_installer.bat -s'
# Renaming installer to include version in its name
- cmd: 'ren %OUTPUT_FOLDER%\installers\%PRODUCT_NAME%Setup.exe "%PRODUCT_NAME%-%FILE_VERSION%-setup.exe"'

test_script:
- cmd: vstest.console /logger:Appveyor %OUTPUT_FOLDER%\tests\tests.exe

#---------------------------------#
# artifacts configuration #
#---------------------------------#

artifacts:
- path: '**\*Setup.exe'
name: installer
- path: 'bin\**\ember\**.exe'
name: editor
- path: 'ember\assets\shaders\**'
name: editor
- path: 'ember\assets\textures\**'
name: editor

#---------------------------------#
# deployment configuration #
#---------------------------------#

# scripts to run before deployment
#before_deploy:

# scripts to run after deployment
#after_deploy:

# to run your custom scripts instead of provider deployments
#deploy_script:

deploy:
- provider: GitHub
auth_token:
secure: ShOkS4UEj4aiSabXwn0u0d0d3BoaVF0wW7TO4JyFdmMfdckHk5IbF1rAJO3aaSRg
release: "%PRODUCT_NAME%-%FILE_VERSION%"
description: 'Beta release of Ember editor v$(appveyor_build_version)'
# github automatically does source zip\tarball for us
artifact: installer
draft: false
prerelease: true
appveyor_repo_tag: false # deploy on tag push only
on:
branch: procedural_generation # release from master branch only
configuration: Release
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ in vec2 v_tex_coord;
in float v_tex_index;
in float v_tiling_factor;

uniform bool u_grayscale = false;
uniform sampler2D u_textures[32];

float vignette(vec2 screen_pos, float radius)
Expand All @@ -51,6 +52,17 @@ float vignette(vec2 screen_pos, float radius)

void main()
{
o_color = texture(u_textures[int(v_tex_index)], v_tex_coord * v_tiling_factor) * v_color;
vec4 texture_color;
if(u_grayscale)
{
texture_color.rgb = vec3(texture(u_textures[int(v_tex_index)], v_tex_coord * v_tiling_factor).r);
texture_color.a = 1.f; // setting alpha back to non transparent
}
else
{
texture_color = texture(u_textures[int(v_tex_index)], v_tex_coord * v_tiling_factor);
}
o_color = texture_color * v_color;

//o_color = vec4(v_tex_index / 10.f,0.f,0.f,1.f);
}
Binary file added ember/assets/textures/brick-wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/door.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/floor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/lava.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/nothing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/stone-floor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ember/assets/textures/water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions ember/src/ember_app.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// --------- Entry Point ---------------
#include "pyro/core/entry_point.h"
#include "layer_2d.h"

// Level editor
// [Ember, a small piece burning or glowing in a fire]
class ember : public pyro::application
{
public:
ember(uint32_t width, uint32_t height)
:application("Ember Editor",width,height)
{
}

~ember() = default;

// Inherited via application
virtual void init() override
{
const float width = static_cast<float>(window().width());
const float height = static_cast<float>(window().height());
m_layer_2d = pyro::make_ref<layer_2d>(width, height);
//push_layer(new layer_3d());
push_layer(m_layer_2d);
}

virtual void deinit() override
{
}

void on_event(pyro::event &e) override
{
application::on_event(e);

pyro::event_dispatcher dispatcher(e);
// dispatch event on window X pressed
dispatcher.dispatch<pyro::key_pressed_event>(BIND_EVENT_FN(ember::on_key_pressed));
}

bool on_key_pressed(pyro::key_pressed_event &e)
{
if(e.key_code() == pyro::key_codes::KEY_ESCAPE)
{
exit();
}
return false;
}

private:
pyro::ref<layer_2d> m_layer_2d;
};


pyro::application *pyro::create_application()
{
return new ember(1280, 720);
}
Loading

0 comments on commit e0a8bac

Please sign in to comment.