Added new comment to examples
This commit is contained in:
parent
8bd3ecaa66
commit
c1b01c0d5d
119 changed files with 376 additions and 46 deletions
|
@ -13,6 +13,9 @@
|
|||
|
||||
#define MAX_BUILDINGS 100
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -30,16 +30,19 @@ typedef struct EnvItem {
|
|||
Color color;
|
||||
} EnvItem;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module functions declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float delta);
|
||||
|
||||
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
|
||||
void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
|
||||
void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
|
||||
void UpdateCameraEvenOutOnLanding(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
|
||||
void UpdateCameraPlayerBoundsPush(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
#define MAX_COLUMNS 20
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
//------------------------------------------------------------------------------------------
|
||||
typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Main entry point
|
||||
//------------------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -28,14 +28,14 @@ const int screenWidth = 800;
|
|||
const int screenHeight = 450;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
// Module functions declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void UpdateDrawFrame(void); // Update and Draw one frame
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Main Enry Point
|
||||
//----------------------------------------------------------------------------------
|
||||
int main()
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
|
||||
|
||||
// Custom logging funtion
|
||||
void LogCustom(int msgType, const char *text, va_list args)
|
||||
void CustomLog(int msgType, const char *text, va_list args)
|
||||
{
|
||||
char timeStr[64] = { 0 };
|
||||
time_t now = time(NULL);
|
||||
|
@ -39,16 +39,18 @@ void LogCustom(int msgType, const char *text, va_list args)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
// First thing we do is setting our custom logger to ensure everything raylib logs
|
||||
// will use our own logger instead of its internal one
|
||||
SetTraceLogCallback(LogCustom);
|
||||
// Set custom logger
|
||||
SetTraceLogCallback(CustomLog);
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -10,10 +10,14 @@
|
|||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_GESTURE_STRINGS 20
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
#define MAX_TOUCH_POINTS 10
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -27,6 +27,9 @@ static void *LoadDataThread(void *arg); // Loading data thread function decl
|
|||
|
||||
static int dataProgress = 0; // Data progress accumulator
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "raymath.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#include <math.h> // Required for: sinf(), cosf()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -40,6 +40,9 @@ void DrawScene(void)
|
|||
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -17,6 +17,9 @@ typedef enum {
|
|||
STORAGE_POSITION_HISCORE = 1
|
||||
} StorageData;
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -13,21 +13,14 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
#define max(a, b) ((a)>(b)? (a) : (b))
|
||||
#define min(a, b) ((a)<(b)? (a) : (b))
|
||||
#include "raymath.h" // Required for: Vector2Clamp()
|
||||
|
||||
// Clamp Vector2 value with min and max and return a new vector2
|
||||
// NOTE: Required for virtual mouse, to clamp inside virtual game size
|
||||
Vector2 ClampValue(Vector2 value, Vector2 min, Vector2 max)
|
||||
{
|
||||
Vector2 result = value;
|
||||
result.x = (result.x > max.x)? max.x : result.x;
|
||||
result.x = (result.x < min.x)? min.x : result.x;
|
||||
result.y = (result.y > max.y)? max.y : result.y;
|
||||
result.y = (result.y < min.y)? min.y : result.y;
|
||||
return result;
|
||||
}
|
||||
#define MAX(a, b) ((a)>(b)? (a) : (b))
|
||||
#define MIN(a, b) ((a)<(b)? (a) : (b))
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
const int windowWidth = 800;
|
||||
|
@ -57,7 +50,7 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// Compute required framebuffer scaling
|
||||
float scale = min((float)GetScreenWidth()/gameScreenWidth, (float)GetScreenHeight()/gameScreenHeight);
|
||||
float scale = MIN((float)GetScreenWidth()/gameScreenWidth, (float)GetScreenHeight()/gameScreenHeight);
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE))
|
||||
{
|
||||
|
@ -70,7 +63,7 @@ int main(void)
|
|||
Vector2 virtualMouse = { 0 };
|
||||
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
|
||||
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
|
||||
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ (float)gameScreenWidth, (float)gameScreenHeight });
|
||||
virtualMouse = Vector2Clamp(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ (float)gameScreenWidth, (float)gameScreenHeight });
|
||||
|
||||
// Apply the same transformation as the virtual mouse to the real mouse (i.e. to work with raygui)
|
||||
//SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth*scale))*0.5f, -(GetScreenHeight() - (gameScreenHeight*scale))*0.5f);
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue