Skip to content

Instantly share code, notes, and snippets.

@rdeioris
Created December 21, 2018 11:18
Show Gist options
  • Save rdeioris/d621645cad4b37becd56b5fc96f2f884 to your computer and use it in GitHub Desktop.
Save rdeioris/d621645cad4b37becd56b5fc96f2f884 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aiv.Fast2D;
using OpenTK;
namespace FirstModernGame
{
class Program
{
static void Main(string[] args)
{
Window window = new Window(1024, 768, "Fast2D");
window.SetVSync(true);
Sprite sprite000 = new Sprite(100, 100);
Texture logoAiv = new Texture("Assets/LogoAIV.png");
Sprite sprite001 = new Sprite(logoAiv.Width, logoAiv.Height);
sprite001.position = new Vector2(300, 400);
for (int i = 0; i < logoAiv.Bitmap.Length; i += 4)
{
// note this is in the computer memory not gpu!
logoAiv.Bitmap[i] = 255;
}
logoAiv.Update();
sprite000.SetMultiplyTint(1, 1, 1, 1);
//logoAiv.Ratio contains texture width/ texture height
Texture spaceShip = new Texture("Assets/Spaceship-Transparent-PNG.png");
while (window.IsOpened)
{
// draw the spaceship
sprite000.position = new Vector2(0, 0);
sprite000.EulerRotation = 0;
sprite000.scale = Vector2.One * 10;
sprite000.DrawTexture(spaceShip);
// draw the sprite with the specific shader
sprite000.position = new Vector2(200, 200);
sprite000.scale = new Vector2(3.5f, 3.5f);
sprite000.EulerRotation += 30 * window.deltaTime;
//sprite000.DrawSolidColor(255, 0, 0, 100);
//sprite001.position += new Vector2(10, 0) * window.deltaTime;
sprite001.position = new Vector2(-((sprite001.Width / 2) * sprite001.scale.X), 100);
sprite001.scale = new Vector2(2f, 1f);
//sprite001.EulerRotation -= 30 * window.deltaTime;
//sprite001.DrawSolidColor(255, 255, 0);
sprite001.DrawTexture(logoAiv);
// tell the GPU to update what is on the screen
window.Update();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment