List of commits:
Subject Hash Author Date (UTC)
Fix zoom for particles 5c80a4a30c13672f00df8f3d74297908c132f45d mse 2021-11-04 14:54:34
Use 2 different speed curves for smart zoom 56f9cd38408e4cd3ed08b75b00b131a0bc236b56 mse 2021-10-22 01:51:47
Improve smart zoom math 87da264dca8c443c24a6340002a8cd8169a1446b mse 2021-10-17 10:11:14
Add smart zoom cc57dc0952db6c59d06ef7a9b5c5526f7801945f mse 2021-10-16 09:13:49
Housekeeping 76d7571c34241141c6e2a6315de5e5b513db5209 mse 2021-10-07 07:33:20
Fix font kerning support ab4cbabbed82f629d616f8878790e7d2666524eb mse 2021-10-02 21:10:14
Add default soundspec volume 82a658f2e2bd786618228346bc1848c1be894054 mse 2021-09-30 05:23:43
Fix Windows build and update SDL d8f30e756bc4d5a63e5b7524db2b69ae5af4f88f mse 2021-09-29 23:31:25
Update gamecontrollerdb 3da6ad2629e0b28cad34b3ff7a89c0fe0d96a2fd mse 2021-09-29 23:02:39
Parse newline escape sequences in caption ff33cfb3e88098ae24a6afa1cc7ac9049b6e4c1f mse 2021-09-27 23:45:58
Fix loadOBJ(...) 0b307ff98c2aa8f79d62770b3e2aff6fb7d8670a mse 2021-09-25 05:18:15
Add uploadModelTransforms(...) 53530b8cabe72cfa6c71148bd484a1b5a17df565 mse 2021-09-23 14:33:47
Readability a5885db68a6134c7c3930b6cf10650f0b340088d mse 2021-09-13 15:56:30
Pad HUD health with 0 267304751e17901c276108d8899d096e2094cb2a mse 2021-09-13 11:02:57
Housekeeping 6ff79e3a21829e267e866a8472777e180d337ff4 mse 2021-09-13 07:33:00
Add CSL comments 7a818e8b57cb38c9bfef922e66bd6f735b4962e4 mse 2021-09-12 09:26:07
Add Confectioner Scripting Language (CSL) & change array separator to ; 8d980bfac5d649574f749b7c04a19af766f71091 mse 2021-09-11 12:31:58
Fix console /set bug 7c45e27e7f40472bea317b0316e4367135b49704 mse 2021-09-11 01:32:11
Scriptable lines@, ids@, bugfix 9f606fd2a793fd76a9d1b9e186434d231b973085 mse 2021-09-10 14:43:50
Add array scripting (@ operator, ARRLEN <array>) 3f098b3e0a04922c2c7a981b232efd8d08a8d9a0 mse 2021-09-10 14:02:39
Commit 5c80a4a30c13672f00df8f3d74297908c132f45d - Fix zoom for particles
Author: mse
Author date (UTC): 2021-11-04 14:54
Committer name: mse
Committer date (UTC): 2021-11-04 14:54
Parent(s): 56f9cd38408e4cd3ed08b75b00b131a0bc236b56
Signing key:
Tree: 5e6ce5c0a713358fde6421ba4da3f9ecc77913a8
File Lines added Lines deleted
confec.cpp 24 14
File confec.cpp changed (mode: 100644) (index 37a1e17..44006b9)
... ... std::string character_selected = "", character_next_screen = "",
495 495 fworld::Entity *trading_entity; fworld::Entity *trading_entity;
496 496
497 497 fgl::Texture tex_circle_grey, tex_circle_orange, tex_cursor, fgl::Texture tex_circle_grey, tex_circle_orange, tex_cursor,
498 tex_net_notification, tex_notification, tex_recipe_overlay,
498 tex_notification_net, tex_notification, tex_recipe_overlay,
499 499 tex_boxes, tex_box_select, tex_character_select; tex_boxes, tex_box_select, tex_character_select;
500 500
501 501 fgl::Framebuffer framebuffer; fgl::Framebuffer framebuffer;
 
... ... int portraitScreenHeight3D = 549; // Supposed to look good at 960p.
516 516 int simScreenHeight2D = landscapeScreenHeight2D; int simScreenHeight2D = landscapeScreenHeight2D;
517 517 int simScreenHeight3D = landscapeScreenHeight3D; int simScreenHeight3D = landscapeScreenHeight3D;
518 518
519 // Camera zoom factor.
520 // This is actually the inverse camera distance factor, as in dolly moves.
521 double zoom_factor = 1.0;
522
519 523 fgl::Color ambient_colors[] = { fgl::Color ambient_colors[] = {
520 524 { 0.4f, 0.5f, 0.8f, 1.0f }, // Night. { 0.4f, 0.5f, 0.8f, 1.0f }, // Night.
521 525 { 0.6f, 0.5f, 0.8f, 1.0f }, // Morning twilight. { 0.6f, 0.5f, 0.8f, 1.0f }, // Morning twilight.
 
... ... int main( int argc, char* argv[] ){
1446 1450 tex_circle_grey = loadImage( data_path + "/circle-grey.png", false, false ); tex_circle_grey = loadImage( data_path + "/circle-grey.png", false, false );
1447 1451 tex_circle_orange = loadImage( data_path + "/circle-orange.png", false, false ); tex_circle_orange = loadImage( data_path + "/circle-orange.png", false, false );
1448 1452 tex_cursor = loadImage( data_path + "/ui/cursor.bmp", false, false ); tex_cursor = loadImage( data_path + "/ui/cursor.bmp", false, false );
1449 tex_net_notification = loadImage( data_path + "/ui/net_notification.png", true, false );
1453 tex_notification_net = loadImage( data_path + "/ui/notification_net.png", true, false );
1450 1454 tex_notification = loadImage( data_path + "/ui/notification.png", true, false ); tex_notification = loadImage( data_path + "/ui/notification.png", true, false );
1451 1455 tex_recipe_overlay = loadImage( data_path + "/ui/recipe_overlay.png", false, false ); tex_recipe_overlay = loadImage( data_path + "/ui/recipe_overlay.png", false, false );
1452 1456 tex_boxes = loadImage( data_path + "/ui/boxes.png", false, false ); tex_boxes = loadImage( data_path + "/ui/boxes.png", false, false );
 
... ... FILE *FileOpen( const char* filename, const char* modes ){
1506 1510 void wsConnect( const std::string &uri, void (*f)(std::string) ){ void wsConnect( const std::string &uri, void (*f)(std::string) ){
1507 1511 if( !emscripten_websocket_is_supported() ){ if( !emscripten_websocket_is_supported() ){
1508 1512 Notify( Notify(
1509 &tex_net_notification,
1513 &tex_notification_net,
1510 1514 "Network Error", "Network Error",
1511 1515 "WebSocket unsupported" "WebSocket unsupported"
1512 1516 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
1523 1527 ws_socket = emscripten_websocket_new( &attr ); ws_socket = emscripten_websocket_new( &attr );
1524 1528 if( ws_socket <= 0 ){ if( ws_socket <= 0 ){
1525 1529 Notify( Notify(
1526 &tex_net_notification,
1530 &tex_notification_net,
1527 1531 "Network Error", "Network Error",
1528 1532 "WebSocket creation failed" "WebSocket creation failed"
1529 1533 ); );
 
... ... EM_BOOL wsOnError( int eventType, const EmscriptenWebSocketErrorEvent *e, void *
1559 1563 (void)e; (void)e;
1560 1564 (void)userData; (void)userData;
1561 1565 Notify( Notify(
1562 &tex_net_notification,
1566 &tex_notification_net,
1563 1567 "Network Error", "Network Error",
1564 1568 "Event type: " + std::to_string( eventType ) "Event type: " + std::to_string( eventType )
1565 1569 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
1610 1614 // Parse the URI. // Parse the URI.
1611 1615 auto uri_parts = wsParseAddress( uri ); auto uri_parts = wsParseAddress( uri );
1612 1616 if( uri_parts.size() < 6 ){ if( uri_parts.size() < 6 ){
1613 Notify( &tex_net_notification, "Network Error", "Invalid URI" );
1617 Notify( &tex_notification_net, "Network Error", "Invalid URI" );
1614 1618 // Return to the main menu. // Return to the main menu.
1615 1619 settings_display = false; settings_display = false;
1616 1620 inputTarget = nullptr; inputTarget = nullptr;
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
1681 1685 return; return;
1682 1686 } }
1683 1687 ws_socket_active = true; ws_socket_active = true;
1684 // TODO: Notify( &tex_net_notification, "Connected to", uri );
1688 // TODO: Notify( &tex_notification_net, "Connected to", uri );
1685 1689 ws_callback = f; ws_callback = f;
1686 1690 // Spawn the WebSocket thread if it does not already exist. // Spawn the WebSocket thread if it does not already exist.
1687 1691 if( ws_thread.get_id() != std::thread::id() ) return; if( ws_thread.get_id() != std::thread::id() ) return;
 
... ... std::smatch wsParseAddress( const std::string &uri ){
1756 1760 // Poco WebSocket exception handler. // Poco WebSocket exception handler.
1757 1761 void wsHandleException( Poco::Exception &e ){ void wsHandleException( Poco::Exception &e ){
1758 1762 Notify( Notify(
1759 &tex_net_notification,
1763 &tex_notification_net,
1760 1764 "Network Error", "Network Error",
1761 1765 e.displayText() e.displayText()
1762 1766 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
1864 1868 ws_mutex.lock(); ws_mutex.lock();
1865 1869 if( uri_parts.size() < 6 || !ws_ready ){ if( uri_parts.size() < 6 || !ws_ready ){
1866 1870 Notify( Notify(
1867 &tex_net_notification,
1871 &tex_notification_net,
1868 1872 "Network Error", "Network Error",
1869 1873 ws_ready ? "Invalid URI" : "Hung socket" ws_ready ? "Invalid URI" : "Hung socket"
1870 1874 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
1916 1920 #endif #endif
1917 1921 }catch( std::exception const &e ){ }catch( std::exception const &e ){
1918 1922 Notify( Notify(
1919 &tex_net_notification,
1923 &tex_notification_net,
1920 1924 "Network Error", "Network Error",
1921 1925 e.what() e.what()
1922 1926 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
2008 2012 ws_tcp_sock->set_option( ws_net::ip::tcp::no_delay( true ) ); ws_tcp_sock->set_option( ws_net::ip::tcp::no_delay( true ) );
2009 2013 }catch( std::exception const &e ){ }catch( std::exception const &e ){
2010 2014 Notify( Notify(
2011 &tex_net_notification,
2015 &tex_notification_net,
2012 2016 "Network Error", "Network Error",
2013 2017 e.what() e.what()
2014 2018 ); );
 
... ... void wsConnect( const std::string &uri, void (*f)(std::string) ){
2019 2023 return; return;
2020 2024 } }
2021 2025 ws_socket_active = true; ws_socket_active = true;
2022 // TODO: Notify( &tex_net_notification, "Connected to", uri );
2026 // TODO: Notify( &tex_notification_net, "Connected to", uri );
2023 2027 ws_callback = f; ws_callback = f;
2024 2028
2025 2029 // Asynchronous code. // Asynchronous code.
 
... ... void Tick(){
4026 4030 if( timeout_timer > 5.0 ){ if( timeout_timer > 5.0 ){
4027 4031 timeout_timer = 0.0; timeout_timer = 0.0;
4028 4032 Notify( Notify(
4029 &tex_net_notification,
4033 &tex_notification_net,
4030 4034 "Network Error", "Network Error",
4031 4035 "Connection lost" "Connection lost"
4032 4036 ); );
 
... ... void Render(){
4353 4357 // Use an inverse square curve to zoom in and a square curve to zoom // Use an inverse square curve to zoom in and a square curve to zoom
4354 4358 // out. This has the effect of kicking off in either direction while // out. This has the effect of kicking off in either direction while
4355 4359 // being framerate-independent. // being framerate-independent.
4356 double zoom_factor = ease(
4360 zoom_factor = ease(
4357 4361 1.0, 1.0,
4358 4362 1.1, 1.1,
4359 4363 zoom ? ( 1.0 - ( 1.0 - f ) * ( 1.0 - f ) ) : ( f * f ) zoom ? ( 1.0 - ( 1.0 - f ) * ( 1.0 - f ) ) : ( f * f )
 
... ... void DrawFloorParticles(){
5105 5109 ); );
5106 5110 } }
5107 5111 auto viewMat = world.viewMat; auto viewMat = world.viewMat;
5112 // Apply zoom factor to view matrix.
5113 viewMat[3].xyz() *= 1.0 - ( zoom_factor - 1.0 ) * 6.2;
5114 // Apply map position to view matrix.
5108 5115 viewMat[3][0] += world.cameraX; viewMat[3][0] += world.cameraX;
5109 5116 viewMat[3][1] -= world.cameraY; viewMat[3][1] -= world.cameraY;
5110 5117 auto projMat = linalg::perspective_matrix( 68.5 * 0.01745, (double)world.screenWidth / (double)world.screenHeight, 0.1, 44.0 ); auto projMat = linalg::perspective_matrix( 68.5 * 0.01745, (double)world.screenWidth / (double)world.screenHeight, 0.1, 44.0 );
 
... ... void DrawParticles(){
5150 5157 ); );
5151 5158 } }
5152 5159 auto viewMat = world.viewMat; auto viewMat = world.viewMat;
5160 // Apply zoom factor to view matrix.
5161 viewMat[3].xyz() *= 1.0 - ( zoom_factor - 1.0 ) * 6.2;
5162 // Apply map position to view matrix.
5153 5163 viewMat[3][0] += world.cameraX; viewMat[3][0] += world.cameraX;
5154 5164 viewMat[3][1] -= world.cameraY; viewMat[3][1] -= world.cameraY;
5155 5165 auto projMat = linalg::perspective_matrix( 68.5 * 0.01745, (double)world.screenWidth / (double)world.screenHeight, 0.1, 44.0 ); auto projMat = linalg::perspective_matrix( 68.5 * 0.01745, (double)world.screenWidth / (double)world.screenHeight, 0.1, 44.0 );
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/ConfectionerEngine

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main