static void Main(string[] args) { Raylib.InitWindow(800, 600, "Bildtest"); Texture2D duckImage = Raylib.LoadTexture("duck.png"); float x = 20; while (!Raylib.WindowShouldClose()) { if (Raylib.IsKeyDown(KeyboardKey.KEY_RIGHT)) { x += 0.1f; } Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BEIGE); //Raylib.DrawTexture(duckImage, 20, 20, Color.WHITE); Raylib.DrawTextureEx(duckImage, new Vector2(x, 20), 0f, 0.25f, Color.WHITE); Raylib.EndDrawing(); } }
public static void Game() { cardsLeft.AddRange(CreateAllCards()); Raylib.SetTargetFPS(120); Raylib.InitWindow(1200, 800, "31"); bool gameActive = true; CreateButtons(); ResetGame(); while (gameActive) { Raylib.SetExitKey(0); Raylib.BeginDrawing(); Raylib.ClearBackground(Color.WHITE); RenderButtons(); if (Raylib.IsKeyPressed(KeyboardKey.KEY_R)) { ResetGame(); } else if (Raylib.IsKeyPressed(KeyboardKey.KEY_Q)) { gameActive = false; } Raylib.EndDrawing(); } Raylib.CloseWindow(); }
// Drawing the game public void Draw() { Raylib.InitWindow(width, height, "Chess"); // generate chessboard and ui board = new(700, new Vector2Int(50, 50), this); ui = new(230, 700, new Vector2Int(760, 50), board); // defines menu menu = new(width, new Vector2Int(0, 0), this); // update function while (!Raylib.WindowShouldClose()) { // begins drawing Raylib.BeginDrawing(); // draw bg Raylib.ClearBackground(new Color(163, 163, 163, 255)); // Updates everything Update(); // ends drawing Raylib.EndDrawing(); } }
public void DrawUI(int score, float velocity, List <Object> snake) { Raylib.ClearBackground(Color.WHITE); Raylib.DrawRectangle(BOUND_LEFT, BOUND_UP, 800, 800, Raylib.ColorFromHSV(217, 0.03f, 0.95f)); Raylib.DrawText($"Score: {score}; Velocity {velocity}; Tail Length: {snake.Count}", 10, BOUND_DOWN + BOX_SIZE, 20, Color.BLACK); }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Goodbye world"); Texture2D ok = Raylib.LoadTexture("ok.png"); Color hotPink = new Color(255, 105, 180, 255); float xPos = 10; while (!Raylib.WindowShouldClose()) { // LOGIC if (Raylib.IsKeyDown(KeyboardKey.KEY_RIGHT)) { xPos += 0.1f; } // DRAWING Raylib.BeginDrawing(); Raylib.ClearBackground(hotPink); //Raylib.DrawRectangle((int) xPos, 10, 50, 50, Color.WHITE); Raylib.DrawTexture(ok, (int)xPos, 10, Color.WHITE); Raylib.EndDrawing(); } }
}//static void main // Second hand //Console.WriteLine("Welcome to your first day of many at the antiquary"); //Planen är att man ska kunna gå från rum till rum i en affär, och kunna plocka upp böcker som man kan köpa. //Sedan andra delen av spelet kommer man tillbaka till sin egen affär och ska sälja den till customers //Man får en rapport hur mycket man tjänar i slutet av dagen. Om man har kvar ett cursed item //får man problem under nästa dag. Om man säljer en cursed item till en customer som inte letar efter det //kommer man få en lawsuit, som man måste kunna betala av //Console.WriteLine(); //Console.ReadLine(); static void DrawHomescreen(Rectangle player, Rectangle background1, Rectangle background2, Rectangle background3, Rectangle background4, Rectangle background5, Rectangle roadVertical, Rectangle roadHorizontal, Rectangle aDoor, Rectangle sDoor) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.WHITE); Raylib.DrawRectangleRec(roadVertical, Color.DARKGRAY); Raylib.DrawRectangleRec(roadHorizontal, Color.DARKGRAY); Raylib.DrawRectangleRec(background1, Color.GRAY); Raylib.DrawRectangleRec(background2, Color.GRAY); Raylib.DrawRectangleRec(background3, Color.GRAY); Raylib.DrawRectangleRec(background4, Color.GRAY); Raylib.DrawRectangleRec(background5, Color.GRAY); Raylib.DrawText("Welcome to a new day at the antiquary", 60, 80, 40, Color.BLACK); Raylib.DrawRectangle(200, 200, 300, 120, Color.RED); Raylib.DrawRectangleRec(sDoor, Color.BLACK); Raylib.DrawText("Second Hand Store", 215, 230, 25, Color.BLACK); Raylib.DrawRectangle(500, 410, 400, 200, Color.PURPLE); Raylib.DrawRectangleRec(aDoor, Color.BLACK); Raylib.DrawText("ANTIQUARY", 590, 450, 35, Color.BLACK); Raylib.DrawRectangleRec(player, Color.PURPLE); Raylib.EndDrawing(); }
void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BEIGE); //draw all bullets for (int i = 0; i < bullets.Length; i++) { if (bullets[i] != null) { bullets[i].Draw(); //explain this line } } player.Draw(); //draw all asteroids for (int i = 0; i < asteroids.Length; i++) { if (asteroids[i] != null) { asteroids[i].Draw(); } } Raylib.EndDrawing(); }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Kollisoner"); Rectangle playerRect = new Rectangle(0, 0, 100, 50); Rectangle enemyRect = new Rectangle(50, 60, 30, 30); Color red = new Color(255, 0, 0, 128); while (!Raylib.WindowShouldClose()) { //playerRect.x += 0.1f; playerRect.y += 0.01f; Raylib.BeginDrawing(); Raylib.ClearBackground(Color.LIGHTGRAY); Raylib.DrawRectangleRec(playerRect, red); Raylib.DrawRectangleRec(enemyRect, red); if (Raylib.CheckCollisionRecs(playerRect, enemyRect)) { Raylib.DrawText("Colliding!", 0, 550, 32, Color.BLACK); } Raylib.EndDrawing(); } }
public void Continue() { Raylib.ClearBackground(GRAY); decor.DisplayDecor(); rocks.DisplayRocks(); astronaut.DisplayAstronaut(); }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Bilder och grejer"); // Image - RAM-minnet, kan ändras på // Texture - Grafikkortet, kan ej ändras på, kan ritas ut Texture2D mike = Raylib.LoadTexture("mike.png"); float mikeX = 0; float mikeY = 0; string scene = "intro"; while (!Raylib.WindowShouldClose()) { // mikeX += 0.05f; // LOGIC: if (scene == "intro") { if (Raylib.IsKeyPressed(KeyboardKey.KEY_SPACE)) { scene = "game"; } } else if (scene == "game") { if (Raylib.IsKeyDown(KeyboardKey.KEY_RIGHT)) { mikeX += 0.1f; } else if (Raylib.IsKeyDown(KeyboardKey.KEY_LEFT)) { mikeX -= 0.1f; } if (Raylib.IsKeyPressed(KeyboardKey.KEY_TAB)) { scene = "intro"; } } // DRAWING: Raylib.BeginDrawing(); if (scene == "intro") { Raylib.ClearBackground(Color.LIME); } else if (scene == "game") { Raylib.ClearBackground(Color.MAROON); Raylib.DrawTexture(mike, (int)mikeX, (int)mikeY, Color.WHITE); } Raylib.EndDrawing(); } }
static void DrawAntique(Rectangle player) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BLACK); Raylib.DrawText("Antiquary", 60, 80, 40, Color.WHITE); Raylib.EndDrawing(); }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Hello TE!"); Color myColor = new Color(0, 255, 128, 255); float x = 0; while (!Raylib.WindowShouldClose()) { if (Raylib.IsKeyDown(KeyboardKey.KEY_RIGHT)) { x += 0.1f; } Raylib.BeginDrawing(); Raylib.ClearBackground(myColor); Raylib.DrawRectangle((int)x, 0, 20, 20, Color.PINK); Raylib.EndDrawing(); } }
void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DARKGRAY); player.Draw(); // darw all bullets for (int i = 0; i < bullets.Length; i++) { if (bullets[i] != null) { bullets[i].Draw(); } } // update all bullets for (int i = 0; i < asteroids.Length; i++) { if (asteroids[i] != null) { asteroids[i].Draw(); } } Raylib.EndDrawing(); }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Test med TE19A"); float x = 0; while (!Raylib.WindowShouldClose()) { if (Raylib.IsKeyDown(KeyboardKey.KEY_RIGHT)) { x += 0.1f; } Raylib.BeginDrawing(); //Color myNewColor = new Color(124, 255, 12, 255); Raylib.ClearBackground(Color.WHITE); Raylib.DrawRectangle((int)x, 0, 30, 30, Color.PINK); Raylib.EndDrawing(); } }
static void Main(string[] args) { //Planen är simpel, Ha en slags hub som finns i rpg-spel i starwars-tema där man kan interacta med saker som uppfyller alla kraven på A-nivå. //Detta då i star wars tema :) Raylib.InitWindow(800, 600, "Hello World"); float x = 100; float y = 400; var bruh = Raylib.LoadImage(@"C:\Users\axel.lilja2\Documents\PROG02\NovemberProjekt\novemberProjekt\bin\Debug\netcoreapp3.1\Character.png"); Texture2D texture = Raylib.LoadTextureFromImage(bruh); while (!Raylib.WindowShouldClose()) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BLUE); Raylib.DrawTexture(texture, (int)x, (int)y, Color.WHITE); Raylib.EndDrawing(); } }
static void Main(string[] args) { Raylib.InitWindow(800, 600, "Snake"); Raylib.SetTargetFPS(60); GameObject snake = new Snake(); while (!Raylib.WindowShouldClose()) { snake.Update(); //LOGIK //GRAFIK Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BROWN); GameObject.DrawAll(); Raylib.EndDrawing(); } }
static void Main(string[] args) { //pong game med Rocket League bilar + boll. Raylib.InitWindow(1000, 600, "Pong"); Raylib.SetTargetFPS(60); //Bil texturer Texture2D carTexture = Raylib.LoadTexture("car.png"); Texture2D carTextureL = Raylib.LoadTexture("carL.png"); GameObject leftPaddle = new Paddle(30, 275, KeyboardKey.KEY_W, KeyboardKey.KEY_S, carTextureL); GameObject rightPaddle = new Paddle(850, 275, KeyboardKey.KEY_UP, KeyboardKey.KEY_DOWN, carTexture); Ball ball = new Ball(); //start GameScreens screen = GameScreens.Start; while (!Raylib.WindowShouldClose()) { if (screen == GameScreens.Start) { if (Raylib.IsKeyPressed(KeyboardKey.KEY_ENTER)) { screen = GameScreens.Game; } } else if (screen == GameScreens.Game) { GameObject.UpdateAll(); } Raylib.BeginDrawing(); if (screen == GameScreens.Start) { Texture2D screenTexture; screenTexture = Raylib.LoadTexture("Sscreen.png"); Raylib.DrawTexture(screenTexture, (int)165, (int)1, Color.WHITE); Raylib.DrawText("Press ENTER to start", 173, 545, 58, Color.ORANGE); Raylib.ClearBackground(Color.BLACK); } else if (screen == GameScreens.Game) { Raylib.ClearBackground(Color.GREEN); GameObject.DrawAll(); } //ball.Update(); //ball.Draw(); Raylib.EndDrawing(); } }
//Used to display objects and other info on the screen. public void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BLACK); Console.Clear(); _scenes[_currentSceneIndex].Draw(); Raylib.EndDrawing(); }
void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DARKBLUE); player.Draw(); Raylib.EndDrawing(); }
public static void Main(string[] args) { Raylib.InitWindow(w, h, ""); Raylib.InitAudioDevice(); Raylib.SetMasterVolume(1.0f); Raylib.SetTargetFPS(60); Raylib.SetExitKey(0); Raylib.SetWindowTitle("A Game"); Image icon = Raylib.LoadImage(@"Images/Cola.png"); Raylib.SetWindowIcon(icon); Bot Bot = new Bot(); Player P1 = new Player(); Menu Menus = new Menu(); PlayerMovement Controller = new PlayerMovement(); Textures Texture = new Textures(); rects.Add(new Rectangle()); while (!Raylib.WindowShouldClose()) { mousePos = Raylib.GetMousePosition(); Raylib.BeginDrawing(); Raylib.ClearBackground(Assets.bg); if (State == "Start") { Menus.Start(); Texture.Steve(); } if (State != "Start") { P1.Draw(); Bot.AI(); Texture.ShowPlayer(); Menus.CheckWin(); } if (State == "Game") { Controller.Move(); } bool areOverlapping = Raylib.CheckCollisionCircles(Player.position, Player.playerSize / 2, Bot.position2, Player.playerSize / 2); if (areOverlapping == true) { Raylib.ClearBackground(Color.WHITE); Raylib.SetSoundVolume(Assets.screamSound, 1f); } else { Raylib.SetSoundVolume(Assets.screamSound, 0f); Raylib.PlaySound(Assets.screamSound); } Raylib.EndDrawing(); UpdateVisual = true; } }
static void Main(string[] args) { Raylib.InitWindow(1280, 720, "prototype"); Raylib.SetWindowState(ConfigFlag.FLAG_WINDOW_RESIZABLE); var camera = new Camera2D(Vector2.Zero, Vector2.Zero, 0, 1); var thing = new InverseKinematics(); var cameraFollowMouse = false; var clickMousePos = Vector2.Zero; var clickCameraPos = Vector2.Zero; while (!Raylib.WindowShouldClose()) { if (Raylib.IsKeyPressed(KeyboardKey.KEY_UP)) { camera.zoom += 0.5f; var m = Raylib.GetMousePosition(); camera.target = m; camera.offset = new Vector2(Raylib.GetScreenWidth(), Raylib.GetScreenHeight()) / 2; cameraPos = camera.target - camera.offset; } if (Raylib.IsKeyPressed(KeyboardKey.KEY_DOWN) && camera.zoom > 0.5f) { camera.zoom -= 0.5f; } if (Raylib.IsMouseButtonPressed(MouseButton.MOUSE_MIDDLE_BUTTON)) { cameraFollowMouse = true; clickMousePos = Raylib.GetMousePosition(); clickCameraPos = camera.target; } if (Raylib.IsMouseButtonReleased(MouseButton.MOUSE_MIDDLE_BUTTON)) { cameraFollowMouse = false; } if (cameraFollowMouse) { camera.target = clickCameraPos + (clickMousePos - Raylib.GetMousePosition()) / camera.zoom; } Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BLACK); Raylib.BeginMode2D(camera); if (Raylib.GetFrameTime() < 0.25) { thing.Update(); } Raylib.EndMode2D(); Raylib.EndDrawing(); } }
static void Game() { Window.Initialize(); Map map = new Map(); map.InitRoads(); Car playerOne = new Car(200, 145, Color.RED, 1); Car playerTwo = new Car(200, 160, Color.BLUE, 2); //Creates a scene that connects the players to the Scene class Scene plane = new Scene(playerOne, playerTwo); while (!Raylib.WindowShouldClose()) { //Calculate the players movement playerOne.CalculatePlayerOne(); playerTwo.CalculatePlayerTwo(); //If a player doesnt collide with a road then the car will bump back out and they lose their speed if (plane.PlayerOneCollidesWithRoads(playerOne, map) == false) { playerOne.speed = -10; } if (plane.PlayerTwoCollidesWithRoads(playerTwo, map) == false) { playerTwo.speed = -10; } Raylib.BeginDrawing(); Raylib.ClearBackground(Window.backgroundColorGame); //Draw cars and map plane.Draw(playerOne, playerTwo, map); //If player has passed all laps let player win, also stops both players speed making it impossible for the other player to win if (playerOne.lapScore == map.lapReq) { plane.AWinner(playerOne); playerOne.speed = 0; playerTwo.speed = 0; } if (playerTwo.lapScore == map.lapReq) { plane.AWinner(playerTwo); playerOne.speed = 0; playerTwo.speed = 0; } Raylib.EndDrawing(); } }
public static List <Placeable> placeableList = new List <Placeable>(); //List of all placeable objects static void Main(string[] args) { Raylib.InitWindow(1200, 900, "Factory"); while (Raylib.WindowShouldClose() == false) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.BLACK); Raylib.EndDrawing(); } }
private void Draw() { Raylib.BeginDrawing(); Raylib.BeginMode3D(_camera); Raylib.ClearBackground(Color.RAYWHITE); _scenes[_currentSceneIndex].Draw(); Raylib.EndMode3D(); Raylib.EndDrawing(); }
public void Draw() { Raylib.BeginDrawing(); { Raylib.ClearBackground(Color.LIGHTGRAY); Scene.Current().Draw(); } Raylib.EndDrawing(); }
public override void Draw() { Raylib.ClearBackground(Color.BLUE); int stringTitleWidth = Raylib.MeasureText("PAC MAN", 50); var stringWidth = Raylib.MeasureTextEx(Raylib.GetFontDefault(), "Press 'ENTER' to play Pac Man...", 25, 1); Raylib.DrawText("PAC MAN", (program.windowWidth - stringTitleWidth) / 2, 20, 50, Color.WHITE); Raylib.DrawText("Press 'ENTER' to play Pac Man...", (program.windowWidth - (int)stringWidth.X) / 2, program.windowHeight - 200, 25, Color.WHITE); Raylib.DrawText("Press 'SPACE' for high scores...", (program.windowWidth - (int)stringWidth.X) / 2, program.windowHeight - 200 + (int)stringWidth.Y, 25, Color.WHITE); }
static void Main(string[] args) { float bulletTimer = 60; float bulletDelay = 60; float meteoriteTimer = 60; float meteoriteDelay = 60; Raylib.InitWindow(800, 600, "Game Engine"); Raylib.SetTargetFPS(60); Ship player = new Ship(); while (!Raylib.WindowShouldClose()) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.GRAY); player.update(); bulletTimer += 1; meteoriteTimer += 1; for (int i = 0; i < Projectile.allProjectiles.Count; i++) { Projectile.allProjectiles[i].update(); } //Går igenom alla projektiler i listan och kör deras metod update for (int i = 0; i < Meteorite.allMeteorites.Count; i++) { Meteorite.allMeteorites[i].update(); } if (Raylib.IsKeyDown(KeyboardKey.KEY_SPACE) && bulletTimer >= bulletDelay) { bulletTimer = 0; Projectile.createProjektile(new Projectile() { ProjectileXPos = player.shipRec.x + 20, ProjectileYPos = player.shipRec.y }); // ¯\_(ツ)_/¯ //Ifall man klickar space så kommer en metod i projectile klassen köras som skapar en projectile i en lista som har en position mitt framför spelaren //Detta kan bara utföras en gång varje secund } if (meteoriteTimer >= meteoriteDelay) { Meteorite.spawner(); meteoriteTimer = 0; //kommer skapa en meteorite varje secund } Raylib.EndDrawing(); } Console.ReadLine(); }
static void Main(string[] args) { Raylib.InitWindow(1920, 1080, "Tanky"); Player p1 = new Player(); Raylib.SetTargetFPS(120); while (!Raylib.WindowShouldClose()) { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.WHITE); Shell.UpdateAll(); Enemy.UpdateAll(); MegaShot.UpdateAll(); AutoLoader.UpdateAll(); NewEngine.UpdateAll(); p1.Update(); Shell.DrawAll(); Enemy.DrawAll(); MegaShot.DrawAll(); AutoLoader.DrawAll(); NewEngine.DrawAll(); p1.Draw(); if (Shell.reloadCurrentValue < 0 && Raylib.IsKeyDown(KeyboardKey.KEY_SPACE)) { new Shell(); p1.Recoil(); Shell.reloadCurrentValue = Shell.reloadMaxValue; } if (Enemy.spawnTimerCurrentValue < 0) { new Enemy(); Enemy.spawnTimerCurrentValue = (float)Enemy.generator.NextDouble() + Enemy.generator.Next(2, 6); } if (Raylib.IsKeyPressed(KeyboardKey.KEY_R)) { new AutoLoader(); } if (Raylib.IsKeyPressed(KeyboardKey.KEY_T)) { new MegaShot(); } if (Raylib.IsKeyPressed(KeyboardKey.KEY_Y)) { new NewEngine(); } Raylib.EndDrawing(); } }
void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.RAYWHITE); DrawBall(ball); DrawPaddle(paddle); //Enter other draw functions here Raylib.EndDrawing(); }
void Draw() { Raylib.BeginDrawing(); Raylib.ClearBackground(Color.RAYWHITE); DrawGameBoard(); DrawGamePieces(); DrawSelectedPiece(board.GetSelected()); Raylib.EndDrawing(); }