Commit Graph

60 Commits (master)

Author SHA1 Message Date
kts da53685587 Font class now can change its point-size on the fly - this obviously changes the 'state' of the Font, so subsequent draws will reflect the changes. This will likely not be a problem, as Text input will likely handle this by specifying size and color changes whenever a render operation is needed. Font also now holds the SDL_RWops object so that the font can be closed and re-opened at different sizes. Also added some minor comments in GUI. 2015-03-09 16:40:10 -07:00
kts b8d6462723 Added basic code for creating and handling GUI events - at the moment just (SDL_USEREVENT + 10) using the SDL_USEREVENT union struct. Maybe define a custom struct that is equal in size to SDL_Event (and has type in the same position) and cast when needed? It'd make it a bit easier/nicer than using data1/data2. Cleaned up GuiElement and added margin functionality. 2015-03-07 22:56:27 -08:00
kts 549b391c4e A magical commit occurs, wherein a much better GUI layout engine is implemented. Much shorter, much more logical, and much more expandable. Still needs some work as well as some tidying up. 2015-03-07 04:07:29 -08:00
kts 8c2dfb042a Added Program HashTable to core. Some delete/remove functionality added to various Render* classes. Gui/GuiList somewhat works. GUI is now specified in terms of (0,0) being at the top-left of the screen. Need to recode so GuiElement contains majority of the needed functionality for updating (and that even GuiList(s) contain proper positioning and sizing. Embedding elements in elements will be much easier and more functional if it's abstracted to the base class rather than a specific subclass. 2015-03-06 21:39:07 -08:00
kts 1f0a4cdc53 Updated OSX, iOS, and Android for SDL2_ttf. 2015-03-06 14:13:11 -08:00
kts 1318be4fc0 SDL_ttf now required. Added basic Font class and default TTF font (Amaranth). 2015-03-06 05:53:09 -08:00
kts 482db6b6f1 Updated VS project, works ok. 2015-03-05 20:04:44 -08:00
kts b3f9d3d0c8 Updated linux build - moved getpwuid/etc. to SysInfo. 2015-03-05 18:45:22 -08:00
kts d4ea6ce4b0 updated TODO. Gui system is as abominable as ever. Need to rework it so offset_x/offset_y contain the absolute x/y(maybe just rename to that) as created during doUpdate(). Added GuiButton/GuiList elements. The former is a basic button that (at the moment) relies on a textured image - will later have a text texture generated with SDL2_ttf. There now exists a SysInfo class, of which the global instance, sysinfo, is provided. This provides the app, user, and external data directories (still needs to be fully implemented). It also provides screen density DPI, xdpi, and ydpi, at least for Android. RenderObjects may now be shown/hidden. 2015-03-05 17:11:11 -08:00
kts 27624848bd Added much dodgy code. Fixed bug in Android wherein if AAsset directory did not exist, a close directory call was still made (thereby exploding everything). Added bad mojo for getting user paths for OS X and Linux (USER/Library/Application Support/RtB on OS X and HOME/.RtB/ on Linux). GLSL shaders now reside in their own directories for different versions (e.g., 'data/shaders/100/default_vs.glsl'). Core now supplies getTexture and getMesh functions - these do not yet account for additions to the Asset Caches or similar, as if they successfully load once, they'll forever reference that same object. Added lots of bad stuff to the GUI, including indecision. I want GUI elements to render to a special context so that you can easily have scrolled content (or, perhaps in the future, an embedded browser for embedding HTML content). At the moment it is unused, but a RenderView is created for each GuiElement created. Ideally this RenderView FBO would only be updated whenever a change occurs to the GuiElement, so as to not consume too much. Gui rendering does exist now, although it's prone to change. RenderViews can now be created with a predefined FBO - this sets the STATIC_FBO flag which indicates not to create nor destroy any framebuffers. Additionally, Core now provides a RenderView for the default window fbo, v_fbo. Something is also distinctly screwed up with the RenderCamera/matrix/etc. - I believe an incorrect transformation is happening at some point, as the face culling seems to be reversed. 2015-03-05 03:13:25 -08:00
kts 12b2eed290 Updated VS project - works fine, but probably does not copy over all the needed DLLs during build (zlib, etc.). 2015-03-04 01:12:49 -08:00
kts a3e703f8fc Updated Linux build. 2015-03-04 01:05:55 -08:00
kts 3c534a9b98 SDL2_image is now used. OMesh::loadObj now ensures that UVs and normals are created equal to the # of vertices - this is not exactly right, as it simply zeros values that don't exist, but it's better than nothing. Vertex indexing should be implemented using GL_DRAW_ELEMENTS, but for now we'll deal. Default cube now generates proper normals and uvs attached to triangular faces. GLSL vertex shaders now flip the outputted fragment UV (1.0 - uv.t). The Texture class has been created which is responsible for turning some image format data into an OpenGL texture. It handles things similarly to Mesh, in that it first loads the data then has to be 'built'. 2015-03-04 00:59:46 -08:00
kts 12020b1da4 Updated VS 2015-03-03 03:29:09 -08:00
kts d1121245af Updated linux build 2015-03-03 03:26:21 -08:00
kts f05725438d Implemented some of the GUI subsystem. Events are first passed through the GUI (should limit this to only particular events) before being sent to the top-most state. Later on, the GUI will be capable of locking the sending of particular events, such as motion or mousemove, if an element is currently focused/held. Basic GuiElement added. Each GuiElement may have children, each of which may have children in turn. The Gui will send getHit requests to the top-most/parent GuiElement, after which that GuiElement will send getHit requests down to its children and their children if need be. If a match is found, a pointer to that element is returned, otherwise NULL. More to be added, but hopefully the GUI system is robust enough - it tries to somewhat decouple from the state, in that elements do not have to have their lower level hit detection processed. There may be some oddities in the design that have yet to be discovered due to there being no visual front end (and the creation of RenderObjects for said visuals). 2015-03-03 03:24:07 -08:00
kts 268cbb5a1f Update VS project - works fine as well. 2015-03-02 20:13:43 -08:00
kts 8b93c18bd5 Updated ios, osx, and android builds - all work fine. 2015-03-02 20:08:00 -08:00
kts a567769fcf Core now uses a state stack. States may be pushed on the stack with Core::pushState(State*) and popped off with Core::popState(). Pushing a state will trigger the old state's onCede(), push the state onto the stack, then call the new state's onInit(if DID_INIT is not set) then onRise(). Popping a state will trigger the top state's onCede and the previous state(if it exists)'s onRise. Core::doProcess now has a delta tickrate accumulator that ensures the world is processed at Core::tick_rate. Rendering is not capped to this tickrate, as doRender is called outside of the Event handling and state processing. Finally, functionality that was in Core for testing is now in TestState - it pushed onto the stack during Core::initSystem 2015-03-02 19:58:35 -08:00
kts 685c28891e GUI Notes that were forgotten. 2015-03-02 11:04:49 -08:00
kts 5b5a1276cf Added more notes to GUI, with some specifics for icon requirements and how the basic view will be. Very terse at the moment. Added default asset cache locations for iOS: the app's resources/data folder and the app's Documents folder. 2015-03-02 03:25:39 -08:00
kts ba6d8e21c8 Updated VS project for States and set header includes for src/ and src/states. 2015-03-02 01:54:08 -08:00
kts 6f30b0a662 Updated Linux makefile to include MenuState 2015-03-02 01:45:45 -08:00
kts 0142296949 Added State class and MenuState subclass. Notes added for GUI and STATES in root. iOS, OS X, android, and Linux build environments now use include directories for src/ and src/states. This is to prevent excessive clutter in the src/ directory - although some might say that point was passed long ago. 2015-03-02 01:18:01 -08:00
kts b1efc3ef74 AssetCache works fine on Windows now. Need to reorganize AssetCache's _WIN32 preprocessor conditionals - it's pretty ugly. 2015-03-01 17:25:19 -08:00
kts a531be218c Moved one line of code for no real reason (stemming from foolishness involved with not cleaning the build) 2015-03-01 16:54:21 -08:00
kts 6e0a0b3226 ApkAssetCache now fully works. Unlike AssetCache, it does not build a cache by traversing the directory hierarchy - this is due to limits of how the Android assets archive works -, but rather adds to the cache on get/load requests. This is more inefficient, but it shouldn't be much of a consideration. Fixed preprocessor conditionals around loops to stop vi from exploding. Some minor code cleanup to remove warnings. 2015-03-01 16:46:13 -08:00
kts 977af72999 AssetCaches no longer keep all .CACHE entries. If an entry does not exist on the file system, it is not added to the cache. As a result of this, dud entries are cleared whenever the cache file is written to disk. 2015-03-01 06:07:50 -08:00
kts abf9b299b5 Added Android Java JNI functions that set 'app' and 'ext' directories that correspond to the application data directory and the external storage app directory respectively. Shaders now use Assets. Assets no longer exist in a 'data/' directory within an AssetCache directory, but rather as their location relative to the root of the AssetCache directory. fileToMem now exists as a separate function to asset_fileToMem, as the old method does not quite fit the new AssetCache scheme. Windows version needs to be fixed to match this update. Android version needs proper Asset management via the ApkAssetCache class - this involves iterating through files in a JNI acceptable manner. 2015-03-01 05:45:36 -08:00
kts c5f013d693 Updated Linux makefile. added <errno.h>, <sys/stat.h>, and <dirent.h> to AssetCache.cpp. Asset system works on Linux now. I also did A Bad Thing and replaced MAX_PATH with 1024. Also, VS allows for some majorly bad template code to be accepted. 2015-03-01 02:44:28 -08:00
kts bc831f05b0 AssetManager/AssetCache system now mostly in place. AssetCache(s) create/read from a .CACHE file in the target directory. This file is human-readable and is the index for the cache. Each line contains the file's path, its checksum, and the filesize. This file is updated when the filesize of the file changes. Currently new files are found and added on start - to be added is a refresh function. Also to be added is an update via modification time - this will require a new entry in the cache index file. A single-line version heading should also be added.
Data files are now loaded from the Cache - Mesh and Program build from passed buffers now. These are generally read from a loaded Asset. Next up: updating it to work on Linux, Android, iOS, and OS X.

Also added a somewhat poor HashTable template implementation. Works okay, but might not be the best.
2015-03-01 02:17:12 -08:00
kts 05a43ddcdb Updated iOS, OSX, and Android projects 2015-02-28 14:43:09 -08:00
kts 7cc5ad8df4 Added the AssetCache class skeleton. 2015-02-28 03:08:47 -08:00
kts aeaeae02b8 Actual update of Asset.cpp 2015-02-27 19:57:06 -08:00
kts b8ac063da1 Updated Linux makefile. Added stdlib.h to Asset.cpp for free() 2015-02-27 19:56:32 -08:00
kts e1d908ae3e Added basic AssetManager class skeleton. This will be the governing class for the loading of files and ensuring data remains the same between clients via checksum comparisons. 2015-02-27 19:49:24 -08:00
kts 0ceb4b828d Added/updated test code for mouse rotation, zooming, and panning. 2015-02-25 15:56:25 -08:00
kts 8c37edcfe7 Added some test code in Core that allow for pinch zooming and two-finger rotation. 2015-02-25 07:51:10 -08:00
kts 00d0ec1c00 Added cube model for testing. Shader textures now start at index 0 rather than 1. Things work on iOS now. closeSystem deletes gl context and destroys window - needs to free textures, etc. still. Added testing finger and mouse motion control. Meshes now generate uv buffer object and normals buffer object. RenderCamera now supports rendering in orthogonal as well as perspective. Orthogonal rendering relies on 'size' float, which indicates the vertical 3D units shown on screen. This is, for RtB, equal to 1 meter. Perspective rendering uses fov_angle, which is the vertical field of view angle. This is, default, pi / 4. Screen resizing now works fine on Android - recreated buffer used non gles type. RenderView now uses nearest mag/min filters rather than linear. Added handleAppEvents which is intended to deal with state changes on mobile devices, such as app minimizing. At the moment, core.closeSystem is called when RtB enters the background. 2015-02-25 04:05:59 -08:00
kts 561c33f092 Updated VS project. Added a _WIN32 ifdef and typedefs for uint32_t and uint8_t due to Windows not including inttypes.h. 2015-02-24 17:18:40 -08:00
kts b19f0bb727 Updated Linux build, forgot to set v_flags to opengl/resizable. Core now calls updateProjection for each camera and setView for each camera's RenderView on window resize. This functionality will be moved elsewhere, as we do not necessarily want to resize the view or the camera to the entire window. 2015-02-24 17:11:52 -08:00
kts a0eeec21b2 Much added. Basic asset access functions using fopen() techniques. Currently the system attempts to load from the CWD on most platforms, but on Android it attempts to load from the assets archive. Once updated, it will likely attempt to load from at least 3 locations before falling back to the built-in application assets (external device, user directory, application data directory). Creation/Loading of RtB is now managed by a Core class. This class is, to some extent, a service locator combined with larger engine functionality. A global instance of the class is provided as 'core'. It is responsible for updating the yet-to-be-added States, the base rendering, and the management of assets and much more. 2015-02-24 16:55:11 -08:00
kts adcf6cd1b5 Added test chest model and basic model rendering shader. Mesh now builds normals buffer along with uv and vp. Added Quaternion class, currently used for RenderObject's rotation matrix generation - needs to be added to RenderCamera. RenderScene now accomplishes what its name implies - the rendering of a scene. Some logic needs to be moved into Program from RenderScene's doRender function. 2015-02-23 02:49:52 -08:00
kts 07cecebad0 Added a single comment. That is all. 2015-02-22 00:14:48 -08:00
kts b7e867fbf2 Updates VS project. Replaced snprintf with std::ostringstream in Program::attachTexture. Added RenderCamera functionality for orientation and position. Much more to be added, but likely need to implement the State machine so majority of the program logic is complete. 2015-02-21 05:53:40 -08:00
kts 082828465c Added Program class - it is responsible for loading and compiling GLSL shaders into a GLSL program. Much to be changed in regards to its functionality, especially Variable/Texture-related access. Rendering to FBO and displaying via a framebuffer shader works. 2015-02-20 19:48:24 -08:00
kts 8b11fd78f3 Re-added VAO code to mesh building, hopefully to no error. 2015-02-13 15:12:26 -08:00
kts f8758111dc Updated android, ios, and osx projects. Hopefully nothing is broken. 2015-02-12 07:40:40 -08:00
kts 9ab5b42752 Added common checks for GLEW on Windows, need to fix and add other systems. Added LOG_INFO to logging, ERROR logs show SDL message box, and pointing logHook to a function taking 2 const char* params will call said function on log. Added Mesh type that can load an OBJ mesh and build OpenGL vbo/vao. Can also build from passed vertices, uv, and normal arrays. RenderCamera updated. RenderObject updated with Mesh member. RenderScene updated with basic rendering system set (renderTo(RenderView*)). RenderView now creates framebuffers and should be working. RenderView also relies on a Mesh that should generally be a quad, but is not necessarily (it uses a Mesh). 2015-02-12 05:48:10 -08:00
kts 28d93f69d3 Updated linux Makefile. 2015-02-11 02:31:21 -08:00