Skip to content
Snippets Groups Projects
Commit e5f05b99 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

demopohjat 9

parent 984bce72
No related branches found
No related tags found
No related merge requests found
......@@ -148,7 +148,7 @@ public class Kuva : PhysicsGame
/// <summary>
/// Lasketaan konvoluutio uint[,] kuva-matriisille käytten painomatriisia.
/// Lasketaan konvoluutio uint[,] kuva-matriisille käyttäen painomatriisia.
/// Konvoluutio lasketaan kunkin pikselin kohdalla kullekin värille (R,B,G)
/// erikseen.
/// Reunat unohdetaan.
......@@ -158,17 +158,18 @@ public class Kuva : PhysicsGame
/// <returns>uusi kuva-matriisi konvoloituna</returns>
/// <example>
/// <pre name="test">
/// uint[,] kuva = { { 0x010905,0x55020202,0x7f030303,0x040404 },
/// { 0x010101,0x66020202,0x7f030803,0x050505 },
/// { 0x010102,0x77090909,0x7f030303,0x060606 } };
/// uint[,] kuva = { { 0x010905,0x55020202,0x7f030303,0x040404 },
/// { 0x010101,0x66020202,0x7f030803,0x050505 },
/// { 0x010102,0x77090909,0x7f030303,0x060606 },
/// { 0x010102,0x23111524,0x66778800,0x080808 } };
/// int[,] painot = {{1,0,0},{0,1,0},{0,0,2}};
///
/// uint[,] kuva2 = Muunna(kuva,painot);
/// kuva2[0,0] === 0U; // reunat jäävät mustiksi
/// kuva2[2,1] === 0U;
/// Color.GetBlue(kuva2[1,1]) === 3;
/// kuva2[1,2] === 0x7f040504U;
/// kuva2[1,1] === 0x66020403U;
/// kuva2[1,2] === 0x7f040504U;
/// kuva2[2,1] === 0x773E4602U;
/// kuva2[2,2] === 0x7F050505U;
/// </pre>
/// </example>
public static uint[,] Muunna(uint[,] kuva, int[,] painot)
......
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace PortaatYlos
{
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using var game = new PortaatYlos();
game.Run();
}
}
}
\ No newline at end of file
using Jypeli;
namespace PortaatYlos;
public class PortaatYlos : PhysicsGame
{
const double LAATIKON_KOKO = 80;
// BYCODEBEGIN
public override void Begin()
{
Level.Background.Color = Color.Black;
Vector piste = new Vector(0, 0);
// Poista rivien alusta kommenttimerkit
// piste = PiirraLaatikko(this, piste);
// piste = PiirraLaatikko(this, piste);
// piste = PiirraLaatikko(this, piste);
PhysicsObject pallo = new PhysicsObject(5, 5, Shape.Circle);
Add(pallo, 1);
pallo.Color = Color.Red;
Camera.ZoomToAllObjects(100);
}
/* poista tämä rivi ja vastaava kommentin lopetusrivi
/// <summary>
/// Aliohjelma piirtää ruutuun yhden neliön, jonka
/// sivun pituus on 80 ja vasemman alakulman koordinaatti p.
/// </summary>
/// <param name="peli">Peli, johon neliö piirretään</param>
/// <param name="p">Neliön vasemman alanurkan koordinaatti.</param>
/// <returns>Neliön oikean ylänurkan koordinaatti</returns>
public static ??? PiirraLaatikko(???)
{
double s = LAATIKON_KOKO;
GameObject nelio = new GameObject(s, s, Shape.Rectangle);
nelio.Position = ???
peli.Add(nelio);
???
}
*/
// BYCODEEND
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Jypeli.NET" Version="11.*"/>
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="2.*"/>
</ItemGroup>
</Project>
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace PortaatYlosAlas
{
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using var game = new PortaatYlosAlas();
game.Run();
}
}
}
\ No newline at end of file
using Jypeli;
namespace PortaatYlosAlas;
public class PortaatYlosAlas : PhysicsGame
{
const double LAATIKON_KOKO = 80;
// BYCODEBEGIN
public override void Begin()
{
Level.Background.Color = Color.Black;
Vector piste = new Vector(0, 0);
// Poista rivien alusta kommenttimerkit
// piste = PiirraLaatikko(this, piste);
// piste = PiirraLaatikko(this, piste);
// piste = PiirraLaatikko(this, piste);
// piste -= new Vector(0,LAATIKON_KOKO);
// piste = PiirraLaatikkoAlas(this,piste);
// piste = PiirraLaatikkoAlas(this,piste);
PhysicsObject pallo = new PhysicsObject(5, 5, Shape.Circle);
Add(pallo, 1);
pallo.Color = Color.Red;
Camera.ZoomToAllObjects(100);
}
// TODO: Kopioi tähän edellisen tehtävän PiirraLaatikko
// TODO: Jatka tekemällä PiirraLaatikkoAlas
// BYCODEEND
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Jypeli.NET" Version="11.*"/>
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="2.*"/>
</ItemGroup>
</Project>
......@@ -13,6 +13,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VarienVaihtoKonsolilla", "V
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortaatYlosAlasKonsolilla", "PortaatYlosAlasKonsolilla\PortaatYlosAlasKonsolilla.csproj", "{CE21768D-76C1-40D6-B875-89051B14486C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortaatYlos", "PortaatYlos\PortaatYlos.csproj", "{BBC7FA41-52CD-417C-9725-4649E3833118}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortaatYlosAlas", "PortaatYlosAlas\PortaatYlosAlas.csproj", "{18EA707A-815F-4041-90DF-AD4C46730C56}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -39,6 +43,14 @@ Global
{CE21768D-76C1-40D6-B875-89051B14486C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE21768D-76C1-40D6-B875-89051B14486C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE21768D-76C1-40D6-B875-89051B14486C}.Release|Any CPU.Build.0 = Release|Any CPU
{BBC7FA41-52CD-417C-9725-4649E3833118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBC7FA41-52CD-417C-9725-4649E3833118}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBC7FA41-52CD-417C-9725-4649E3833118}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBC7FA41-52CD-417C-9725-4649E3833118}.Release|Any CPU.Build.0 = Release|Any CPU
{18EA707A-815F-4041-90DF-AD4C46730C56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18EA707A-815F-4041-90DF-AD4C46730C56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18EA707A-815F-4041-90DF-AD4C46730C56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18EA707A-815F-4041-90DF-AD4C46730C56}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment