itfrombit / osx_handmade Goto Github PK
View Code? Open in Web Editor NEWOS X port of Handmade Hero
OS X port of Handmade Hero
Did you ever get your dylib code to successfully reload your dylib?
I have it loading up just fine in my port, but can't seem to get it to reload. It actually runs through the reload code just fine, but always gets the same version of the dylib (despite manually checking that the dylib file is the new version). Basically the behavior is it seems like the original dylib is being loaded but never unloaded.
I did some investigation, and apparently the objc runtime doesn't allow dylibs to be unloaded (at least according to http://stackoverflow.com/questions/8793099/unload-dynamic-library-needs-two-dlclose-calls). I didn't know if that jived with what you'd seen or not...
I know it may not be in your wheelhouse to do this, but just throwing it out there. I’d love to see a video of you going over how you went about making this, in the spirit of Casey’s videos.
I solved this by cp ../data/test1.hha to ../data/test1_v1.hha , but I had to do this for all the assets in ../data
I also had to move the contents of handmade_hero_art_pack_1.zip to ./art
Nothing big, just some friction no my first make.
I wondered if someone could help me get this compiling. When I run make full
I get the following output:
▶ make full
rm -rf *.o *.dylib libhandmade.dylib libhandmade_opengl.dylib handmade test_png hhaedit HandmadeTabView HandmadeRendererTest Contents Handmade.app HandmadeTabView.app HandmadeRendererTest.app osx_hhfont *.dSYM
rm -f libhandmade.dylib
clang -O2 -Wall -DOSX_HANDMADE_USE_METAL=0 -DHANDMADE_USE_VSYNC=0 -DHANDMADE_PROFILE=1 -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -fno-exceptions -fno-rtti -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-variable -Wno-c++11-narrowing -Wno-missing-braces -Wno-logical-not-parentheses -Wno-switch -Wno-write-strings -Wno-c++11-compat-deprecated-writable-strings -Wno-tautological-compare -Wno-missing-braces -Wno-null-dereference -Wno-writable-strings -std=c++11 -stdlib=libc++ -ggdb -dynamiclib -o libhandmade.dylib ../cpp/code/handmade.cpp
In file included from ../cpp/code/handmade.cpp:33:
../cpp/code/handmade_world_mode.cpp:537:30: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
if(Input->FKeyPressed[9] || 1)
^ ~
../cpp/code/handmade_world_mode.cpp:537:30: note: use '|' for a bitwise operation
if(Input->FKeyPressed[9] || 1)
^~
|
1 warning generated.
rm -f ./handmade
clang -O2 -Wall -DOSX_HANDMADE_USE_METAL=0 -DHANDMADE_USE_VSYNC=0 -DHANDMADE_PROFILE=1 -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -std=c++11 -stdlib=libc++ -ggdb -I../cpp/code -fno-exceptions -fno-rtti -Wno-writable-strings -Wno-deprecated-declarations -Wno-null-dereference -Wno-c++11-compat-deprecated-writable-strings -Wno-unused-function -Wno-unused-variable -Wno-missing-braces -lstdc++ -framework Cocoa -framework IOKit -framework AudioUnit -o handmade osx_main.mm
In file included from osx_main.mm:41:
In file included from ../cpp/code/handmade_platform.h:29:
../cpp/code/handmade_types.h:104:9: warning: 'U64Max' macro redefined [-Wmacro-redefined]
#define U64Max ((u64)-1)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Math64.h:715:13: note:
previous definition is here
#define U64Max() (0xffffffffffffffffULL)
^
1 warning generated.
# The 'local' bundle for convenient debugging with lldb
mkdir -p ./Contents/MacOS
mkdir -p ./Contents/Resources
mkdir -p ./Contents/Resources/data
mkdir -p ./Contents/Resources/debug
cp -R ../tags ./Contents/Resources
cp -R ../sources ./Contents/Resources
# Uncomment the following 4 lines to use our own generated fonts
# cp osx_fonts/liberation_mono* ./Contents/Resources/sources/base_game/fonts
# mkdir -p ./Contents/Resources/tags/fonts
# cp LiberationMono.hht ./Contents/Resources/tags/fonts/
#cp Monaco.hht ./Contents/Resources/tags/fonts/
#
#cp /testfonts_v2.hha ./Contents/Resources/data/testfonts_v2.hha
#cp /intro_art_v2.hha ./Contents/Resources/data/intro_art_v2.hha
#cp ../art/*.png ./Contents/Resources/art
cp libhandmade.dylib ./Contents/MacOS/libhandmade.dylib
cp libhandmade_opengl.dylib ./Contents/MacOS/libhandmade_opengl.dylib
cp: libhandmade_opengl.dylib: No such file or directory
make: *** [package] Error 1
Which implies that there is a problem with an OpenGl file. When I run the game (./handmade
as suggested) then I get the following error.
Here is what I have done;
code
from Casey's repo into cpp/code
directory within osx_handmade
.tags
directory from Casey's repo into the root of osx_handmade
.sources
) into the root of osx_handmade
.sh fix_handmade_hero_source.sh
.make full
, this is where I get the error.Following this, calls to make
without arguments complain about a lock.tmp
file. I am able to run make libhandmade_opengl.dylib
without issue, but it doesn't seem to help. I can also make HandmadeRendererTest
which will run but the graphics are all a bit messed up.
I'm on a Macbook Pro with with Catalina 10.15.6 (19G2021), my version of Clang is 11.0.3 (clang-1103.0.32.62). Any help with what I might be doing wrong would be much appreciated.
So I had someone run into this when they were running the swift platform code on an older macbook air and got a failure when trying to init the display link.
Specifically it seems that the user's macbook air didn't support double buffering (which is weird because basically all macs support double buffering via opengl, but that's what the machine reported :/ ).
I made the following changes to support him and add some fallback for machines without double buffer support. joekarl/swift_handmade_hero@100f658?diff=unified
Also needed to add a glFlush() inside of the display link callback to handle flushing for single buffer devices.
So just a heads up in case you run into anything like that...
Hello, I just found this platform layer and was hoping to get handmade hero up and running on my Mac.
I'm hitting a snag when trying to follow the instructions in the Readme. When running make osx_asset_builder
, I'm getting:
make: *** No rule to make target
osx_asset_builder.cpp', needed by osx_asset_builder.o'. Stop.
It looks like there is no osx_asset_builder.cpp in the repo? How do I build the assets? Thanks!
Just a note, the current build is missing https://raw.githubusercontent.com/nothings/stb/master/stb_truetype.h
so it generates this error:
./osx_asset_builder.h:35:10: fatal error: 'stb_truetype.h' file not found
Quick fix, just thought you'd like to know!
I'm in the midst of doing a swift version of the platform layer and am running into some issues with compiling the handmade source. In particular I'm getting errors finding the following types:
debug_platform_free_file_memory
debug_platform_read_entire_file
debug_platform_write_entire_file
debug_read_file_result
Did you run into this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.