/*********************************/ /* YABS ( // */ /* main ( )/ */ /* by salade )(/ */ /* ________________ ( /) */ /* ()__)____________))))) :^} */ /*********************************/ #include "yabs_core.h" #include "yabs_utils.h" static yabs::gameState game_state; static yabs::Scene3D sc3d{ // camera {{5.0f, 5.0f, 5.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, 45.0f, 0}, // movement {0.0f, 0.0f}, // rotation {0.0f, -0.2f, 0.0f}, // mouse {0.0f, 0.0f}}; int main(void) { // create window InitWindow(YABS_SCREENWIDTH, YABS_SCREENHEIGHT, YABS_TITLE); // create image Image checked = GenImageChecked(2, 2, 1, 1, BLACK, GRAY); Texture2D texture = LoadTextureFromImage(checked); UnloadImage(checked); // create model with image as texture Model model = {}; model = LoadModelFromMesh(GenMeshCube(1.0f, 1.0f, 1.0f)); model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // setup camera SetTargetFPS(60); // game loop while (!WindowShouldClose()) { switch (game_state) { case (yabs::TITLE): { break; } case (yabs::PICK): { break; } case (yabs::DEATH): { break; } case (yabs::GAMEPLAY): { yabs::core::reset_camera(sc3d); break; } case (yabs::NEXT): { break; } case (yabs::ENDING): { break; } } switch (game_state) { case (yabs::TITLE): { break; } case (yabs::PICK): { break; } case (yabs::DEATH): { break; } case (yabs::GAMEPLAY): { while (game_state != yabs::NEXT) { yabs::core::draw(game_state, model); } break; } case (yabs::NEXT): { break; } case (yabs::ENDING): { break; } } // draw BeginDrawing(); ClearBackground(GRAY); BeginMode3D(sc3d.camera); yabs::core::tick(sc3d); yabs::core::draw(game_state, model); EndMode3D(); DrawFPS(0, 0); DrawText("Controls: Mouse / WASD / SPACE/CTRL.", YABS_SCREENWIDTH - 400, 0, 20, DARKGRAY); EndDrawing(); } UnloadTexture(texture); UnloadModel(model); CloseWindow(); return (0); }