Reviewed examples
This commit is contained in:
parent
9a578c5962
commit
e28fef6ee0
3 changed files with 14 additions and 21 deletions
|
@ -27,7 +27,7 @@ int main()
|
||||||
|
|
||||||
// Generates some random columns
|
// Generates some random columns
|
||||||
float heights[MAX_COLUMNS];
|
float heights[MAX_COLUMNS];
|
||||||
Vector3 positions[MAX_COLUMNS] = { 0.0, 2.5, 0.0 };
|
Vector3 positions[MAX_COLUMNS];
|
||||||
Color colors[MAX_COLUMNS];
|
Color colors[MAX_COLUMNS];
|
||||||
|
|
||||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
@ -76,7 +76,7 @@ int main()
|
||||||
|
|
||||||
DrawText("First person camera default controls:", 20, 20, 10, GRAY);
|
DrawText("First person camera default controls:", 20, 20, 10, GRAY);
|
||||||
DrawText("- Move with keys: W, A, S, D", 40, 50, 10, DARKGRAY);
|
DrawText("- Move with keys: W, A, S, D", 40, 50, 10, DARKGRAY);
|
||||||
DrawText("- Mouse move to lokk around", 40, 70, 10, DARKGRAY);
|
DrawText("- Mouse move to look around", 40, 70, 10, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - Basic window
|
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
||||||
|
* As you will notice, code structure is slightly diferent to the other examples...
|
||||||
|
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||||
*
|
*
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
|
||||||
*
|
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//#define PLATFORM_WEB
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,8 +23,8 @@ int main()
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
Model dwarf = LoadModel("resources/model/_dwarf.obj"); // Load OBJ model
|
||||||
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
|
Texture2D texture = LoadTexture("resources/model/_dwarf_diffuse.png"); // Load model texture
|
||||||
SetModelTexture(&dwarf, texture); // Bind texture to model
|
SetModelTexture(&dwarf, texture); // Bind texture to model
|
||||||
Vector3 position = { 0.0, 0.0, 0.0 }; // Set model position
|
Vector3 position = { 0.0, 0.0, 0.0 }; // Set model position
|
||||||
|
|
||||||
|
@ -36,10 +36,7 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_LEFT)) position.x -= 0.2;
|
//...
|
||||||
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue