Skip to content

Commit

Permalink
fix bad glfw version
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Nov 18, 2024
1 parent 62fda80 commit b0195aa
Show file tree
Hide file tree
Showing 44 changed files with 211 additions and 595 deletions.
1 change: 0 additions & 1 deletion glfw/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ video tutorials.
- Jonas Ådahl
- Lasse Öörni
- Leonard König
- Grzesiek11
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement

4 changes: 0 additions & 4 deletions glfw/deps/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef BUILD_MONOLITHIC

#include "getopt.h"

#include <stddef.h>
Expand Down Expand Up @@ -230,5 +228,3 @@ int getopt_long(int argc, char* const argv[], const char* optstring,
++optind;
return retval;
}

#endif // BUILD_MONOLITHIC
6 changes: 0 additions & 6 deletions glfw/deps/getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
#ifndef INCLUDED_GETOPT_PORT_H
#define INCLUDED_GETOPT_PORT_H


#ifdef BUILD_MONOLITHIC
#error "Error: make sure to point an include search path to the libgetopt library BEFORE including the glfw/deps/ search path, for otherwise you'll include the DISABLED alternative getopt implementation in glfw/depts/ !"
#endif


#if defined(__cplusplus)
extern "C" {
#endif
Expand Down
4 changes: 2 additions & 2 deletions glfw/deps/nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -5682,7 +5682,7 @@ template<typename T> struct nk_alignof{struct Big {T x; char c;}; enum {

#endif /* NK_NUKLEAR_H_ */

//#ifdef NK_IMPLEMENTATION
#ifdef NK_IMPLEMENTATION

#ifndef NK_INTERNAL_H
#define NK_INTERNAL_H
Expand Down Expand Up @@ -6018,7 +6018,7 @@ NK_LIB void nk_property(struct nk_context *ctx, const char *name, struct nk_prop



#ifdef NK_IMPLEMENTATION


/* ===============================================================
*
Expand Down
91 changes: 41 additions & 50 deletions glfw/examples/boing.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@

#if defined(_MSC_VER)
// Make MS math.h define M_PI
#if !defined(_USE_MATH_DEFINES)
#define _USE_MATH_DEFINES
#endif
#define _USE_MATH_DEFINES
#endif

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#ifndef BUILD_MONOLITHIC
#define GLAD_GL_IMPLEMENTATION
#endif
#include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Expand All @@ -53,16 +49,16 @@
*****************************************************************************/

/* Prototypes */
static void init( void );
static void display( void );
static void reshape( GLFWwindow* window, int w, int h );
static void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
static void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
static void cursor_position_callback( GLFWwindow* window, double x, double y );
static void DrawBoingBall( void );
static void BounceBall( double dt );
static void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
static void DrawGrid( void );
void init( void );
void display( void );
void reshape( GLFWwindow* window, int w, int h );
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
void cursor_position_callback( GLFWwindow* window, double x, double y );
void DrawBoingBall( void );
void BounceBall( double dt );
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
void DrawGrid( void );

#define RADIUS 70.f
#define STEP_LONGITUDE 22.5f /* 22.5 makes 8 bands like original Boing */
Expand Down Expand Up @@ -95,21 +91,21 @@ typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM;
typedef struct {float x; float y; float z;} vertex_t;

/* Global vars */
static int windowed_xpos, windowed_ypos, windowed_width, windowed_height;
static int width, height;
static GLfloat deg_rot_y = 0.f;
static GLfloat deg_rot_y_inc = 2.f;
static int override_pos = GLFW_FALSE;
static GLfloat cursor_x = 0.f;
static GLfloat cursor_y = 0.f;
static GLfloat ball_x = -RADIUS;
static GLfloat ball_y = -RADIUS;
static GLfloat ball_x_inc = 1.f;
static GLfloat ball_y_inc = 2.f;
static DRAW_BALL_ENUM drawBallHow;
static double t;
static double t_old = 0.f;
static double dt;
int windowed_xpos, windowed_ypos, windowed_width, windowed_height;
int width, height;
GLfloat deg_rot_y = 0.f;
GLfloat deg_rot_y_inc = 2.f;
int override_pos = GLFW_FALSE;
GLfloat cursor_x = 0.f;
GLfloat cursor_y = 0.f;
GLfloat ball_x = -RADIUS;
GLfloat ball_y = -RADIUS;
GLfloat ball_x_inc = 1.f;
GLfloat ball_y_inc = 2.f;
DRAW_BALL_ENUM drawBallHow;
double t;
double t_old = 0.f;
double dt;

/* Random number generator */
#ifndef RAND_MAX
Expand All @@ -120,7 +116,7 @@ static double dt;
/*****************************************************************************
* Truncate a degree.
*****************************************************************************/
static GLfloat TruncateDeg( GLfloat deg )
GLfloat TruncateDeg( GLfloat deg )
{
if ( deg >= 360.f )
return (deg - 360.f);
Expand All @@ -132,23 +128,23 @@ static GLfloat TruncateDeg( GLfloat deg )
* Convert a degree (360-based) into a radian.
* 360' = 2 * PI
*****************************************************************************/
static double deg2rad( double deg )
double deg2rad( double deg )
{
return deg / 360 * (2 * M_PI);
}

/*****************************************************************************
* 360' sin().
*****************************************************************************/
static double sin_deg( double deg )
double sin_deg( double deg )
{
return sin( deg2rad( deg ) );
}

/*****************************************************************************
* 360' cos().
*****************************************************************************/
static double cos_deg( double deg )
double cos_deg( double deg )
{
return cos( deg2rad( deg ) );
}
Expand All @@ -158,7 +154,7 @@ static double cos_deg( double deg )
*
* c = a x b
*****************************************************************************/
static void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n )
void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n )
{
GLfloat u1, u2, u3;
GLfloat v1, v2, v3;
Expand All @@ -183,7 +179,7 @@ static void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n )
/*****************************************************************************
* init()
*****************************************************************************/
static void init( void )
void init( void )
{
/*
* Clear background.
Expand All @@ -197,7 +193,7 @@ static void init( void )
/*****************************************************************************
* display()
*****************************************************************************/
static void display(void)
void display(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
Expand All @@ -218,7 +214,7 @@ static void display(void)
/*****************************************************************************
* reshape()
*****************************************************************************/
static void reshape( GLFWwindow* window, int w, int h )
void reshape( GLFWwindow* window, int w, int h )
{
mat4x4 projection, view;

Expand All @@ -241,7 +237,7 @@ static void reshape( GLFWwindow* window, int w, int h )
glLoadMatrixf((const GLfloat*) view);
}

static void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
{
if (action != GLFW_PRESS)
return;
Expand Down Expand Up @@ -277,7 +273,7 @@ static void set_ball_pos ( GLfloat x, GLfloat y )
ball_y = y - (height / 2);
}

static void mouse_button_callback( GLFWwindow* window, int button, int action, int mods )
void mouse_button_callback( GLFWwindow* window, int button, int action, int mods )
{
if (button != GLFW_MOUSE_BUTTON_LEFT)
return;
Expand All @@ -293,7 +289,7 @@ static void mouse_button_callback( GLFWwindow* window, int button, int action, i
}
}

static void cursor_position_callback( GLFWwindow* window, double x, double y )
void cursor_position_callback( GLFWwindow* window, double x, double y )
{
cursor_x = (float) x;
cursor_y = (float) y;
Expand All @@ -310,7 +306,7 @@ static void cursor_position_callback( GLFWwindow* window, double x, double y )
* The ball is built by stacking latitudinal circles. Each circle is composed
* of a widely-separated set of points, so that each facet is noticeably large.
*****************************************************************************/
static void DrawBoingBall( void )
void DrawBoingBall( void )
{
GLfloat lon_deg; /* degree of longitude */
double dt_total, dt2;
Expand Down Expand Up @@ -387,7 +383,7 @@ static void DrawBoingBall( void )
/*****************************************************************************
* Bounce the ball.
*****************************************************************************/
static void BounceBall( double delta_t )
void BounceBall( double delta_t )
{
GLfloat sign;
GLfloat deg;
Expand Down Expand Up @@ -440,7 +436,7 @@ static void BounceBall( double delta_t )
* Parms: long_lo, long_hi
* Low and high longitudes of slice, resp.
*****************************************************************************/
static void DrawBoingBallBand( GLfloat long_lo,
void DrawBoingBallBand( GLfloat long_lo,
GLfloat long_hi )
{
vertex_t vert_ne; /* "ne" means south-east, so on */
Expand Down Expand Up @@ -544,7 +540,7 @@ static void DrawBoingBallBand( GLfloat long_lo,
* Draw the purple grid of lines, behind the Boing ball.
* When the Workbench is dropped to the bottom, Boing shows 12 rows.
*****************************************************************************/
static void DrawGrid( void )
void DrawGrid( void )
{
int row, col;
const int rowTotal = 12; /* must be divisible by 2 */
Expand Down Expand Up @@ -625,11 +621,6 @@ static void DrawGrid( void )
* main()
*======================================================================*/


#ifdef BUILD_MONOLITHIC
#define main glfw_boing_example_main
#endif

int main( void )
{
GLFWwindow* window;
Expand Down
17 changes: 5 additions & 12 deletions glfw/examples/gears.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@

#if defined(_MSC_VER)
// Make MS math.h define M_PI
#if !defined(_USE_MATH_DEFINES)
#define _USE_MATH_DEFINES
#endif
#define _USE_MATH_DEFINES
#endif

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#ifndef BUILD_MONOLITHIC
#define GLAD_GL_IMPLEMENTATION
#endif
#include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Expand Down Expand Up @@ -167,6 +163,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f);
}
glEnd();

}


Expand Down Expand Up @@ -215,7 +212,7 @@ static void animate(void)


/* change view angle, exit upon ESC */
static void key( GLFWwindow* window, int k, int s, int action, int mods )
void key( GLFWwindow* window, int k, int s, int action, int mods )
{
if( action != GLFW_PRESS ) return;

Expand Down Expand Up @@ -248,7 +245,7 @@ static void key( GLFWwindow* window, int k, int s, int action, int mods )


/* new window size */
static void reshape( GLFWwindow* window, int width, int height )
void reshape( GLFWwindow* window, int width, int height )
{
GLfloat h = (GLfloat) height / (GLfloat) width;
GLfloat xmax, znear, zfar;
Expand Down Expand Up @@ -304,12 +301,8 @@ static void init(void)
}


#ifdef BUILD_MONOLITHIC
#define main glfw_gears_example_main
#endif

/* program entry */
int main(int argc, const char **argv)
int main(int argc, char *argv[])
{
GLFWwindow* window;
int width, height;
Expand Down
9 changes: 1 addition & 8 deletions glfw/examples/heightmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
#include <assert.h>
#include <stddef.h>

#ifndef BUILD_MONOLITHIC
#define GLAD_GL_IMPLEMENTATION
#endif
#include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Expand Down Expand Up @@ -400,12 +398,7 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description);
}


#ifdef BUILD_MONOLITHIC
#define main glfw_heightmap_example_main
#endif

int main(int argc, const char** argv)
int main(int argc, char** argv)
{
GLFWwindow* window;
int iter;
Expand Down
7 changes: 0 additions & 7 deletions glfw/examples/offscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
//
//========================================================================

#ifndef BUILD_MONOLITHIC
#define GLAD_GL_IMPLEMENTATION
#endif
#include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Expand Down Expand Up @@ -74,11 +72,6 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description);
}


#ifdef BUILD_MONOLITHIC
#define main glfw_offscreen_example_main
#endif

int main(void)
{
GLFWwindow* window;
Expand Down
Loading

0 comments on commit b0195aa

Please sign in to comment.