mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-05 14:10:32 -04:00
Moved to git
Assembla's decision to remove Trac incited us to ditch them entirely. Further, the repository no longer includes binaries or libraries; these can be downloaded from niotso.org/pub/ and updated with the included update-libraries script.
This commit is contained in:
parent
6b0b0c1d9c
commit
227617b540
33 changed files with 368 additions and 95 deletions
|
@ -7,7 +7,5 @@ else()
|
|||
endif()
|
||||
|
||||
add_subdirectory(FileHandler)
|
||||
add_subdirectory(freetype)
|
||||
add_subdirectory(libgldemo)
|
||||
add_subdirectory(libpq)
|
||||
add_subdirectory(libvitaboy)
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
*/
|
||||
|
||||
#include "FileHandler.hpp"
|
||||
#include <mpg123.h>
|
||||
#include "wav/read_wav.h"
|
||||
#include "xa/read_xa.h"
|
||||
#include "utk/read_utk.h"
|
||||
#include "libmpg123/mpg123.h"
|
||||
|
||||
namespace File {
|
||||
|
||||
|
|
|
@ -11,13 +11,8 @@ endif()
|
|||
|
||||
add_subdirectory(far)
|
||||
add_subdirectory(iff)
|
||||
add_subdirectory(libexpat)
|
||||
add_subdirectory(libjpeg-turbo)
|
||||
add_subdirectory(libmpg123)
|
||||
add_subdirectory(libpng)
|
||||
add_subdirectory(utk)
|
||||
add_subdirectory(xa)
|
||||
add_subdirectory(zlib)
|
||||
|
||||
set(FILEHANDLER_SOURCES
|
||||
Audio.cpp
|
||||
|
@ -33,7 +28,7 @@ if(WIN32)
|
|||
set(FILEHANDLER_SOURCES ${FILEHANDLER_SOURCES} resource.rc)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler)
|
||||
include_directories(${FILEHANDLER_INCLUDE_DIR} ${LIBMPG123_INCLUDE_DIR} ${LIBJPEGTURBO_INCLUDE_DIR} ${LIBPNG_INCLUDE_DIR})
|
||||
|
||||
#### Static library (uncomment to build)
|
||||
#add_library(FileHandler_static STATIC ${FILEHANDLER_SOURCES})
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "FileHandler.hpp"
|
||||
#include <setjmp.h> //Used by libpng
|
||||
#include <jpeglib.h>
|
||||
#include <png.h>
|
||||
#include "bmp/read_bmp.h"
|
||||
#include "libjpeg-turbo/jpeglib.h"
|
||||
#include "libpng/png.h"
|
||||
|
||||
namespace File {
|
||||
|
||||
|
|
17
Libraries/FileHandler/Text.cpp
Normal file
17
Libraries/FileHandler/Text.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
FileHandler - General-purpose file handling library for Niotso
|
||||
Text.cpp - Copyright (c) 2012 Niotso Project <http://niotso.org/>
|
||||
Author(s): Fatbag <X-Fi6@phppoll.org>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
|
@ -1,14 +1,14 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
project(libgldemo)
|
||||
|
||||
if(WIN32)
|
||||
set(LIBGLDEMO_SOURCES wgl.c)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(libgldemo)
|
||||
|
||||
if(WIN32)
|
||||
set(LIBGLDEMO_SOURCES wgl.c)
|
||||
else()
|
||||
set(LIBGLDEMO_SOURCES glx.c)
|
||||
add_definitions(-D_POSIX_C_SOURCE=200112)
|
||||
endif()
|
||||
|
||||
add_library(libgldemo_static STATIC ${LIBGLDEMO_SOURCES})
|
||||
set_target_properties(libgldemo_static PROPERTIES
|
||||
OUTPUT_NAME "gldemo"
|
||||
add_definitions(-D_POSIX_C_SOURCE=200112)
|
||||
endif()
|
||||
|
||||
add_library(libgldemo_static STATIC ${LIBGLDEMO_SOURCES})
|
||||
set_target_properties(libgldemo_static PROPERTIES
|
||||
OUTPUT_NAME "gldemo"
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
|
|
@ -49,8 +49,6 @@ static void KillGLWindow()
|
|||
DestroyWindow(hWnd);
|
||||
hWnd = NULL;
|
||||
}
|
||||
|
||||
UnregisterClass("OpenGL", hInst);
|
||||
}
|
||||
|
||||
static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t height)
|
||||
|
@ -71,7 +69,6 @@ static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t
|
|||
0, /* Reserved */
|
||||
0, 0, 0 /* Masks */
|
||||
};
|
||||
DEVMODE dm;
|
||||
DWORD dwStyle, dwExStyle;
|
||||
RECT WindowRect;
|
||||
int PixelFormat;
|
||||
|
@ -79,10 +76,11 @@ static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t
|
|||
int (WINAPI *wglGetSwapIntervalEXT)(void);
|
||||
|
||||
if(fullscreen){
|
||||
width = dm.dmPelsWidth;
|
||||
height = dm.dmPelsHeight;
|
||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_TOPMOST;
|
||||
dwStyle = WS_POPUP;
|
||||
|
||||
width = ResWidth;
|
||||
height = ResHeight;
|
||||
ShowCursor(0);
|
||||
}else{
|
||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
|
@ -227,7 +225,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
wc.hInstance = hInst = hInstance;
|
||||
wc.hIcon = (HICON) LoadImage(NULL, IDI_WINLOGO, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||
wc.hCursor = (HCURSOR) LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED | LR_DEFAULTSIZE);
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
|
||||
ResWidth = dm.dmPelsWidth;
|
||||
ResHeight = dm.dmPelsHeight;
|
||||
|
@ -259,6 +256,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
|
||||
if(msg.message == WM_QUIT){
|
||||
KillGLWindow();
|
||||
UnregisterClass("OpenGL", hInstance);
|
||||
return (!Demo.Shutdown || Demo.Shutdown()) ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ else()
|
|||
add_definitions(-Dstricmp=strcasecmp)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Libraries/libgldemo)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler)
|
||||
include_directories(${LIBGLDEMO_INCLUDE_DIR})
|
||||
include_directories(${FILEHANDLER_INCLUDE_DIR})
|
||||
|
||||
#### Static library (uncomment to build)
|
||||
#add_library(libvitaboy_static STATIC ${LIBVITABOY_SOURCES})
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
i,j,k,l: Translate the sim around the screen
|
||||
z,x: Rotate the sim like a clock
|
||||
a,s: Zoom in, out
|
||||
q: Toggle skeleton
|
||||
n: Animate the character
|
||||
F11: Enter/leave fullscreen
|
||||
*/
|
||||
|
@ -81,6 +82,8 @@ static float AnimationTime = 0;
|
|||
static bool ShowMesh = true;
|
||||
static bool ShowSkeleton = true;
|
||||
|
||||
static bool PressedQ = false;
|
||||
|
||||
static void DisplayFileError(const char * Filename){
|
||||
const char * Message;
|
||||
switch(File::Error){
|
||||
|
@ -366,13 +369,14 @@ static int DrawScene(float TimeDelta, uint8_t keys[256])
|
|||
if(keys[KEY_DOWN]){ if((Character.Rotation.x+=60*TimeDelta) >=360) Character.Rotation.x-=360; }
|
||||
if(keys[KEY_LEFT]){ if((Character.Rotation.y-=60*TimeDelta) <=-360) Character.Rotation.y+=360; }
|
||||
if(keys[KEY_RIGHT]){ if((Character.Rotation.y+=60*TimeDelta) >=360) Character.Rotation.y-=360; }
|
||||
if(keys['X']){ if((Character.Rotation.z-=60*TimeDelta) <=-360) Character.Rotation.z+=360; }
|
||||
if(keys['Z']){ if((Character.Rotation.z+=60*TimeDelta) >=360) Character.Rotation.z-=360; }
|
||||
if(keys['K']){ Character.Translation.y-=3*TimeDelta; }
|
||||
if(keys['I']){ Character.Translation.y+=3*TimeDelta; }
|
||||
if(keys['J']){ Character.Translation.x-=3*TimeDelta; }
|
||||
if(keys['L']){ Character.Translation.x+=3*TimeDelta; }
|
||||
if(keys['N']){ AdvanceFrame(Skeleton, Animation, TimeDelta); }
|
||||
if(keys['X']){ if((Character.Rotation.z-=60*TimeDelta) <=-360) Character.Rotation.z+=360; }
|
||||
if(keys['Z']){ if((Character.Rotation.z+=60*TimeDelta) >=360) Character.Rotation.z-=360; }
|
||||
if(keys['K']){ Character.Translation.y-=3*TimeDelta; }
|
||||
if(keys['I']){ Character.Translation.y+=3*TimeDelta; }
|
||||
if(keys['J']){ Character.Translation.x-=3*TimeDelta; }
|
||||
if(keys['L']){ Character.Translation.x+=3*TimeDelta; }
|
||||
if(keys['Q']){ if(!PressedQ){ PressedQ = 1; ShowSkeleton = !ShowSkeleton; }} else PressedQ = 0;
|
||||
if(keys['N']){ AdvanceFrame(Skeleton, Animation, TimeDelta); }
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen and the depth buffer
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue